aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@fripost.org>2012-04-18 03:37:55 +0200
committerGuilhem Moulin <guilhem.moulin@fripost.org>2012-04-18 03:37:55 +0200
commita1cee8071f753b80daf374af4bad8458657dd07a (patch)
tree30a851174b98af3b3e3c87546af8a66f445d8e2b
parent7b2df0cb8d29ba835be5d645f8b4f70b74b2fcc4 (diff)
wibble
-rwxr-xr-xfripost-passwd11
-rwxr-xr-xlib/Fripost/Schema.pm3
2 files changed, 11 insertions, 3 deletions
diff --git a/fripost-passwd b/fripost-passwd
index 9ae47d9..d6abe3f 100755
--- a/fripost-passwd
+++ b/fripost-passwd
@@ -10,7 +10,7 @@ fripost-passwd - Change password of user
=head1 SYNOPSIS
-B<fripost-passwd> [B<--debug>] [B<--pretend>] [I<username>]
+B<fripost-passwd> [B<--verbose>] [B<--debug>] [B<--pretend>] [I<username>]
[B<--password=>I<password>]
=head1 DESCRIPTION
@@ -60,6 +60,10 @@ The default value is read from the configuration file, see B<CONFIGURATION>.
The root DN for everything done by B<fripost-passwd>.
The default value is read from the configuration file, see B<CONFIGURATION>.
+=item B<-v>, B<--verbose>
+
+Verbose mode.
+
=item B<--debug>
Debug mode.
@@ -120,11 +124,14 @@ GetOptions(
'bind_pw=s' => \$conf->{bind_pw},
'pretend' => \$conf->{pretend},
'debug' => \$conf->{debug},
+ 'v|verbose' => \$conf->{verbose},
'password=s' => \$conf->{password},
'man' => sub { pod2usage(-exitstatus => 0,
-verbose => 2) }
) or pod2usage(2);
+sub vsay { say STDERR @_ if $conf->{verbose} || $conf->{debug}; }
+
# Connect to the LDAP server
my $ldap = Fripost::Schema->new( $conf );
@@ -149,7 +156,7 @@ die "Error: Unknown user `" .$username. "'.\n"
if ($conf->{pretend}) {
- say "Nothing to do since we are pretending...";
+ vsay "Nothing to do since we are pretending...";
exit 0;
}
diff --git a/lib/Fripost/Schema.pm b/lib/Fripost/Schema.pm
index 288aa1e..14caccd 100755
--- a/lib/Fripost/Schema.pm
+++ b/lib/Fripost/Schema.pm
@@ -111,6 +111,7 @@ sub passwd {
# Disconnect to the LDAP server.
sub unbind {
+ $_[0]->_dsay( "Unbinding from the LDAP server." );
$_[0]->{_ldap}->unbind();
}
@@ -120,7 +121,7 @@ sub _dsay {
my $self = shift;
return unless (exists $self->{_options}->{debug})
and $self->{_options}->{debug};
- print STDERR "Debug: ";
+ print STDERR "DEBUG: ";
say STDERR @_;
}