From: Todd C. Miller Date: Sun, 5 May 2002 00:45:51 +0000 (+0000) Subject: Don't call set_perms() when doing timestamp stuff unless timestamp_uid != 0. X-Git-Tag: SUDO_1_6_7~129 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=982218c34395ed83d5c90e4028e0c41243fbab41;p=sudo Don't call set_perms() when doing timestamp stuff unless timestamp_uid != 0. --- diff --git a/check.c b/check.c index 33451f609..79c2e02db 100644 --- a/check.c +++ b/check.c @@ -145,7 +145,8 @@ update_timestamp(timestampdir, timestampfile) char *timestampfile; { - set_perms(PERM_TIMESTAMP); + if (timestamp_uid != 0) + set_perms(PERM_TIMESTAMP); if (touch(timestampfile ? timestampfile : timestampdir, time(NULL)) == -1) { if (timestampfile) { int fd = open(timestampfile, O_WRONLY|O_CREAT|O_TRUNC, 0600); @@ -159,7 +160,8 @@ update_timestamp(timestampdir, timestampfile) log_error(NO_EXIT|USE_ERRNO, "Can't mkdir %s", timestampdir); } } - set_perms(PERM_ROOT); + if (timestamp_uid != 0) + set_perms(PERM_ROOT); } /* @@ -309,7 +311,8 @@ timestamp_status(timestampdir, timestampfile, user, make_dirs) char *dirparent = def_str(I_TIMESTAMPDIR); int status = TS_ERROR; /* assume the worst */ - set_perms(PERM_TIMESTAMP); + if (timestamp_uid != 0) + set_perms(PERM_TIMESTAMP); /* * Sanity check dirparent and make it if it doesn't already exist. @@ -347,7 +350,8 @@ timestamp_status(timestampdir, timestampfile, user, make_dirs) } } if (status == TS_ERROR) { - set_perms(PERM_ROOT); + if (timestamp_uid != 0) + set_perms(PERM_ROOT); return(status); } @@ -462,7 +466,8 @@ timestamp_status(timestampdir, timestampfile, user, make_dirs) } } - set_perms(PERM_ROOT); + if (timestamp_uid != 0) + set_perms(PERM_ROOT); return(status); }