create_admin_success_flag() should use restore_perms() rather than

set_perms() to restore the uid.
This commit is contained in:
Todd C. Miller
2010-11-23 07:34:22 -05:00
parent d39747e6a5
commit 8f4b215216

View File

@@ -1349,14 +1349,11 @@ create_admin_success_flag(void)
/* Create admin flag file if it doesn't already exist. */
set_perms(PERM_USER);
if (stat(flagfile, &statbuf) == 0) {
set_perms(PERM_ROOT);
return;
if (stat(flagfile, &statbuf) != 0) {
fd = open(flagfile, O_CREAT|O_WRONLY|O_EXCL, 0644);
close(fd);
}
fd = open(flagfile, O_CREAT|O_WRONLY|O_EXCL, 0644);
close(fd);
set_perms(PERM_ROOT);
restore_perms();
}
#else /* !USE_ADMIN_FLAG */
static void