diff options
| author | Guilhem Moulin <guilhem.moulin@fripost.org> | 2012-06-08 08:07:07 +0200 | 
|---|---|---|
| committer | Guilhem Moulin <guilhem.moulin@fripost.org> | 2012-06-08 08:07:07 +0200 | 
| commit | 05d7924b1c44e85a379b3ff5cca7b512383df769 (patch) | |
| tree | 7b480cb29372e94034bed1da91099f146aaeeded /lib/Fripost/Commands/add_alias.pm | |
| parent | 93d4b1701fbef7e2173324e27adc751062ca360f (diff) | |
Ensure that no cycle is created when add an alias.
Diffstat (limited to 'lib/Fripost/Commands/add_alias.pm')
| -rw-r--r-- | lib/Fripost/Commands/add_alias.pm | 5 | 
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Fripost/Commands/add_alias.pm b/lib/Fripost/Commands/add_alias.pm index 7155368..8581a9f 100644 --- a/lib/Fripost/Commands/add_alias.pm +++ b/lib/Fripost/Commands/add_alias.pm @@ -19,6 +19,7 @@ use IO::Prompter;  use Fripost::Prompt;  use Fripost::Schema;  use Fripost::Email; +use Fripost::Tests;  our $VERSION = '0.01'; @@ -32,6 +33,10 @@ sub main {      my @addr = @_;      @addr || push @addr, (split /, */, prompt "Alias from address(es): "); +    my $graph = build_alias_graph ($ldap->alias->search()->entries); +    my @path = search_path ($graph, $goto, $addr[0]); +    die "Error: Cannot create cycle " . join (' -> ', @path) . ' -> ' . $goto . "\n" +        if @path;      # Show goto adress      say "Goto adress: $goto";  | 
