2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-05 08:45:28 +00:00

Rewrite compat/getprogname.c and add setprogname().

The progname is now passed to the plugin via the settings array.
This commit is contained in:
Todd C. Miller
2010-03-19 07:52:31 -04:00
parent 0dbf4362d9
commit eec5235d19
6 changed files with 42 additions and 33 deletions

View File

@@ -100,7 +100,9 @@ static struct sudo_settings {
{ "selinux_type" },
#define ARG_RUNAS_USER 11
{ "runas_user" },
#define NUM_SETTINGS 12
#define ARG_PROGNAME 12
{ "progname" },
#define NUM_SETTINGS 13
{ NULL }
};
@@ -125,6 +127,9 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
env_add = emalloc2(env_size, sizeof(char *));
env_add[0] = NULL;
/* Pass progname to plugin so it can call setprogname() */
sudo_settings[ARG_PROGNAME].value = getprogname();
/* First, check to see if we were invoked as "sudoedit". */
if (strcmp(getprogname(), "sudoedit") == 0)
mode = MODE_EDIT;