bin/143570: [patch] stock ftpd does not handle "filesize" limit
right
Eugene Grosbein
egrosbein at rdtc.ru
Fri Feb 5 07:40:03 UTC 2010
The following reply was made to PR bin/143570; it has been noted by GNATS.
From: Eugene Grosbein <egrosbein at rdtc.ru>
To: bug-followup at freebsd.org
Cc:
Subject: Re: bin/143570: [patch] stock ftpd does not handle "filesize" limit right
Date: Fri, 5 Feb 2010 14:05:41 +0700
Here is better looking edition of the patch above:
fixed spelling error in a comment, change for dologout() fuction corrected.
--- libexec/ftpd/ftpd.c.orig 2010-02-05 11:19:23.000000000 +0700
+++ libexec/ftpd/ftpd.c 2010-02-05 13:57:43.000000000 +0700
@@ -428,6 +428,10 @@
}
}
+ /* 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;
@@ -1183,14 +1187,16 @@
#endif
(void) seteuid(0);
- if (logged_in && dowtmp)
- ftpd_logwtmp(ttyline, "", NULL);
- pw = NULL;
#ifdef LOGIN_CAP
setusercontext(NULL, getpwuid(0), 0,
LOGIN_SETPRIORITY|LOGIN_SETRESOURCES|LOGIN_SETUMASK|
LOGIN_SETMAC);
#endif
+
+ if (logged_in && dowtmp)
+ ftpd_logwtmp(ttyline, "", NULL);
+ pw = NULL;
+
#ifdef USE_PAM
if (pamh) {
if ((e = pam_setcred(pamh, PAM_DELETE_CRED)) != PAM_SUCCESS)
@@ -1463,7 +1469,7 @@
}
setusercontext(lc, pw, 0,
LOGIN_SETLOGIN|LOGIN_SETGROUP|LOGIN_SETPRIORITY|
- LOGIN_SETRESOURCES|LOGIN_SETUMASK|LOGIN_SETMAC);
+ LOGIN_SETUMASK|LOGIN_SETMAC);
#else
setlogin(pw->pw_name);
(void) initgroups(pw->pw_name, pw->pw_gid);
@@ -1485,6 +1491,10 @@
(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);
@@ -2745,6 +2755,11 @@
if (logged_in && dowtmp) {
(void) seteuid(0);
+#ifdef LOGIN_CAP
+ setusercontext(NULL, getpwuid(0), 0,
+ LOGIN_SETPRIORITY|LOGIN_SETRESOURCES|LOGIN_SETUMASK|
+ LOGIN_SETMAC);
+#endif
ftpd_logwtmp(ttyline, "", NULL);
}
/* beware of flushing buffers after a SIGPIPE */
More information about the freebsd-bugs
mailing list