summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Command/Admin
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-04-24 04:35:38 +0000
committerfukachan <fukachan>2002-04-24 04:35:38 +0000
commit979e5b18bf35e1873fc5774b725e8a374bf435a2 (patch)
treee17879d9f3b3205744f772bc6d44f9618683dfa9 /fml/lib/FML/Command/Admin
parent7e7532704084193ca042ab8f307b19b7a28ec75a (diff)
downloadfml8-979e5b18bf35e1873fc5774b725e8a374bf435a2.tar.gz
fml8-979e5b18bf35e1873fc5774b725e8a374bf435a2.tar.bz2
fml8-979e5b18bf35e1873fc5774b725e8a374bf435a2.zip
check $ml_name duplication over all $alias_maps in the postfix case
Diffstat (limited to 'fml/lib/FML/Command/Admin')
-rw-r--r--fml/lib/FML/Command/Admin/newml.pm43
1 files changed, 39 insertions, 4 deletions
diff --git a/fml/lib/FML/Command/Admin/newml.pm b/fml/lib/FML/Command/Admin/newml.pm
index 243f14f2..f1941f76 100644
--- a/fml/lib/FML/Command/Admin/newml.pm
+++ b/fml/lib/FML/Command/Admin/newml.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: newml.pm,v 1.27 2002/04/24 03:50:00 fukachan Exp $
+# $FML: newml.pm,v 1.28 2002/04/24 03:59:15 fukachan Exp $
#
package FML::Command::Admin::newml;
@@ -95,6 +95,12 @@ sub process
}
}
+ # check alias key defined in MTA aliases
+ if ($self->_mta_alias_has_ml_entry($curproc, $ml_name)) {
+ warn("$ml_name already exists (somewhere in MTA aliases)");
+ return ;
+ }
+
# o.k. here we go !
eval q{
use File::Utils qw(mkdirhier);
@@ -180,7 +186,7 @@ sub _update_aliases
_install($src, $dst, $params);
# append
- if ($self->_alias_has_ml_entry($alias, $ml_name)) {
+ if ($self->_alias_has_ml_entry($curproc, $alias, $ml_name)) {
print STDERR "warning: $ml_name already defined!\n";
print STDERR " ignore aliases updating.\n";
}
@@ -203,13 +209,42 @@ sub _update_aliases
}
+
+# Descriptions: $alias file has an $ml_name entry or not
+# Arguments: OBJ($self) OBJ($curproc) STR($ml_name)
+# Side Effects: none
+# Return Value: NUM( 1 or 0 )
+sub _mta_alias_has_ml_entry
+{
+ my ($self, $curproc, $ml_name) = @_;
+ my $found = 0;
+
+ eval q{
+ use FML::MTAControl;
+ my $postfix = new FML::MTAControl;
+ $found = $postfix->find_key_in_alias($curproc, {
+ mta_type => 'postfix',
+ key => $ml_name,
+ });
+ };
+ croak($@) if $@;
+
+ return $found;
+}
+
+
# Descriptions: $alias file has an $ml_name entry or not
-# Arguments: OBJ($self) STR($alias) STR($ml_name)
+# Arguments: OBJ($self) OBJ($curproc) STR($alias) STR($ml_name)
# Side Effects: none
# Return Value: NUM( 1 or 0 )
sub _alias_has_ml_entry
{
- my ($self, $alias, $ml_name) = @_;
+ my ($self, $curproc, $alias, $ml_name) = @_;
+ my $found = 0;
+
+ # search all entries defined in MTA
+ $found = $self->_mta_alias_has_ml_entry($curproc, $ml_name);
+ return 1 if $found;
use FileHandle;
my $fh = new FileHandle $alias;