1. md5crypt isn't support anymore
2. if you want des passwords, go use vipw

I kept auto and blowfish instead of just hard coding blowfish because
there's some bits that allow fiddling with the salt. (that needs
improvement too, but not this diff)

Index: adduser.perl
===================================================================
RCS file: /cvs/src/usr.sbin/adduser/adduser.perl,v
retrieving revision 1.61
diff -u -p -r1.61 adduser.perl
--- adduser.perl        15 Feb 2014 06:27:50 -0000      1.61
+++ adduser.perl        13 Jul 2014 10:18:41 -0000
@@ -96,7 +96,7 @@ sub variables {
     # common shells, first element has higher priority
     @shellpref = ('csh', 'sh', 'bash', 'tcsh', 'ksh');
 
-    @encryption_methods = ('auto', 'blowfish', 'md5', 'des', 'old');
+    @encryption_methods = ('auto', 'blowfish' );
 
     $defaultshell = 'ksh';     # defaultshell if not empty
     $group_uniq = 'USER';
@@ -958,18 +958,7 @@ sub uniq {
 # That may be a DES salt or a blowfish rotation count
 sub salt {
     local($salt);              # initialization
-    if ($encryptionmethod eq "des" || $encryptionmethod eq "old") {
-        local($i, $rand);
-        local(@itoa64) = ( '0' .. '9', 'a' .. 'z', 'A' .. 'Z' ); # 0 .. 63
-
-        warn "calculate salt\n" if $verbose > 1;
-
-        for ($i = 0; $i < 8; $i++) {
-           srand(time + $rand + $$);
-           $rand = rand(25*29*17 + $rand);
-           $salt .=  $itoa64[$rand & $#itoa64];
-        }
-    } elsif ($encryptionmethod eq "md5" || $encryptionmethod eq "auto") {
+    if ($encryptionmethod eq "auto") {
         $salt = "";
     } elsif ($encryptionmethod =~ /^blowfish/ ) {
         ($encryptionmethod, $salt) = split(/\,/, $encryptionmethod);
@@ -991,11 +980,7 @@ sub encrypt {
     local($pass, $salt) = ($_[0], $_[1]);
     local(@args, $crypt);
 
-    if ($encryptionmethod eq "des" || $encryptionmethod eq "old") {
-        @args = ("-s", $salt);
-    } elsif ($encryptionmethod eq "md5") {
-        @args = ("-m");
-    } elsif ($encryptionmethod eq "blowfish") {
+    if ($encryptionmethod eq "blowfish") {
         @args = ("-b", $salt);
     } elsif ($encryptionmethod eq "auto") {
         @args = ("-c", $log_cl);

Reply via email to