mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Allow to save/restore files (was games user suid problem)
This commit is contained in:
parent
382f755da5
commit
acc5abeb6a
1 changed files with 12 additions and 2 deletions
|
|
@ -108,6 +108,7 @@ char *sfile;
|
|||
sfile = name_buffer;
|
||||
}
|
||||
}
|
||||
setuid(getuid());
|
||||
if ( ((fp = fopen(sfile, "w")) == NULL) ||
|
||||
((file_id = md_get_file_id(sfile)) == -1)) {
|
||||
message("problem accessing the save file", 0);
|
||||
|
|
@ -161,6 +162,14 @@ char *sfile;
|
|||
}
|
||||
}
|
||||
|
||||
static char save_name[80];
|
||||
|
||||
static del_save_file()
|
||||
{
|
||||
setuid(getuid());
|
||||
md_df(save_name);
|
||||
}
|
||||
|
||||
restore(fname)
|
||||
char *fname;
|
||||
{
|
||||
|
|
@ -233,8 +242,9 @@ char *fname;
|
|||
clear();
|
||||
clean_up("sorry, file has been touched");
|
||||
}
|
||||
if ((!wizard) && !md_df(fname)) {
|
||||
clean_up("cannot delete file");
|
||||
if ((!wizard)) {
|
||||
strcpy(save_name, fname);
|
||||
atexit(del_save_file);
|
||||
}
|
||||
msg_cleared = 0;
|
||||
ring_stats(0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue