Bug 41925 - trivial patch to add automatic crypting to 'dbmmanage import'
trivial patch to add automatic crypting to 'dbmmanage import'
Status: NEW
Product: Apache httpd-2
Classification: Unclassified
Component: support
2.2.3
All All
: P2 normal (vote)
: ---
Assigned To: Apache HTTPD Bugs Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2007-03-21 20:06 UTC by Craig Sanders
Modified: 2007-03-21 20:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Sanders 2007-03-21 20:06:24 UTC
dbmmanage import expects username:password pairs to be already encrypted, when
it is a trivial patch to enable it to encrypt passwords itself if they are fed
in as plaintext.

see patch below.  it supports all the encryption types supported by the
manual/command-line input methods because it just calls the same crypting
function that was already in the script:

btw, if you have pre-crypted passwords to feed it, just use the "-p" (plaintext)
on the dbmmanage command line.  might make sense to have a synonym of "-n" for
"don't crypt" as well.



--- dbmmanage.orig	2007-02-12 16:52:43.000000000 +1100
+++ dbmmanage	2007-03-22 14:03:11.231980231 +1100
@@ -307,7 +307,9 @@
 
 sub dbmc::import {
     while(defined($_ = <STDIN>) and chomp) {
-	($key,$crypted_pwd,$groups,$comment) = split /:/, $_, 4;
+	my $plain_pwd;
+	($key,$plain_pwd,$groups,$comment) = split /:/, $_, 4;
+	$crypted_pwd = cryptpw($plain_pwd);
 	dbmc->add;
     }
 }