Subject: An extension providing control over nice values via the ftpaccess file.

From: "Ronald F. Guilmette" <[email-masked]>
Date: Mon, 04 Sep 1995 14:47:38 -0700

Here are some patches for another small but useful enhancement to the
wu-ftpd 2.4 server.

The following patches implement a new form of directive for the ftpaccess
file, i.e. the `nice' directive.  This directive has the form:

	nice <nice-delta> [<class>]

In cases where the <class> argument is given, the process nice value of
the server is adjusted by <nice-delta> whenever any user belonging to
the relevant class logs in.  In the case where the <class> argument is
omitted, the <nice-delta> value is used as a default process nice value
adjustment, and is applied whenever ftpd fails to find any class-specific
`nice' directive in the ftpaccess file which applies specifically to the
class of the user who is logging in.

I was motivated to implement this small enhancement because I realized
that some folks might be unduly limiting the number of FTP logins due
to concerns about system loads, and about apparent response times for
other (non-ftp) system users.  With this enhancement in place, system
administrators should be able to raise such limits to higher numbers,
while simultaneously lowering the process scheduling priority of any
ftpd daemon processes that serve various classes of ftp users (or perhaps
even ALL ftp users).

Ron Guilmette
Infinite Monkeys & Co.

P.S.  `nice' directives in the ftpaccess file which specify negative values
for <nice-delta> are inherently dangerous, and should generally be avoided.

cut here for patches... apply these with `patch -p1'
----------------------------------------------------------------------------
diff -rc2 2.4-/doc/ftpaccess.5 2.4+/doc/ftpaccess.5
*** 2.4-/doc/ftpaccess.5	Fri Apr  1 11:03:24 1994
--- 2.4+/doc/ftpaccess.5	Mon Sep  4 14:27:54 1995
***************
*** 67,70 ****
--- 67,79 ----
  anonymous FTP user would.
  .TP 0.5i
+ .B nice <nice-delta> [<class>]
+ Adjust the process nice value of the ftpd server process
+ by the indicated <nice-delta> value if the remote user is a member of
+ the named <class>.  If <class> is not specified, then use <nice-delta>
+ as the default adjustment to the ftpd server process nice value.  This
+ default nice value adjustment is used to adjust the nice value of the
+ server process only for those users who do not belong to any class for
+ which a class-specific `nice' directive exists in the ftpaccess file.
+ .TP 0.5i
  .B limit <class> <n> <times> <message_file>
  Limit <class> to <n> users at times <times>, displaying
diff -rc2 2.4-/src/access.c 2.4+/src/access.c
*** 2.4-/src/access.c	Wed Apr 13 14:02:22 1994
--- 2.4+/src/access.c	Mon Sep  4 14:14:46 1995
***************
*** 282,286 ****
  /* PURPOSE   : Scan the ACL buffer and determine what logging to perform */
  /*             for this user, and whether or not user is allowed to use  */
! /*             the automatic TAR and COMPRESS functions.                 */
  /* ARGUMENTS : pointer to buffer to class name, pointer to ACL buffer    */
  /*************************************************************************/
--- 282,289 ----
  /* PURPOSE   : Scan the ACL buffer and determine what logging to perform */
  /*             for this user, and whether or not user is allowed to use  */
! /*             the automatic TAR and COMPRESS functions.  Also, set the  */
! /*	       current process priority of this copy of the ftpd server  */
! /*	       to a `nice' value value if this user is a member of a     */
! /*	       group which the ftpaccess file says should be nice'd.     */
  /* ARGUMENTS : pointer to buffer to class name, pointer to ACL buffer    */
  /*************************************************************************/
***************
*** 448,451 ****
--- 451,485 ----
  
  /*************************************************************************/
+ /* FUNCTION  : acl_getnice                                               */
+ /* PURPOSE   : Scan the ACL buffer and determine what nice value applies */
+ /*             to the user                                               */
+ /* ARGUMENTS : pointer class name                                        */
+ /*************************************************************************/
+ 
+ int
+ acl_getnice(char *class)
+ {
+     int nice_delta_for_class_found = 0;
+     int nice_delta;
+     int default_nice_delta = 0;
+     struct aclmember *entry = NULL;
+ 
+     /* nice <nice_delta> [<class>] */
+     while (getaclentry("nice", &entry)) {
+         if (!ARG0)
+ 	    continue;
+ 	if (!ARG1)
+             default_nice_delta = atoi(ARG0);
+         else if (!strcmp(class, ARG1)) {
+ 	    nice_delta_for_class_found = 1;
+             nice_delta = atoi(ARG0);
+ 	}
+     }
+     if (!nice_delta_for_class_found)
+ 	nice_delta = default_nice_delta;
+     return nice_delta;
+ }
+ 
+ /*************************************************************************/
  /* FUNCTION  : acl_deny                                                  */
  /* PURPOSE   : Scan the ACL buffer and determine a deny command applies  */
***************
*** 774,777 ****
--- 808,812 ----
        msgfile[MAXPATHLEN];
      int limit;
+     int nice_delta;
  
      if (!use_accessfile)
***************
*** 795,798 ****
--- 830,838 ----
                 remotehost, remoteaddr);
          return (0);
+     }
+     if ((nice_delta = acl_getnice(class))) {
+ 	if (nice_delta < 0)
+ 	    syslog(LOG_NOTICE, "Process nice value adjusted by %d", nice_delta);
+ 	nice (nice_delta);
      }
      /* if no limits defined, no limits apply -- access OK */

---

From: "Ronald F. Guilmette" <[email-masked]>
Date: Fri, 15 Sep 1995 02:09:19 -0700

Is this list dead?

I previously sent some patches to this list, hoping to garner at least
_some_ reaction from the ``official'' wu-ftpd ``maintainers'', but based
upon the deafening silence afterward, I get the impression that wu-ftpd
is an orphan now, and that no one is actively maintaining or enhancing it.

If I am wrong about that, then would whoever is actively working on it
please speak up?

-- Ron Guilmette, Roseville, CA -------- Infinite Monkeys & Co. ------------
---- E-mail: [email-masked] ----------- Purveyors of Compiler Test Suites -
----------------------------------------------------------------------------

---

From: [email-masked] (Koos van den Hout _U nix and we all_)
Date: Fri, 15 Sep 95 11:40:41 MET DST

> Is this list dead?

The list works, as list.

> is an orphan now, and that no one is actively maintaining or enhancing it.

I've also sent patches to the list. Since the 'academic' version gets
updated from time to time, someone is maintaining it (can't remember who
offhand).

Maybe there should be an official address for sending patches to.

                                            Grtx. KH

-- 
  Koos van den Hout,           Internetter, Unix freak and BBS SysOp at large
  [email-masked] (Home)        BBS Koos z'n Doos (+31-3402-36637 28k8)
  [email-masked] (Work)  <-- finger for PGPkey       (+31-3402-56619 14k4)
  http://www.hvu.nl/~koos (WWW)    Looking for a license plate with "RFC 822"
  GCS d- p(-) c++(+++) l+ u+++ e++ m+(-) s+/- !n h f+ g+ w(++) t+ r !y(*)

---

From: Michael Brennen <[email-masked]>
Date: Fri, 15 Sep 1995 11:07:10 -0500 (CDT)

> > is an orphan now, and that no one is actively maintaining or enhancing it.

Bingo.

> Maybe there should be an official address for sending patches to.

There seems to be nothing official remaining about this list except that
it is carried on Washington University's bandwidth.  Apparently there is
no official WU maintenance going on.

My complaint is that we (whoever *we* are) can't get admin control of the 
list to update the subscribe info to include the FAQ and other resources 
that are available.

Stan Barber has been pitching in his time to maintain an ongoing beta 
version.  This is all unofficial and on his own time, and it is quite a 
nice effort.  I expect he like most of us is plenty busy with other stuff.

Send patches to this list; he will get them.  (STAN: IS THAT RIGHT???  :-)

Michael Brennen