|
Lines 94-99
extern int debug_flag;
Link Here
|
| 94 |
extern u_int utmp_len; |
94 |
extern u_int utmp_len; |
| 95 |
extern int startup_pipe; |
95 |
extern int startup_pipe; |
| 96 |
extern void destroy_sensitive_data(void); |
96 |
extern void destroy_sensitive_data(void); |
|
|
97 |
extern Buffer loginmsg; |
| 97 |
|
98 |
|
| 98 |
/* original command from peer. */ |
99 |
/* original command from peer. */ |
| 99 |
const char *original_command = NULL; |
100 |
const char *original_command = NULL; |
|
Lines 189-194
auth_input_request_forwarding(struct pas
Link Here
|
| 189 |
return 1; |
190 |
return 1; |
| 190 |
} |
191 |
} |
| 191 |
|
192 |
|
|
|
193 |
static void |
| 194 |
display_loginmsg(void) |
| 195 |
{ |
| 196 |
if (buffer_len(&loginmsg) > 0) { |
| 197 |
buffer_append(&loginmsg, "\0", 1); |
| 198 |
printf("%s", (char *)buffer_ptr(&loginmsg)); |
| 199 |
buffer_clear(&loginmsg); |
| 200 |
} |
| 201 |
} |
| 192 |
|
202 |
|
| 193 |
void |
203 |
void |
| 194 |
do_authenticated(Authctxt *authctxt) |
204 |
do_authenticated(Authctxt *authctxt) |
|
Lines 586-591
do_exec(Session *s, const char *command)
Link Here
|
| 586 |
do_exec_no_pty(s, command); |
596 |
do_exec_no_pty(s, command); |
| 587 |
|
597 |
|
| 588 |
original_command = NULL; |
598 |
original_command = NULL; |
|
|
599 |
|
| 600 |
/* |
| 601 |
* Clear loginmsg: it's the child's responsibility to display |
| 602 |
* it to the user, otherwise multiple sessions may accumulate |
| 603 |
* multiple copies of the login messages. |
| 604 |
*/ |
| 605 |
buffer_clear(&loginmsg); |
| 589 |
} |
606 |
} |
| 590 |
|
607 |
|
| 591 |
|
608 |
|
|
Lines 593-599
do_exec(Session *s, const char *command)
Link Here
|
| 593 |
void |
610 |
void |
| 594 |
do_login(Session *s, const char *command) |
611 |
do_login(Session *s, const char *command) |
| 595 |
{ |
612 |
{ |
| 596 |
char *time_string; |
|
|
| 597 |
socklen_t fromlen; |
613 |
socklen_t fromlen; |
| 598 |
struct sockaddr_storage from; |
614 |
struct sockaddr_storage from; |
| 599 |
struct passwd * pw = s->pw; |
615 |
struct passwd * pw = s->pw; |
|
Lines 623-638
do_login(Session *s, const char *command
Link Here
|
| 623 |
if (check_quietlogin(s, command)) |
639 |
if (check_quietlogin(s, command)) |
| 624 |
return; |
640 |
return; |
| 625 |
|
641 |
|
| 626 |
if (options.print_lastlog && s->last_login_time != 0) { |
642 |
display_loginmsg(); |
| 627 |
time_string = ctime(&s->last_login_time); |
|
|
| 628 |
if (strchr(time_string, '\n')) |
| 629 |
*strchr(time_string, '\n') = 0; |
| 630 |
if (strcmp(s->hostname, "") == 0) |
| 631 |
printf("Last login: %s\r\n", time_string); |
| 632 |
else |
| 633 |
printf("Last login: %s from %s\r\n", time_string, |
| 634 |
s->hostname); |
| 635 |
} |
| 636 |
|
643 |
|
| 637 |
do_motd(); |
644 |
do_motd(); |
| 638 |
} |
645 |
} |
|
Lines 1377-1388
session_pty_req(Session *s)
Link Here
|
| 1377 |
if (s->ttyfd != -1) { |
1384 |
if (s->ttyfd != -1) { |
| 1378 |
packet_disconnect("Protocol error: you already have a pty."); |
1385 |
packet_disconnect("Protocol error: you already have a pty."); |
| 1379 |
return 0; |
1386 |
return 0; |
| 1380 |
} |
|
|
| 1381 |
/* Get the time and hostname when the user last logged in. */ |
| 1382 |
if (options.print_lastlog) { |
| 1383 |
s->hostname[0] = '\0'; |
| 1384 |
s->last_login_time = get_last_login_time(s->pw->pw_uid, |
| 1385 |
s->pw->pw_name, s->hostname, sizeof(s->hostname)); |
| 1386 |
} |
1387 |
} |
| 1387 |
|
1388 |
|
| 1388 |
s->term = packet_get_string(&len); |
1389 |
s->term = packet_get_string(&len); |