Article 1981 of comp.infosystems.gopher: Xref: feenix.metronet.com comp.infosystems.gopher:1981 Newsgroups: comp.infosystems.gopher Path: feenix.metronet.com!news.ecn.bgu.edu!mp.cs.niu.edu!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!uunet!utcsri!newsflash.concordia.ca!mizar.cc.umanitoba.ca!silver.cs.umanitoba.ca!sbalneav From: sbalneav@silver.cs.umanitoba.ca (Scott Balneaves) Subject: Fingering under gopher - gophinger Message-ID: Summary: a free program to do fingering in gopher Keywords: gophinger finger gopher Sender: news@ccu.umanitoba.ca Nntp-Posting-Host: silver.cs.umanitoba.ca Organization: University of Manitoba, Winnipeg, Canada Date: Wed, 14 Apr 1993 20:08:06 GMT Lines: 149 A couple of weeks ago I saw someone who wanted to be able to do a "finger" under a gopher server. To this person (whose name escapes me) and to anyone else that ever wanted to finger people via a gopher, this bud's for you... I hacked this together in about 2 or 3 hours, so I cannot guarentee that it's bulletproof. But, it does seem to work. If you use it, send me some mail -- I'd love to see it in action! :-) It requires that you have perl, which you can get from many places. Instructions for use are at the top of the program. Go nuts. Scott ------------CUT HERE-------------------- #!/usr/local/bin/perl ############################################################################# # Copyright Notice ############################################################################# # gophinger.perl - Scott L. Balneaves # # "I see I've foiled your plans for world dominiation again, # Mr. Goldfinger" # # Copy it, mangle it, use it, do whatever. Just leave my name at the top. # # If it don't do something you want it to do, just gimme an e-mail at # sbalneav@silver.cs.umanitoba.ca # and I'll see what I can do for 'ya. ############################################################################# # # This program uses inetd to get started, so.. you'll need a line in # your inetd.conf something like the following: # # gophinger stream tcp nowait tcp /usr/local/bin/gophinger.perl gophinger # # and a line in your /etc/services file something like: # # gophinger 71/tcp # # in your .Links file, try something to the effect of: # # Type=1 # Name=Gophinger finger service # Host=yourhost.what.ever.that.is # Port=71 # Path=+ # # I've structured it so that you can get the list of names in whatever # way you want. Gophinger expects to use an /etc/passwd like file. # You can either use /etc/passwd, or use a modified version of the file. # for instance, you can create a file like: # # sbalneav@silver.cs.umanitoba.ca::::Scott L. Balneaves:: # sbalneav@ccu.Umanitoba.ca::::Scott L. Balneaves:: # # as a test, and have gophinger go after that. That way you can finger # people on different hosts (internet coke machines, etc :-) # # You can also use YP (or NIS if you like) to get the info, pass it # through a filter that removes certain names, etc. Whatever you like, # so long as the output looks like a passwd entry, you'll be fine. # # At any rate, $command is the command to use to get the passwd-like file # into gophinger. I've included a couple, commented out, and one which # is guarenteed to work :-) (note the trailing pipe symbol at the end of # the command string) # # This program was a quick hack, so don't expect perfection. # ############################################################################# #$command = "cat /usr/local/etc/gophinger.passwd |"; #$command = "ypcat passwd | sort |"; $command = "cat /etc/passwd | sort |"; $defaultport=71; # our default port is 71 # # Get the port number from the services file # ($name, $aliases, $port) = getservbyname('g2fd','tcp'); $port=$defaultport unless $port; # # Get our full host name # chop($host = `hostname`); ($host, $aliases, $type, $len, $thisaddr) = gethostbyname($host); # # Receive our request and hack off the naughty bits :-) # $line=; chop $line; # ouch chop $line; # ouch $line="1" unless $line; # # did we get a request for a listing(1)? or a request to finger (0)? # ($type,$name)= split('/',$line); if (! $name) { $type="1"; } # # OK, we got a request to list. Open our pipe, and start squakin' # if ($type eq '1') { open(PASSWD, $command) || die; while () { chop; ($login,$passwd,$uid,$gid,$gcos,$home,$home,$shell) = split(/:/); $putout="0$login [$gcos]\t0/$login\t$host\t$port\r\n"; print($putout); } close (PASSWD); $putout=".\r\n"; print($putout); } else { # # We got a request to finger. Pipe that and spray the output # open(FINGER, "finger $name |") || die; while () { chop; print "$_\r\n"; } close (FINGER); $putout=".\r\n"; print($putout); } ------------CUT HERE-------------------- -- Scott L. Balneaves | sbalneav@silver.cs.umanitoba.ca "No tears to cry, no feelings left... | Weird answers $1.00 This species has amused itself to death." | Correct, weird answers $1.50 - Roger Waters | Crackpot theories FREE .