#!/usr/local/bin/perl # # user_links_sort --- User Home Page Links # # Search all the users home directories for a wide world web public # directory and output the ``User Supplied Home Pages'' document to be # directly sent to the caller. # # Example Usage: CIT, Griffith University, Australia # http://www.cit.gu.edu.au/cgi-bin/user-links # # This program currently knows about and looks for the following html # document files in users WWW public directory. ( "public_html"? ) # # index.html The mail home page of the user, if not present # the user is not presented in the list thus allowing # hidden homepages to exist. # comment.html A short comment about this users WWW home to be # included. # personal.html personal information about this user specifically. # # NOTE: this program ignores all input arguments making it very secure. # # Programmer: Anthony Thyssen 29 May 94 # http://www.cit.gu.edu.au/~anthony/ # # --------------------------------------------------------------------------- # The following constants is used to determine the directories and files # the might supply. Only the user's WWW directory must exist and be # readable by the httpd user `nobody'. The other files is optional. # # For best effect the user should also supply a summery file ``comment.html'' # and an initial index (home page) file ``index.html''. $USER_DIR="www"; # Name of directory to look for in users homes # default "public_html", set in httpd configs @USER_INDEX= ( "index.html", # list of valid index files "index.htm", # user home pages (must be present) "index.shtml" ); # $USER_SUMMERY="comment.html"; # the short summery to include in the output. $USER_PERSONAL="personal.html"; # the users personal details page $USER_PUBS="publications.html"; # publications by the user (not used) $MIN_UID=100; # the smallest USER_ID a user can have $HELP_DOC=' Installing a WWW Homepage '; $WEBMASTER=' webmaster@cit.gu.edu.au'; # --------------------------------------------------------------------------- # Print the top part of the user links document print <<"EOF"; Content-type: text/html
User Home PagesThis list is automatically collected whenever a request is made by the server. Staff members who wish to create a personal home page or information area can read $HELP_DOC (please read it) which explains how to do this. For more information or if you are experiencing problems contact $WEBMASTER
NOTE: This list is now sorted by the the users surname (You can thank Rodney for this) instead of the order in the password file. If this is not to your liking please contact the WebMaster and let your feelings be known. All suggestions are welcome.
EOF
# For each user on this machine determine if they provide a WWW directory
open(PASSWD, "/etc/passwd")
|| die "Can't open passwd file: $!\n";
while( $userrec = \n\n";
}
else {
print " \n\n";
}
print <<"EOF";
\n";
for $user ( sort keys %user ) {
($login, $first, $last, $dir) = split(/:/, $user{$user});
# Surname first
print "
Program: ``user_links_sort'' -- User Home Page Linker
Created: 26th November 1993
Sorting added: 30th April 1995
Modified: 7th August 1997
Written:
Anthony Thyssen,
<
anthony\@cit.gu.edu.au>
Send comments, errors and suggestions to
$WEBMASTER
EOF