Add user_config example plugin
Add a plugin to read qpsmptd-style configuration files from users' home directories. Little to no testing yet.
This commit is contained in:
parent
b22d037c39
commit
3379248c45
17
plugins/user_config
Normal file
17
plugins/user_config
Normal file
@ -0,0 +1,17 @@
|
||||
#!/perl (Editor hint)
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub hook_user_config {
|
||||
my ($self,$txn,$user,$conf) = @_;
|
||||
my $username = $user->host or return DECLINED;
|
||||
my $filename = "/home/$username/.qpsmtpd/$conf";
|
||||
return DECLINED unless -f $filename;
|
||||
my $fh;
|
||||
unless (open $fh,$filename) {
|
||||
$self->log(LOGNOTICE,"Couldn't open $filename:$!");
|
||||
return DECLINED;
|
||||
}
|
||||
map {chomp} (my @return = (<$fh>));
|
||||
return OK,@return;
|
||||
}
|
Loading…
Reference in New Issue
Block a user