|
Lines 1892-1898
sftp_server_usage(void)
Link Here
|
| 1892 |
fprintf(stderr, |
1892 |
fprintf(stderr, |
| 1893 |
"usage: %s [-ehR] [-d start_directory] [-f log_facility] " |
1893 |
"usage: %s [-ehR] [-d start_directory] [-f log_facility] " |
| 1894 |
"[-l log_level]\n\t[-P denied_requests] " |
1894 |
"[-l log_level]\n\t[-P denied_requests] " |
| 1895 |
"[-p allowed_requests] [-u umask]\n" |
1895 |
"[-p allowed_requests] [-u umask] [-t session_timeout]\n" |
| 1896 |
" %s -Q protocol_feature\n", |
1896 |
" %s -Q protocol_feature\n", |
| 1897 |
__progname, __progname); |
1897 |
__progname, __progname); |
| 1898 |
exit(1); |
1898 |
exit(1); |
|
Lines 1906-1911
sftp_server_main(int argc, char **argv, struct passwd *user_pw)
Link Here
|
| 1906 |
SyslogFacility log_facility = SYSLOG_FACILITY_AUTH; |
1906 |
SyslogFacility log_facility = SYSLOG_FACILITY_AUTH; |
| 1907 |
char *cp, *homedir = NULL, uidstr[32], buf[4*4096]; |
1907 |
char *cp, *homedir = NULL, uidstr[32], buf[4*4096]; |
| 1908 |
long mask; |
1908 |
long mask; |
|
|
1909 |
long timeout = -1; |
| 1909 |
|
1910 |
|
| 1910 |
extern char *optarg; |
1911 |
extern char *optarg; |
| 1911 |
extern char *__progname; |
1912 |
extern char *__progname; |
|
Lines 1916-1922
sftp_server_main(int argc, char **argv, struct passwd *user_pw)
Link Here
|
| 1916 |
pw = pwcopy(user_pw); |
1917 |
pw = pwcopy(user_pw); |
| 1917 |
|
1918 |
|
| 1918 |
while (!skipargs && (ch = getopt(argc, argv, |
1919 |
while (!skipargs && (ch = getopt(argc, argv, |
| 1919 |
"d:f:l:P:p:Q:u:cehR")) != -1) { |
1920 |
"d:f:l:P:p:Q:u:cehRt:")) != -1) { |
| 1920 |
switch (ch) { |
1921 |
switch (ch) { |
| 1921 |
case 'Q': |
1922 |
case 'Q': |
| 1922 |
if (strcasecmp(optarg, "requests") != 0) { |
1923 |
if (strcasecmp(optarg, "requests") != 0) { |
|
Lines 1978-1983
sftp_server_main(int argc, char **argv, struct passwd *user_pw)
Link Here
|
| 1978 |
fatal("Invalid umask \"%s\"", optarg); |
1979 |
fatal("Invalid umask \"%s\"", optarg); |
| 1979 |
(void)umask((mode_t)mask); |
1980 |
(void)umask((mode_t)mask); |
| 1980 |
break; |
1981 |
break; |
|
|
1982 |
case 't': |
| 1983 |
timeout = strtol(optarg, &cp, 10); |
| 1984 |
if (*cp != '\0' || timeout < 0 || timeout > INT_MAX / 1000) |
| 1985 |
fatal("Invalid timeout \"%s\"", optarg); |
| 1986 |
if (timeout == 0) |
| 1987 |
timeout = -1; |
| 1988 |
else |
| 1989 |
timeout *= 1000; |
| 1990 |
break; |
| 1981 |
case 'h': |
1991 |
case 'h': |
| 1982 |
default: |
1992 |
default: |
| 1983 |
sftp_server_usage(); |
1993 |
sftp_server_usage(); |
|
Lines 2057-2067
sftp_server_main(int argc, char **argv, struct passwd *user_pw)
Link Here
|
| 2057 |
pfd[1].events = POLLOUT; |
2067 |
pfd[1].events = POLLOUT; |
| 2058 |
} |
2068 |
} |
| 2059 |
|
2069 |
|
| 2060 |
if (poll(pfd, 2, -1) == -1) { |
2070 |
if ((r = poll(pfd, 2, (int)timeout)) == -1) { |
| 2061 |
if (errno == EINTR) |
2071 |
if (errno == EINTR) |
| 2062 |
continue; |
2072 |
continue; |
| 2063 |
error("poll: %s", strerror(errno)); |
2073 |
error("poll: %s", strerror(errno)); |
| 2064 |
sftp_server_cleanup_exit(2); |
2074 |
sftp_server_cleanup_exit(2); |
|
|
2075 |
} else if (r == 0) { |
| 2076 |
logit("session timed out"); |
| 2077 |
sftp_server_cleanup_exit(0); |
| 2065 |
} |
2078 |
} |
| 2066 |
|
2079 |
|
| 2067 |
/* copy stdin to iqueue */ |
2080 |
/* copy stdin to iqueue */ |
| 2068 |
- |
|
|