added random number
This commit is contained in:
parent
5d3ab5976f
commit
5cb72a2314
|
@ -136,6 +136,9 @@ class Ldap{
|
||||||
var $supports_samba2_schema=false; // objectClass sambaAccount
|
var $supports_samba2_schema=false; // objectClass sambaAccount
|
||||||
var $supports_samba3_schema=false; // objectClass sambaSamAccount
|
var $supports_samba3_schema=false; // objectClass sambaSamAccount
|
||||||
|
|
||||||
|
// random number (changes on every page request)
|
||||||
|
var $rand;
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
// $config: an object of Config (../config/config.php)
|
// $config: an object of Config (../config/config.php)
|
||||||
function Ldap($config) {
|
function Ldap($config) {
|
||||||
|
@ -171,6 +174,8 @@ class Ldap{
|
||||||
"uidnumber" => _("UID number"),
|
"uidnumber" => _("UID number"),
|
||||||
"gidnumber" => _("GID number")
|
"gidnumber" => _("GID number")
|
||||||
);
|
);
|
||||||
|
mt_srand((double)microtime()*1000000);
|
||||||
|
$this->rand = mt_rand();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,13 +336,16 @@ class Ldap{
|
||||||
// define which attributes to save
|
// define which attributes to save
|
||||||
return array("conf", "username", "password", "ldapUserAttributes", "ldapGroupAttributes",
|
return array("conf", "username", "password", "ldapUserAttributes", "ldapGroupAttributes",
|
||||||
"ldapHostAttributes", "objectClasses", "supports_unix_hosts", "supports_samba2_schema",
|
"ldapHostAttributes", "objectClasses", "supports_unix_hosts", "supports_samba2_schema",
|
||||||
"supports_samba3_schema");
|
"supports_samba3_schema", "rand");
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconnects to LDAP server when deserialized
|
// reconnects to LDAP server when deserialized
|
||||||
function __wakeup() {
|
function __wakeup() {
|
||||||
$data = $this->decrypt();
|
$data = $this->decrypt();
|
||||||
$this->connect($data[0], $data[1]);
|
$this->connect($data[0], $data[1]);
|
||||||
|
// change random number
|
||||||
|
mt_srand($this->rand + (microtime() * 1000000));
|
||||||
|
$this->rand = mt_rand();
|
||||||
}
|
}
|
||||||
|
|
||||||
// encrypts username and password
|
// encrypts username and password
|
||||||
|
|
Loading…
Reference in New Issue