use FS::Conf;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(checkeuid checkruid cgisuidsetup
- adminsuidsetup getotaker dbh datasrc getsecrets driver_name );
+@EXPORT_OK = qw(checkeuid checkruid cgisuidsetup adminsuidsetup forksuidsetup
+ getotaker dbh datasrc getsecrets driver_name );
$freeside_uid = scalar(getpwnam('freeside'));
=cut
sub adminsuidsetup {
+ $dbh->disconnect if $dbh;
+ &forksuidsetup(@_);
+}
+sub forksuidsetup {
$user = shift;
croak "fatal: adminsuidsetup called without arguements" unless $user;
+ $user =~ /^([\w\-\.]+)$/ or croak "fatal: illegal user $user";
+ $user = $1;
+
$ENV{'PATH'} ='/usr/local/bin:/usr/bin:/usr/ucb:/bin';
$ENV{'SHELL'} = '/bin/sh';
$ENV{'IFS'} = " \t\n";
croak "Not running uid freeside!" unless checkeuid();
getsecrets;
- $dbh->disconnect if $dbh;
$dbh = DBI->connect($datasrc,$db_user,$db_pass, {
'AutoCommit' => 0,
'ChopBlanks' => 1,
foreach ( keys %callback ) {
&{$callback{$_}};
+ # breaks multi-database installs # delete $callback{$_}; #run once
}
$dbh;
$user = lc ( $cgi->connection->user );
} else {
die "fatal: Can't get REMOTE_USER! for cgi $cgi - you need to setup ".
- "Apache user authentication as documented in htdocs/docs/config.html";
+ "Apache user authentication as documented in httemplate/docs/install.html";
}
$user;
}
die "No user!" unless $user;
my($conf) = new FS::Conf $conf_dir;
my($line) = grep /^\s*$user\s/, $conf->config('mapsecrets');
- die "User not found in mapsecrets!" unless $line;
+ die "User $user not found in mapsecrets!" unless $line;
$line =~ /^\s*$user\s+(.*)$/;
$secrets = $1;
die "Illegal mapsecrets line for user?!" unless $secrets;
=head1 VERSION
-$Id: UID.pm,v 1.8 2001-08-21 09:34:13 ivan Exp $
+$Id: UID.pm,v 1.16 2002-06-28 08:23:44 ivan Exp $
=head1 BUGS