Changeset View
Changeset View
Standalone View
Standalone View
lib/libutil/login_class.c
Show First 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | ++vars; | ||||
*/ | */ | ||||
if (!paths) { | if (!paths) { | ||||
const char **set_env = login_getcaplist(lc, "setenv", ","); | const char **set_env = login_getcaplist(lc, "setenv", ","); | ||||
if (set_env != NULL) { | if (set_env != NULL) { | ||||
while (*set_env != NULL) { | while (*set_env != NULL) { | ||||
char *p = strchr(*set_env, '='); | char *p = strchr(*set_env, '='); | ||||
if (p != NULL) { /* Discard invalid entries */ | if (p != NULL && p != *set_env) { /* Discard invalid entries */ | ||||
const char *ep; | |||||
char *np; | char *np; | ||||
*p++ = '\0'; | *p++ = '\0'; | ||||
/* Strip leading spaces from variable name */ | |||||
ep = *set_env; | |||||
while (*ep == ' ' || *ep == '\t') | |||||
ep++; | |||||
if ((np = substvar(p, pwd, hlen, pch, nlen)) != NULL) { | if ((np = substvar(p, pwd, hlen, pch, nlen)) != NULL) { | ||||
setenv(*set_env, np, 1); | setenv(ep, np, 1); | ||||
free(np); | free(np); | ||||
} | } | ||||
} | } | ||||
++set_env; | ++set_env; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 309 Lines • Show Last 20 Lines |