Bugzilla – Attachment 1673 Details for
Bug 1229
No way to set default umask for SFTP server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Revised patch
sftp-umask2.diff (text/plain), 2.26 KB, created by
Damien Miller
on 2009-08-27 10:13:33 AEST
(
hide
)
Description:
Revised patch
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2009-08-27 10:13:33 AEST
Size:
2.26 KB
patch
obsolete
>Index: sftp-server.8 >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/sftp-server.8,v >retrieving revision 1.15 >diff -u -p -r1.15 sftp-server.8 >--- sftp-server.8 26 Mar 2009 08:38:39 -0000 1.15 >+++ sftp-server.8 26 Aug 2009 23:49:55 -0000 >@@ -32,6 +32,7 @@ > .Nm sftp-server > .Op Fl f Ar log_facility > .Op Fl l Ar log_level >+.Op Fl u Ar umask > .Sh DESCRIPTION > .Nm > is a program that speaks the server side of SFTP protocol >@@ -71,6 +72,11 @@ performs on behalf of the client. > DEBUG and DEBUG1 are equivalent. > DEBUG2 and DEBUG3 each specify higher levels of debugging output. > The default is ERROR. >+.It Fl u Ar umask >+Sets an explicit >+.Xr umask 2 >+to be applied to newly-created files and directories, instead of the >+user's default mask. > .El > .Pp > For logging to work, >Index: sftp-server.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/sftp-server.c,v >retrieving revision 1.85 >diff -u -p -r1.85 sftp-server.c >--- sftp-server.c 14 Apr 2009 16:33:42 -0000 1.85 >+++ sftp-server.c 26 Aug 2009 23:49:55 -0000 >@@ -1294,7 +1294,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); > } > >@@ -1306,13 +1307,15 @@ sftp_server_main(int argc, char **argv, > 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; > > 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': > /* >@@ -1333,6 +1336,13 @@ sftp_server_main(int argc, char **argv, > log_facility = log_facility_number(optarg); > 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); >+ umask(mask); > break; > case 'h': > default:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1229
:
1205
| 1673