|
|
@@ -1,23 +1,20 @@
|
|
|
Index: servconf.c
|
|
|
---- servconf.c.orig 2005-12-13 09:33:20 +0100
|
|
|
-+++ servconf.c 2006-02-11 09:28:21 +0100
|
|
|
-@@ -103,6 +103,15 @@
|
|
|
- options->num_accept_env = 0;
|
|
|
+--- servconf.c.orig 2006-08-18 16:23:15 +0200
|
|
|
++++ servconf.c 2006-09-28 08:06:00 +0200
|
|
|
+@@ -122,6 +122,12 @@
|
|
|
options->permit_tun = -1;
|
|
|
-
|
|
|
+ options->num_permitted_opens = -1;
|
|
|
+ options->adm_forced_command = NULL;
|
|
|
+ options->log_sftp = LOG_SFTP_NOT_SET;
|
|
|
-+ options->sftp_log_facility = SYSLOG_FACILITY_NOT_SET;
|
|
|
-+ options->sftp_log_level = SYSLOG_LEVEL_NOT_SET;
|
|
|
-+
|
|
|
++ options->sftp_log_facility = SYSLOG_FACILITY_NOT_SET;
|
|
|
++ options->sftp_log_level = SYSLOG_LEVEL_NOT_SET;
|
|
|
+ memset(options->sftp_umask, 0, SFTP_UMASK_LENGTH);
|
|
|
-+
|
|
|
+ options->sftp_permit_chmod = SFTP_PERMIT_NOT_SET;
|
|
|
+ options->sftp_permit_chown = SFTP_PERMIT_NOT_SET;
|
|
|
-+
|
|
|
- /* Needs to be accessable in many places */
|
|
|
- use_privsep = -1;
|
|
|
}
|
|
|
-@@ -233,6 +242,24 @@
|
|
|
+
|
|
|
+ void
|
|
|
+@@ -250,6 +256,24 @@
|
|
|
if (options->permit_tun == -1)
|
|
|
options->permit_tun = SSH_TUNMODE_NO;
|
|
|
|
|
|
@@ -42,9 +39,9 @@ Index: servconf.c
|
|
|
/* Turn privilege separation on by default */
|
|
|
if (use_privsep == -1)
|
|
|
use_privsep = 1;
|
|
|
-@@ -275,6 +302,9 @@
|
|
|
- sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2,
|
|
|
+@@ -293,6 +317,9 @@
|
|
|
sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
|
|
|
+ sMatch, sPermitOpen, sForceCommand,
|
|
|
sUsePrivilegeSeparation,
|
|
|
+ sLogSftp, sSftpLogFacility, sSftpLogLevel,
|
|
|
+ sSftpUmask,
|
|
|
@@ -52,8 +49,8 @@ Index: servconf.c
|
|
|
sDeprecated, sUnsupported
|
|
|
} ServerOpCodes;
|
|
|
|
|
|
-@@ -284,6 +314,12 @@
|
|
|
- ServerOpCodes opcode;
|
|
|
+@@ -307,6 +334,12 @@
|
|
|
+ u_int flags;
|
|
|
} keywords[] = {
|
|
|
/* Portable-specific options */
|
|
|
+ { "logsftp", sLogSftp},
|
|
|
@@ -63,18 +60,18 @@ Index: servconf.c
|
|
|
+ { "sftppermitchmod", sSftpPermitChmod},
|
|
|
+ { "sftppermitchown", sSftpPermitChown},
|
|
|
#ifdef USE_PAM
|
|
|
- { "usepam", sUsePAM },
|
|
|
+ { "usepam", sUsePAM, SSHCFG_GLOBAL },
|
|
|
#else
|
|
|
-@@ -446,6 +482,8 @@
|
|
|
- ServerOpCodes opcode;
|
|
|
- u_short port;
|
|
|
+@@ -431,6 +464,8 @@
|
|
|
+ add_listen_addr(ServerOptions *options, char *addr, u_short port)
|
|
|
+ {
|
|
|
u_int i;
|
|
|
+ unsigned int umaskvalue = 0;
|
|
|
+ char *umaskptr;
|
|
|
|
|
|
- cp = line;
|
|
|
- arg = strdelim(&cp);
|
|
|
-@@ -932,6 +970,58 @@
|
|
|
+ if (options->num_ports == 0)
|
|
|
+ options->ports[options->num_ports++] = SSH_DEFAULT_PORT;
|
|
|
+@@ -1146,6 +1181,58 @@
|
|
|
case sBanner:
|
|
|
charptr = &options->banner;
|
|
|
goto parse_filename;
|
|
|
@@ -134,9 +131,9 @@ Index: servconf.c
|
|
|
* These options can contain %X options expanded at
|
|
|
* connect time, so that you can specify paths like:
|
|
|
Index: servconf.h
|
|
|
---- servconf.h.orig 2005-12-13 09:29:03 +0100
|
|
|
-+++ servconf.h 2006-02-11 09:28:21 +0100
|
|
|
-@@ -35,6 +35,19 @@
|
|
|
+--- servconf.h.orig 2006-08-18 16:23:15 +0200
|
|
|
++++ servconf.h 2006-09-28 08:05:25 +0200
|
|
|
+@@ -34,6 +34,19 @@
|
|
|
#define PERMIT_NO_PASSWD 2
|
|
|
#define PERMIT_YES 3
|
|
|
|
|
|
@@ -156,10 +153,10 @@ Index: servconf.h
|
|
|
#define DEFAULT_AUTH_FAIL_MAX 6 /* Default for MaxAuthTries */
|
|
|
|
|
|
typedef struct {
|
|
|
-@@ -137,6 +150,13 @@
|
|
|
- int use_pam; /* Enable auth via PAM */
|
|
|
-
|
|
|
+@@ -141,6 +154,13 @@
|
|
|
int permit_tun;
|
|
|
+
|
|
|
+ int num_permitted_opens;
|
|
|
+ int log_sftp; /* perform sftp-server logging */
|
|
|
+ SyslogFacility sftp_log_facility; /* Facility for sftp subsystem logging. */
|
|
|
+ LogLevel sftp_log_level; /* Level for sftp subsystem logging. */
|
|
|
@@ -171,9 +168,9 @@ Index: servconf.h
|
|
|
|
|
|
void initialize_server_options(ServerOptions *);
|
|
|
Index: session.c
|
|
|
---- session.c.orig 2006-02-08 00:18:55 +0100
|
|
|
-+++ session.c 2006-02-11 09:28:21 +0100
|
|
|
-@@ -113,6 +113,15 @@
|
|
|
+--- session.c.orig 2006-09-01 07:38:37 +0200
|
|
|
++++ session.c 2006-09-28 08:04:35 +0200
|
|
|
+@@ -138,6 +138,15 @@
|
|
|
|
|
|
static int is_child = 0;
|
|
|
|
|
|
@@ -189,15 +186,15 @@ Index: session.c
|
|
|
/* Name and directory of socket for authentication agent forwarding. */
|
|
|
static char *auth_sock_name = NULL;
|
|
|
static char *auth_sock_dir = NULL;
|
|
|
-@@ -975,6 +984,7 @@
|
|
|
- env = xmalloc(envsize * sizeof(char *));
|
|
|
+@@ -1011,6 +1020,7 @@
|
|
|
+ env = xcalloc(envsize, sizeof(char *));
|
|
|
env[0] = NULL;
|
|
|
|
|
|
+
|
|
|
#ifdef HAVE_CYGWIN
|
|
|
/*
|
|
|
* The Windows environment contains some setting which are
|
|
|
-@@ -1135,6 +1145,67 @@
|
|
|
+@@ -1171,6 +1181,67 @@
|
|
|
child_set_env(&env, &envsize, SSH_AUTHSOCKET_ENV_NAME,
|
|
|
auth_sock_name);
|
|
|
|
|
|
@@ -266,11 +263,11 @@ Index: session.c
|
|
|
if (options.permit_user_env && !options.use_login) {
|
|
|
snprintf(buf, sizeof buf, "%.200s/.ssh/environment",
|
|
|
Index: sftp-server.8
|
|
|
---- sftp-server.8.orig 2003-10-15 07:50:43 +0200
|
|
|
-+++ sftp-server.8 2006-02-11 09:28:22 +0100
|
|
|
-@@ -41,6 +41,20 @@
|
|
|
+--- sftp-server.8.orig 2006-09-26 12:57:06 +0200
|
|
|
++++ sftp-server.8 2006-09-28 08:04:35 +0200
|
|
|
+@@ -49,6 +49,20 @@
|
|
|
.Cm Subsystem
|
|
|
- option.
|
|
|
+ declaration.
|
|
|
See
|
|
|
+.Xr sshd 8
|
|
|
+for more information. Sftp-server transactions may be logged
|
|
|
@@ -288,40 +285,37 @@ Index: sftp-server.8
|
|
|
+. See
|
|
|
.Xr sshd_config 5
|
|
|
for more information.
|
|
|
- .Sh SEE ALSO
|
|
|
+ .Pp
|
|
|
Index: sftp-server.c
|
|
|
---- sftp-server.c.orig 2006-01-02 13:40:51 +0100
|
|
|
-+++ sftp-server.c 2006-02-11 09:28:22 +0100
|
|
|
-@@ -32,6 +32,13 @@
|
|
|
- #define get_string(lenp) buffer_get_string(&iqueue, lenp);
|
|
|
- #define TRACE debug
|
|
|
+--- sftp-server.c.orig 2006-08-05 04:39:40 +0200
|
|
|
++++ sftp-server.c 2006-09-28 08:18:48 +0200
|
|
|
+@@ -53,6 +53,12 @@
|
|
|
+ /* Our verbosity */
|
|
|
+ LogLevel log_level = SYSLOG_LEVEL_ERROR;
|
|
|
|
|
|
+/* SFTP_UMASK */
|
|
|
+static mode_t setumask = 0;
|
|
|
-+
|
|
|
+static int permit_chmod = 1;
|
|
|
+static int permit_chown = 1;
|
|
|
+static int permit_logging = 0;
|
|
|
+
|
|
|
- extern char *__progname;
|
|
|
-
|
|
|
- /* input and output queue */
|
|
|
-@@ -382,6 +389,14 @@
|
|
|
+ /* Our client */
|
|
|
+ struct passwd *pw = NULL;
|
|
|
+ char *client_addr = NULL;
|
|
|
+@@ -498,6 +504,12 @@
|
|
|
a = get_attrib();
|
|
|
flags = flags_from_portable(pflags);
|
|
|
mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a->perm : 0666;
|
|
|
-+
|
|
|
+ if (setumask != 0) {
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
-+ logit("setting file creation mode to 0666 and umask to %o", setumask);
|
|
|
++ if (permit_logging == 0)
|
|
|
++ logit("setting file creation mode to 0666 and umask to %o", setumask);
|
|
|
+ mode = 0666;
|
|
|
+ umask(setumask);
|
|
|
+ }
|
|
|
-+
|
|
|
- TRACE("open id %u name %s flags %d mode 0%o", id, name, pflags, mode);
|
|
|
+ logit("open \"%s\" flags %s mode 0%o",
|
|
|
+ name, string_from_portable(pflags), mode);
|
|
|
fd = open(name, flags, mode);
|
|
|
- if (fd < 0) {
|
|
|
-@@ -395,6 +410,8 @@
|
|
|
+@@ -512,6 +524,8 @@
|
|
|
status = SSH2_FX_OK;
|
|
|
}
|
|
|
}
|
|
|
@@ -330,15 +324,7 @@ Index: sftp-server.c
|
|
|
if (status != SSH2_FX_OK)
|
|
|
send_status(id, status);
|
|
|
xfree(name);
|
|
|
-@@ -431,6 +448,7 @@
|
|
|
- (unsigned long long)off, len);
|
|
|
- if (len > sizeof buf) {
|
|
|
- len = sizeof buf;
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
- logit("read change len %d", len);
|
|
|
- }
|
|
|
- fd = handle_to_fd(handle);
|
|
|
-@@ -450,6 +468,8 @@
|
|
|
+@@ -569,6 +583,8 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -347,70 +333,59 @@ Index: sftp-server.c
|
|
|
if (status != SSH2_FX_OK)
|
|
|
send_status(id, status);
|
|
|
}
|
|
|
-@@ -484,10 +504,13 @@
|
|
|
- } else if ((size_t)ret == len) {
|
|
|
- status = SSH2_FX_OK;
|
|
|
- } else {
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
- logit("nothing at all written");
|
|
|
+@@ -608,6 +624,8 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
-+ logit("writing file");
|
|
|
++ if (permit_logging == 1)
|
|
|
++ logit("writing file");
|
|
|
send_status(id, status);
|
|
|
xfree(data);
|
|
|
}
|
|
|
-@@ -580,24 +603,46 @@
|
|
|
- a = get_attrib();
|
|
|
- TRACE("setstat id %u name %s", id, name);
|
|
|
- if (a->flags & SSH2_FILEXFER_ATTR_SIZE) {
|
|
|
-+if ( permit_logging == 1 )
|
|
|
-+logit("process_setstat: truncate");
|
|
|
- ret = truncate(name, a->size);
|
|
|
- if (ret == -1)
|
|
|
+@@ -708,10 +726,19 @@
|
|
|
status = errno_to_portable(errno);
|
|
|
}
|
|
|
if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) {
|
|
|
+ if (permit_chmod == 1) {
|
|
|
+ logit("set \"%s\" mode %04o", name, a->perm);
|
|
|
ret = chmod(name, a->perm & 0777);
|
|
|
if (ret == -1)
|
|
|
status = errno_to_portable(errno);
|
|
|
-+ else
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
++ else
|
|
|
++ if (permit_logging == 1)
|
|
|
+ logit("chmod'ed %s", name);
|
|
|
+ } else {
|
|
|
+ status = SSH2_FX_PERMISSION_DENIED;
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
-+ logit("chmod %s: operation prohibited by sftp-server configuration.", name);
|
|
|
++ if (permit_logging == 1)
|
|
|
++ logit("chmod %s: operation prohibited by sftp-server configuration.", name);
|
|
|
+ }
|
|
|
}
|
|
|
if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) {
|
|
|
-+if ( permit_logging == 1 )
|
|
|
-+logit("process_setstat: utimes");
|
|
|
- ret = utimes(name, attrib_to_tv(a));
|
|
|
- if (ret == -1)
|
|
|
+ char buf[64];
|
|
|
+@@ -725,11 +752,20 @@
|
|
|
status = errno_to_portable(errno);
|
|
|
}
|
|
|
if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) {
|
|
|
+ if (permit_chown == 1) {
|
|
|
+ logit("set \"%s\" owner %lu group %lu", name,
|
|
|
+ (u_long)a->uid, (u_long)a->gid);
|
|
|
ret = chown(name, a->uid, a->gid);
|
|
|
if (ret == -1)
|
|
|
status = errno_to_portable(errno);
|
|
|
-+ else
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
++ else
|
|
|
++ if (permit_logging == 1)
|
|
|
+ logit("chown'ed %s.", name);
|
|
|
+ } else {
|
|
|
+ status = SSH2_FX_PERMISSION_DENIED;
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
-+ logit("chown %s: operation prohibited by sftp-server configuration.", name);
|
|
|
++ if (permit_logging == 1)
|
|
|
++ logit("chown %s: operation prohibited by sftp-server configuration.", name);
|
|
|
+ }
|
|
|
}
|
|
|
send_status(id, status);
|
|
|
xfree(name);
|
|
|
-@@ -612,6 +657,9 @@
|
|
|
+@@ -743,6 +779,9 @@
|
|
|
+ int handle, fd, ret;
|
|
|
int status = SSH2_FX_OK;
|
|
|
- char *name;
|
|
|
|
|
|
+if ( permit_logging == 1 )
|
|
|
+logit("process_fsetstat");
|
|
|
@@ -418,64 +393,53 @@ Index: sftp-server.c
|
|
|
id = get_int();
|
|
|
handle = get_handle();
|
|
|
a = get_attrib();
|
|
|
-@@ -622,11 +670,14 @@
|
|
|
- status = SSH2_FX_FAILURE;
|
|
|
- } else {
|
|
|
- if (a->flags & SSH2_FILEXFER_ATTR_SIZE) {
|
|
|
-+if ( permit_logging == 1 )
|
|
|
-+logit("process_fsetstat: ftruncate");
|
|
|
- ret = ftruncate(fd, a->size);
|
|
|
- if (ret == -1)
|
|
|
+@@ -760,6 +799,7 @@
|
|
|
status = errno_to_portable(errno);
|
|
|
}
|
|
|
if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) {
|
|
|
+ if (permit_chmod == 1) {
|
|
|
+ logit("set \"%s\" mode %04o", name, a->perm);
|
|
|
#ifdef HAVE_FCHMOD
|
|
|
ret = fchmod(fd, a->perm & 0777);
|
|
|
- #else
|
|
|
-@@ -634,8 +685,18 @@
|
|
|
+@@ -768,6 +808,14 @@
|
|
|
#endif
|
|
|
if (ret == -1)
|
|
|
status = errno_to_portable(errno);
|
|
|
-+ else
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
++ else
|
|
|
++ if (permit_logging == 1)
|
|
|
+ logit("chmod: succeeded.");
|
|
|
+ } else {
|
|
|
+ status = SSH2_FX_PERMISSION_DENIED;
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
-+ logit("chmod: operation prohibited by sftp-server configuration.");
|
|
|
++ if (permit_logging == 1)
|
|
|
++ logit("chmod: operation prohibited by sftp-server configuration.");
|
|
|
+ }
|
|
|
}
|
|
|
if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) {
|
|
|
-+if ( permit_logging == 1 )
|
|
|
-+logit("process_fsetstat: utimes");
|
|
|
- #ifdef HAVE_FUTIMES
|
|
|
- ret = futimes(fd, attrib_to_tv(a));
|
|
|
- #else
|
|
|
-@@ -645,6 +706,7 @@
|
|
|
+ char buf[64];
|
|
|
+@@ -785,6 +833,7 @@
|
|
|
status = errno_to_portable(errno);
|
|
|
}
|
|
|
if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) {
|
|
|
+ if (permit_chown == 1) {
|
|
|
+ logit("set \"%s\" owner %lu group %lu", name,
|
|
|
+ (u_long)a->uid, (u_long)a->gid);
|
|
|
#ifdef HAVE_FCHOWN
|
|
|
- ret = fchown(fd, a->uid, a->gid);
|
|
|
- #else
|
|
|
-@@ -652,6 +714,14 @@
|
|
|
+@@ -794,6 +843,14 @@
|
|
|
#endif
|
|
|
if (ret == -1)
|
|
|
status = errno_to_portable(errno);
|
|
|
-+ else
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
++ else
|
|
|
++ if (permit_logging == 1)
|
|
|
+ logit("chown: succeeded");
|
|
|
+ } else {
|
|
|
+ status = SSH2_FX_PERMISSION_DENIED;
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
-+ logit("chown: operation prohibited by sftp-server configuration.");
|
|
|
++ if (permit_logging == 1)
|
|
|
++ logit("chown: operation prohibited by sftp-server configuration.");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
send_status(id, status);
|
|
|
-@@ -681,6 +751,8 @@
|
|
|
+@@ -824,6 +881,8 @@
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -484,8 +448,8 @@ Index: sftp-server.c
|
|
|
if (status != SSH2_FX_OK)
|
|
|
send_status(id, status);
|
|
|
xfree(path);
|
|
|
-@@ -754,6 +826,8 @@
|
|
|
- TRACE("remove id %u name %s", id, name);
|
|
|
+@@ -899,6 +958,8 @@
|
|
|
+ logit("remove name \"%s\"", name);
|
|
|
ret = unlink(name);
|
|
|
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
|
|
|
+ if ( permit_logging == 1 )
|
|
|
@@ -493,28 +457,21 @@ Index: sftp-server.c
|
|
|
send_status(id, status);
|
|
|
xfree(name);
|
|
|
}
|
|
|
-@@ -771,9 +845,19 @@
|
|
|
+@@ -916,6 +977,12 @@
|
|
|
a = get_attrib();
|
|
|
mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ?
|
|
|
a->perm & 0777 : 0777;
|
|
|
-+
|
|
|
+ if (setumask != 0) {
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
-+ logit("setting directory creation mode to 0777 and umask to %o.", setumask);
|
|
|
++ if (permit_logging == 1)
|
|
|
++ logit("setting directory creation mode to 0777 and umask to %o.", setumask);
|
|
|
+ mode = 0777;
|
|
|
+ umask(setumask);
|
|
|
+ }
|
|
|
-+
|
|
|
- TRACE("mkdir id %u name %s mode 0%o", id, name, mode);
|
|
|
+ debug3("request %u: mkdir", id);
|
|
|
+ logit("mkdir name \"%s\" mode 0%o", name, mode);
|
|
|
ret = mkdir(name, mode);
|
|
|
- status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
-+ logit("mkdir %s", name);
|
|
|
- send_status(id, status);
|
|
|
- xfree(name);
|
|
|
- }
|
|
|
-@@ -790,6 +874,8 @@
|
|
|
- TRACE("rmdir id %u name %s", id, name);
|
|
|
+@@ -937,6 +1004,8 @@
|
|
|
+ logit("rmdir name \"%s\"", name);
|
|
|
ret = rmdir(name);
|
|
|
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
|
|
|
+ if ( permit_logging == 1 )
|
|
|
@@ -522,7 +479,7 @@ Index: sftp-server.c
|
|
|
send_status(id, status);
|
|
|
xfree(name);
|
|
|
}
|
|
|
-@@ -816,6 +902,8 @@
|
|
|
+@@ -964,6 +1033,8 @@
|
|
|
s.name = s.long_name = resolvedname;
|
|
|
send_names(id, 1, &s);
|
|
|
}
|
|
|
@@ -531,7 +488,7 @@ Index: sftp-server.c
|
|
|
xfree(path);
|
|
|
}
|
|
|
|
|
|
-@@ -871,6 +959,8 @@
|
|
|
+@@ -1020,6 +1091,8 @@
|
|
|
status = SSH2_FX_OK;
|
|
|
}
|
|
|
send_status(id, status);
|
|
|
@@ -540,7 +497,7 @@ Index: sftp-server.c
|
|
|
xfree(oldpath);
|
|
|
xfree(newpath);
|
|
|
}
|
|
|
-@@ -896,6 +986,8 @@
|
|
|
+@@ -1046,6 +1119,8 @@
|
|
|
s.name = s.long_name = buf;
|
|
|
send_names(id, 1, &s);
|
|
|
}
|
|
|
@@ -549,7 +506,7 @@ Index: sftp-server.c
|
|
|
xfree(path);
|
|
|
}
|
|
|
|
|
|
-@@ -914,6 +1006,8 @@
|
|
|
+@@ -1065,6 +1140,8 @@
|
|
|
ret = symlink(oldpath, newpath);
|
|
|
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
|
|
|
send_status(id, status);
|
|
|
@@ -558,33 +515,29 @@ Index: sftp-server.c
|
|
|
xfree(oldpath);
|
|
|
xfree(newpath);
|
|
|
}
|
|
|
-@@ -1035,6 +1129,8 @@
|
|
|
- {
|
|
|
- fd_set *rset, *wset;
|
|
|
- int in, out, max;
|
|
|
+@@ -1212,6 +1289,8 @@
|
|
|
+ ssize_t len, olen, set_size;
|
|
|
+ SyslogFacility log_facility = SYSLOG_FACILITY_AUTH;
|
|
|
+ char *cp;
|
|
|
+ unsigned int val = 0;
|
|
|
+ char *umask_env;
|
|
|
- ssize_t len, olen, set_size;
|
|
|
|
|
|
- /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
|
|
|
-@@ -1045,6 +1141,16 @@
|
|
|
- __progname = ssh_get_progname(av[0]);
|
|
|
- handle_init();
|
|
|
+ extern char *optarg;
|
|
|
+ extern char *__progname;
|
|
|
+@@ -1250,6 +1329,12 @@
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-+ /* Transaction logging */
|
|
|
-+
|
|
|
-+ if (atoi(getenv("LOG_SFTP")) == 1)
|
|
|
-+ {
|
|
|
++ if (atoi(getenv("LOG_SFTP")) == 1) {
|
|
|
+ permit_logging = 1;
|
|
|
+ log_init("sftp-server", atoi(getenv("SFTP_LOG_LEVEL")),
|
|
|
+ atoi(getenv("SFTP_LOG_FACILITY")), 0);
|
|
|
-+ };
|
|
|
-+
|
|
|
-+
|
|
|
- #ifdef DEBUG_SFTP_SERVER
|
|
|
- log_init("sftp-server", SYSLOG_LEVEL_DEBUG1, SYSLOG_FACILITY_AUTH, 0);
|
|
|
- #endif
|
|
|
-@@ -1052,6 +1158,39 @@
|
|
|
++ }
|
|
|
++ else
|
|
|
+ log_init(__progname, log_level, log_facility, log_stderr);
|
|
|
+
|
|
|
+ if ((cp = getenv("SSH_CONNECTION")) != NULL) {
|
|
|
+@@ -1273,6 +1358,39 @@
|
|
|
in = dup(STDIN_FILENO);
|
|
|
out = dup(STDOUT_FILENO);
|
|
|
|
|
|
@@ -624,19 +577,10 @@ Index: sftp-server.c
|
|
|
#ifdef HAVE_CYGWIN
|
|
|
setmode(in, O_BINARY);
|
|
|
setmode(out, O_BINARY);
|
|
|
-@@ -1091,6 +1230,8 @@
|
|
|
- len = read(in, buf, sizeof buf);
|
|
|
- if (len == 0) {
|
|
|
- debug("read eof");
|
|
|
-+ if ( permit_logging == 1 )
|
|
|
-+ logit("sftp-server finished.");
|
|
|
- exit(0);
|
|
|
- } else if (len < 0) {
|
|
|
- error("read error");
|
|
|
Index: sshd_config.5
|
|
|
---- sshd_config.5.orig 2006-01-03 08:47:31 +0100
|
|
|
-+++ sshd_config.5 2006-02-11 09:28:22 +0100
|
|
|
-@@ -426,6 +426,10 @@
|
|
|
+--- sshd_config.5.orig 2006-08-30 03:06:34 +0200
|
|
|
++++ sshd_config.5 2006-09-28 08:04:35 +0200
|
|
|
+@@ -485,6 +485,10 @@
|
|
|
DEBUG and DEBUG1 are equivalent.
|
|
|
DEBUG2 and DEBUG3 each specify higher levels of debugging output.
|
|
|
Logging with a DEBUG level violates the privacy of users and is not recommended.
|
|
|
@@ -647,7 +591,7 @@ Index: sshd_config.5
|
|
|
.It Cm MACs
|
|
|
Specifies the available MAC (message authentication code) algorithms.
|
|
|
The MAC algorithm is used in protocol version 2
|
|
|
-@@ -597,6 +601,37 @@
|
|
|
+@@ -717,6 +721,37 @@
|
|
|
.It Cm ServerKeyBits
|
|
|
Defines the number of bits in the ephemeral protocol version 1 server key.
|
|
|
The minimum value is 512, and the default is 768.
|
|
|
@@ -684,15 +628,14 @@ Index: sshd_config.5
|
|
|
+mode specified by the sftp client. The default is for no umask.
|
|
|
.It Cm StrictModes
|
|
|
Specifies whether
|
|
|
- .Nm sshd
|
|
|
+ .Xr sshd 8
|
|
|
Index: sshd_config
|
|
|
---- sshd_config.orig 2005-12-13 09:29:03 +0100
|
|
|
-+++ sshd_config 2006-02-11 09:28:22 +0100
|
|
|
-@@ -103,3 +103,14 @@
|
|
|
-
|
|
|
+--- sshd_config.orig 2006-07-24 06:06:47 +0200
|
|
|
++++ sshd_config 2006-09-28 08:19:22 +0200
|
|
|
+@@ -105,6 +105,17 @@
|
|
|
# override default of no subsystems
|
|
|
Subsystem sftp /usr/libexec/sftp-server
|
|
|
-+
|
|
|
+
|
|
|
+# sftp-server logging
|
|
|
+#LogSftp no
|
|
|
+#SftpLogFacility AUTH
|
|
|
@@ -703,3 +646,7 @@ Index: sshd_config
|
|
|
+
|
|
|
+#SftpPermitChmod yes
|
|
|
+#SftpPermitChown yes
|
|
|
++
|
|
|
+ # Example of overriding settings on a per-user basis
|
|
|
+ #Match User anoncvs
|
|
|
+ # X11Forwarding no
|