httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@locus.apache.org
Subject cvs commit: apache-2.0/src/support dbmmanage
Date Wed, 20 Sep 2000 20:10:01 GMT
wrowe       00/09/20 13:10:00

  Modified:    src      CHANGES
               src/support dbmmanage
  Log:
       Overhaul of dbmmanage to allow a groups arg (as in Apache 1.2)
       as well as a comment arg to the add, adduser and update cmds.
       update allows the user to clear or preserve pw/groups/comment.
       Fixed a bug in dbmmanage that prevented the check option from
       parsing a password followed by :group... text.  Corrected the
       seed calcualation for Win32 systems, and added -lsdbm support.
       PR: 3810, 5527
  
  Revision  Changes    Path
  1.233     +12 -0     apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.232
  retrieving revision 1.233
  diff -u -r1.232 -r1.233
  --- CHANGES	2000/09/20 17:35:56	1.232
  +++ CHANGES	2000/09/20 20:09:58	1.233
  @@ -1,4 +1,16 @@
   Changes with Apache 2.0a7
  +
  +  *) Overhaul of dbmmanage to allow a groups arg (as in Apache 1.2)
  +     as well as a comment arg to the add, adduser and update cmds.
  +     update allows the user to clear or preserve pw/groups/comment.
  +     Fixed a bug in dbmmanage that prevented the check option from 
  +     parsing a password followed by :group... text.  Corrected the
  +     seed calcualation for Win32 systems, and added -lsdbm support.
  +     [William Rowe]
  +
  +  *) Configured mod_auth_dbm to compile with sdbmlib under Win32.
  +     [William Rowe]
  +
     *) Avoid a segfault when parsing .htaccess files.  An 
        uninitialized tree pointer was passed to ap_build_config().
        [Jeff Trawick]
  
  
  
  1.6       +37 -9     apache-2.0/src/support/dbmmanage
  
  Index: dbmmanage
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/support/dbmmanage,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- dbmmanage	2000/09/20 17:12:42	1.5
  +++ dbmmanage	2000/09/20 20:09:59	1.6
  @@ -68,7 +68,7 @@
   use Fcntl;
   use AnyDBM_File ();
   
  -my($file,$command,$key,$crypted_pwd) = @ARGV;
  +my($file,$command,$key,$crypted_pwd,$groups,$comment) = @ARGV;
   
   usage() unless $file and $command and defined &{$dbmc::{$command}};
   
  @@ -98,17 +98,33 @@
   
   sub usage {
       my $cmds = join "|", sort keys %dbmc::;
  -    die "usage: $0 filename [$cmds] [username]\n";
  +    die <<SYNTAX;
  +Usage: dbmmanage dbname command [username [pw [group[,group] [comment]]]]
  +
  +    where command is one of: $cmds
  +
  +    pw of . for update retains the old password
  +    pw of - (or blank) for update prompts for the password
  +
  +    groups or comment of . (or blank) for update retains old values
  +    groups or comment of - for update clears the existing value
  +    groups or comment of - for add or adduser is an empty value
  +SYNTAX
   }
   
   my $x;
   sub genseed {
       my $psf;
  -    for (qw(-xlwwa -le)) { 
  -	`ps $_ 2>/dev/null`;
  -	$psf = $_, last unless $?;
  +    if ($Is_Win32) {
  +	srand (time ^ $$ or time ^ ($$ + ($$ << 15)));
       }
  -    srand (time ^ $$ ^ unpack("%L*", `ps $psf | gzip -f`));
  +    else {
  +        for (qw(-xlwwa -le)) { 
  +	    `ps $_ 2>/dev/null`;
  +            $psf = $_, last unless $?;
  +        }
  +        srand (time ^ $$ ^ unpack("%L*", `ps $psf | gzip -f`));
  +    }
       @range = (qw(. /), '0'..'9','a'..'z','A'..'Z');
       $x = int scalar @range;
   }
  @@ -147,7 +163,15 @@
   
   sub dbmc::update {
       die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key};
  -    dbmc->adduser;
  +    $crypted_pwd = (split /:/, $DB{$key}, 4)[0] if $crypted_pwd eq '.';
  +    $groups = (split /:/, $DB{$key}, 4)[1] if !$groups || $groups eq '.';
  +    $comment = (split /:/, $DB{$key}, 4)[2] if !$comment || $comment eq '.';
  +    if (!$crypted_pwd || $crypted_pwd eq '-') {
  +        dbmc->adduser;
  +    }
  +    else {
  +        dbmc->add;
  +    }
   }
   
   sub dbmc::add {
  @@ -155,6 +179,10 @@
       unless($is_update) {
   	die "Sorry, user `$key' already exists!\n" if $DB{$key};
       }
  +    $groups = '' if $groups eq '-';
  +    $comment = '' if $comment eq '-';
  +    $groups .= ":" . $comment if $comment;
  +    $crypted_pwd .= ":" . $groups if $groups;
       $DB{$key} = $crypted_pwd;
       my $action = $is_update ? "updated" : "added";
       print "User $key $action with password encrypted to $DB{$key}\n";
  @@ -178,13 +206,13 @@
   
   sub dbmc::check {
       die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key};
  -    my $chkpass = (split /:/, $DB{$key})[0];
  +    my $chkpass = (split /:/, $DB{$key},4)[0];
       print crypt(getpass(), $chkpass) eq $chkpass ? "password ok\n" : "password mismatch\n";
   }
   
   sub dbmc::import {
       while(defined($_ = <STDIN>) and chomp) {
  -	($key,$crypted_pwd) = split /:/, $_, 2;
  +	($key,$crypted_pwd,$groups,$comment) = split /:/, $_, 4;
   	dbmc->add;
       }
   }
  
  
  

Mime
View raw message