--------------------------------------------------------------------
adduser.cgi
--------------------------------------------------------------------
This perl script is a CGI program which I use to create users
accounts from an HTTP form. The script takes on the standard input
(via the POST method of the HTML form) the following items:

 - First name
 - Last name
 - Desired e-mail alias
 - Password

Then it performs several tasks:

 - Check first name and last name to contains only allowed
   characters.
 - Check alias to contains only allowed characters.
 - Check that mail alias does not already exists as an user name
   or as an alias.
 - Generate an unique username from first name and second name
   initial characters, plus a random number.
 - Create the user placing first name and second name as a
   comment (gecos field in /etc/passwd).
 - Add the alias in /etc/aliases.

The script must be installed suid root, because it is run by
the httpd daemon (running as nobody or other unprivileged user),
but it must perform superuser actions (adduser, ...).
Place the script in /usr/lib/cgi-bin or whatever your cgi-bin
directory is and:

 # chown root.root adduser.cgi
 # chmod 4755 adduser.cgi

--------------------------------------------------------------------
History
--------------------------------------------------------------------

Version 1.1 (15 Jan 2000)

   The script is now working. It must be suid root (chmod 4755).
   Some check is done un user input. No special chars are
   allowed in user name (e.g. accented letters).

   The username is generated with the initials of first name
   and last name, plus a random number of USERNAME_DIGITS digits.

   The alias is appended to /etc/aliases.
