You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "William A. Rowe, Jr." <wr...@rowe-clan.net> on 2000/09/20 22:19:03 UTC
RE: cvs commit: apache-2.0/src/support dbmmanage
There are three remaining problems I can't solve easily...
1) dbmmanage.1 needs updating, if anyone who can rip through man
pages would change it to reflect reality (not my forte, nor do
I have a simple way to test.)
2) there are lots of users who report it just doesn't work. They
appear to use the wrong xDBM_File from the dbmmanage script that
doesn't match their build -lxdbm argument. So the only way I
can see getting it right is to rewrite the script upon installation.
This would be an autoconf type issue, if I'm guessing right.
3) I simply can't figure out how to hash passwords with MD5.pm or
Digest::MD5.pm. This is -required- under win32... since some Perls
are bundled with crypt, and we aren't. It succeeds, we fail.
> -----Original Message-----
> From: wrowe@locus.apache.org [mailto:wrowe@locus.apache.org]
> Sent: Wednesday, September 20, 2000 3:10 PM
> To: apache-2.0-cvs@apache.org
> Subject: cvs commit: apache-2.0/src/support dbmmanage
>
>
> 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;
> }
> }
>
>
>
>