2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Re-enable environment files and setting environment variables on the

command line.
This commit is contained in:
Todd C. Miller
2010-04-26 17:14:11 -04:00
parent af092dc406
commit b041c91caf
4 changed files with 29 additions and 33 deletions

View File

@@ -630,13 +630,14 @@ new_logline(const char *message, int serrno)
len += sizeof(LL_TSID_STR) + 2 + strlen(sudo_user.sessid);
if (sudo_user.env_vars != NULL) {
size_t evlen = 0;
struct list_member *cur;
for (cur = sudo_user.env_vars; cur != NULL; cur = cur->next)
evlen += strlen(cur->value) + 1;
char * const *ep;
for (ep = sudo_user.env_vars; *ep != NULL; ep++)
evlen += strlen(*ep) + 1;
evstr = emalloc(evlen);
evstr[0] = '\0';
for (cur = sudo_user.env_vars; cur != NULL; cur = cur->next) {
strlcat(evstr, cur->value, evlen);
for (ep = sudo_user.env_vars; *ep != NULL; ep++) {
strlcat(evstr, *ep, evlen);
strlcat(evstr, " ", evlen); /* NOTE: last one will fail */
}
len += sizeof(LL_ENV_STR) + 2 + evlen;