diff options
author | Damien Miller <djm@mindrot.org> | 2006-07-10 20:36:47 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2006-07-10 20:36:47 +1000 |
commit | 917f9b6b6eb560e205a787bd8f38d4b9741c9a9f (patch) | |
tree | 579833892a9e1251e2750a2779fecbf4714c4445 | |
parent | 8ec8c3e98a07be51e0a136170f02b7ebab0f28ca (diff) |
- djm@cvs.openbsd.org 2006/07/06 10:47:05
[servconf.c servconf.h session.c sshd_config.5]
support arguments to Subsystem commands; ok markus@
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | servconf.c | 14 | ||||
-rw-r--r-- | servconf.h | 3 | ||||
-rw-r--r-- | session.c | 11 | ||||
-rw-r--r-- | sshd_config.5 | 6 |
5 files changed, 28 insertions, 11 deletions
@@ -35,6 +35,9 @@ | |||
35 | [serverloop.c sshconnect.c uuencode.c] | 35 | [serverloop.c sshconnect.c uuencode.c] |
36 | move #include <netinet/in.h> out of includes.h; ok deraadt@ | 36 | move #include <netinet/in.h> out of includes.h; ok deraadt@ |
37 | (also ssh-rand-helper.c logintest.c loginrec.c) | 37 | (also ssh-rand-helper.c logintest.c loginrec.c) |
38 | - djm@cvs.openbsd.org 2006/07/06 10:47:05 | ||
39 | [servconf.c servconf.h session.c sshd_config.5] | ||
40 | support arguments to Subsystem commands; ok markus@ | ||
38 | 41 | ||
39 | 20060706 | 42 | 20060706 |
40 | - (dtucker) [configure.ac] Try AIX blibpath test in different order when | 43 | - (dtucker) [configure.ac] Try AIX blibpath test in different order when |
@@ -4768,4 +4771,4 @@ | |||
4768 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM | 4771 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM |
4769 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu | 4772 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu |
4770 | 4773 | ||
4771 | $Id: ChangeLog,v 1.4368 2006/07/10 10:35:38 djm Exp $ | 4774 | $Id: ChangeLog,v 1.4369 2006/07/10 10:36:47 djm Exp $ |
diff --git a/servconf.c b/servconf.c index 43372e20f..af0ad1a35 100644 --- a/servconf.c +++ b/servconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: servconf.c,v 1.150 2006/03/25 13:17:02 djm Exp $ */ | 1 | /* $OpenBSD: servconf.c,v 1.151 2006/07/06 10:47:05 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
4 | * All rights reserved | 4 | * All rights reserved |
@@ -446,6 +446,7 @@ process_server_config_line(ServerOptions *options, char *line, | |||
446 | ServerOpCodes opcode; | 446 | ServerOpCodes opcode; |
447 | u_short port; | 447 | u_short port; |
448 | u_int i; | 448 | u_int i; |
449 | size_t len; | ||
449 | 450 | ||
450 | cp = line; | 451 | cp = line; |
451 | if ((arg = strdelim(&cp)) == NULL) | 452 | if ((arg = strdelim(&cp)) == NULL) |
@@ -901,6 +902,17 @@ parse_flag: | |||
901 | fatal("%s line %d: Missing subsystem command.", | 902 | fatal("%s line %d: Missing subsystem command.", |
902 | filename, linenum); | 903 | filename, linenum); |
903 | options->subsystem_command[options->num_subsystems] = xstrdup(arg); | 904 | options->subsystem_command[options->num_subsystems] = xstrdup(arg); |
905 | |||
906 | /* Collect arguments (separate to executable) */ | ||
907 | p = xstrdup(arg); | ||
908 | len = strlen(p) + 1; | ||
909 | while ((arg = strdelim(&cp)) != NULL && *arg != '\0') { | ||
910 | len += 1 + strlen(arg); | ||
911 | p = xrealloc(p, 1, len); | ||
912 | strlcat(p, " ", len); | ||
913 | strlcat(p, arg, len); | ||
914 | } | ||
915 | options->subsystem_args[options->num_subsystems] = p; | ||
904 | options->num_subsystems++; | 916 | options->num_subsystems++; |
905 | break; | 917 | break; |
906 | 918 | ||
diff --git a/servconf.h b/servconf.h index 73604a98e..671050e4c 100644 --- a/servconf.h +++ b/servconf.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: servconf.h,v 1.73 2006/03/25 22:22:43 djm Exp $ */ | 1 | /* $OpenBSD: servconf.h,v 1.74 2006/07/06 10:47:05 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -111,6 +111,7 @@ typedef struct { | |||
111 | u_int num_subsystems; | 111 | u_int num_subsystems; |
112 | char *subsystem_name[MAX_SUBSYSTEMS]; | 112 | char *subsystem_name[MAX_SUBSYSTEMS]; |
113 | char *subsystem_command[MAX_SUBSYSTEMS]; | 113 | char *subsystem_command[MAX_SUBSYSTEMS]; |
114 | char *subsystem_args[MAX_SUBSYSTEMS]; | ||
114 | 115 | ||
115 | u_int num_accept_env; | 116 | u_int num_accept_env; |
116 | char *accept_env[MAX_ACCEPT_ENV]; | 117 | char *accept_env[MAX_ACCEPT_ENV]; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: session.c,v 1.204 2006/07/02 22:45:59 stevesk Exp $ */ | 1 | /* $OpenBSD: session.c,v 1.205 2006/07/06 10:47:05 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
4 | * All rights reserved | 4 | * All rights reserved |
@@ -1841,7 +1841,7 @@ session_subsystem_req(Session *s) | |||
1841 | struct stat st; | 1841 | struct stat st; |
1842 | u_int len; | 1842 | u_int len; |
1843 | int success = 0; | 1843 | int success = 0; |
1844 | char *cmd, *subsys = packet_get_string(&len); | 1844 | char *prog, *cmd, *subsys = packet_get_string(&len); |
1845 | u_int i; | 1845 | u_int i; |
1846 | 1846 | ||
1847 | packet_check_eom(); | 1847 | packet_check_eom(); |
@@ -1849,9 +1849,10 @@ session_subsystem_req(Session *s) | |||
1849 | 1849 | ||
1850 | for (i = 0; i < options.num_subsystems; i++) { | 1850 | for (i = 0; i < options.num_subsystems; i++) { |
1851 | if (strcmp(subsys, options.subsystem_name[i]) == 0) { | 1851 | if (strcmp(subsys, options.subsystem_name[i]) == 0) { |
1852 | cmd = options.subsystem_command[i]; | 1852 | prog = options.subsystem_command[i]; |
1853 | if (stat(cmd, &st) < 0) { | 1853 | cmd = options.subsystem_args[i]; |
1854 | error("subsystem: cannot stat %s: %s", cmd, | 1854 | if (stat(prog, &st) < 0) { |
1855 | error("subsystem: cannot stat %s: %s", prog, | ||
1855 | strerror(errno)); | 1856 | strerror(errno)); |
1856 | break; | 1857 | break; |
1857 | } | 1858 | } |
diff --git a/sshd_config.5 b/sshd_config.5 index 836add94f..3b639b17d 100644 --- a/sshd_config.5 +++ b/sshd_config.5 | |||
@@ -34,7 +34,7 @@ | |||
34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
36 | .\" | 36 | .\" |
37 | .\" $OpenBSD: sshd_config.5,v 1.58 2006/07/02 17:12:58 stevesk Exp $ | 37 | .\" $OpenBSD: sshd_config.5,v 1.59 2006/07/06 10:47:05 djm Exp $ |
38 | .Dd September 25, 1999 | 38 | .Dd September 25, 1999 |
39 | .Dt SSHD_CONFIG 5 | 39 | .Dt SSHD_CONFIG 5 |
40 | .Os | 40 | .Os |
@@ -643,8 +643,8 @@ The default is | |||
643 | .Dq yes . | 643 | .Dq yes . |
644 | .It Cm Subsystem | 644 | .It Cm Subsystem |
645 | Configures an external subsystem (e.g. file transfer daemon). | 645 | Configures an external subsystem (e.g. file transfer daemon). |
646 | Arguments should be a subsystem name and a command to execute upon subsystem | 646 | Arguments should be a subsystem name and a command (with optional arguments) |
647 | request. | 647 | to execute upon subsystem request. |
648 | The command | 648 | The command |
649 | .Xr sftp-server 8 | 649 | .Xr sftp-server 8 |
650 | implements the | 650 | implements the |