User Home Page Locator
The following gateway program (a shell script) can be
run to search the UNIX password file for a
particular userid or name, and locate the home page for that user.
#!/bin/sh
# thumb - Track Home-pages at U of MB
# i.e. do a "finger-style" search for user home pages
# (OK, the acronym is a stretch, but I figured it was a fitting name
# for this awkward but useful utility, based on the finger gateway.)
#
# (c) 1995, Gilbert Detillieux, Computer Science, University of Manitoba.
echo "Content-type: text/html"
echo ""
if [ $# = 0 ]; then
cat << EOM
<title>User Home Page Locator</title>
<h1><img src="/icons/index.xbm" alt="">
User Home Page Locator</h1>
This is a "finger-style" facility to help locate
a user's home page on this server.
<p>
Enter search criteria into your browser's search dialogue...
<isindex>
A (lowercase) userid or a (case sensitive) real first or last name may
be specified. Also, a substring can be used for the first or last name.
(Single word only.)
<p>
EOM
else
case "$*" in # check what we're about to eat...
*[!\ 0-9A-Za-z]*) # may contain harmful substances...
cat << EOM
<title>User Home Page Locator - Error</title>
<h1><img src="/icons/index.xbm" alt="">
User Home Page Locator - Error</h1>
Please limit the search string to alpha-numeric characters.
<p>
Enter search criteria into your browser's search dialogue...
<isindex>
A (lowercase) userid or a (case sensitive) real first or last name may
be specified. Also, a substring can be used for the first or last name.
(Single word only.)
<p>
EOM
;;
?) # too short - potentially too many responses...
cat << EOM
<title>User Home Page Locator - Error</title>
<h1><img src="/icons/index.xbm" alt="">
User Home Page Locator - Error</h1>
Please specify more than one alpha-numeric character
in the search string.
<p>
Enter search criteria into your browser's search dialogue...
<isindex>
A (lowercase) userid or a (case sensitive) real first or last name may
be specified. Also, a substring can be used for the first or last name.
(Single word only.)
<p>
EOM
;;
*) # argument string is probably safe...
cat << EOM
<title>User Home Page Locator - Selections</title>
<h1><img src="/icons/index.xbm" alt="">
User Home Page Locator</h1>
The following user(s) match the search criteria. Clicking on
the userid will take you to the appropriate home page, if available.
<p>
<pre>
EOM
# now, scan password file... (pick one that's appropriate)
#ypcat passwd | # YP (NIS) lookup
#ypcat passwd | fgrep -i "$*" | # for large map, do quick weed-out
cat /etc/passwd | # normal file lookup
awk -F: "\$1 == \"$*\" || \$5 ~ /$*/" | \
sort | \
( IFS=:
while read user pass uid gid name homedir shell; do
if [ -d "$homedir/public_html" ]; then
echo "<a href=\"/~$user/\">$user</a> $name"
else
:
# Comment out if you only want to list users with
# home pages, rather than all matching entries
echo "$user $name"
fi
done
)
echo "</pre>"
;;
esac
fi
cat << EOM
<hr>
<address>World Wide Web Administrator --
<a href="mailto:www@$SERVER_NAME">www@$SERVER_NAME</a></address>
EOM
Seminar Index
|
Home Page Template
|
URLs and Linking
Copyright (c) 1995,
Gilbert Detillieux,
Computer Science,
University of Manitoba.