Change Debug sudo.conf setting to take a program name as the first

argument.  In the future, this will allow visudo and sudoreplay to
use their own Debug entries.
This commit is contained in:
Todd C. Miller
2011-11-08 08:24:45 -05:00
parent 5d2c01e3d3
commit e58b232740

View File

@@ -97,12 +97,27 @@ static struct sudo_conf_paths sudo_conf_paths[] = {
{ NULL }
};
/*
* "Debug progname debug_file debug_flags"
*/
static int
set_debug(const char *entry, void *data)
{
size_t filelen;
size_t filelen, proglen;
const char *progname;
/* Is this debug setting for me? */
progname = getprogname();
if (strcmp(progname, "sudoedit") == 0)
progname = "sudo";
proglen = strlen(progname);
if (strncmp(entry, progname, proglen) != 0 ||
!isblank((unsigned char)entry[proglen]))
return FALSE;
entry += proglen + 1;
while (isblank((unsigned char)*entry))
entry++;
/* Parse Debug line */
debug_flags = strpbrk(entry, " \t");
if (debug_flags == NULL)
return FALSE;