version 1.73, 2019/01/28 01:38:06 |
version 1.73.2.2, 2019/12/09 04:51:48 |
|
|
if (pwd == NULL) |
if (pwd == NULL) |
auth_errx(as, 1, "who are you?"); |
auth_errx(as, 1, "who are you?"); |
if ((username = strdup(pwd->pw_name)) == NULL) |
if ((username = strdup(pwd->pw_name)) == NULL) |
auth_errx(as, 1, "can't allocate memory"); |
auth_err(as, 1, NULL); |
if (asme && !altshell) { |
if (asme && !altshell) { |
if (pwd->pw_shell && *pwd->pw_shell) { |
if (pwd->pw_shell && *pwd->pw_shell) { |
if ((shell = strdup(pwd->pw_shell)) == NULL) |
if ((shell = strdup(pwd->pw_shell)) == NULL) |
auth_errx(as, 1, "can't allocate memory"); |
auth_err(as, 1, NULL); |
} else { |
} else { |
shell = _PATH_BSHELL; |
shell = _PATH_BSHELL; |
iscsh = NO; |
iscsh = NO; |
|
|
err(1, "unveil"); |
err(1, "unveil"); |
|
|
for (;;) { |
for (;;) { |
|
char *pw_class = class; |
|
|
/* get target user, default to root unless in -L mode */ |
/* get target user, default to root unless in -L mode */ |
if (*argv) { |
if (*argv) { |
user = *argv; |
user = *argv; |
|
|
auth_clean(as); |
auth_clean(as); |
if (auth_setitem(as, AUTHV_INTERACTIVE, "True") != 0 || |
if (auth_setitem(as, AUTHV_INTERACTIVE, "True") != 0 || |
auth_setitem(as, AUTHV_NAME, user) != 0) |
auth_setitem(as, AUTHV_NAME, user) != 0) |
auth_errx(as, 1, "can't allocate memory"); |
auth_err(as, 1, NULL); |
if ((user = auth_getitem(as, AUTHV_NAME)) == NULL) |
if ((user = auth_getitem(as, AUTHV_NAME)) == NULL) |
auth_errx(as, 1, "internal error"); |
auth_errx(as, 1, "internal error"); |
if (auth_setpwd(as, NULL) || (pwd = auth_getpwd(as)) == NULL) { |
if (auth_setpwd(as, NULL) || (pwd = auth_getpwd(as)) == NULL) { |
|
|
} |
} |
|
|
/* If the user specified a login class, use it */ |
/* If the user specified a login class, use it */ |
if (!class && pwd && pwd->pw_class && pwd->pw_class[0] != '\0') |
if (pw_class == NULL && pwd != NULL) |
class = strdup(pwd->pw_class); |
pw_class = pwd->pw_class; |
if ((lc = login_getclass(class)) == NULL) |
if ((lc = login_getclass(pw_class)) == NULL) |
auth_errx(as, 1, "no such login class: %s", |
auth_errx(as, 1, "no such login class: %s", |
class ? class : LOGIN_DEFCLASS); |
pw_class ? pw_class : LOGIN_DEFCLASS); |
|
|
if ((ruid == 0 && !emlogin) || |
if ((ruid == 0 && !emlogin) || |
verify_user(username, pwd, style, lc, as) == 0) |
verify_user(username, pwd, style, lc, as) == 0) |
|
|
} |
} |
fprintf(stderr, "Login incorrect\n"); |
fprintf(stderr, "Login incorrect\n"); |
} |
} |
|
if (pwd == NULL) |
|
auth_errx(as, 1, "internal error"); |
|
|
if (pledge("stdio unveil rpath getpw exec id", NULL) == -1) |
if (pledge("stdio unveil rpath getpw exec id", NULL) == -1) |
err(1, "pledge"); |
err(1, "pledge"); |
|
|
auth_errx(as, 1, "permission denied (shell)."); |
auth_errx(as, 1, "permission denied (shell)."); |
} else if (pwd->pw_shell && *pwd->pw_shell) { |
} else if (pwd->pw_shell && *pwd->pw_shell) { |
if ((shell = strdup(pwd->pw_shell)) == NULL) |
if ((shell = strdup(pwd->pw_shell)) == NULL) |
auth_errx(as, 1, "can't allocate memory"); |
auth_err(as, 1, NULL); |
iscsh = UNSET; |
iscsh = UNSET; |
} else { |
} else { |
shell = _PATH_BSHELL; |
shell = _PATH_BSHELL; |