Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/perl
- use Authen::SASL::Authd qw(auth_cyrus);
- use strict;
- use warnings;
- my $status = 1; # Default to pass
- my $username = $ARGV[0];
- print "Please enter a password: ";
- my $password = <STDIN>;
- print "Reenter NEW password: ";
- my $npassword = <STDIN>;
- $password = trim($password);
- $npassword = trim($npassword);
- if ($password ne $npassword) { $status = 0; }
- if (!$username) { $status = 0; }
- if (!$password) { $status = 0; }
- if ($status == 1) { auth_cyrus($username, $password) or $status = 0; }
- if ($status == 1) { print "Passed\n"; }
- else { print "Failed\n"; }
- sub trim {
- my $data = $_[0];
- $data =~ s/^\s+(.*)/$1/;
- $data =~ s/(.*)\s+$/$1/;
- chomp($data);
- return $data;
- }
Add Comment
Please, Sign In to add comment