version 1.134.2.2, 2002/10/11 14:51:52 |
version 1.134.2.3, 2003/04/03 22:35:17 |
|
|
void |
void |
do_authenticated(Authctxt *authctxt) |
do_authenticated(Authctxt *authctxt) |
{ |
{ |
|
setproctitle("%s", authctxt->pw->pw_name); |
|
|
/* |
/* |
* Cancel the alarm we set to limit the time taken for |
* Cancel the alarm we set to limit the time taken for |
* authentication. |
* authentication. |
|
|
{ |
{ |
char buf[256]; |
char buf[256]; |
u_int i, envsize; |
u_int i, envsize; |
char **env; |
char **env, *laddr; |
struct passwd *pw = s->pw; |
struct passwd *pw = s->pw; |
|
|
/* Initialize the environment. */ |
/* Initialize the environment. */ |
|
|
get_remote_ipaddr(), get_remote_port(), get_local_port()); |
get_remote_ipaddr(), get_remote_port(), get_local_port()); |
child_set_env(&env, &envsize, "SSH_CLIENT", buf); |
child_set_env(&env, &envsize, "SSH_CLIENT", buf); |
|
|
|
laddr = get_local_ipaddr(packet_get_connection_in()); |
snprintf(buf, sizeof buf, "%.50s %d %.50s %d", |
snprintf(buf, sizeof buf, "%.50s %d %.50s %d", |
get_remote_ipaddr(), get_remote_port(), |
get_remote_ipaddr(), get_remote_port(), laddr, get_local_port()); |
get_local_ipaddr(packet_get_connection_in()), get_local_port()); |
xfree(laddr); |
child_set_env(&env, &envsize, "SSH_CONNECTION", buf); |
child_set_env(&env, &envsize, "SSH_CONNECTION", buf); |
|
|
if (s->ttyfd != -1) |
if (s->ttyfd != -1) |
|
|
/* Add authority data to .Xauthority if appropriate. */ |
/* Add authority data to .Xauthority if appropriate. */ |
if (debug_flag) { |
if (debug_flag) { |
fprintf(stderr, |
fprintf(stderr, |
"Running %.500s add " |
"Running %.500s remove %.100s\n", |
"%.100s %.100s %.100s\n", |
options.xauth_location, s->auth_display); |
|
fprintf(stderr, |
|
"%.500s add %.100s %.100s %.100s\n", |
options.xauth_location, s->auth_display, |
options.xauth_location, s->auth_display, |
s->auth_proto, s->auth_data); |
s->auth_proto, s->auth_data); |
} |
} |
|
|
options.xauth_location); |
options.xauth_location); |
f = popen(cmd, "w"); |
f = popen(cmd, "w"); |
if (f) { |
if (f) { |
|
fprintf(f, "remove %s\n", |
|
s->auth_display); |
fprintf(f, "add %s %s %s\n", |
fprintf(f, "add %s %s %s\n", |
s->auth_display, s->auth_proto, |
s->auth_display, s->auth_proto, |
s->auth_data); |
s->auth_data); |
|
|
* legal, and means /bin/sh. |
* legal, and means /bin/sh. |
*/ |
*/ |
shell = (pw->pw_shell[0] == '\0') ? _PATH_BSHELL : pw->pw_shell; |
shell = (pw->pw_shell[0] == '\0') ? _PATH_BSHELL : pw->pw_shell; |
|
|
|
/* |
|
* Make sure $SHELL points to the shell from the password file, |
|
* even if shell is overridden from login.conf |
|
*/ |
|
env = do_setup_env(s, shell); |
|
|
#ifdef HAVE_LOGIN_CAP |
#ifdef HAVE_LOGIN_CAP |
shell = login_getcapstr(lc, "shell", (char *)shell, (char *)shell); |
shell = login_getcapstr(lc, "shell", (char *)shell, (char *)shell); |
#endif |
#endif |
|
|
env = do_setup_env(s, shell); |
|
|
|
/* we have to stash the hostname before we close our socket. */ |
/* we have to stash the hostname before we close our socket. */ |
if (options.use_login) |
if (options.use_login) |