diff options
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -33,7 +33,7 @@ | |||
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include "includes.h" | 35 | #include "includes.h" |
36 | RCSID("$OpenBSD: session.c,v 1.40 2000/10/15 14:14:01 markus Exp $"); | 36 | RCSID("$OpenBSD: session.c,v 1.42 2000/10/27 07:32:18 markus Exp $"); |
37 | 37 | ||
38 | #include "xmalloc.h" | 38 | #include "xmalloc.h" |
39 | #include "ssh.h" | 39 | #include "ssh.h" |
@@ -119,7 +119,7 @@ void session_pty_cleanup(Session *s); | |||
119 | void session_proctitle(Session *s); | 119 | void session_proctitle(Session *s); |
120 | void do_exec_pty(Session *s, const char *command, struct passwd * pw); | 120 | void do_exec_pty(Session *s, const char *command, struct passwd * pw); |
121 | void do_exec_no_pty(Session *s, const char *command, struct passwd * pw); | 121 | void do_exec_no_pty(Session *s, const char *command, struct passwd * pw); |
122 | void do_login(Session *s); | 122 | void do_login(Session *s, const char *command); |
123 | 123 | ||
124 | void | 124 | void |
125 | do_child(const char *command, struct passwd * pw, const char *term, | 125 | do_child(const char *command, struct passwd * pw, const char *term, |
@@ -627,8 +627,8 @@ do_exec_pty(Session *s, const char *command, struct passwd * pw) | |||
627 | close(ttyfd); | 627 | close(ttyfd); |
628 | 628 | ||
629 | /* record login, etc. similar to login(1) */ | 629 | /* record login, etc. similar to login(1) */ |
630 | if (command == NULL && !options.use_login) | 630 | if (!(options.use_login && command == NULL)) |
631 | do_login(s); | 631 | do_login(s, command); |
632 | 632 | ||
633 | /* Do common processing for the child, such as execing the command. */ | 633 | /* Do common processing for the child, such as execing the command. */ |
634 | do_child(command, pw, s->term, s->display, s->auth_proto, | 634 | do_child(command, pw, s->term, s->display, s->auth_proto, |
@@ -684,7 +684,7 @@ get_remote_name_or_ip(void) | |||
684 | 684 | ||
685 | /* administrative, login(1)-like work */ | 685 | /* administrative, login(1)-like work */ |
686 | void | 686 | void |
687 | do_login(Session *s) | 687 | do_login(Session *s, const char *command) |
688 | { | 688 | { |
689 | FILE *f; | 689 | FILE *f; |
690 | char *time_string; | 690 | char *time_string; |
@@ -731,7 +731,9 @@ do_login(Session *s) | |||
731 | } | 731 | } |
732 | #endif | 732 | #endif |
733 | 733 | ||
734 | /* Done if .hushlogin exists. */ | 734 | /* Done if .hushlogin exists or a command given. */ |
735 | if (command != NULL) | ||
736 | return; | ||
735 | snprintf(buf, sizeof(buf), "%.200s/.hushlogin", pw->pw_dir); | 737 | snprintf(buf, sizeof(buf), "%.200s/.hushlogin", pw->pw_dir); |
736 | #ifdef HAVE_LOGIN_CAP | 738 | #ifdef HAVE_LOGIN_CAP |
737 | if (login_getcapbool(lc, "hushlogin", 0) || stat(buf, &st) >= 0) | 739 | if (login_getcapbool(lc, "hushlogin", 0) || stat(buf, &st) >= 0) |
@@ -1778,7 +1780,8 @@ session_set_fds(Session *s, int fdin, int fdout, int fderr) | |||
1778 | fatal("no channel for session %d", s->self); | 1780 | fatal("no channel for session %d", s->self); |
1779 | channel_set_fds(s->chanid, | 1781 | channel_set_fds(s->chanid, |
1780 | fdout, fdin, fderr, | 1782 | fdout, fdin, fderr, |
1781 | fderr == -1 ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ); | 1783 | fderr == -1 ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ, |
1784 | 1); | ||
1782 | } | 1785 | } |
1783 | 1786 | ||
1784 | void | 1787 | void |