This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//sudo_1.8.23-9.el7/plugins/sudoers/sudoers.c | |
static int | |
set_cmnd(void) | |
{ | |
... | |
if (sudo_mode & (MODE_RUN | MODE_EDIT | MODE_CHECK)) { | |
... | |
/* set user_args */ | |
if (NewArgc > 1) { | |
char *to, *from, **av; | |
size_t size, n; | |
/* Alloc and build up user_args. */ | |
for (size = 0, av = NewArgv + 1; *av; av++) | |
size += strlen(*av) + 1; | |
[6] if (size == 0 || (user_args = malloc(size)) == NULL) { | |
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory")); | |
debug_return_int(-1); | |
} | |
if (ISSET(sudo_mode, MODE_SHELL|MODE_LOGIN_SHELL)) { | |
/* | |
* When running a command via a shell, the sudo front-end | |
* escapes potential meta chars. We unescape non-spaces | |
* for sudoers matching and logging purposes. | |
*/ | |
[7] for (to = user_args, av = NewArgv + 1; (from = *av); av++) { | |
while (*from) { | |
if (from[0] == '\\' && !isspace((unsigned char)from[1])) | |
from++; | |
*to++ = *from++; | |
} | |
*to++ = ' '; | |
} | |
*--to = '\0'; | |
} else { | |
... | |
} | |
} | |
} | |
... | |
[8] if (!update_defaults(SETDEF_CMND, false)) { | |
[9] log_warningx(SLOG_SEND_MAIL|SLOG_NO_STDERR, | |
N_("problem with defaults entries")); | |
} | |
debug_return_int(ret); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment