>Number: 3810 >Category: general >Synopsis: Minor addition to dbmmanage >Confidential: no >Severity: non-critical >Priority: medium >Responsible: apache >State: open >Class: change-request >Submitter-Id: apache >Arrival-Date: Mon Feb 1 15:20:00 PST 1999 >Last-Modified: >Originator: [EMAIL PROTECTED] >Organization: apache >Release: 1.3.4 >Environment: Linux 2.0.34, Gnu etc... >Description: The following patch makes dbmmanage maintain a list of groups for each user in the DB file; the format for entries is:
encrypted-password:comma-separated-list-of-groups This allows for users in multiple groups, and a single DB file when using mod_auth_db. >How-To-Repeat: >Fix: The patch file follows: ----------------------------------------- *** /usr/bin/dbmmanage Mon Feb 1 17:15:37 1999 --- /usr/bin/dbmunge Tue Feb 2 08:58:57 1999 *************** *** 97,103 **** sub usage { my $cmds = join "|", sort keys %dbmc::; ! die "usage: $0 filename [$cmds] [username]\n"; } my $x; --- 97,103 ---- sub usage { my $cmds = join "|", sort keys %dbmc::; ! die "usage: $0 filename [$cmds] [username] [value]\n"; } my $x; *************** *** 151,163 **** sub dbmc::add { die "Can't use empty password!\n" unless $crypted_pwd; ! unless($is_update) { die "Sorry, user `$key' already exists!\n" if $DB{$key}; ! } ! $DB{$key} = $crypted_pwd; my $action = $is_update ? "updated" : "added"; ! print "User $key $action with password encrypted to $DB{$key}\n"; } sub dbmc::adduser { my $value = getpass "New password:"; --- 151,196 ---- sub dbmc::add { die "Can't use empty password!\n" unless $crypted_pwd; ! ! if ($is_update) { ! $DB{$key} =~ s/^[^:]*/$crypted_pwd/; ! } else { die "Sorry, user `$key' already exists!\n" if $DB{$key}; ! $DB{$key} = $crypted_pwd; ! }; ! my $action = $is_update ? "updated" : "added"; ! print "User $key $action. New record is: $DB{$key}\n"; ! } ! ! sub dbmc::addtogroup { ! die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key}; ! $DB{$key} =~ /([^:]*).?([^:]*)(.*)/; ! my ($hpwd,$grps,$other) = ($1,$2,$3); ! $grps =~ s/ //g; ! die "Sorry, user `$key' is already in group $crypted_pwd!\n" if ($grps =~ m/(^|,)$crypted_pwd(,|$)/ ); ! if ($grps eq "") { ! $grps = $crypted_pwd; ! } else { ! $grps = "$grps,$crypted_pwd"; ! }; ! $DB{$key} = "$hpwd:$grps$other"; ! print "User $key added to group $crypted_pwd, new record is: $hpwd:$grps$other\n"; } + + sub dbmc::delfromgroup { + die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key}; + $DB{$key} =~ /([^:]*).?([^:]*)(.*)/; + my ($hpwd,$grps,$other) = ($1,$2,$3); + $grps =~ s/ //g; + die "Sorry, user `$key' is not in group $crypted_pwd!\n" if (!($grps =~ m/(^|,)$crypted_pwd(,|$)/)) ; + $grps =~ s/^$crypted_pwd(,|$)//g; + $grps =~ s/,$crypted_pwd(,|$)/$1/g; + + $DB{$key} = "$hpwd:$grps$other"; + print "User $key delete from group $crypted_pwd, new record is: $hpwd:$grps$other\n"; + } + sub dbmc::adduser { my $value = getpass "New password:"; >Audit-Trail: >Unformatted: [In order for any reply to be added to the PR database, ] [you need to include <[EMAIL PROTECTED]> in the Cc line ] [and leave the subject line UNCHANGED. This is not done] [automatically because of the potential for mail loops. ] [If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request ] [from a developer. ] [Reply only with text; DO NOT SEND ATTACHMENTS! ]