mirror of
https://github.com/webmin/webmin.git
synced 2025-08-17 19:06:28 +00:00
added support for using Unix SHA in ldap-useradmin module
This commit is contained in:
@ -35,7 +35,7 @@ home_style=Automatic home directory style,4,0-home/username,1-home/u/username,2-
|
||||
line6=New user options,11
|
||||
base_uid=Lowest UID for new users,3,From Users and Groups module
|
||||
base_gid=Lowest GID for new groups,3,From Users and Groups module
|
||||
md5=Encryption method for passwords,1,3-LDAP MD5,1-Unix MD5,0-crypt,2-Plain text,4-LDAP SSHA
|
||||
md5=Encryption method for passwords,1,3-LDAP MD5,1-Unix MD5,0-crypt,2-Plain text,4-LDAP SSHA,5-Unix SHA
|
||||
shells=Build list of shells from,2,fixed-Builtin list,passwd-System users,shells-/etc/shells
|
||||
|
||||
line7=New user defaults,11
|
||||
|
@ -133,6 +133,14 @@ sub encrypt_password
|
||||
{
|
||||
local ($pass, $salt) = @_;
|
||||
&seed_random();
|
||||
if ($config{'md5'} == 5) {
|
||||
# SHA encryption
|
||||
local $qp = quotemeta($pass);
|
||||
local $out = `$config{'slappasswd'} -h '{sha}' -s $qp 2>/dev/null`;
|
||||
$out =~ s/\s+$//;
|
||||
$out =~ s/^\{sha\}//i;
|
||||
return $out;
|
||||
}
|
||||
if ($config{'md5'} == 4) {
|
||||
# LDAP SSHA encryption
|
||||
local $qp = quotemeta($pass);
|
||||
|
@ -137,6 +137,7 @@ if ($in{'new'} && !$access{'gmultiple'}) {
|
||||
|
||||
$pfx = $config{'md5'} == 1 || $config{'md5'} == 3 ? "{md5}" :
|
||||
$config{'md5'} == 4 ? "{ssha}" :
|
||||
$config{'md5'} == 5 ? "{sha}" :
|
||||
$config{'md5'} == 0 ? "{crypt}" : "";
|
||||
if ($in{'passmode'} == 0) {
|
||||
$pass = "";
|
||||
|
@ -238,6 +238,7 @@ else {
|
||||
|
||||
local $pfx = $config{'md5'} == 1 || $config{'md5'} == 3 ? "{md5}" :
|
||||
$config{'md5'} == 4 ? "{ssha}" :
|
||||
$config{'md5'} == 5 ? "{sha}" :
|
||||
$config{'md5'} == 0 ? "{crypt}" : "";
|
||||
if ($in{'passmode'} == 0) {
|
||||
# Password is blank
|
||||
|
Reference in New Issue
Block a user