- 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@
This commit is contained in:
parent
8ec8c3e98a
commit
917f9b6b6e
|
@ -35,6 +35,9 @@
|
||||||
[serverloop.c sshconnect.c uuencode.c]
|
[serverloop.c sshconnect.c uuencode.c]
|
||||||
move #include <netinet/in.h> out of includes.h; ok deraadt@
|
move #include <netinet/in.h> out of includes.h; ok deraadt@
|
||||||
(also ssh-rand-helper.c logintest.c loginrec.c)
|
(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
|
20060706
|
||||||
- (dtucker) [configure.ac] Try AIX blibpath test in different order when
|
- (dtucker) [configure.ac] Try AIX blibpath test in different order when
|
||||||
|
@ -4768,4 +4771,4 @@
|
||||||
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
||||||
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.4368 2006/07/10 10:35:38 djm Exp $
|
$Id: ChangeLog,v 1.4369 2006/07/10 10:36:47 djm Exp $
|
||||||
|
|
14
servconf.c
14
servconf.c
|
@ -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
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
@ -446,6 +446,7 @@ process_server_config_line(ServerOptions *options, char *line,
|
||||||
ServerOpCodes opcode;
|
ServerOpCodes opcode;
|
||||||
u_short port;
|
u_short port;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
cp = line;
|
cp = line;
|
||||||
if ((arg = strdelim(&cp)) == NULL)
|
if ((arg = strdelim(&cp)) == NULL)
|
||||||
|
@ -901,6 +902,17 @@ parse_flag:
|
||||||
fatal("%s line %d: Missing subsystem command.",
|
fatal("%s line %d: Missing subsystem command.",
|
||||||
filename, linenum);
|
filename, linenum);
|
||||||
options->subsystem_command[options->num_subsystems] = xstrdup(arg);
|
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++;
|
options->num_subsystems++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -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>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
|
@ -111,6 +111,7 @@ typedef struct {
|
||||||
u_int num_subsystems;
|
u_int num_subsystems;
|
||||||
char *subsystem_name[MAX_SUBSYSTEMS];
|
char *subsystem_name[MAX_SUBSYSTEMS];
|
||||||
char *subsystem_command[MAX_SUBSYSTEMS];
|
char *subsystem_command[MAX_SUBSYSTEMS];
|
||||||
|
char *subsystem_args[MAX_SUBSYSTEMS];
|
||||||
|
|
||||||
u_int num_accept_env;
|
u_int num_accept_env;
|
||||||
char *accept_env[MAX_ACCEPT_ENV];
|
char *accept_env[MAX_ACCEPT_ENV];
|
||||||
|
|
11
session.c
11
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
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
@ -1841,7 +1841,7 @@ session_subsystem_req(Session *s)
|
||||||
struct stat st;
|
struct stat st;
|
||||||
u_int len;
|
u_int len;
|
||||||
int success = 0;
|
int success = 0;
|
||||||
char *cmd, *subsys = packet_get_string(&len);
|
char *prog, *cmd, *subsys = packet_get_string(&len);
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
packet_check_eom();
|
packet_check_eom();
|
||||||
|
@ -1849,9 +1849,10 @@ session_subsystem_req(Session *s)
|
||||||
|
|
||||||
for (i = 0; i < options.num_subsystems; i++) {
|
for (i = 0; i < options.num_subsystems; i++) {
|
||||||
if (strcmp(subsys, options.subsystem_name[i]) == 0) {
|
if (strcmp(subsys, options.subsystem_name[i]) == 0) {
|
||||||
cmd = options.subsystem_command[i];
|
prog = options.subsystem_command[i];
|
||||||
if (stat(cmd, &st) < 0) {
|
cmd = options.subsystem_args[i];
|
||||||
error("subsystem: cannot stat %s: %s", cmd,
|
if (stat(prog, &st) < 0) {
|
||||||
|
error("subsystem: cannot stat %s: %s", prog,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" 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
|
.Dd September 25, 1999
|
||||||
.Dt SSHD_CONFIG 5
|
.Dt SSHD_CONFIG 5
|
||||||
.Os
|
.Os
|
||||||
|
@ -643,8 +643,8 @@ The default is
|
||||||
.Dq yes .
|
.Dq yes .
|
||||||
.It Cm Subsystem
|
.It Cm Subsystem
|
||||||
Configures an external subsystem (e.g. file transfer daemon).
|
Configures an external subsystem (e.g. file transfer daemon).
|
||||||
Arguments should be a subsystem name and a command to execute upon subsystem
|
Arguments should be a subsystem name and a command (with optional arguments)
|
||||||
request.
|
to execute upon subsystem request.
|
||||||
The command
|
The command
|
||||||
.Xr sftp-server 8
|
.Xr sftp-server 8
|
||||||
implements the
|
implements the
|
||||||
|
|
Loading…
Reference in New Issue