diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-05-08 20:33:05 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-05-08 20:33:05 +0000 |
commit | 97c677d4f04b8f8938c893656f667a29527f4a0f (patch) | |
tree | 17e28513452c08b9a5a026e19b64ae8eae09ec59 /session.c | |
parent | 387c472660ef173c2e469e70eb1a25d47f6e8887 (diff) |
- (bal) UseLogin patch for Solaris/UNICOS. Patch by Wayne Davison
<wayne@blorf.net>
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -127,6 +127,9 @@ void session_proctitle(Session *s); | |||
127 | void do_exec_pty(Session *s, const char *command); | 127 | void do_exec_pty(Session *s, const char *command); |
128 | void do_exec_no_pty(Session *s, const char *command); | 128 | void do_exec_no_pty(Session *s, const char *command); |
129 | void do_login(Session *s, const char *command); | 129 | void do_login(Session *s, const char *command); |
130 | #ifdef LOGIN_NEEDS_UTMPX | ||
131 | void do_pre_login(Session *s); | ||
132 | #endif | ||
130 | void do_child(Session *s, const char *command); | 133 | void do_child(Session *s, const char *command); |
131 | void do_motd(void); | 134 | void do_motd(void); |
132 | int check_quietlogin(Session *s, const char *command); | 135 | int check_quietlogin(Session *s, const char *command); |
@@ -644,6 +647,10 @@ do_exec_pty(Session *s, const char *command) | |||
644 | #ifndef HAVE_OSF_SIA | 647 | #ifndef HAVE_OSF_SIA |
645 | if (!(options.use_login && command == NULL)) | 648 | if (!(options.use_login && command == NULL)) |
646 | do_login(s, command); | 649 | do_login(s, command); |
650 | # ifdef LOGIN_NEEDS_UTMPX | ||
651 | else | ||
652 | do_pre_login(s); | ||
653 | # endif | ||
647 | #endif | 654 | #endif |
648 | 655 | ||
649 | /* Do common processing for the child, such as execing the command. */ | 656 | /* Do common processing for the child, such as execing the command. */ |
@@ -687,6 +694,34 @@ do_exec_pty(Session *s, const char *command) | |||
687 | } | 694 | } |
688 | } | 695 | } |
689 | 696 | ||
697 | #ifdef LOGIN_NEEDS_UTMPX | ||
698 | void | ||
699 | do_pre_login(Session *s) | ||
700 | { | ||
701 | socklen_t fromlen; | ||
702 | struct sockaddr_storage from; | ||
703 | pid_t pid = getpid(); | ||
704 | |||
705 | /* | ||
706 | * Get IP address of client. If the connection is not a socket, let | ||
707 | * the address be 0.0.0.0. | ||
708 | */ | ||
709 | memset(&from, 0, sizeof(from)); | ||
710 | if (packet_connection_is_on_socket()) { | ||
711 | fromlen = sizeof(from); | ||
712 | if (getpeername(packet_get_connection_in(), | ||
713 | (struct sockaddr *) & from, &fromlen) < 0) { | ||
714 | debug("getpeername: %.100s", strerror(errno)); | ||
715 | fatal_cleanup(); | ||
716 | } | ||
717 | } | ||
718 | |||
719 | record_utmp_only(pid, s->tty, s->pw->pw_name, | ||
720 | get_remote_name_or_ip(utmp_len, options.reverse_mapping_check), | ||
721 | (struct sockaddr *)&from); | ||
722 | } | ||
723 | #endif | ||
724 | |||
690 | /* administrative, login(1)-like work */ | 725 | /* administrative, login(1)-like work */ |
691 | void | 726 | void |
692 | do_login(Session *s, const char *command) | 727 | do_login(Session *s, const char *command) |
@@ -1511,6 +1546,9 @@ do_child(Session *s, const char *command) | |||
1511 | /* Launch login(1). */ | 1546 | /* Launch login(1). */ |
1512 | 1547 | ||
1513 | execl(LOGIN_PROGRAM, "login", "-h", hostname, | 1548 | execl(LOGIN_PROGRAM, "login", "-h", hostname, |
1549 | #ifdef LOGIN_NEEDS_TERM | ||
1550 | s->term? s->term : "unknown", | ||
1551 | #endif | ||
1514 | "-p", "-f", "--", pw->pw_name, NULL); | 1552 | "-p", "-f", "--", pw->pw_name, NULL); |
1515 | 1553 | ||
1516 | /* Login couldn't be executed, die. */ | 1554 | /* Login couldn't be executed, die. */ |