";
echo (" Current Config
");
$conf->printconf();
echo ("
Starting Test...
");
// now all prferences are loaded
echo ("Loading preferences...");
$ServerURL = $conf->get_ServerURL();
$Admins = $conf->get_Admins();
$Passwd = $conf->get_Passwd();
$Adminstring = $conf->get_Adminstring();
$Suff_users = $conf->get_UserSuffix();
$Suff_groups = $conf->get_GroupSuffix();
$Suff_hosts = $conf->get_HostSuffix();
$MinUID = $conf->get_minUID();
$MaxUID = $conf->get_maxUID();
$MinGID = $conf->get_minGID();
$MaxGID = $conf->get_maxGID();
$MinMachine = $conf->get_minMachine();
$MaxMachine = $conf->get_maxMachine();
$userlistAttributes = $conf->get_userlistAttributes();
$grouplistAttributes = $conf->get_grouplistAttributes();
$hostlistAttributes = $conf->get_hostlistAttributes();
$maxlistentries = $conf->get_maxlistentries();
$defaultlanguage = $conf->get_defaultlanguage();
$scriptpath = $conf->get_scriptPath();
$scriptServer = $conf->get_scriptServer();
$samba3 = $conf->get_samba3();
$domainSID = $conf->get_domainSID();
echo ("done
");
// next we modify them and save lam.conf
echo ("Changing preferences...");
$conf->set_ServerURL("ldap://123.345.678.123:777");
$conf->set_Admins(array("uid=test,o=test,dc=org","uid=root,o=test2,c=de"));
$conf->set_Passwd("123456abcde");
$conf->set_Adminstring("uid=test,o=test,dc=org;uid=root,o=test2,c=de");
$conf->set_UserSuffix("ou=test,o=test,c=de");
$conf->set_GroupSuffix("ou=testgrp,o=test,c=de");
$conf->set_HostSuffix("ou=testhst,o=test,c=de");
$conf->set_minUID("25");
$conf->set_maxUID("254");
$conf->set_minGID("253");
$conf->set_maxGID("1234");
$conf->set_minMachine("3");
$conf->set_maxMachine("47");
$conf->set_userlistAttributes("#uid;#cn");
$conf->set_grouplistAttributes("#gidNumber;#cn;#memberUID");
$conf->set_hostlistAttributes("#cn;#uid;#description");
$conf->set_maxlistentries("54");
$conf->set_defaultlanguage("de_AT:iso639_de:Deutsch (Oesterreich)");
$conf->set_scriptPath("/var/www/lam/lib/script");
$conf->set_scriptServer("127.0.0.1");
$conf->set_samba3("yes");
$conf->set_domainSID("S-0-1-22-1234567890-1234567890-1234567890");
$conf->save();
echo ("done
");
// at last all preferences are read from lam.conf and compared
echo ("Loading and comparing...");
$conf = new Config('default');
if ($conf->get_ServerURL() != "ldap://123.345.678.123:777") echo ("
Saving ServerURL failed!
");
$adm_arr = $conf->get_Admins();
if ($adm_arr[0] != "uid=test,o=test,dc=org") echo ("
Saving admins failed!" . $adm_arr[0] . "
");
if ($adm_arr[1] != "uid=root,o=test2,c=de") echo ("
Saving admins failed!
");
if ($conf->get_Passwd() != "123456abcde") echo ("
Saving password failed!
");
if ($conf->get_Adminstring() != "uid=test,o=test,dc=org;uid=root,o=test2,c=de") echo ("
Saving admin string failed!
");
if ($conf->get_UserSuffix() != "ou=test,o=test,c=de") echo ("
Saving user suffix failed!
");
if ($conf->get_GroupSuffix() != "ou=testgrp,o=test,c=de") echo ("
Saving group suffix failed!
");
if ($conf->get_HostSuffix() != "ou=testhst,o=test,c=de") echo ("
Saving host suffix failed!
");
if ($conf->get_minUID() != "25") echo ("
Saving minUID failed!
");
if ($conf->get_maxUID() != "254") echo ("
Saving maxUID failed!
");
if ($conf->get_minGID() != "253") echo ("
Saving minGID failed!
");
if ($conf->get_maxGID() != "1234") echo ("
Saving maxGID failed!
");
if ($conf->get_minMachine() != "3") echo ("
Saving maxMachine failed!
");
if ($conf->get_maxMachine() != "47") echo ("
Saving minMachine failed!
");
if ($conf->get_userlistAttributes() != "#uid;#cn") echo ("
Saving userlistAttributes failed!
");
if ($conf->get_grouplistAttributes() != "#gidNumber;#cn;#memberUID") echo ("
Saving grouplistAttributes failed!
");
if ($conf->get_hostlistAttributes() != "#cn;#uid;#description") echo ("
Saving hostlistAttributes failed!
");
if ($conf->get_maxlistentries() != "54") echo ("
Saving maxlistentries failed!
");
if ($conf->get_defaultlanguage() != "de_AT:iso639_de:Deutsch (Oesterreich)") echo ("
Saving default language failed!
");
if ($conf->get_scriptPath() != "/var/www/lam/lib/script") echo ("
Saving script path failed!
");
if ($conf->get_scriptServer() != "127.0.0.1") echo ("
Saving script server failed!
");
if ($conf->get_samba3() != "yes") echo ("
Saving samba3 failed!
");
if ($conf->get_domainSID() != "S-0-1-22-1234567890-1234567890-1234567890") echo ("
Saving domainSID failed!
");
echo ("done
");
// restore old values
echo ("Restoring old preferences...");
$conf->set_ServerURL($ServerURL);
$conf->set_Admins($Admins);
$conf->set_Passwd($Passwd);
$conf->set_Adminstring($Adminstring);
$conf->set_UserSuffix($Suff_users);
$conf->set_GroupSuffix($Suff_groups);
$conf->set_HostSuffix($Suff_hosts);
$conf->set_minUID($MinUID);
$conf->set_maxUID($MaxUID);
$conf->set_minGID($MinGID);
$conf->set_maxGID($MaxGID);
$conf->set_minMachine($MinMachine);
$conf->set_maxMachine($MaxMachine);
$conf->set_userlistAttributes($userlistAttributes);
$conf->set_grouplistAttributes($grouplistAttributes);
$conf->set_hostlistAttributes($hostlistAttributes);
$conf->set_maxlistentries($maxlistentries);
$conf->set_defaultLanguage($defaultlanguage);
$conf->set_scriptPath($scriptpath);
$conf->set_scriptServer($scriptserver);
$conf->set_samba3($samba3);
$conf->set_domainSID($domainSID);
$conf->save();
echo ("done
");
// finished
echo ("
Test is complete.");
echo ("
Current Config
");
$conf->printconf();
?>