Add support for non-root timestamp dirs. This allows the timestamp

dir to be shared via NFS (though this is not recommended).
This commit is contained in:
Todd C. Miller
2002-05-03 22:48:17 +00:00
parent 15965c2ce7
commit a30951d34c
4 changed files with 49 additions and 10 deletions

17
sudo.c
View File

@@ -131,6 +131,7 @@ FILE *sudoers_fp = NULL;
struct interface *interfaces;
int num_interfaces;
int tgetpass_flags;
int timestamp_uid;
extern int errorlineno;
#if defined(RLIMIT_CORE) && !defined(SUDO_DEVEL)
static struct rlimit corelimit;
@@ -287,6 +288,22 @@ main(argc, argv, envp)
log_error(NO_MAIL|MSG_ONLY, "no passwd entry for %s!", *user_runas);
}
/*
* Look up the timestamp dir owner if one is specified.
*/
if (def_str(I_TIMESTAMPOWNER)) {
struct passwd *pw;
if (*def_str(I_TIMESTAMPOWNER) == '#')
pw = getpwuid(atoi(def_str(I_TIMESTAMPOWNER) + 1));
else
pw = getpwnam(def_str(I_TIMESTAMPOWNER));
if (!pw)
log_error(0, "timestamp owner (%s): No such user",
def_str(I_TIMESTAMPOWNER));
timestamp_uid = pw->pw_uid;
}
/* This goes after the sudoers parse since we honor sudoers options. */
if (sudo_mode == MODE_KILL || sudo_mode == MODE_INVALIDATE) {
remove_timestamp((sudo_mode == MODE_KILL));