75 points, due Feb. 21, 2000
For this project, you will be designing an HTML form and a CGI Perl program. Traditionally, finger is used to discover information about a user on a Unix system. Here's an example:
phoenix:~ * finger ashao Login: ashao Name: Aaron G. Shao Directory: /home1/ashao Shell: /bin/tcsh Last login Tue Feb 8 09:42 (EST) on ttyp2 from 220.127.116.11 No Plan. phoenix:~ * finger maria Login: mlakin Name: Maria Lakin Directory: /home1/mlakin Shell: /bin/tcsh Never logged in. No Plan. Login: mperez Name: Maria Perez Directory: /home1/mperez Shell: /usr/local/shells/noshell Never logged in. No Plan. phoenix:~ * finger kelliher Login: kelliher Name: Thomas P. Kelliher Directory: /home1/kelliher Shell: /bin/tcsh Office: Hoffberger 140, (410) 337-6189 Home Phone: (410) 931-2946 On since Fri Feb 11 06:57 (EST) on ttyp1 (messages off) from phoenix.goucher.edu:10.0 Mail forwarded to: Send mail to kelliher AT DOMAIN bluebird.goucher.edu Plan: Office Address: Thomas P. Kelliher Department of Mathematics and Computer Science ... <Edited for brevity.> ... Th 9:00am--10:00am or by appointment Login: tom Name: Tom Kelliher Directory: /home1/tom Shell: /bin/tcsh Never logged in. Mail forwarded to: Send mail to kelliher AT DOMAIN phoenix.goucher.edu No Plan. Login: tomstu Name: Thomas P. Kelliher Directory: /home1/tomstu Shell: /bin/tcsh Never logged in. No Plan. phoenix:~ *
In the first example, we search for a user based on their username. In the second example, we search for a user based on part of their real name in the GECOS field. Note that more than one record matched. The third example demonstrates two things: A match is searched for in both the username and GECOS field, and the finger program will print the contents of the .project and .plan files in the user's home directory if they are present and readable. (Finger Adam Badik to see an example of the .project file in use.)
The password file's path is /etc/passwd. Here's an example record:
kelliher:*:100:200:Thomas P. Kelliher,Hoffberger 140,(410) 337-6189,(410) 931-2946:/home1/kelliher:/bin/tcsh(The actual record is a single line.) The field names of the colon-delimited records are as follows:
name:password:uid:gid:gecos:home_dir:shellThe name field is the user name. The ``*'' is a dummy password. The actual password is kept in a more secure location. Note that GECOS is, itself, a comma-delimited field with this format:
name,office,work_phone,home_phoneThe name field is the real name.
Design an HTML form by hand to read the name for which to search. The query should be submitted using the POST method. The form's action should be to run your CGI program.
Your CGI Perl program should search the password file and for each match of either the user name or real name produce output in this form:
Login: ashao Name: Aaron G. Shao Directory: /home1/ashao Shell: /bin/tcsh <No line or office, office phone, and home phone info as above.> <No line or contents of the .project file.> <"No Plan." or contents of the .plan file.>The information on the first two lines should be separated horizontally by using an HTML table. Adjacent records should be separated by a horizontal rule. If no password file record matches the search term, an appropriate error message should be returned. Under no circumstances should the contents of the entire password file be returned. You'll need to perform some devious thinking to determine a set of tests for this.
The following will be taken into consideration in evaluating your work:
Remember that you need to inform me as soon as you place any executable programs in your cgi-bin directory. To submit your project, turn in hard-copy of the HTML and Perl. Write the path to the files on the first sheets. Your project is due at the beginning of class on the 21st. You must not modify any of your project files after the due date and time until I give you a ``go ahead'' signal. See the syllabus for the late policy.