diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | session.c | 19 |
2 files changed, 13 insertions, 11 deletions
@@ -10,6 +10,9 @@ | |||
10 | - markus@cvs.openbsd.org 2001/03/20 19:21:21 | 10 | - markus@cvs.openbsd.org 2001/03/20 19:21:21 |
11 | [session.c] | 11 | [session.c] |
12 | remove unused arg | 12 | remove unused arg |
13 | - markus@cvs.openbsd.org 2001/03/20 19:21:21 | ||
14 | [session.c] | ||
15 | remove unused arg | ||
13 | 16 | ||
14 | 20010321 | 17 | 20010321 |
15 | - (djm) Fix ttyname breakage for AIX and Tru64. Patch from Steve | 18 | - (djm) Fix ttyname breakage for AIX and Tru64. Patch from Steve |
@@ -4669,4 +4672,4 @@ | |||
4669 | - Wrote replacements for strlcpy and mkdtemp | 4672 | - Wrote replacements for strlcpy and mkdtemp |
4670 | - Released 1.0pre1 | 4673 | - Released 1.0pre1 |
4671 | 4674 | ||
4672 | $Id: ChangeLog,v 1.1003 2001/03/22 01:25:37 mouring Exp $ | 4675 | $Id: ChangeLog,v 1.1004 2001/03/22 01:27:23 mouring Exp $ |
@@ -33,7 +33,7 @@ | |||
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include "includes.h" | 35 | #include "includes.h" |
36 | RCSID("$OpenBSD: session.c,v 1.63 2001/03/20 19:21:21 markus Exp $"); | 36 | RCSID("$OpenBSD: session.c,v 1.64 2001/03/20 19:35:29 markus Exp $"); |
37 | 37 | ||
38 | #include "ssh.h" | 38 | #include "ssh.h" |
39 | #include "ssh1.h" | 39 | #include "ssh1.h" |
@@ -100,7 +100,6 @@ typedef struct Session Session; | |||
100 | struct Session { | 100 | struct Session { |
101 | int used; | 101 | int used; |
102 | int self; | 102 | int self; |
103 | int extended; | ||
104 | struct passwd *pw; | 103 | struct passwd *pw; |
105 | pid_t pid; | 104 | pid_t pid; |
106 | /* tty */ | 105 | /* tty */ |
@@ -116,6 +115,7 @@ struct Session { | |||
116 | int single_connection; | 115 | int single_connection; |
117 | /* proto 2 */ | 116 | /* proto 2 */ |
118 | int chanid; | 117 | int chanid; |
118 | int is_subsystem; | ||
119 | }; | 119 | }; |
120 | 120 | ||
121 | /* func */ | 121 | /* func */ |
@@ -555,11 +555,11 @@ do_exec_no_pty(Session *s, const char *command) | |||
555 | close(perr[1]); | 555 | close(perr[1]); |
556 | 556 | ||
557 | if (compat20) { | 557 | if (compat20) { |
558 | session_set_fds(s, pin[1], pout[0], s->extended ? perr[0] : -1); | 558 | session_set_fds(s, pin[1], pout[0], s->is_subsystem ? -1 : perr[0]); |
559 | } else { | 559 | } else { |
560 | /* Enter the interactive session. */ | 560 | /* Enter the interactive session. */ |
561 | server_loop(pid, pin[1], pout[0], perr[0]); | 561 | server_loop(pid, pin[1], pout[0], perr[0]); |
562 | /* server_loop has closed pin[1], pout[1], and perr[1]. */ | 562 | /* server_loop has closed pin[1], pout[0], and perr[0]. */ |
563 | } | 563 | } |
564 | #else /* USE_PIPES */ | 564 | #else /* USE_PIPES */ |
565 | /* We are the parent. Close the child sides of the socket pairs. */ | 565 | /* We are the parent. Close the child sides of the socket pairs. */ |
@@ -571,7 +571,7 @@ do_exec_no_pty(Session *s, const char *command) | |||
571 | * handle the case that fdin and fdout are the same. | 571 | * handle the case that fdin and fdout are the same. |
572 | */ | 572 | */ |
573 | if (compat20) { | 573 | if (compat20) { |
574 | session_set_fds(s, inout[1], inout[1], s->extended ? err[1] : -1); | 574 | session_set_fds(s, inout[1], inout[1], s->is_subsystem ? -1 : err[1]); |
575 | } else { | 575 | } else { |
576 | server_loop(pid, inout[1], inout[1], err[1]); | 576 | server_loop(pid, inout[1], inout[1], err[1]); |
577 | /* server_loop has closed inout[1] and err[1]. */ | 577 | /* server_loop has closed inout[1] and err[1]. */ |
@@ -1504,7 +1504,7 @@ session_new(void) | |||
1504 | Session *s = &sessions[i]; | 1504 | Session *s = &sessions[i]; |
1505 | if (! s->used) { | 1505 | if (! s->used) { |
1506 | s->pid = 0; | 1506 | s->pid = 0; |
1507 | s->extended = 0; | 1507 | s->is_subsystem = 0; |
1508 | s->chanid = -1; | 1508 | s->chanid = -1; |
1509 | s->ptyfd = -1; | 1509 | s->ptyfd = -1; |
1510 | s->ttyfd = -1; | 1510 | s->ttyfd = -1; |
@@ -1661,6 +1661,7 @@ session_subsystem_req(Session *s) | |||
1661 | for (i = 0; i < options.num_subsystems; i++) { | 1661 | for (i = 0; i < options.num_subsystems; i++) { |
1662 | if(strcmp(subsys, options.subsystem_name[i]) == 0) { | 1662 | if(strcmp(subsys, options.subsystem_name[i]) == 0) { |
1663 | debug("subsystem: exec() %s", options.subsystem_command[i]); | 1663 | debug("subsystem: exec() %s", options.subsystem_command[i]); |
1664 | s->is_subsystem = 1; | ||
1664 | do_exec_no_pty(s, options.subsystem_command[i]); | 1665 | do_exec_no_pty(s, options.subsystem_command[i]); |
1665 | success = 1; | 1666 | success = 1; |
1666 | } | 1667 | } |
@@ -1735,7 +1736,6 @@ session_shell_req(Session *s) | |||
1735 | /* if forced_command == NULL, the shell is execed */ | 1736 | /* if forced_command == NULL, the shell is execed */ |
1736 | char *shell = forced_command; | 1737 | char *shell = forced_command; |
1737 | packet_done(); | 1738 | packet_done(); |
1738 | s->extended = 1; | ||
1739 | if (s->ttyfd == -1) | 1739 | if (s->ttyfd == -1) |
1740 | do_exec_no_pty(s, shell); | 1740 | do_exec_no_pty(s, shell); |
1741 | else | 1741 | else |
@@ -1754,7 +1754,6 @@ session_exec_req(Session *s) | |||
1754 | command = forced_command; | 1754 | command = forced_command; |
1755 | debug("Forced command '%.500s'", forced_command); | 1755 | debug("Forced command '%.500s'", forced_command); |
1756 | } | 1756 | } |
1757 | s->extended = 1; | ||
1758 | if (s->ttyfd == -1) | 1757 | if (s->ttyfd == -1) |
1759 | do_exec_no_pty(s, command); | 1758 | do_exec_no_pty(s, command); |
1760 | else | 1759 | else |
@@ -1805,8 +1804,8 @@ session_input_channel_req(int id, void *arg) | |||
1805 | s->self, id, rtype, reply); | 1804 | s->self, id, rtype, reply); |
1806 | 1805 | ||
1807 | /* | 1806 | /* |
1808 | * a session is in LARVAL state until a shell | 1807 | * a session is in LARVAL state until a shell, a command |
1809 | * or programm is executed | 1808 | * or a subsystem is executed |
1810 | */ | 1809 | */ |
1811 | if (c->type == SSH_CHANNEL_LARVAL) { | 1810 | if (c->type == SSH_CHANNEL_LARVAL) { |
1812 | if (strcmp(rtype, "shell") == 0) { | 1811 | if (strcmp(rtype, "shell") == 0) { |