version 1.24, 2000/08/17 20:05:10 |
version 1.25, 2000/08/17 20:06:34 |
|
|
extern char *__progname; |
extern char *__progname; |
extern int log_stderr; |
extern int log_stderr; |
extern int debug_flag; |
extern int debug_flag; |
|
extern unsigned int utmp_len; |
|
|
extern int startup_pipe; |
extern int startup_pipe; |
|
|
|
|
} |
} |
} |
} |
|
|
|
const char * |
|
get_remote_name_or_ip(void) |
|
{ |
|
static const char *remote = ""; |
|
if (utmp_len > 0) |
|
remote = get_canonical_hostname(); |
|
if (utmp_len == 0 || strlen(remote) > utmp_len) |
|
remote = get_remote_ipaddr(); |
|
return remote; |
|
} |
|
|
/* administrative, login(1)-like work */ |
/* administrative, login(1)-like work */ |
void |
void |
do_login(Session *s) |
do_login(Session *s) |
|
|
fatal_cleanup(); |
fatal_cleanup(); |
} |
} |
} |
} |
|
|
/* Record that there was a login on that tty from the remote host. */ |
/* Record that there was a login on that tty from the remote host. */ |
record_login(pid, s->tty, pw->pw_name, pw->pw_uid, |
record_login(pid, s->tty, pw->pw_name, pw->pw_uid, |
get_canonical_hostname(), |
get_remote_name_or_ip(), (struct sockaddr *)&from); |
(struct sockaddr *)&from); |
|
|
|
/* Done if .hushlogin exists. */ |
/* Done if .hushlogin exists. */ |
snprintf(buf, sizeof(buf), "%.200s/.hushlogin", pw->pw_dir); |
snprintf(buf, sizeof(buf), "%.200s/.hushlogin", pw->pw_dir); |
|
|
} else { |
} else { |
/* Launch login(1). */ |
/* Launch login(1). */ |
|
|
execl("/usr/bin/login", "login", "-h", get_remote_ipaddr(), |
execl("/usr/bin/login", "login", |
"-p", "-f", "--", pw->pw_name, NULL); |
"-h", get_remote_name_or_ip(), |
|
"-p", "-f", "--", pw->pw_name, NULL); |
|
|
/* Login couldn't be executed, die. */ |
/* Login couldn't be executed, die. */ |
|
|