From d9cbf3639ade0a2c6cbb017039d60d6cbf97d783 Mon Sep 17 00:00:00 2001 From: katagia Date: Fri, 11 Jul 2003 13:53:28 +0000 Subject: [PATCH] Fixed pwdcanchange and pwdmustchange --- lam/lib/account.inc | 12 ++--- lam/templates/account.php | 102 +++++++++++++++++++++++++++-------- lam/templates/masscreate.php | 1 + 3 files changed, 87 insertions(+), 28 deletions(-) diff --git a/lam/lib/account.inc b/lam/lib/account.inc index a6de5b5e..df4cdac1 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -89,13 +89,15 @@ function initvars($type=false,$DN=false) { // This function registers all needes @session_start(); if ($type) { if (session_is_registered("type2")) session_unregister("type2"); - else session_register("type2"); // $type2 stores the kind of account (User|Group|Host) + session_register("type2"); // $type2 stores the kind of account (User|Group|Host) $_SESSION['type2'] = $type; if (session_is_registered("shelllist")) session_unregister("shelllist"); - else session_register("shelllist"); // $shelllist contains all shells defined in /etc/shells + session_register("shelllist"); // $shelllist contains all shells defined in /etc/shells $_SESSION['shelllist'] = getshells(); // Write List of all valid shells in variable if (session_is_registered("account")) session_unregister("account"); - else session_register("account"); // The new Accout properties are stored here + session_register("account"); // The new Accout properties are stored here + if (session_is_registered("errors")) session_unregister("errors"); + session_register("errors"); // $type2 stores the kind of account (User|Group|Host) if ($DN) { if (session_is_registered("account_old")) session_unregister("account_old"); else session_register("account_old"); // Only valid if an account should be modified. It'll contains the existing account properties @@ -358,8 +360,6 @@ function checksamba($values, $type) { // This function checks all samba account if ((!$values->smb_domain=='') && !ereg('^([a-z]|[A-Z]|[0-9]|[-])+$', $values->smb_domain)) $errors[] = array('ERROR', _('Domain Name'), _('Domain Name contents invalid characters. Valid characters are: a-z, A-Z, 0-9 and -.')); if ($values->smb_useunixpwd) $return->smb_useunixpwd = 1; else $return->smb_useunixpwd = 0; - if ($values->smb_pwdcanchange) $return->smb_pwdcanchange = 1; else $return->smb_pwdcanchange = 0; - if ($values->smb_pwdmustchange) $return->smb_pwdmustchange = 1; else $return->smb_pwdmustchange = 0; if ($values->smb_password) { // Encrypt password $return->smb_password = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $values->smb_password, @@ -373,8 +373,6 @@ function checksamba($values, $type) { // This function checks all samba account if ((!$values->smb_domain=='') && !ereg('^([a-z]|[A-Z]|[0-9]|[-])+$', $values->smb_domain)) $errors[] = array('ERROR', _('Domain Name'), _('Domain Name contents invalid characters. Valid characters are: a-z, A-Z, 0-9 and -.')); if ($values->smb_useunixpwd) $return->smb_useunixpwd = 1; else $return->smb_useunixpwd = 0; - if ($values->smb_pwdcanchange) $return->smb_pwdcanchange = 1; else $return->smb_pwdcanchange = 0; - if ($values->smb_pwdmustchange) $return->smb_pwdmustchange = 1; else $return->smb_pwdmustchange = 0; if ($values->smb_password) { // Encrypt password $return->smb_password = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $values->smb_password, diff --git a/lam/templates/account.php b/lam/templates/account.php index 65af0054..de7ab015 100644 --- a/lam/templates/account.php +++ b/lam/templates/account.php @@ -133,14 +133,14 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch MCRYPT_MODE_ECB, base64_decode($_COOKIE['IV']))); } else $_SESSION['account']->smb_password = ""; + $_SESSION['account']->smb_pwdcanchange = mktime($_POST['f_smb_pwdcanchange_s'], $_POST['f_smb_pwdcanchange_m'], $_POST['f_smb_pwdcanchange_h'], + $_POST['f_smb_pwdcanchange_mon'], $_POST['f_smb_pwdcanchange_day'], $_POST['f_smb_pwdcanchange_yea']); + $_SESSION['account']->smb_pwdmustchange = mktime($_POST['f_smb_pwdmustchange_s'], $_POST['f_smb_pwdmustchange_m'], $_POST['f_smb_pwdmustchange_h'], + $_POST['f_smb_pwdmustchange_mon'], $_POST['f_smb_pwdmustchange_day'], $_POST['f_smb_pwdmustchange_yea']); if ($_POST['f_smb_password_no']) $_SESSION['account']->smb_password_no = true; else $_SESSION['account']->smb_password_no = false; if ($_POST['f_smb_useunixpwd']) $_SESSION['account']->smb_useunixpwd = $_POST['f_smb_useunixpwd']; else $_SESSION['account']->smb_useunixpwd = false; - if ($_POST['f_smb_pwdcanchange']) $_SESSION['account']->smb_pwdcanchange = $_POST['f_smb_pwdcanchange']; - else $_SESSION['account']->smb_pwdcanchange = false; - if ($_POST['f_smb_pwdmustchange']) $_SESSION['account']->smb_pwdmustchange = $_POST['f_smb_pwdmustchange']; - else $_SESSION['account']->smb_pwdmustchange = false; if ($_POST['f_smb_homedrive']) $_SESSION['account']->smb_homedrive = $_POST['f_smb_homedrive']; if ($_POST['f_smb_scriptpath']) $_SESSION['account']->smb_scriptPath = $_POST['f_smb_scriptpath']; else $_SESSION['account']->smb_scriptPath = ''; @@ -321,7 +321,6 @@ if ($select_local != 'pdf') { "; } - switch ($select_local) { // backmain = back to lists // load = load profile @@ -389,6 +388,7 @@ if ($select_local != 'pdf') { for ($i=0; $ismb_pwdcanchange); + $mustchangedate = getdate($_SESSION['account']->smb_pwdmustchange); $_SESSION['account']->smb_flagsW = 0; echo ''; + echo ' + + + + + '; echo _('Samba Password'); echo ''."\n".' '."\n".''._('Help').' '."\n".''; echo _('User can change Password'); - echo ''."\n".'smb_pwdcanchange) echo ' checked '; - echo '>'."\n".' - '._('Help').' + echo ''."\n".''."\n".''; + echo ''._('Help').' '."\n".''; echo _('User must change Password'); - echo ''."\n".'smb_pwdmustchange) echo ' checked '; - echo '>'."\n".' - '._('Help').' + echo ''."\n".''."\n".''; + echo ''._('Help').' '."\n".''; echo _('Accout is deactivated'); echo ''."\n".''._('Help').' '."\n".''; echo _('Host can change Password'); - echo ''."\n".'smb_pwdcanchange) echo ' checked '; - echo '> - '._('Help').' + echo ''."\n".''."\n".''; + echo ''._('Help').' '."\n".''; echo _('Host must change Password'); - echo ''."\n".'smb_pwdmustchange) echo ' checked '; - echo '> - '._('Help').' + echo ''."\n".''."\n".''; + echo ''._('Help').' '."\n".''; echo _('Accout is deactivated'); echo ''."\n".''; break; case 'create':