Merge r584 from 0.3x branch (drop root privs in forkserver before loading

plugins)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@585 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Devin Carraway 2005-12-11 09:14:20 +00:00
parent cc45e9a576
commit bf5eea44c2

View File

@ -132,7 +132,6 @@ if ($PID_FILE) {
# Load plugins here # Load plugins here
my $qpsmtpd = Qpsmtpd::TcpServer->new(); my $qpsmtpd = Qpsmtpd::TcpServer->new();
$qpsmtpd->load_plugins;
# Drop privileges # Drop privileges
my (undef, undef, $quid, $qgid) = getpwnam $USER or my (undef, undef, $quid, $qgid) = getpwnam $USER or
@ -141,7 +140,6 @@ my $groups = "$qgid $qgid";
while (my ($name,$passwd,$gid,$members) = getgrent()) { while (my ($name,$passwd,$gid,$members) = getgrent()) {
my @m = split(/ /, $members); my @m = split(/ /, $members);
if (grep {$_ eq $USER} @m) { if (grep {$_ eq $USER} @m) {
::log(LOGINFO,"$USER is member of group $name($gid)");
$groups .= " $gid"; $groups .= " $gid";
} }
} }
@ -152,6 +150,8 @@ POSIX::setuid($quid) or
die "unable to change uid: $!\n"; die "unable to change uid: $!\n";
$> = $quid; $> = $quid;
$qpsmtpd->load_plugins;
::log(LOGINFO,"Listening on port $PORT"); ::log(LOGINFO,"Listening on port $PORT");
::log(LOGINFO, 'Running as user '. ::log(LOGINFO, 'Running as user '.
(getpwuid($>) || $>) . (getpwuid($>) || $>) .