diff options
author | Eugene Grosbein <eugen@FreeBSD.org> | 2017-10-06 13:46:05 +0000 |
---|---|---|
committer | Eugene Grosbein <eugen@FreeBSD.org> | 2017-10-06 13:46:05 +0000 |
commit | de8d85c908d0ee7bd69f69dc1b9475f30a321eb4 (patch) | |
tree | 65f3f3cd26f04047a032cc2337c3b7cec9ac98d8 /libexec/ftpd | |
parent | 31329820e5dd13b48fb1f2dd830b5f8259554fca (diff) | |
download | src-de8d85c908d0ee7bd69f69dc1b9475f30a321eb4.tar.gz src-de8d85c908d0ee7bd69f69dc1b9475f30a321eb4.zip |
Notes
Diffstat (limited to 'libexec/ftpd')
-rw-r--r-- | libexec/ftpd/ftpd.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 5756c28b81a2..1e9c794eefcd 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -430,6 +430,10 @@ main(int argc, char *argv[], char **envp) } } + /* handle filesize limit gracefully */ + sa.sa_handler = SIG_IGN; + (void)sigaction(SIGXFSZ, &sa, NULL); + if (daemon_mode) { int *ctl_sock, fd, maxfd = -1, nfds, i; fd_set defreadfds, readfds; @@ -1196,14 +1200,14 @@ end_login(void) #endif (void) seteuid(0); - if (logged_in && dowtmp) - ftpd_logwtmp(wtmpid, NULL, NULL); - pw = NULL; #ifdef LOGIN_CAP setusercontext(NULL, getpwuid(0), 0, LOGIN_SETALL & ~(LOGIN_SETLOGIN | LOGIN_SETUSER | LOGIN_SETGROUP | LOGIN_SETPATH | LOGIN_SETENV)); #endif + if (logged_in && dowtmp) + ftpd_logwtmp(wtmpid, NULL, NULL); + pw = NULL; #ifdef USE_PAM if (pamh) { if ((e = pam_setcred(pamh, PAM_DELETE_CRED)) != PAM_SUCCESS) @@ -1478,7 +1482,7 @@ skip: } } setusercontext(lc, pw, 0, LOGIN_SETALL & - ~(LOGIN_SETUSER | LOGIN_SETPATH | LOGIN_SETENV)); + ~(LOGIN_SETRESOURCES | LOGIN_SETUSER | LOGIN_SETPATH | LOGIN_SETENV)); #else setlogin(pw->pw_name); (void) initgroups(pw->pw_name, pw->pw_gid); @@ -1520,6 +1524,10 @@ skip: (struct sockaddr *)&his_addr); logged_in = 1; +#ifdef LOGIN_CAP + setusercontext(lc, pw, 0, LOGIN_SETRESOURCES); +#endif + if (guest && stats && statfd < 0) #ifdef VIRTUAL_HOSTING statfd = open(thishost->statfile, O_WRONLY|O_APPEND); @@ -2770,6 +2778,11 @@ dologout(int status) if (logged_in && dowtmp) { (void) seteuid(0); +#ifdef LOGIN_CAP + setusercontext(NULL, getpwuid(0), 0, LOGIN_SETALL & ~(LOGIN_SETLOGIN | + LOGIN_SETUSER | LOGIN_SETGROUP | LOGIN_SETPATH | + LOGIN_SETENV)); +#endif ftpd_logwtmp(wtmpid, NULL, NULL); } /* beware of flushing buffers after a SIGPIPE */ |