Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Feb 2010 07:40:03 GMT
From:      Eugene Grosbein <egrosbein@rdtc.ru>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/143570: [patch] stock ftpd does not handle "filesize" limit right
Message-ID:  <201002050740.o157e3Yq050159@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/143570; it has been noted by GNATS.

From: Eugene Grosbein <egrosbein@rdtc.ru>
To: bug-followup@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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002050740.o157e3Yq050159>