From: Nick J. <nje...@us...> - 2002-03-26 00:47:45
|
Update of /cvsroot/sandweb/sandweb/tools In directory usw-pr-cvs1:/tmp/cvs-serv32470 Modified Files: install_script.pl Log Message: * install_script now sets perms on sandweb-admin, except I can't figure out what chmod g=rwxs doesn't work through the perl script, perhaps security? dunno, for now when its done it just says "please enter this" chmod u=rwx,g=rwxs,o= $PREFIX/bin/sandweb-admin Index: install_script.pl =================================================================== RCS file: /cvsroot/sandweb/sandweb/tools/install_script.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -U2 -r1.2 -r1.3 --- install_script.pl 25 Mar 2002 23:26:05 -0000 1.2 +++ install_script.pl 26 Mar 2002 00:47:40 -0000 1.3 @@ -41,4 +41,21 @@ } else { exit(4); } +# set permissions on installed sandweb-admin +if (-f "$PREFIX/bin/sandweb-admin") { + my $httpuser_uid = &getuid($httpuser); + if ($httpuser_uid == -1) { + print "Unable to get UID of $httpuser\n"; + exit(5); + } + print "Setting ownership of $PREFIX/bin/sandweb-admin to: $httpuser_uid:0\n"; + #print "Setting permissions on $PREFIX/bin/sandweb-admin to: (u=rwx,g=rwxs,o=) $httpuser_uid:0...\n"; + #chmod(0770, "$PREFIX/bin/sandweb-admin"); + #system("chmod", "u=rwx,g=rwxs,o=", "$PREFIX/bin/sandweb-admin"); + #`chmod u=rwx,g=rwxs,o= $PREFIX/bin/sandweb-admin`; + chown($httpuser_uid, 0, "$PREFIX/bin/sandweb-admin"); +} else { + print "unable to local $PREFIX/bin/sandweb-admin\n"; + exit(6); +} @@ -56,3 +73,23 @@ close CFG; +print "----------------------\n"; print "Installation complete!\n"; +print "----------------------\n"; +print "Please execute this command prior to using the 'sandweb-admin' tool.\n"; +print "It must have it's SUID but set to maintain the correct permissions.\n"; +print "\n chmod u=rwx,g=rwxs,o= $PREFIX/bin/sandweb-admin\n\n"; +exit(0); + +sub getuid($) { + my $user = shift; + my ($junk, $junk2, $junk3); + my $uid = -1; + open (PW, "</etc/passwd") or die "Unable to read password file\n"; + foreach my $line (<PW>) { + if ($line =~ /^$user\:/) { + ($junk, $junk2, $uid, $junk3) = split(':', $line, 4); + } + } + close PW; + return $uid; +} |