App-Milter-Limit
view release on metacpan or search on metacpan
lib/App/Milter/Limit.pm view on Meta::CPAN
else {
# figure out the connection from sendmail
my $path = $milter->auto_getconn($$conf{name});
$milter->setconn($path)
or croak "auto_setconn failed";
# get the socket's file name without local: or unix:
$path = substr($path,index($path, ':')+1);
# make sure the permissions are correct
chown $$conf{user}, $$conf{group}, $path
or die "chown($path): $!";
}
my %callbacks = (
envfrom => \&_envfrom_callback
);
$milter->register($$conf{name}, \%callbacks, SMFI_CURR_ACTS);
debug("registered as $$conf{name}");
}
lib/App/Milter/Limit/PidFile.pm view on Meta::CPAN
$Pid->file(dir => $$conf{state_dir});
if ($Pid->alive) {
$Pid = undef;
return 1;
}
$Pid->touch;
# chown the file so we can unlink it
chown $$conf{user}, $$conf{group}, $Pid->{path};
return 0;
}
1;
__END__
=pod
lib/App/Milter/Limit/Util.pm view on Meta::CPAN
sub make_path {
my $path = shift;
unless (-d $path) {
File::Path::make_path($path, { mode => 0755 });
}
my $conf = App::Milter::Limit::Config->global;
if (defined @$conf{qw(user group)}) {
chown $$conf{user}, $$conf{group}, $path
or die "chown($path): $!";
}
}
1;
__END__
=pod
=encoding UTF-8
lib/App/Milter/Limit/Util.pm view on Meta::CPAN
return the UID for the given C<$username>
=head2 get_gid ($groupname)
return the GID for the given C<$groupname>
=head2 make_path ($path)
create the given directory path if necessary, creating intermediate directories
as necessary. The final directory will be C<chown()>'ed as the user/group from
the config file.
=head1 SOURCE
The development version is on github at L<https://github.com/mschout/milter-limit>
and may be cloned from L<https://github.com/mschout/milter-limit.git>
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
( run in 1.998 second using v1.01-cache-2.11-cpan-71847e10f99 )