diff options
Diffstat (limited to 'fripost-newalias')
-rwxr-xr-x | fripost-newalias | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/fripost-newalias b/fripost-newalias index e00adcb..0ca009b 100755 --- a/fripost-newalias +++ b/fripost-newalias @@ -12,7 +12,7 @@ fripost-newalias - Add a new alias to the system =head1 SYNOPSIS B<fripost-newalias> [B<--verbose>] [B<--debug>] [B<--pretend>] -[I<goto> [I<from>...]] +[B<--force>] [I<goto> [I<from>...]] =head1 DESCRIPTION @@ -32,6 +32,11 @@ B<fripost-newalias> raises an error. Only simulates the insertion. (But still query the LDAP server to ensure that the virtual domains of aliases are know, for example.) +=item B<--force> + +Force creating the creation, even if I<from> is already an alias. Also, +disable the sending of the confirmation. + =item B<--server_host=>I<host> The LDAP URI to connect to. @@ -127,6 +132,7 @@ GetOptions( 'bind_dn=s' => \$conf->{bind_dn}, 'bind_pw=s' => \$conf->{bind_pw}, 'pretend' => \$conf->{pretend}, + 'force' => \$conf->{force}, 'debug' => \$conf->{debug}, 'v|verbose' => \$conf->{verbose}, 'man' => sub { pod2usage(-exitstatus => 0, @@ -178,7 +184,7 @@ confirm_or_abort(); ## Insert alias into database for my $addr (@addr) { my $rs = $ldap->alias->search({ address => $addr }); - if (!$rs->count) { + if (!$rs->count or defined $conf->{force}) { if (!$ldap->user->search({ username => $addr })->count) { if (!$conf->{pretend}) { $ldap->alias->add({ address => $addr, goto => $goto, @@ -218,7 +224,7 @@ my $msg = MIME::Lite->new( Encoding => 'quoted-printable', ); -{ +unless (defined $conf->{force}) { my ($vars, $data); $vars = { addrs => \@addr, |