No need to convert sudoedit -> sudo in sudo_debug_get_instance()

as we store the actual program name and only do the sudoedit ->
sudo conversion when reading the sudo.conf file.  Fixes debugging
when invoked as sudoedit.
This commit is contained in:
Todd C. Miller
2014-10-24 11:28:39 -06:00
parent 4bf641df69
commit fd8cf2c89b

View File

@@ -370,19 +370,12 @@ sudo_debug_deregister(int instance_id)
int
sudo_debug_get_instance(const char *program)
{
size_t proglen;
int idx;
/* Treat "sudoedit" as an alias for "sudo". */
proglen = strlen(program);
if (proglen > 4 && strcmp(program + proglen - 4, "edit") == 0)
proglen -= 4;
for (idx = 0; idx <= sudo_debug_last_instance; idx++) {
if (sudo_debug_instances[idx] == NULL)
continue;
if (strncmp(sudo_debug_instances[idx]->program, program, proglen) == 0
&& sudo_debug_instances[idx]->program[proglen] == '\0')
if (strcmp(sudo_debug_instances[idx]->program, program) == 0)
return SUDO_DEBUG_MKINSTANCE(idx);
}
return SUDO_DEBUG_INSTANCE_INITIALIZER;