version 1.250, 2010/01/12 01:31:05 |
version 1.251, 2010/01/12 08:33:17 |
|
|
do_nologin(struct passwd *pw) |
do_nologin(struct passwd *pw) |
{ |
{ |
FILE *f = NULL; |
FILE *f = NULL; |
char buf[1024]; |
char buf[1024], *nl, *def_nl = _PATH_NOLOGIN; |
|
struct stat sb; |
|
|
if (!login_getcapbool(lc, "ignorenologin", 0) && pw->pw_uid) |
if (login_getcapbool(lc, "ignorenologin", 0) && pw->pw_uid) |
f = fopen(login_getcapstr(lc, "nologin", _PATH_NOLOGIN, |
return; |
_PATH_NOLOGIN), "r"); |
nl = login_getcapstr(lc, "nologin", def_nl, def_nl); |
if (f != NULL || errno == EPERM) { |
|
/* /etc/nologin exists. Print its contents and exit. */ |
if (stat(nl, &sb) == -1) { |
logit("User %.100s not allowed because %s exists", |
if (nl != def_nl) |
pw->pw_name, _PATH_NOLOGIN); |
xfree(nl); |
if (f == NULL) |
return; |
exit(254); |
} |
|
|
|
/* /etc/nologin exists. Print its contents if we can and exit. */ |
|
logit("User %.100s not allowed because %s exists", pw->pw_name, nl); |
|
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); |
exit(254); |
|
} |
} |
|
exit(254); |
} |
} |
|
|
/* |
/* |