Add support for pseudonyms on minilists

tags/smeserver-minilist-0.1.5-1 0.1.3_el6
Daniel Berteaud 11 years ago
parent 5b5c40db7d
commit c578d1e15b
  1. 52
      root/etc/e-smith/templates/var/qmail/users/assign/71MinilistPseudo

@ -0,0 +1,52 @@
{
$OUT = '';
my (undef, undef, $uid, $gid, undef, undef, undef, $dir, undef)
= getpwnam("alias");
unless (defined $uid && defined $gid && defined $dir)
{
my $msg =
"Failed to obtain user details for \'alias\' "
. "while processing pseudonym assignments.";
warn "$msg\n";
$OUT = $msg;
return;
}
my $alias_assign = "alias:${uid}:${gid}:${dir}";
undef $uid;
undef $gid;
undef $dir;
use esmith::AccountsDB;
my $adb = esmith::AccountsDB->open_ro();
foreach $pseudonym ( $adb->pseudonyms )
{
next if ( $pseudonym->key =~ /@/ ); # user@domain goes in virtualdomains
my $account = $pseudonym->prop('Account');
unless ($account)
{
my $key = $pseudonym->key;
warn "pseudonym $key has no account property";
next;
}
$account = $adb->get($pseudonym->prop('Account'));
unless ($account)
{
my $key = $pseudonym->key;
warn "pseudonym $key points to account which does not exist";
next;
}
if ($account->prop('type') eq "minilist")
{
$OUT .= "=" . $pseudonym->key . ":${alias_assign}:-:" . $account->key . ":\n";
$OUT .= "+" . $pseudonym->key . "-:${alias_assign}:-:" . $account->key . ":\n";
next;
}
}
chomp($OUT);
$OUT = "=alias:${alias_assign}:::" unless $OUT;
}
Loading…
Cancel
Save