- djm@cvs.openbsd.org 2009/08/27 17:28:52

[sftp-server.c]
     allow setting an explicit umask on the commandline to override whatever
     default the user has. bz#1229; ok dtucker@ deraadt@ markus@
This commit is contained in:
Darren Tucker 2009-10-07 08:44:42 +11:00
parent 8ec4fd8e3c
commit 7dc4850ce8
2 changed files with 17 additions and 3 deletions

View File

@ -46,6 +46,10 @@
- dtucker@cvs.openbsd.org 2009/08/20 23:54:28
[mux.c]
subsystem_flag is defined in ssh.c so it's extern; ok djm
- djm@cvs.openbsd.org 2009/08/27 17:28:52
[sftp-server.c]
allow setting an explicit umask on the commandline to override whatever
default the user has. bz#1229; ok dtucker@ deraadt@ markus@
20091002
- (djm) [Makefile.in] Mention readconf.o in ssh-keysign's make deps.

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sftp-server.c,v 1.85 2009/04/14 16:33:42 stevesk Exp $ */
/* $OpenBSD: sftp-server.c,v 1.86 2009/08/27 17:28:52 djm Exp $ */
/*
* Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
*
@ -1322,7 +1322,8 @@ sftp_server_usage(void)
extern char *__progname;
fprintf(stderr,
"usage: %s [-he] [-l log_level] [-f log_facility]\n", __progname);
"usage: %s [-he] [-l log_level] [-f log_facility] [-u umask]\n",
__progname);
exit(1);
}
@ -1334,6 +1335,8 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
ssize_t len, olen, set_size;
SyslogFacility log_facility = SYSLOG_FACILITY_AUTH;
char *cp, buf[4*4096];
const char *errmsg;
mode_t mask;
extern char *optarg;
extern char *__progname;
@ -1341,7 +1344,7 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
__progname = ssh_get_progname(argv[0]);
log_init(__progname, log_level, log_facility, log_stderr);
while (!skipargs && (ch = getopt(argc, argv, "f:l:che")) != -1) {
while (!skipargs && (ch = getopt(argc, argv, "f:l:u:che")) != -1) {
switch (ch) {
case 'c':
/*
@ -1363,6 +1366,13 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
if (log_facility == SYSLOG_FACILITY_NOT_SET)
error("Invalid log facility \"%s\"", optarg);
break;
case 'u':
mask = (mode_t)strtonum(optarg, 0, 0777, &errmsg);
if (cp != NULL)
fatal("Invalid umask \"%s\": %s",
optarg, errmsg);
(void)umask(mask);
break;
case 'h':
default:
sftp_server_usage();