diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | sftp-server.c | 16 |
2 files changed, 17 insertions, 3 deletions
@@ -46,6 +46,10 @@ | |||
46 | - dtucker@cvs.openbsd.org 2009/08/20 23:54:28 | 46 | - dtucker@cvs.openbsd.org 2009/08/20 23:54:28 |
47 | [mux.c] | 47 | [mux.c] |
48 | subsystem_flag is defined in ssh.c so it's extern; ok djm | 48 | subsystem_flag is defined in ssh.c so it's extern; ok djm |
49 | - djm@cvs.openbsd.org 2009/08/27 17:28:52 | ||
50 | [sftp-server.c] | ||
51 | allow setting an explicit umask on the commandline to override whatever | ||
52 | default the user has. bz#1229; ok dtucker@ deraadt@ markus@ | ||
49 | 53 | ||
50 | 20091002 | 54 | 20091002 |
51 | - (djm) [Makefile.in] Mention readconf.o in ssh-keysign's make deps. | 55 | - (djm) [Makefile.in] Mention readconf.o in ssh-keysign's make deps. |
diff --git a/sftp-server.c b/sftp-server.c index d984e6049..d144001bb 100644 --- a/sftp-server.c +++ b/sftp-server.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-server.c,v 1.85 2009/04/14 16:33:42 stevesk Exp $ */ | 1 | /* $OpenBSD: sftp-server.c,v 1.86 2009/08/27 17:28:52 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000-2004 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000-2004 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -1322,7 +1322,8 @@ sftp_server_usage(void) | |||
1322 | extern char *__progname; | 1322 | extern char *__progname; |
1323 | 1323 | ||
1324 | fprintf(stderr, | 1324 | fprintf(stderr, |
1325 | "usage: %s [-he] [-l log_level] [-f log_facility]\n", __progname); | 1325 | "usage: %s [-he] [-l log_level] [-f log_facility] [-u umask]\n", |
1326 | __progname); | ||
1326 | exit(1); | 1327 | exit(1); |
1327 | } | 1328 | } |
1328 | 1329 | ||
@@ -1334,6 +1335,8 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw) | |||
1334 | ssize_t len, olen, set_size; | 1335 | ssize_t len, olen, set_size; |
1335 | SyslogFacility log_facility = SYSLOG_FACILITY_AUTH; | 1336 | SyslogFacility log_facility = SYSLOG_FACILITY_AUTH; |
1336 | char *cp, buf[4*4096]; | 1337 | char *cp, buf[4*4096]; |
1338 | const char *errmsg; | ||
1339 | mode_t mask; | ||
1337 | 1340 | ||
1338 | extern char *optarg; | 1341 | extern char *optarg; |
1339 | extern char *__progname; | 1342 | extern char *__progname; |
@@ -1341,7 +1344,7 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw) | |||
1341 | __progname = ssh_get_progname(argv[0]); | 1344 | __progname = ssh_get_progname(argv[0]); |
1342 | log_init(__progname, log_level, log_facility, log_stderr); | 1345 | log_init(__progname, log_level, log_facility, log_stderr); |
1343 | 1346 | ||
1344 | while (!skipargs && (ch = getopt(argc, argv, "f:l:che")) != -1) { | 1347 | while (!skipargs && (ch = getopt(argc, argv, "f:l:u:che")) != -1) { |
1345 | switch (ch) { | 1348 | switch (ch) { |
1346 | case 'c': | 1349 | case 'c': |
1347 | /* | 1350 | /* |
@@ -1363,6 +1366,13 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw) | |||
1363 | if (log_facility == SYSLOG_FACILITY_NOT_SET) | 1366 | if (log_facility == SYSLOG_FACILITY_NOT_SET) |
1364 | error("Invalid log facility \"%s\"", optarg); | 1367 | error("Invalid log facility \"%s\"", optarg); |
1365 | break; | 1368 | break; |
1369 | case 'u': | ||
1370 | mask = (mode_t)strtonum(optarg, 0, 0777, &errmsg); | ||
1371 | if (cp != NULL) | ||
1372 | fatal("Invalid umask \"%s\": %s", | ||
1373 | optarg, errmsg); | ||
1374 | (void)umask(mask); | ||
1375 | break; | ||
1366 | case 'h': | 1376 | case 'h': |
1367 | default: | 1377 | default: |
1368 | sftp_server_usage(); | 1378 | sftp_server_usage(); |