From 3379248c45793613121f0c203975ca3ede966aba Mon Sep 17 00:00:00 2001 From: Jared Johnson Date: Tue, 9 Sep 2014 18:09:31 -0500 Subject: [PATCH] Add user_config example plugin Add a plugin to read qpsmptd-style configuration files from users' home directories. Little to no testing yet. --- plugins/user_config | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 plugins/user_config diff --git a/plugins/user_config b/plugins/user_config new file mode 100644 index 0000000..aa7e259 --- /dev/null +++ b/plugins/user_config @@ -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; +}