]> andersk Git - openssh.git/commitdiff
- djm@cvs.openbsd.org 2006/07/06 10:47:05
authordjm <djm>
Mon, 10 Jul 2006 10:36:47 +0000 (10:36 +0000)
committerdjm <djm>
Mon, 10 Jul 2006 10:36:47 +0000 (10:36 +0000)
     [servconf.c servconf.h session.c sshd_config.5]
     support arguments to Subsystem commands; ok markus@

ChangeLog
servconf.c
servconf.h
session.c
sshd_config.5

index 1dde002344443e48bf04f5c9a863c200929a12db..97e1c6e9e22e689ed90b30b01ee0a70168f554b3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,9 @@
      [serverloop.c sshconnect.c uuencode.c]
      move #include <netinet/in.h> out of includes.h; ok deraadt@
      (also ssh-rand-helper.c logintest.c loginrec.c)
+   - 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@
 
 20060706
  - (dtucker) [configure.ac] Try AIX blibpath test in different order when
index 43372e20fc3f2c8c20324fb26cd645ff7caa4be1..af0ad1a3556c92644c5340dbe4db3ad28fe21548 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: servconf.c,v 1.150 2006/03/25 13:17:02 djm Exp $ */
+/* $OpenBSD: servconf.c,v 1.151 2006/07/06 10:47:05 djm Exp $ */
 /*
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
@@ -446,6 +446,7 @@ process_server_config_line(ServerOptions *options, char *line,
        ServerOpCodes opcode;
        u_short port;
        u_int i;
+       size_t len;
 
        cp = line;
        if ((arg = strdelim(&cp)) == NULL)
@@ -901,6 +902,17 @@ parse_flag:
                        fatal("%s line %d: Missing subsystem command.",
                            filename, linenum);
                options->subsystem_command[options->num_subsystems] = xstrdup(arg);
+
+               /* Collect arguments (separate to executable) */
+               p = xstrdup(arg);
+               len = strlen(p) + 1;
+               while ((arg = strdelim(&cp)) != NULL && *arg != '\0') {
+                       len += 1 + strlen(arg);
+                       p = xrealloc(p, 1, len);
+                       strlcat(p, " ", len);
+                       strlcat(p, arg, len);
+               }
+               options->subsystem_args[options->num_subsystems] = p;
                options->num_subsystems++;
                break;
 
index 73604a98e8ea4db3472c236287754911fcf73b85..671050e4c738c9253c8d93932893f172a01152da 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: servconf.h,v 1.73 2006/03/25 22:22:43 djm Exp $ */
+/* $OpenBSD: servconf.h,v 1.74 2006/07/06 10:47:05 djm Exp $ */
 
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -111,6 +111,7 @@ typedef struct {
        u_int num_subsystems;
        char   *subsystem_name[MAX_SUBSYSTEMS];
        char   *subsystem_command[MAX_SUBSYSTEMS];
+       char   *subsystem_args[MAX_SUBSYSTEMS];
 
        u_int num_accept_env;
        char   *accept_env[MAX_ACCEPT_ENV];
index cb0e8267cca785913f45047e59924a6184c8f200..899c3a16b47435ece14a452224857948154a7bc4 100644 (file)
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.204 2006/07/02 22:45:59 stevesk Exp $ */
+/* $OpenBSD: session.c,v 1.205 2006/07/06 10:47:05 djm Exp $ */
 /*
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
@@ -1841,7 +1841,7 @@ session_subsystem_req(Session *s)
        struct stat st;
        u_int len;
        int success = 0;
-       char *cmd, *subsys = packet_get_string(&len);
+       char *prog, *cmd, *subsys = packet_get_string(&len);
        u_int i;
 
        packet_check_eom();
@@ -1849,9 +1849,10 @@ session_subsystem_req(Session *s)
 
        for (i = 0; i < options.num_subsystems; i++) {
                if (strcmp(subsys, options.subsystem_name[i]) == 0) {
-                       cmd = options.subsystem_command[i];
-                       if (stat(cmd, &st) < 0) {
-                               error("subsystem: cannot stat %s: %s", cmd,
+                       prog = options.subsystem_command[i];
+                       cmd = options.subsystem_args[i];
+                       if (stat(prog, &st) < 0) {
+                               error("subsystem: cannot stat %s: %s", prog,
                                    strerror(errno));
                                break;
                        }
index 836add94fb00b62f91a22513e0e61f2dd5cab0e8..3b639b17d50ab88ed6148411094a87581fd35446 100644 (file)
@@ -34,7 +34,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $OpenBSD: sshd_config.5,v 1.58 2006/07/02 17:12:58 stevesk Exp $
+.\" $OpenBSD: sshd_config.5,v 1.59 2006/07/06 10:47:05 djm Exp $
 .Dd September 25, 1999
 .Dt SSHD_CONFIG 5
 .Os
@@ -643,8 +643,8 @@ The default is
 .Dq yes .
 .It Cm Subsystem
 Configures an external subsystem (e.g. file transfer daemon).
-Arguments should be a subsystem name and a command to execute upon subsystem
-request.
+Arguments should be a subsystem name and a command (with optional arguments)
+to execute upon subsystem request.
 The command
 .Xr sftp-server 8
 implements the
This page took 0.267216 seconds and 5 git commands to generate.