Set safe_cmnd after sudoers_lookup() if it has not been set.

Previously it was set by sudo "ALL" in the parser but at that point
the fully-qualified pathname has not yet been found.
This commit is contained in:
Todd C. Miller
2004-11-24 21:28:55 +00:00
parent 9c526bdc30
commit f75a034f06
3 changed files with 20 additions and 32 deletions

10
sudo.c
View File

@@ -284,6 +284,8 @@ main(argc, argv, envp)
if (!def_ignore_local_sudoers && !ISSET(validated, VALIDATE_OK))
#endif
validated = sudoers_lookup(pwflag);
if (safe_cmnd == NULL)
safe_cmnd = estrdup(user_cmnd);
/*
* Look up the timestamp dir owner if one is specified.
@@ -367,14 +369,6 @@ main(argc, argv, envp)
exit(0);
}
/* This *must* have been set if we got a match but... */
if (safe_cmnd == NULL) {
log_error(MSG_ONLY,
"internal error, safe_cmnd never got set for %s; %s",
user_cmnd,
"please report this error at http://courtesan.com/sudo/bugs/");
}
#ifdef HAVE_SYSTRACE
if (def_monitor)
systrace_attach(getpid());