/[docman]/adduser.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /adduser.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dpavlin, Fri Jan 26 12:39:34 2001 UTC revision 1.2 by dpavlin, Mon May 28 06:28:40 2001 UTC
# Line 7  use Digest::MD5 qw(md5_hex); Line 7  use Digest::MD5 qw(md5_hex);
7  my $htpasswd = shift @ARGV || ".htusers";  my $htpasswd = shift @ARGV || ".htusers";
8    
9  my $login = shift @ARGV;  my $login = shift @ARGV;
10  if (! $login) {  while (! $login) {
11          print "login: ";          print "login: ";
12          $login=<STDIN>; chomp $login;          $login=<STDIN>; chomp $login;
13  }  }
14    
15  my $fullname = shift @ARGV;  my $fullname = shift @ARGV;
16  if (! $fullname) {  while (! $fullname) {
17          print "full name: ";          print "full name: ";
18          $fullname=<STDIN>; chomp $fullname;          $fullname=<STDIN>; chomp $fullname;
19  }  }
20    
21  my $passswd = shift @ARGV;  my $passwd = shift @ARGV;
22  if (! $passswd) {  if (! $passwd) {
23          print "password [auth_pop3]: ";          print "password [auth_pop3]: ";
24          $passwd=<STDIN>; chomp $passwd;          $passwd=<STDIN>; chomp $passwd;
25          if ($passwd eq "") {          if ($passwd eq "") {
26                  $passwd="auth_pop3";                  $passwd="auth_pop3";
         } elsif (substr($passwd,0,5) ne "auth_") {  
                 $passwd=md5_hex($login.$passwd);  
27          }          }
28  }  }
29    elsif (substr($passwd,0,5) ne "auth_") {
30                    $passwd=md5_hex($login.$passwd);
31    }
32    
33  my $email = shift @ARGV;  my $email = shift @ARGV;
34  while (! $email || $email !~ /@/) {  while (! $email || $email !~ /\w@\w/) {
35          print "e-mail: ";          print "e-mail: ";
36          $email=<STDIN>; chomp $email;          $email=<STDIN>; chomp $email;
37          print "e-mail address needs to have @ for auth_pop3 to work!\n" if ($email !~ /@/);          print "e-mail address needs to have user\@domain for auth_pop3",
38                  " to work!\n" if ($email !~ /\w@\w/);
39  }  }
40    
41  if (! -e "$htpasswd") {  if (! -e "$htpasswd") {
# Line 42  if (! -e "$htpasswd") { Line 44  if (! -e "$htpasswd") {
44  } else {  } else {
45          open(HTPASSWD,">> $htpasswd") || die "append $htpasswd: $!";          open(HTPASSWD,">> $htpasswd") || die "append $htpasswd: $!";
46  }  }
47    
48  print HTPASSWD "$login:$fullname:$passwd:$email\n";  print HTPASSWD "$login:$fullname:$passwd:$email\n";
49  close(HTPASSWD);  close(HTPASSWD);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.26