From cf4f339b5c2dcef604a3c5d5f28cfc2b5f2b6143 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 14 Aug 2009 11:47:45 +1000 Subject: [PATCH] Fix missing encoding SambaPasswordAttributes --- lib/PageRender.php | 4 +++- lib/SambaPasswordAttribute.php | 2 +- lib/TemplateRender.php | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/PageRender.php b/lib/PageRender.php index f858216..92205ec 100644 --- a/lib/PageRender.php +++ b/lib/PageRender.php @@ -236,7 +236,9 @@ class PageRender extends Visitor { $enc = $_REQUEST[$matchall[1][0]][$passwordattr][$i]; } else - $enc = strtolower($args[0]); + $enc = $args[0]; + + $enc = strtolower($enc); switch ($enc) { case 'lm': diff --git a/lib/SambaPasswordAttribute.php b/lib/SambaPasswordAttribute.php index 04ce01e..a46e057 100644 --- a/lib/SambaPasswordAttribute.php +++ b/lib/SambaPasswordAttribute.php @@ -14,6 +14,6 @@ * @package phpLDAPadmin * @subpackage Templates */ -class SambaPasswordAttribute extends Attribute { +class SambaPasswordAttribute extends PasswordAttribute { } ?> diff --git a/lib/TemplateRender.php b/lib/TemplateRender.php index 0a3794e..caaab9f 100644 --- a/lib/TemplateRender.php +++ b/lib/TemplateRender.php @@ -2401,6 +2401,25 @@ function deleteAttribute(attrName,friendlyName,i) echo ''; } + protected function drawDefaultHelperSambaPasswordAttribute($attribute,$i) { + $id = 'enc'; + + if (! $attribute->getPostValue()) + printf('',$attribute->getName(),$i); + + switch ($attribute->getName()) { + case 'sambalmpassword' : $enc = 'lm'; break; + case 'sambantpassword' : $enc = 'nt'; break; + + default: + return ''; + } + + printf('', + $id,htmlspecialchars($attribute->getName()),$i, + $id,htmlspecialchars($attribute->getName()),$i,$enc); + } + /** SELECTION ATTRIBUTE RENDERING **/ protected function drawIconSelectionAttribute($attribute,$val) {