home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!jvnc.net!netnews.upenn.edu!netnews.cc.lehigh.edu!usenet
- From: lusol@Lehigh.EDU (Stephen O. Lidie)
- Newsgroups: comp.lang.perl
- Subject: Re: "Secure" way to find out hostname
- Message-ID: <1993Jan6.140149.11253@Lehigh.EDU>
- Date: 6 Jan 93 14:01:49 GMT
- References: <1id258INN8j6@nntp1.radiomail.net>
- Sender: usenet@Lehigh.EDU
- Organization: Lehigh University, Bethlehem PA
- Lines: 34
- Nntp-Posting-Host: meatball.cc.lehigh.edu
-
- In article <1id258INN8j6@nntp1.radiomail.net> hogan@radiomail.net (Emmett
- Hogan) writes:
- >Hi All,
- >
- >Quick and hopefully easy question:
- >
- >Is there an acceptable way to find out your machine's hostname in a setuid
- >PERL script? When I try this: $host = `/bin/hostname` I get INSECURE
- >path.
- >
- >Any ideas?
- >
- >Thanks in advance,
- >Emmett
- >
- Now, I've only written one setuid Perl program but I had the same problem.
- Never did figure out 'the right way' to do it, but did get around it by doing
- all my initialization under the user's id:
-
- $euid = $>; # user
- $> = $<;
- ..
- chop($hostname = `/bin/hostname`);
- ..
- $> = $euid; # back to root or whatever
-
-
- OK you Perl heavies, let's hear the full 'how to untaint' story....
-
-
-
- SOL
-
- system( 'telnet Turkey.CC.Lehigh.EDU 4031' ); # JAPH
-