web archive: don't allow users to delete gtk and windows

This commit is contained in:
Daniel Marjamäki 2013-08-09 19:25:59 +02:00
parent 3032dbabce
commit 4c7e92f67b
2 changed files with 9 additions and 1 deletions

View File

@ -40,6 +40,11 @@ int main()
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
if (strcmp(name,"gtk")==0 || strcmp(name,"windows")==0) {
generatepage("Permission denied to delete this file");
return EXIT_SUCCESS;
}
FILE *f = fopen("data.txt", "wt"); FILE *f = fopen("data.txt", "wt");
if (f == NULL) { if (f == NULL) {
generatepage("Failed to delete file (access denied)"); generatepage("Failed to delete file (access denied)");

View File

@ -22,6 +22,9 @@ void listAll(char **data)
printf("<tr><td width=\"200\">%s</td>", name); printf("<tr><td width=\"200\">%s</td>", name);
printf("<td><input type=\"button\" onclick=\"editFile(\'%s\','%i')\" value=\"Edit\"/>", name, version); printf("<td><input type=\"button\" onclick=\"editFile(\'%s\','%i')\" value=\"Edit\"/>", name, version);
printf("<input type=\"button\" onclick=\"renameFile(\'%s\','%i')\" value=\"Rename\"/>", name, version); printf("<input type=\"button\" onclick=\"renameFile(\'%s\','%i')\" value=\"Rename\"/>", name, version);
if (strcmp(name,"gtk")==0 || strcmp(name,"windows")==0)
printf("<font color=\"gray\">Delete</font>");
else
printf("<input type=\"button\" onclick=\"deleteFile(\'%s\','%i')\" value=\"Delete\"/>&nbsp;</td>", name, version); printf("<input type=\"button\" onclick=\"deleteFile(\'%s\','%i')\" value=\"Delete\"/>&nbsp;</td>", name, version);
printf("</tr>\n"); printf("</tr>\n");
} }