|
|
@@ -1,7 +1,7 @@
|
|
|
Index: servconf.c
|
|
|
---- servconf.c.orig 2008-02-10 12:48:55 +0100
|
|
|
-+++ servconf.c 2008-03-31 08:58:32 +0200
|
|
|
-@@ -123,6 +123,12 @@
|
|
|
+--- servconf.c.orig 2008-07-04 05:51:12 +0200
|
|
|
++++ servconf.c 2008-07-22 08:33:33 +0200
|
|
|
+@@ -127,6 +127,12 @@
|
|
|
options->num_permitted_opens = -1;
|
|
|
options->adm_forced_command = NULL;
|
|
|
options->chroot_directory = NULL;
|
|
|
@@ -14,7 +14,7 @@ Index: servconf.c
|
|
|
}
|
|
|
|
|
|
void
|
|
|
-@@ -251,6 +257,24 @@
|
|
|
+@@ -259,6 +265,24 @@
|
|
|
if (options->permit_tun == -1)
|
|
|
options->permit_tun = SSH_TUNMODE_NO;
|
|
|
|
|
|
@@ -39,17 +39,17 @@ Index: servconf.c
|
|
|
/* Turn privilege separation on by default */
|
|
|
if (use_privsep == -1)
|
|
|
use_privsep = 1;
|
|
|
-@@ -294,6 +318,9 @@
|
|
|
+@@ -302,6 +326,9 @@
|
|
|
sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
|
|
|
sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
|
|
|
- sUsePrivilegeSeparation,
|
|
|
+ sUsePrivilegeSeparation, sAllowAgentForwarding,
|
|
|
+ sLogSftp, sSftpLogFacility, sSftpLogLevel,
|
|
|
+ sSftpUmask,
|
|
|
+ sSftpPermitChown, sSftpPermitChmod,
|
|
|
sDeprecated, sUnsupported
|
|
|
} ServerOpCodes;
|
|
|
|
|
|
-@@ -308,6 +335,12 @@
|
|
|
+@@ -316,6 +343,12 @@
|
|
|
u_int flags;
|
|
|
} keywords[] = {
|
|
|
/* Portable-specific options */
|
|
|
@@ -62,7 +62,7 @@ Index: servconf.c
|
|
|
#ifdef USE_PAM
|
|
|
{ "usepam", sUsePAM, SSHCFG_GLOBAL },
|
|
|
#else
|
|
|
-@@ -629,6 +662,8 @@
|
|
|
+@@ -636,6 +669,8 @@
|
|
|
u_short port;
|
|
|
u_int i, flags = 0;
|
|
|
size_t len;
|
|
|
@@ -71,7 +71,7 @@ Index: servconf.c
|
|
|
|
|
|
cp = line;
|
|
|
if ((arg = strdelim(&cp)) == NULL)
|
|
|
-@@ -1150,6 +1185,58 @@
|
|
|
+@@ -1165,6 +1200,58 @@
|
|
|
charptr = &options->banner;
|
|
|
goto parse_filename;
|
|
|
|
|
|
@@ -131,8 +131,8 @@ 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 2008-03-07 08:31:24 +0100
|
|
|
-+++ servconf.h 2008-03-31 08:58:54 +0200
|
|
|
+--- servconf.h.orig 2008-06-10 15:01:51 +0200
|
|
|
++++ servconf.h 2008-07-22 08:33:13 +0200
|
|
|
@@ -34,6 +34,19 @@
|
|
|
#define PERMIT_NO_PASSWD 2
|
|
|
#define PERMIT_YES 3
|
|
|
@@ -151,9 +151,9 @@ Index: servconf.h
|
|
|
+#define SFTP_PERMIT_YES 1
|
|
|
+
|
|
|
#define DEFAULT_AUTH_FAIL_MAX 6 /* Default for MaxAuthTries */
|
|
|
+ #define DEFAULT_SESSIONS_MAX 10 /* Default for MaxSessions */
|
|
|
|
|
|
- /* Magic name for internal sftp-server */
|
|
|
-@@ -146,6 +159,12 @@
|
|
|
+@@ -149,6 +162,12 @@
|
|
|
int num_permitted_opens;
|
|
|
|
|
|
char *chroot_directory;
|
|
|
@@ -167,9 +167,9 @@ Index: servconf.h
|
|
|
|
|
|
void initialize_server_options(ServerOptions *);
|
|
|
Index: session.c
|
|
|
---- session.c.orig 2008-03-27 01:03:05 +0100
|
|
|
-+++ session.c 2008-03-31 08:57:29 +0200
|
|
|
-@@ -144,6 +144,15 @@
|
|
|
+--- session.c.orig 2008-06-16 15:29:18 +0200
|
|
|
++++ session.c 2008-07-22 08:33:13 +0200
|
|
|
+@@ -146,6 +146,15 @@
|
|
|
|
|
|
static int is_child = 0;
|
|
|
|
|
|
@@ -185,7 +185,7 @@ Index: session.c
|
|
|
/* Name and directory of socket for authentication agent forwarding. */
|
|
|
static char *auth_sock_name = NULL;
|
|
|
static char *auth_sock_dir = NULL;
|
|
|
-@@ -1012,6 +1021,7 @@
|
|
|
+@@ -1119,6 +1128,7 @@
|
|
|
env = xcalloc(envsize, sizeof(char *));
|
|
|
env[0] = NULL;
|
|
|
|
|
|
@@ -193,7 +193,7 @@ Index: session.c
|
|
|
#ifdef HAVE_CYGWIN
|
|
|
/*
|
|
|
* The Windows environment contains some setting which are
|
|
|
-@@ -1172,6 +1182,67 @@
|
|
|
+@@ -1279,6 +1289,67 @@
|
|
|
child_set_env(&env, &envsize, SSH_AUTHSOCKET_ENV_NAME,
|
|
|
auth_sock_name);
|
|
|
|
|
|
@@ -262,8 +262,8 @@ 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 2007-06-05 10:27:13 +0200
|
|
|
-+++ sftp-server.8 2008-03-31 08:57:29 +0200
|
|
|
+--- sftp-server.8.orig 2008-07-21 10:20:40 +0200
|
|
|
++++ sftp-server.8 2008-07-22 08:33:14 +0200
|
|
|
@@ -49,6 +49,20 @@
|
|
|
.Cm Subsystem
|
|
|
declaration.
|
|
|
@@ -286,9 +286,9 @@ Index: sftp-server.8
|
|
|
for more information.
|
|
|
.Pp
|
|
|
Index: sftp-server.c
|
|
|
---- sftp-server.c.orig 2008-03-07 08:33:53 +0100
|
|
|
-+++ sftp-server.c 2008-03-31 08:57:29 +0200
|
|
|
-@@ -53,6 +53,12 @@
|
|
|
+--- sftp-server.c.orig 2008-07-04 06:10:19 +0200
|
|
|
++++ sftp-server.c 2008-07-22 08:35:27 +0200
|
|
|
+@@ -59,6 +59,12 @@
|
|
|
/* Our verbosity */
|
|
|
LogLevel log_level = SYSLOG_LEVEL_ERROR;
|
|
|
|
|
|
@@ -301,7 +301,7 @@ Index: sftp-server.c
|
|
|
/* Our client */
|
|
|
struct passwd *pw = NULL;
|
|
|
char *client_addr = NULL;
|
|
|
-@@ -509,6 +515,12 @@
|
|
|
+@@ -551,6 +557,12 @@
|
|
|
a = get_attrib();
|
|
|
flags = flags_from_portable(pflags);
|
|
|
mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a->perm : 0666;
|
|
|
@@ -314,7 +314,7 @@ Index: sftp-server.c
|
|
|
logit("open \"%s\" flags %s mode 0%o",
|
|
|
name, string_from_portable(pflags), mode);
|
|
|
fd = open(name, flags, mode);
|
|
|
-@@ -523,6 +535,8 @@
|
|
|
+@@ -565,6 +577,8 @@
|
|
|
status = SSH2_FX_OK;
|
|
|
}
|
|
|
}
|
|
|
@@ -323,7 +323,7 @@ Index: sftp-server.c
|
|
|
if (status != SSH2_FX_OK)
|
|
|
send_status(id, status);
|
|
|
xfree(name);
|
|
|
-@@ -580,6 +594,8 @@
|
|
|
+@@ -622,6 +636,8 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -332,7 +332,7 @@ Index: sftp-server.c
|
|
|
if (status != SSH2_FX_OK)
|
|
|
send_status(id, status);
|
|
|
}
|
|
|
-@@ -619,6 +635,8 @@
|
|
|
+@@ -661,6 +677,8 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -341,13 +341,13 @@ Index: sftp-server.c
|
|
|
send_status(id, status);
|
|
|
xfree(data);
|
|
|
}
|
|
|
-@@ -720,10 +738,19 @@
|
|
|
+@@ -762,10 +780,20 @@
|
|
|
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);
|
|
|
+ ret = chmod(name, a->perm & 07777);
|
|
|
if (ret == -1)
|
|
|
status = errno_to_portable(errno);
|
|
|
+ else
|
|
|
@@ -358,10 +358,11 @@ Index: sftp-server.c
|
|
|
+ if (permit_logging == 1)
|
|
|
+ logit("chmod %s: operation prohibited by sftp-server configuration.", name);
|
|
|
+ }
|
|
|
++ }
|
|
|
}
|
|
|
if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) {
|
|
|
char buf[64];
|
|
|
-@@ -737,11 +764,20 @@
|
|
|
+@@ -779,11 +807,20 @@
|
|
|
status = errno_to_portable(errno);
|
|
|
}
|
|
|
if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) {
|
|
|
@@ -382,7 +383,7 @@ Index: sftp-server.c
|
|
|
}
|
|
|
send_status(id, status);
|
|
|
xfree(name);
|
|
|
-@@ -755,6 +791,9 @@
|
|
|
+@@ -797,6 +834,9 @@
|
|
|
int handle, fd, ret;
|
|
|
int status = SSH2_FX_OK;
|
|
|
|
|
|
@@ -392,15 +393,15 @@ Index: sftp-server.c
|
|
|
id = get_int();
|
|
|
handle = get_handle();
|
|
|
a = get_attrib();
|
|
|
-@@ -773,6 +812,7 @@
|
|
|
+@@ -815,6 +855,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);
|
|
|
-@@ -781,6 +821,14 @@
|
|
|
+ ret = fchmod(fd, a->perm & 07777);
|
|
|
+@@ -823,6 +864,14 @@
|
|
|
#endif
|
|
|
if (ret == -1)
|
|
|
status = errno_to_portable(errno);
|
|
|
@@ -415,7 +416,7 @@ Index: sftp-server.c
|
|
|
}
|
|
|
if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) {
|
|
|
char buf[64];
|
|
|
-@@ -798,6 +846,7 @@
|
|
|
+@@ -840,6 +889,7 @@
|
|
|
status = errno_to_portable(errno);
|
|
|
}
|
|
|
if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) {
|
|
|
@@ -423,7 +424,7 @@ Index: sftp-server.c
|
|
|
logit("set \"%s\" owner %lu group %lu", name,
|
|
|
(u_long)a->uid, (u_long)a->gid);
|
|
|
#ifdef HAVE_FCHOWN
|
|
|
-@@ -807,6 +856,14 @@
|
|
|
+@@ -849,6 +899,14 @@
|
|
|
#endif
|
|
|
if (ret == -1)
|
|
|
status = errno_to_portable(errno);
|
|
|
@@ -438,7 +439,7 @@ Index: sftp-server.c
|
|
|
}
|
|
|
}
|
|
|
send_status(id, status);
|
|
|
-@@ -837,6 +894,8 @@
|
|
|
+@@ -879,6 +937,8 @@
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -447,7 +448,7 @@ Index: sftp-server.c
|
|
|
if (status != SSH2_FX_OK)
|
|
|
send_status(id, status);
|
|
|
xfree(path);
|
|
|
-@@ -912,6 +971,8 @@
|
|
|
+@@ -954,6 +1014,8 @@
|
|
|
logit("remove name \"%s\"", name);
|
|
|
ret = unlink(name);
|
|
|
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
|
|
|
@@ -456,10 +457,10 @@ Index: sftp-server.c
|
|
|
send_status(id, status);
|
|
|
xfree(name);
|
|
|
}
|
|
|
-@@ -929,6 +990,12 @@
|
|
|
+@@ -971,6 +1033,12 @@
|
|
|
a = get_attrib();
|
|
|
mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ?
|
|
|
- a->perm & 0777 : 0777;
|
|
|
+ a->perm & 07777 : 0777;
|
|
|
+ if (setumask != 0) {
|
|
|
+ if (permit_logging == 1)
|
|
|
+ logit("setting directory creation mode to 0777 and umask to %o.", setumask);
|
|
|
@@ -469,7 +470,7 @@ Index: sftp-server.c
|
|
|
debug3("request %u: mkdir", id);
|
|
|
logit("mkdir name \"%s\" mode 0%o", name, mode);
|
|
|
ret = mkdir(name, mode);
|
|
|
-@@ -950,6 +1017,8 @@
|
|
|
+@@ -992,6 +1060,8 @@
|
|
|
logit("rmdir name \"%s\"", name);
|
|
|
ret = rmdir(name);
|
|
|
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
|
|
|
@@ -478,7 +479,7 @@ Index: sftp-server.c
|
|
|
send_status(id, status);
|
|
|
xfree(name);
|
|
|
}
|
|
|
-@@ -977,6 +1046,8 @@
|
|
|
+@@ -1019,6 +1089,8 @@
|
|
|
s.name = s.long_name = resolvedname;
|
|
|
send_names(id, 1, &s);
|
|
|
}
|
|
|
@@ -487,7 +488,7 @@ Index: sftp-server.c
|
|
|
xfree(path);
|
|
|
}
|
|
|
|
|
|
-@@ -1033,6 +1104,8 @@
|
|
|
+@@ -1078,6 +1150,8 @@
|
|
|
status = SSH2_FX_OK;
|
|
|
}
|
|
|
send_status(id, status);
|
|
|
@@ -496,7 +497,7 @@ Index: sftp-server.c
|
|
|
xfree(oldpath);
|
|
|
xfree(newpath);
|
|
|
}
|
|
|
-@@ -1059,6 +1132,8 @@
|
|
|
+@@ -1104,6 +1178,8 @@
|
|
|
s.name = s.long_name = buf;
|
|
|
send_names(id, 1, &s);
|
|
|
}
|
|
|
@@ -505,7 +506,7 @@ Index: sftp-server.c
|
|
|
xfree(path);
|
|
|
}
|
|
|
|
|
|
-@@ -1078,6 +1153,8 @@
|
|
|
+@@ -1123,6 +1199,8 @@
|
|
|
ret = symlink(oldpath, newpath);
|
|
|
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
|
|
|
send_status(id, status);
|
|
|
@@ -514,7 +515,7 @@ Index: sftp-server.c
|
|
|
xfree(oldpath);
|
|
|
xfree(newpath);
|
|
|
}
|
|
|
-@@ -1249,6 +1326,8 @@
|
|
|
+@@ -1334,6 +1412,8 @@
|
|
|
ssize_t len, olen, set_size;
|
|
|
SyslogFacility log_facility = SYSLOG_FACILITY_AUTH;
|
|
|
char *cp, buf[4*4096];
|
|
|
@@ -523,7 +524,7 @@ Index: sftp-server.c
|
|
|
|
|
|
extern char *optarg;
|
|
|
extern char *__progname;
|
|
|
-@@ -1284,6 +1363,12 @@
|
|
|
+@@ -1369,6 +1449,12 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -536,7 +537,7 @@ Index: sftp-server.c
|
|
|
log_init(__progname, log_level, log_facility, log_stderr);
|
|
|
|
|
|
if ((cp = getenv("SSH_CONNECTION")) != NULL) {
|
|
|
-@@ -1305,6 +1390,39 @@
|
|
|
+@@ -1390,6 +1476,39 @@
|
|
|
in = dup(STDIN_FILENO);
|
|
|
out = dup(STDOUT_FILENO);
|
|
|
|
|
|
@@ -577,9 +578,9 @@ Index: sftp-server.c
|
|
|
setmode(in, O_BINARY);
|
|
|
setmode(out, O_BINARY);
|
|
|
Index: sshd_config.5
|
|
|
---- sshd_config.5.orig 2008-03-27 01:02:02 +0100
|
|
|
-+++ sshd_config.5 2008-03-31 08:57:29 +0200
|
|
|
-@@ -530,6 +530,10 @@
|
|
|
+--- sshd_config.5.orig 2008-07-02 14:35:43 +0200
|
|
|
++++ sshd_config.5 2008-07-22 08:35:50 +0200
|
|
|
+@@ -539,6 +539,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.
|
|
|
@@ -590,10 +591,10 @@ Index: sshd_config.5
|
|
|
.It Cm MACs
|
|
|
Specifies the available MAC (message authentication code) algorithms.
|
|
|
The MAC algorithm is used in protocol version 2
|
|
|
-@@ -773,6 +777,37 @@
|
|
|
+@@ -812,6 +816,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.
|
|
|
+ The minimum value is 512, and the default is 1024.
|
|
|
+.It Cm SftpLogFacility
|
|
|
+Gives the facility code that is used when logging
|
|
|
+.Nm sftp-server .
|
|
|
@@ -629,9 +630,9 @@ Index: sshd_config.5
|
|
|
Specifies whether
|
|
|
.Xr sshd 8
|
|
|
Index: sshd_config
|
|
|
---- sshd_config.orig 2008-02-10 12:40:12 +0100
|
|
|
-+++ sshd_config 2008-03-31 08:57:29 +0200
|
|
|
-@@ -110,6 +110,17 @@
|
|
|
+--- sshd_config.orig 2008-07-02 14:35:43 +0200
|
|
|
++++ sshd_config 2008-07-22 08:33:14 +0200
|
|
|
+@@ -112,6 +112,17 @@
|
|
|
# override default of no subsystems
|
|
|
Subsystem sftp /usr/libexec/sftp-server
|
|
|
|