From ce975f0b3ed0c5a978db8dc14cd5848cb4d9d4fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Bernigaud?= Date: Thu, 28 Mar 2013 11:03:22 +0100 Subject: [PATCH] Fixes: #2170 sambaPwdCanChange is obsolete --- samba/personal/samba/class_sambaAccount.inc | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/samba/personal/samba/class_sambaAccount.inc b/samba/personal/samba/class_sambaAccount.inc index c6ea79d..f70b4e2 100644 --- a/samba/personal/samba/class_sambaAccount.inc +++ b/samba/personal/samba/class_sambaAccount.inc @@ -298,8 +298,7 @@ class sambaAccount extends simplePlugin ), new BooleanAttribute ( _('Cannot change password'), _('Not allowed to change password'), - 'sambaPwdCanChange', FALSE, FALSE, '', - '4294967295', '' + 'fd_pwdCantChange' ), new DateAttribute ( _('Account expiration'), _('When does the account expire'), @@ -371,6 +370,15 @@ class sambaAccount extends simplePlugin 'erase' => array ('' => array ('sambaHomePath')) ) ); + $this->attributesAccess['sambaPwdLastSet']->setManagedAttributes( + array( + 'disable' => array (TRUE => array ('fd_pwdCantChange')) + ) + ); + $this->attributesAccess['fd_pwdCantChange']->setInLdap(FALSE); + $value = (isset($this->attrs['sambaPwdLastSet']) && ($this->attrs['sambaPwdLastSet'][0] == '4294967295')); + $this->attributesAccess['fd_pwdCantChange']->setInitialValue($value); + $this->attributesAccess['fd_pwdCantChange']->setValue($value); // Get samba domain and its sid/rid base if ($this->sambaSID != "") { @@ -492,11 +500,10 @@ class sambaAccount extends simplePlugin } /* Do not modify values if not needed */ - if (!$this->attributesAccess['sambaPwdLastSet']->hasChanged()) { + if (!$this->attributesAccess['sambaPwdLastSet']->hasChanged() && !$this->attributesAccess['fd_pwdCantChange']->hasChanged()) { unset($this->attrs['sambaPwdLastSet']); - } - if (!$this->attributesAccess['sambaPwdCanChange']->hasChanged()) { - unset($this->attrs['sambaPwdCanChange']); + } elseif (!$this->sambaPwdLastSet) { + $this->attrs['sambaPwdLastSet'] = ($this->fd_pwdCantChange?array('4294967295'):''); } // Handle "sambaKickoffTime" -- 1.7.2.5