Changeset View
Changeset View
Standalone View
Standalone View
session.c
Show First 20 Lines • Show All 1,269 Lines • ▼ Show 20 Lines | if (!s->is_subsystem && options.adm_forced_command == NULL && | ||||
} | } | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
do_nologin(struct passwd *pw) | do_nologin(struct passwd *pw) | ||||
{ | { | ||||
FILE *f = NULL; | FILE *f = NULL; | ||||
char buf[1024], *nl, *def_nl = _PATH_NOLOGIN; | const char *nl; | ||||
char buf[1024], *def_nl = _PATH_NOLOGIN; | |||||
emaste: in base system now we've kept the `const char *nl;` but following upstream have dropped the… | |||||
struct stat sb; | struct stat sb; | ||||
#ifdef HAVE_LOGIN_CAP | #ifdef HAVE_LOGIN_CAP | ||||
if (login_getcapbool(lc, "ignorenologin", 0) || pw->pw_uid == 0) | if (login_getcapbool(lc, "ignorenologin", 0) || pw->pw_uid == 0) | ||||
return; | return; | ||||
nl = login_getcapstr(lc, "nologin", def_nl, def_nl); | nl = login_getcapstr(lc, "nologin", def_nl, def_nl); | ||||
#else | #else | ||||
if (pw->pw_uid == 0) | if (pw->pw_uid == 0) | ||||
return; | return; | ||||
nl = def_nl; | nl = def_nl; | ||||
#endif | #endif | ||||
if (stat(nl, &sb) == -1) { | if (stat(nl, &sb) == -1) | ||||
if (nl != def_nl) | |||||
free(nl); | |||||
return; | return; | ||||
} | |||||
/* /etc/nologin exists. Print its contents if we can and exit. */ | /* /etc/nologin exists. Print its contents if we can and exit. */ | ||||
logit("User %.100s not allowed because %s exists", pw->pw_name, nl); | logit("User %.100s not allowed because %s exists", pw->pw_name, nl); | ||||
if ((f = fopen(nl, "r")) != NULL) { | if ((f = fopen(nl, "r")) != NULL) { | ||||
while (fgets(buf, sizeof(buf), f)) | while (fgets(buf, sizeof(buf), f)) | ||||
fputs(buf, stderr); | fputs(buf, stderr); | ||||
fclose(f); | fclose(f); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,421 Lines • Show Last 20 Lines |
in base system now we've kept the const char *nl; but following upstream have dropped the free()