From d5c8d42adccdca089dfb294a8960a2e3831eb308 Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 27 Apr 2011 23:09:43 +1000 Subject: [PATCH] SF Bug #3004012 - password sync for sambaSamAccount template broken. --- lib/AttributeFactory.php | 5 ++++- lib/PageRender.php | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/AttributeFactory.php b/lib/AttributeFactory.php index a928c29..975b2a3 100644 --- a/lib/AttributeFactory.php +++ b/lib/AttributeFactory.php @@ -83,7 +83,10 @@ class AttributeFactory { if (isset($values['type'])) switch ($values['type']) { case 'password': - return $this->newPasswordAttribute($name,$values,$server_id,$source); + if (! strcasecmp($name,'sambaLMPassword') || ! strcasecmp($name,'sambaNTPassword')) + return $this->newSambaPasswordAttribute($name,$values,$server_id,$source); + else + return $this->newPasswordAttribute($name,$values,$server_id,$source); case 'multiselect': case 'select': diff --git a/lib/PageRender.php b/lib/PageRender.php index 745387a..02cdb80 100644 --- a/lib/PageRender.php +++ b/lib/PageRender.php @@ -189,7 +189,10 @@ class PageRender extends Visitor { $blank++; } - } elseif (count($attribute2->getValues()) !=1) { + } elseif (count($attribute2->getValues()) == 0) { + return; + + } elseif (count($attribute2->getValues()) != 1) { array_push($values,''); $blank++; @@ -231,6 +234,9 @@ class PageRender extends Visitor { return; } + if (! $attribute->hasBeenModified()) + return; + # Get the attribute. if (preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',strtolower($args[1]),$matchall)) { if (count($matchall[1]) != 1) @@ -272,7 +278,7 @@ class PageRender extends Visitor { case 'nt': $sambapassword = new smbHash; - $vals[$i] = $sambapassword->nthash($passwordvalue); break; + $vals[$i] = $sambapassword->nthash($passwordvalue); break;