Fix pattern substitution in user_config plugin

This commit is contained in:
Jared Johnson 2014-09-15 10:40:46 -05:00
parent de742dc95e
commit 4b7af20f49

View File

@ -33,11 +33,12 @@ sub init {
} }
sub hook_user_config { sub hook_user_config {
my ($self,$txn,$user,$conf) = @_; my ($self,$txn,$addr,$conf) = @_;
my $path = $self->{pattern} or return DECLINED; my $path = $self->{pattern} or return DECLINED;
$path =~ s/%u/$user->user/g; my ( $user, $host, $address ) = ( $addr->user, $addr->host, $addr->address );
$path =~ s/%h/$user->host/g; $path =~ s/%u/$user/g;
$path =~ s/%a/$user->address/g; $path =~ s/%h/$host/g;
$path =~ s/%a/$address/g;
my $filename = "$path/$conf"; my $filename = "$path/$conf";
return DECLINED unless -f $filename; return DECLINED unless -f $filename;
my $fh; my $fh;