Fix use_md5 on linux
authorJamie Cameron <jcameron@webmin.com>
Thu, 15 Jan 2009 05:19:04 +0000 (05:19 +0000)
committerJamie Cameron <jcameron@webmin.com>
Thu, 15 Jan 2009 05:19:04 +0000 (05:19 +0000)
useradmin/freebsd-lib.pl
useradmin/linux-lib.pl

index 09f1f09..5093c6e 100644 (file)
@@ -53,14 +53,14 @@ local $md5 = 0;
 while(<CONF>) {
        s/\r|\n//g;
        s/#.*$//;
-       $md5++ if (/passwd_format\s*=\s*md5/);
+       $md5 = 1 if (/passwd_format\s*=\s*md5/);
        }
 close(CONF);
 &open_readfile(CONF, "/etc/auth.conf");
 while(<CONF>) {
        s/\r|\n//g;
        s/#.*$//;
-       $md5++ if (/crypt_default\s*=\s*md5/);
+       $md5 = 1 if (/crypt_default\s*=\s*md5/);
        }
 close(CONF);
 return $md5;
index 09c2de2..de90fdf 100644 (file)
@@ -72,7 +72,9 @@ if (&foreign_check("pam")) {
        LOOP:
        foreach my $m (@{$svc->{'mods'}}) {
                if ($m->{'type'} eq 'password') {
-                       if ($m->{'args'} =~ /md5/) { $md5++; }
+                       if ($m->{'args'} =~ /md5/) {
+                               $md5 = 1;
+                               }
                        elsif ($m->{'module'} =~ /pam_stack\.so/ &&
                               $m->{'args'} =~ /service=(\S+)/) {
                                # Referred to another service!
@@ -100,7 +102,7 @@ elsif (&open_readfile(PAM, "/etc/pam.d/passwd")) {
        # Otherwise try to check the PAM file directly
        while(<PAM>) {
                s/#.*$//g;
-               $md5++ if (/^password.*md5/);
+               $md5 = 1 if (/^password.*md5/);
                }
        close(PAM);
        }
@@ -108,7 +110,7 @@ if (&open_readfile(DEFS, "/etc/login.defs")) {
        # The login.defs file is used on debian sometimes
        while(<DEFS>) {
                s/#.*$//g;
-               $md5++ if (/MD5_CRYPT_ENAB\s+yes/i);
+               $md5 = 1 if (/MD5_CRYPT_ENAB\s+yes/i);
                }
        close(DEFS);
        }