summaryrefslogtreecommitdiff
path: root/sftp-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'sftp-server.c')
-rw-r--r--sftp-server.c16
1 files changed, 13 insertions, 3 deletions
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();