diff --git a/lam/lib/tree.inc b/lam/lib/tree.inc
index a8778688..a2ae5175 100644
--- a/lam/lib/tree.inc
+++ b/lam/lib/tree.inc
@@ -1107,32 +1107,9 @@ function get_enc_type( $user_password )
/* Capture the stuff in the { } to determine if this is crypt, md5, etc. */
$enc_type = null;
if( preg_match( "/{([^}]+)}/", $user_password, $enc_type) )
- $enc_type = strtolower( $enc_type[1] );
+ return $enc_type[1];
else
return null;
-
- /* handle crypt types */
- if( 0 == strcasecmp( $enc_type, 'crypt') ) {
- $salt = null;
- if( preg_match( "/{[^}]+}\\$(.)\\$/", $user_password, $salt) )
- $salt = $salt[1];
- else
- $salt = null;
- switch( $salt ) {
- case '': // CRYPT_STD_DES
- $enc_type = "crypt";
- break;
- case '1': // CRYPT_MD5
- $enc_type = "md5crypt";
- break;
- case '2': // CRYPT_BLOWFISH
- $enc_type = "blowfish";
- break;
- default:
- $enc_type = "crypt";
- }
- }
- return $enc_type;
}
/**
diff --git a/lam/templates/tree/edit.php b/lam/templates/tree/edit.php
index e58d49dc..49d8530e 100644
--- a/lam/templates/tree/edit.php
+++ b/lam/templates/tree/edit.php
@@ -341,7 +341,7 @@ foreach( $attrs as $attr => $vals ) {
+ value="" />
$vals ) {
value="" />
diff --git a/lam/templates/tree/update_confirm.php b/lam/templates/tree/update_confirm.php
index 61f0795f..27399386 100644
--- a/lam/templates/tree/update_confirm.php
+++ b/lam/templates/tree/update_confirm.php
@@ -88,7 +88,7 @@ foreach( $old_values as $attr => $old_val )
// special case for userPassword attributes
if( 0 == strcasecmp( $attr, 'userPassword' ) && $new_val != '' ) {
- $new_val = password_hash( $new_val, $_POST['enc_type'] );
+ $new_val = pwd_hash($new_val, true, $_POST['enc_type'] );
$password_already_hashed = true;
}
// special case for samba password
@@ -111,7 +111,7 @@ if( isset( $_POST['enc_type'] ) &&
$_POST['enc_type'] != 'clear' &&
$_POST['new_values']['userpassword'] != '' ) {
- $new_password = password_hash( $_POST['new_values']['userpassword'], $_POST['enc_type'] );
+ $new_password = pwd_hash( $_POST['new_values']['userpassword'], true, $_POST['enc_type'] );
$update_array[ 'userpassword' ] = $new_password;
}
@@ -160,7 +160,7 @@ foreach( $update_array as $attr => $val ) {
foreach( $old_values[ $attr ] as $v )
echo nl2br( htmlspecialchars( $v ) ) . "
";
else
- if( 0 == strcasecmp( $attr, 'userPassword' ) && ( obfuscate_password_display() || is_null( get_enc_type( $old_values[ $attr ] ) ) ) ) {
+ if( 0 == strcasecmp( $attr, 'userPassword' ) && ( is_null( get_enc_type( $old_values[ $attr ] ) ) ) ) {
echo preg_replace( '/./', '*', $old_values[ $attr ] ) . "
";
}
else {
@@ -190,7 +190,7 @@ foreach( $update_array as $attr => $val ) {
}
else
if( $new_val != '' )
- if( 0 == strcasecmp( $attr, 'userPassword' ) && ( obfuscate_password_display() || is_null( get_enc_type( $new_values[ $attr ] ) ) ) ) {
+ if( 0 == strcasecmp( $attr, 'userPassword' ) && ( is_null( get_enc_type( $new_values[ $attr ] ) ) ) ) {
echo preg_replace( '/./', '*', $new_val ) . "
";
}
else {