aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO.org12
-rwxr-xr-xfripost88
-rw-r--r--lib/Fripost/Commands/add_alias.pm (renamed from lib/Fripost/Commands/alias_add.pm)6
-rw-r--r--lib/Fripost/Commands/add_domain.pm (renamed from lib/Fripost/Commands/domain_add.pm)6
-rw-r--r--lib/Fripost/Commands/add_user.pm (renamed from lib/Fripost/Commands/user_add.pm)6
-rw-r--r--lib/Fripost/Commands/search_alias.pm (renamed from lib/Fripost/Commands/alias_search.pm)6
-rw-r--r--lib/Fripost/Commands/search_domain.pm (renamed from lib/Fripost/Commands/domain_search.pm)6
-rw-r--r--lib/Fripost/Commands/search_user.pm (renamed from lib/Fripost/Commands/user_search.pm)6
-rw-r--r--lib/Fripost/Commands/user_passwd.pm2
-rwxr-xr-xlib/Fripost/Schema.pm3
10 files changed, 69 insertions, 72 deletions
diff --git a/TODO.org b/TODO.org
index 4f720c7..6b9d830 100644
--- a/TODO.org
+++ b/TODO.org
@@ -8,11 +8,11 @@
** TODO Detect cycles when creating aliases. (E.g., a->b, b->a should not be allowed.)
** TODO Add a subroutine is_email_valid with options (e.g., `allow_empty_login'), and add options to prompt_email (e.g., `allow_list', `allow_empty_login', `ensure_domain_known', `ensure_user_known', `allow_empty_user').
** DONE Merge the tools into a single executable.
-*** fripost-adduser -> fripost user-add
+*** fripost-adduser -> fripost add-user
*** fripost-mkpass -> fripost mkpass
-*** fripost-newalias -> fripost alias-add
-*** fripost-newdomain -> fripost domain-add
+*** fripost-newalias -> fripost add-alias
+*** fripost-newdomain -> fripost add-domain
*** fripost-passwd -> fripost user-passwd
-*** fripost-searchalias -> fripost alias-search
-*** fripost-searchdomain -> fripost domain-search
-*** fripost-searchuser -> fripost user-search
+*** fripost-searchalias -> fripost search-alias
+*** fripost-searchdomain -> fripost search-domain
+*** fripost-searchuser -> fripost search-user
diff --git a/fripost b/fripost
index e9e27e7..5a80d70 100755
--- a/fripost
+++ b/fripost
@@ -13,8 +13,8 @@ fripost - Fripost.org handling utility for virtual hosting
=head1 SYNOPSIS
-B<fripost> [I<options>] { mkpass | user-add | user-search | user-passwd
-| domain-add | domain-search | alias-add | alias-search }
+B<fripost> [I<options>] { mkpass | add-user | search-user | user-passwd
+| add-domain | search-domain | add-alias | search-alias }
B<fripost> B<--man>
@@ -26,11 +26,11 @@ B<fripost> B<--man>
Create a random new password, and returns its hash.
-=item B<fripost> user-add [I<username>] [B<--password=>I<password>]
+=item B<fripost> add-user [I<username>] [B<--password=>I<password>]
Add a new virtual mailbox.
-=item B<fripost> user-search [I<username>]
+=item B<fripost> search-user [I<username>]
List matching virtual users.
@@ -38,19 +38,19 @@ List matching virtual users.
Change user password.
-=item B<fripost> domain-add [I<domain> [I<username>]]
+=item B<fripost> add-domain [I<domain> [I<username>]]
Add a new virtual domain.
-=item B<fripost> domain-search [I<domain> [I<username>]]
+=item B<fripost> search-domain [I<domain> [I<username>]]
List matching virtual domains.
-=item B<fripost> alias-add [B<--force>] [I<goto> [I<from>...]]
+=item B<fripost> add-alias [B<--force>] [I<goto> [I<from>...]]
Add a new virtual alias.
-=item B<fripost> alias-search [B<-f>|B<--from>] [B<-g>|B<--goto>] [I<address>]
+=item B<fripost> search-alias [B<-f>|B<--from>] [B<-g>|B<--goto>] [I<address>]
List matching virtual aliases.
@@ -69,9 +69,9 @@ C<mkpass> is used to generate a salted SHA-1 hash of the given
I<password>. If no argument is given, the password is randomly
generated, respecting Fripost's password policy.
-=item B<fripost> user-add [I<username>] [B<--password=>I<password>]
+=item B<fripost> add-user [I<username>] [B<--password=>I<password>]
-C<user-add> is used to add a new virtual mailbox to the system, unless
+C<add-user> is used to add a new virtual mailbox to the system, unless
B<--pretend> is set.
If I<username> or I<password> are not given, the user is prompted for
their value.
@@ -84,16 +84,16 @@ This can be useful if the user does not want to give the clear copy but
only a hash, for example.
Using this option disables the sending of credentials.
-=item B<fripost> user-search [I<username>]
+=item B<fripost> search-user [I<username>]
-C<user-search> is used to
+C<search-user> is used to
list virtual mailboxes whose username matches exactly I<username>.
Wildcards I<*> can appear in I<username>, to match zero or more characters.
If no I<username> is given, lists all existing mailboxes.
-If I<username> has no domain part, C<user-search> lists matching users for any
+If I<username> has no domain part, C<search-user> lists matching users for any
domains.
-Otherwise, C<user-search> looks up the matching user parts for each matching
+Otherwise, C<search-user> looks up the matching user parts for each matching
domain.
Because of these multiple searches, the use of wildcards on the domain
part of I<username> may be inefficient.
@@ -111,31 +111,31 @@ This can be useful if the user does not want to give the clear copy but
only a hash, for example.
Using this option disables the sending of credentials.
-=item B<fripost> domain-add [I<domain> [I<username>]]
+=item B<fripost> add-domain [I<domain> [I<username>]]
-C<domain-add> is used add a new virtual domain to the system, unless
+C<add-domain> is used add a new virtual domain to the system, unless
B<--pretend> is set.
If I<domain> is not given, the user is prompted for its value.
-By default, C<domain-add> prompts for the owner(s) of the new
+By default, C<add-domain> prompts for the owner(s) of the new
domain; Use the empty string I<''> to create a "global" domain, only
managed by Fripost's administrators.
If I<domain> is an existing virtual domain, the owner(s) are simply
added to the list of managers.
-=item B<fripost> domain-search [I<domain> [I<username>]]
+=item B<fripost> search-domain [I<domain> [I<username>]]
-C<domain-search> is used to list virtual domains matching exactly I<domain>,
+C<search-domain> is used to list virtual domains matching exactly I<domain>,
and whose owner is I<username>.
Wildcards I<*> can appear in I<domain>, to match zero or more characters.
If no I<username> is given, list all domains matching I<domain>, regardless
of the owner; If I<owner> is the empty string I<''>, list only the non
self-managed domains.
-If neither I<domain> nor I<owner> are given, C<domain-search> lists
+If neither I<domain> nor I<owner> are given, C<search-domain> lists
all existing virtual domains.
-=item B<fripost> alias-add [B<--force>] [I<goto> [I<from>...]]
+=item B<fripost> add-alias [B<--force>] [I<goto> [I<from>...]]
-C<alias-add> is used to add a new virtual alias to the system, unless
+C<add-alias> is used to add a new virtual alias to the system, unless
B<--pretend> is set.
If I<goto> or I<from> are not given, the user is prompted for their
value.
@@ -166,18 +166,18 @@ See B<virtual>(5) for details and warnings.
If serveral entries are matching, for instance if there are an alias from
I<user>@I<domain> to I<goto> and another for I<user>@I<domain> to
I<goto2>, emails to I<user>@I<domain> will be redirected to BOTH I<goto>
-and I<goto2>. Note that C<alias-add> forbids the creation of such
+and I<goto2>. Note that C<add-alias> forbids the creation of such
multi-recipient aliases, unless B<--force> is set.
-=item B<fripost> alias-search [B<-f>|B<--from>] [B<-g>|B<--goto>] [I<address>]
+=item B<fripost> search-alias [B<-f>|B<--from>] [B<-g>|B<--goto>] [I<address>]
-C<alias-search> is used to list virtual aliases whose value or target
+C<search-alias> is used to list virtual aliases whose value or target
matches exactly I<address>.
As of the current version, wilcards are not allowed in I<address>; This
will be fixed soon.
To list matching aliases (resp., targets) only, use the flag B<-f>
(resp., B<-g>).
-If no I<address> is given, C<alias-search> lists all existing virtual
+If no I<address> is given, C<search-alias> lists all existing virtual
aliases.
=back
@@ -315,13 +315,13 @@ use YAML::Syck;
use Fripost::Schema;
use Fripost::Commands::mkpass;
-use Fripost::Commands::user_add;
-use Fripost::Commands::user_search;
+use Fripost::Commands::add_user;
+use Fripost::Commands::search_user;
use Fripost::Commands::user_passwd;
-use Fripost::Commands::domain_add;
-use Fripost::Commands::domain_search;
-use Fripost::Commands::alias_add;
-use Fripost::Commands::alias_search;
+use Fripost::Commands::add_domain;
+use Fripost::Commands::search_domain;
+use Fripost::Commands::add_alias;
+use Fripost::Commands::search_alias;
## Get global command line options
@@ -372,26 +372,26 @@ if ($cmd eq 'mkpass') {
&Fripost::Commands::mkpass::main (@ARGV);
exit 0;
}
-elsif ($cmd eq 'user-add') {
- $main = "Fripost::Commands::user_add::main";
+elsif ($cmd eq 'add-user') {
+ $main = "Fripost::Commands::add_user::main";
}
-elsif ($cmd eq 'user-search') {
- $main = "Fripost::Commands::user_search::main";
+elsif ($cmd eq 'search-user') {
+ $main = "Fripost::Commands::search_user::main";
}
elsif ($cmd eq 'user-passwd') {
$main = "Fripost::Commands::user_passwd::main";
}
-elsif ($cmd eq 'domain-add') {
- $main = "Fripost::Commands::domain_add::main";
+elsif ($cmd eq 'add-domain') {
+ $main = "Fripost::Commands::add_domain::main";
}
-elsif ($cmd eq 'domain-search') {
- $main = "Fripost::Commands::domain_search::main";
+elsif ($cmd eq 'search-domain') {
+ $main = "Fripost::Commands::search_domain::main";
}
-elsif ($cmd eq 'alias-add') {
- $main = "Fripost::Commands::alias_add::main";
+elsif ($cmd eq 'add-alias') {
+ $main = "Fripost::Commands::add_alias::main";
}
-elsif ($cmd eq 'alias-search') {
- $main = "Fripost::Commands::alias_search::main";
+elsif ($cmd eq 'search-alias') {
+ $main = "Fripost::Commands::search_alias::main";
}
else {
pod2usage( -exitstatus => 1,
diff --git a/lib/Fripost/Commands/alias_add.pm b/lib/Fripost/Commands/add_alias.pm
index f86b1f7..7155368 100644
--- a/lib/Fripost/Commands/alias_add.pm
+++ b/lib/Fripost/Commands/add_alias.pm
@@ -1,4 +1,4 @@
-package Fripost::Commands::alias_add;
+package Fripost::Commands::add_alias;
use 5.010_000;
use strict;
@@ -7,7 +7,7 @@ use utf8;
=head1 NAME
-alias_add - Add a new virtual alias
+add_alias - Add a new virtual alias
=cut
@@ -128,6 +128,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=cut
-1; # End of alias_add.pm
+1; # End of add_alias.pm
__END__
diff --git a/lib/Fripost/Commands/domain_add.pm b/lib/Fripost/Commands/add_domain.pm
index a727623..4d53e35 100644
--- a/lib/Fripost/Commands/domain_add.pm
+++ b/lib/Fripost/Commands/add_domain.pm
@@ -1,4 +1,4 @@
-package Fripost::Commands::domain_add;
+package Fripost::Commands::add_domain;
use 5.010_000;
use warnings;
@@ -7,7 +7,7 @@ use utf8;
=head1 NAME
-domain_add - Add a new virtual domain.
+add_domain - Add a new virtual domain.
=cut
@@ -145,6 +145,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=cut
-1; # End of domain_add.pm
+1; # End of add_domain.pm
__END__
diff --git a/lib/Fripost/Commands/user_add.pm b/lib/Fripost/Commands/add_user.pm
index 70ee638..4e1cf10 100644
--- a/lib/Fripost/Commands/user_add.pm
+++ b/lib/Fripost/Commands/add_user.pm
@@ -1,4 +1,4 @@
-package Fripost::Commands::user_add;
+package Fripost::Commands::add_user;
use 5.010_000;
use strict;
@@ -7,7 +7,7 @@ use utf8;
=head1 NAME
-user_add - Add a new mailbox to the system
+add_user - Add a new mailbox to the system
=cut
@@ -156,6 +156,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=cut
-1; # End of user_add.pm
+1; # End of add_user.pm
__END__
diff --git a/lib/Fripost/Commands/alias_search.pm b/lib/Fripost/Commands/search_alias.pm
index 01aed7f..2241436 100644
--- a/lib/Fripost/Commands/alias_search.pm
+++ b/lib/Fripost/Commands/search_alias.pm
@@ -1,4 +1,4 @@
-package Fripost::Commands::alias_search;
+package Fripost::Commands::search_alias;
use 5.010_000;
use strict;
@@ -7,7 +7,7 @@ use utf8;
=head1 NAME
-alias_search.pm - List matching virtual aliases
+search_alias.pm - List matching virtual aliases
=cut
@@ -73,6 +73,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=cut
-1; # End of alias_search.pm
+1; # End of search_alias.pm
__END__
diff --git a/lib/Fripost/Commands/domain_search.pm b/lib/Fripost/Commands/search_domain.pm
index 8aaf775..9c47d43 100644
--- a/lib/Fripost/Commands/domain_search.pm
+++ b/lib/Fripost/Commands/search_domain.pm
@@ -1,4 +1,4 @@
-package Fripost::Commands::domain_search;
+package Fripost::Commands::search_domain;
use 5.010_000;
use strict;
@@ -7,7 +7,7 @@ use utf8;
=head1 NAME
-domain_search.pm - List matching virtual domains
+search_domain.pm - List matching virtual domains
=cut
@@ -55,6 +55,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=cut
-1; # End of domain_search.pm
+1; # End of search_domain.pm
__END__
diff --git a/lib/Fripost/Commands/user_search.pm b/lib/Fripost/Commands/search_user.pm
index 30ffd4d..f476a98 100644
--- a/lib/Fripost/Commands/user_search.pm
+++ b/lib/Fripost/Commands/search_user.pm
@@ -1,4 +1,4 @@
-package Fripost::Commands::user_search;
+package Fripost::Commands::search_user;
use 5.010_000;
use strict;
@@ -7,7 +7,7 @@ use utf8;
=head1 NAME
-user_search.pm - List matching virtual users
+search_user.pm - List matching virtual users
=cut
@@ -53,6 +53,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=cut
-1; # End of user_search.pm
+1; # End of search_user.pm
__END__
diff --git a/lib/Fripost/Commands/user_passwd.pm b/lib/Fripost/Commands/user_passwd.pm
index f443ef6..805b7e1 100644
--- a/lib/Fripost/Commands/user_passwd.pm
+++ b/lib/Fripost/Commands/user_passwd.pm
@@ -8,7 +8,7 @@ use utf8;
=head1 NAME
-user_add - Change user password
+user_passwd - Change user password
=cut
diff --git a/lib/Fripost/Schema.pm b/lib/Fripost/Schema.pm
index f8649b7..72a7484 100755
--- a/lib/Fripost/Schema.pm
+++ b/lib/Fripost/Schema.pm
@@ -30,9 +30,6 @@ sub new {
my $class = shift;
my $h = shift;
- $h->{server_host} //= 'ldap://127.0.0.1:389';
- $h->{base_dn} //= '';
-
my $self = {_options => $h};
bless $self, $class;