(Paul Close writes:)
> We are slowly getting towards a configuration checker! Now all we need
> is to check each directory in the .cf file, and we'd be most of the
> way there....
>
oh what the heck. I was 'hurling perl' and needed a diversion for a while
anyway...this is what was posted earlier, with some perl5 ('use English')
in there to make it at least a little more readable to me at least.
I call the script "config-test" since 'test' is such a bad name to use
for a script because it's built into some shells.
--
----------- Vince Skahan ------ vds7789@aw101.iasl.ca.boeing.com -----------
(output on 1.94a1 with a 'posix' wrapper - news.news mode 6755)
-------- try to open majordomo '.cf' file --------
----------- environment variables ----------------
HOME=/site/sw/majordomo-1.94
LOGNAME=news
MAJORDOMO_CF=/site/sw/majordomo-1.94/majordomo.cf
PATH=/bin:/usr/bin:/usr/ucb
SHELL=/bin/csh
SYSTYPE=bsd4.3
USER=news
------------- euid/egid checks -------------------
effective user = news (uid 300)
effective group = news news (gid 300 300)
-------------- uid/gid checks --------------------
real user = news (uid 300)
real group = news news (gid 300 300)
-------------- end of tests ----------------------
(output on 1.94a1 with a 'root' wrapper - root.news mode 4755)
-------- try to open majordomo '.cf' file --------
----------- environment variables ----------------
HOME=/site/sw/majordomo-1.94
LOGNAME=news
MAJORDOMO_CF=/site/sw/majordomo-1.94/majordomo.cf
PATH=/bin:/usr/bin:/usr/ucb
SHELL=/bin/csh
SYSTYPE=bsd4.3
USER=news
------------- euid/egid checks -------------------
effective user = root (uid 0)
effective group = news news (gid 300 300)
-------------- uid/gid checks --------------------
real user = root (uid 0)
real group = news news (gid 300 300)
-------------- end of tests ----------------------
#!/usr/local/bin/perl5
# $Id: test,v 1.3 1995/11/08 09:16:24 majordom Exp $
# configuration test for majordomo
# provided with majordomo, modifications by darren stalder <torin@daft.com>
# more mods by Vince Skahan <vince@atc.boeing.com>
#
# execute this by cd to your majordomo dir, then 'wrapper config-test'
#
# To use perl4 for this:
# change $EUID to
# change $EGID to
# change $UID to
# change $GID to
# comment out the next two lines
require 5.000;
use English;
print "-------- try to open majordomo '.cf' file --------\n";
open(CF, $ENV{MAJORDOMO_CF}) || warn "unable to open $ENV{MAJORDOMO_CF}: $!";
print "----------- environment variables ----------------\n";
foreach $e (sort keys %ENV) {
print " $e=$ENV{$e}\n";
}
print "------------- euid/egid checks -------------------\n";
$euid_name=getpwuid($EUID);
push(@egid_group_numbers,(split(' ',$EGID))); # it switches groups...
foreach $groupnum (@egid_group_numbers) {
$name = getgrgid($groupnum);
push(@egid_names,$name);
}
print " effective user = $euid_name (uid $EUID)\n";
print " effective group = @egid_names (gid $EGID)\n";
print "-------------- uid/gid checks --------------------\n";
$uid_name=getpwuid($UID);
push(@gid_group_numbers,(split(' ',$GID))); # it switches groups...
foreach $groupnum (@gid_group_numbers) {
$name = getgrgid($groupnum);
push(@gid_names,$name);
}
print " real user = $uid_name (uid $UID)\n";
print " real group = @gid_names (gid $GID)\n";
print "-------------- end of tests ----------------------\n";
#
# that's all folks
#
References:
|
|