|
From: Dave I. <dav...@en...> - 2006-02-17 16:07:49
|
Correction. The change I outlined below *does* fix both my original problem
and the follow-up problem. So the tweak to unix_crypt() is *not* necessary.
Cheers
Dave I
-----Original Message-----
From: web...@li...
[mailto:web...@li...] On Behalf Of Dave Isaacs
Sent: Friday, February 17, 2006 10:42 AM
To: 'web...@li...'
Subject: RE: [webmin-l] Change Password error
I think I found the problem.
Below is a snippet from passwd/save_passwd.cgi (shown with line numbers).
Note line 70, where $user gets assigned. I think this line should be up at
line 55. If I compare this version of save_passwd.cgi to one from an older
version of Webmin (v1.170 to be specific), in the older version the code to
assign $user does occur before the "# Validate inputs" comment.
I tried moving line 70 to line 55 as described above, and the problem I was
having validating the old password went away.
Unfortunately this did not fix my original problem (the "Failed to encrypt
password" error), so the tweak to the unix_crypt() subroutine you described
is still necessary.
53 # Update the config files directly via the useradmin module
54 &foreign_require("useradmin", "user-lib.pl");
55
56 # Validate inputs
57 if ($access{'old'} == 1 ||
58 $access{'old'} == 2 && $user->{'user'} ne $remote_user)
{
59 &unix_crypt($in{'old'}, $user->{'pass'}) eq
$user->{'pass'} ||
60 &error($text{'passwd_eold'});
61 }
62 if ($access{'repeat'}) {
63 $in{'new'} eq $in{'repeat'} ||
&error($text{'passwd_erepeat'});
64 }
65 $err = &useradmin::check_password_restrictions(
66 $in{'new'}, $in{'user'});
67 &error($err) if ($err);
68
69 # Find the user, either in local password file or LDAP
70 $user = &find_user($in{'user'});
71
72 if ($user) {
73 &can_edit_passwd([ $user->{'user'}, $user->{'pass'},
74 $user->{'uid'}, $user->{'gid'} ])
||
75 &error($text{'passwd_ecannot'});
76
77 # Actually do the change
78 &change_password($user, $in{'new'},
79 $access{'others'} == 1 ||
80 $access{'others'} == 2 && $in{'others'});
81 }
82 else {
83 &error($text{'passwd_euser'});
84 }
85 delete($user->{'plainpass'});
86 delete($user->{'pass'});
87 &webmin_log("passwd", undef, $user->{'user'}, $user);
88 }
Thanks
Dave I
-----Original Message-----
From: web...@li...
[mailto:web...@li...] On Behalf Of Dave Isaacs
Sent: Friday, February 17, 2006 10:10 AM
To: 'web...@li...'
Subject: RE: [webmin-l] Change Password error
Here is the line from /etc/shadow
entconfig:FTtGqKpdrEpjg:13196:0:99999:7:::
In Users and Groups, the Pre-encrypted password shows up as FTtGqKpdrEpjg.
Thanks
Dave I
-----Original Message-----
From: web...@li...
[mailto:web...@li...
<mailto:web...@li...> ] On Behalf Of Jamie
Cameron
Sent: Friday, February 17, 2006 3:57 AM
To: web...@li...
Subject: RE: [webmin-l] Change Password error
Hi Dave,
That is definately a bug..
What does the user in question have in the password field of his entry in
/etc/passwd or /etc/shadow? Or more importantly, if you edit him in the
Users and Groups module, does his encrypted password show up properly?
- Jamie
-----Original Message-----
From: Dave Isaacs <dav...@en...>
Subj: RE: [webmin-l] Change Password error
Date: Fri 17 Feb 2006 6:53 am
Size: 2K
To: "'web...@li...'"
<web...@li...>
Sorry, I have to take that back. This doesn't work.
Yes, it allows me to change the password, but now I can put anything in the
"Old Password" field and have it work. That's bad.
Dave I
-----Original Message-----
From: web...@li...
[mailto:web...@li...
<mailto:web...@li...> ] On Behalf Of Dave
Isaacs
Sent: Wednesday, February 15, 2006 6:23 PM
To: 'web...@li...'
Subject: RE: [webmin-l] Change Password error
That works. Thanks!
Dave I
-----Original Message-----
From: web...@li...
[mailto:web...@li...
<mailto:web...@li...>
<mailto:web...@li...
<mailto:web...@li...> > ] On Behalf Of Jamie
Cameron
Sent: Wednesday, February 15, 2006 6:09 PM
To: web...@li...
Subject: RE: [webmin-l] Change Password error
Hi Dave,
Basically, all I did was change the function unix_crypt in the file
web-lib-funcs.pl to:
# unix_crypt(password, salt)
# Performs Unix encryption on a password, using crypt() or Crypt::UnixCrypt
sub unix_crypt { local ($pass, $salt) = @_;
return "" if (!$salt); # same as real crypt
local $rv = eval "crypt(\$pass, \$salt)";
local $err = $@;
return $rv if ($rv && !$@);
eval "use Crypt::UnixCrypt";
if (!$@) {
return Crypt::UnixCrypt::crypt($pass, $salt);
}
else {
&error("Failed to encrypt password : $err");
}
}
You could do the same thing by directly editing that file in your copy of
Webmin.
- Jamie
On 16/Feb/2006 00:54 Dave Isaacs wrote ..
> Is it possible to give me details (or at least hints) of what need to
> be fixed? I have to deliver a production system by the end of the
> month and I have no working change password feature.
>
> Thanks
>
> Dave I
>
> -----Original Message-----
> From: web...@li...
> [mailto:web...@li...
<mailto:web...@li...>
<mailto:web...@li...
<mailto:web...@li...> > ] On Behalf Of Jamie
> Cameron
> Sent: Tuesday, February 14, 2006 6:39 PM
> To: web...@li...
> Subject: RE: [webmin-l] Change Password error
>
>
> There is another way it could happen - but I will deal with that in
--- message truncated ---
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk
<http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642>
&kid=103432&bid=230486&dat=121642
-
Forwarded by the Webmin mailing list at web...@li...
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-list
<http://lists.sourceforge.net/lists/listinfo/webadmin-list>
|