never dereference
This commit is contained in:
parent
b476a5c2f6
commit
18f6cd2dbc
|
@ -310,7 +310,7 @@ function search_domains($server = null, $suffix = null) {
|
||||||
if ($server == null) {
|
if ($server == null) {
|
||||||
$server = $_SESSION['ldap']->server();
|
$server = $_SESSION['ldap']->server();
|
||||||
}
|
}
|
||||||
$sr = @ldap_search($server, escapeDN($suffix), "objectClass=sambaDomain", $attr, 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$sr = @ldap_search($server, escapeDN($suffix), "objectClass=sambaDomain", $attr, 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if ($sr) {
|
if ($sr) {
|
||||||
$units = ldap_get_entries($server, $sr);
|
$units = ldap_get_entries($server, $sr);
|
||||||
// delete count entry
|
// delete count entry
|
||||||
|
|
|
@ -183,7 +183,7 @@ class cache {
|
||||||
// Get Data from ldap
|
// Get Data from ldap
|
||||||
$search = $this->attributes[$scope];
|
$search = $this->attributes[$scope];
|
||||||
$search[] = 'objectClass';
|
$search[] = 'objectClass';
|
||||||
$result = @ldap_search($_SESSION['ldap']->server(), escapeDN($suffix), 'objectClass=*', $search, 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$result = @ldap_search($_SESSION['ldap']->server(), escapeDN($suffix), 'objectClass=*', $search, 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
// Write search result in array
|
// Write search result in array
|
||||||
$entry = @ldap_first_entry($_SESSION['ldap']->server(), $result);
|
$entry = @ldap_first_entry($_SESSION['ldap']->server(), $result);
|
||||||
|
|
|
@ -285,7 +285,7 @@ class PlaLdapExporter extends PlaAbstractExporter{
|
||||||
elseif( $this->scope == 'one' )
|
elseif( $this->scope == 'one' )
|
||||||
$this->results = @ldap_list($this->ds, $this->base_dn, $this->queryFilter, $this->attributes);
|
$this->results = @ldap_list($this->ds, $this->base_dn, $this->queryFilter, $this->attributes);
|
||||||
else // scope == 'sub'
|
else // scope == 'sub'
|
||||||
$this->results = @ldap_search($this->ds, $this->base_dn, $this->queryFilter, $this->attributes, 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$this->results = @ldap_search($this->ds, $this->base_dn, $this->queryFilter, $this->attributes, 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
|
|
||||||
// if no result, there is a something wrong
|
// if no result, there is a something wrong
|
||||||
if( ! $this->results )
|
if( ! $this->results )
|
||||||
|
|
|
@ -134,7 +134,7 @@ class Ldap{
|
||||||
*/
|
*/
|
||||||
function search_units($suffix) {
|
function search_units($suffix) {
|
||||||
$ret = array();
|
$ret = array();
|
||||||
$sr = @ldap_search($this->server(), escapeDN($suffix), "objectClass=organizationalunit", array("DN"), 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$sr = @ldap_search($this->server(), escapeDN($suffix), "objectClass=organizationalunit", array("DN"), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if ($sr) {
|
if ($sr) {
|
||||||
$units = ldap_get_entries($this->server, $sr);
|
$units = ldap_get_entries($this->server, $sr);
|
||||||
unset($units['count']);
|
unset($units['count']);
|
||||||
|
|
|
@ -828,7 +828,7 @@ class lamList {
|
||||||
$module_filter = get_ldap_filter($this->type); // basic filter is provided by modules
|
$module_filter = get_ldap_filter($this->type); // basic filter is provided by modules
|
||||||
$filter = "(&" . $module_filter . ")";
|
$filter = "(&" . $module_filter . ")";
|
||||||
$attrs = $this->attrArray;
|
$attrs = $this->attrArray;
|
||||||
$sr = @ldap_search($_SESSION["ldap"]->server(), escapeDN($this->suffix), $filter, $attrs, 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$sr = @ldap_search($_SESSION["ldap"]->server(), escapeDN($this->suffix), $filter, $attrs, 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if (ldap_errno($_SESSION["ldap"]->server()) == 4) {
|
if (ldap_errno($_SESSION["ldap"]->server()) == 4) {
|
||||||
StatusMessage("WARN", _("LDAP sizelimit exceeded, not all entries are shown."), _("See README.openldap.txt to solve this problem."));
|
StatusMessage("WARN", _("LDAP sizelimit exceeded, not all entries are shown."), _("See README.openldap.txt to solve this problem."));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1624,7 +1624,7 @@ class accountContainer {
|
||||||
$this->module = array();
|
$this->module = array();
|
||||||
$modules = $_SESSION['config']->get_AccountModules($this->type);
|
$modules = $_SESSION['config']->get_AccountModules($this->type);
|
||||||
$search = substr($dn, 0, strpos($dn, ','));
|
$search = substr($dn, 0, strpos($dn, ','));
|
||||||
$result = @ldap_search($_SESSION['ldap']->server(), escapeDN($dn), escapeDN($search), array(), 0, 0, 0, LDAP_DEREF_ALWAYS); // TODO use ldap_read()
|
$result = @ldap_search($_SESSION['ldap']->server(), escapeDN($dn), escapeDN($search), array(), 0, 0, 0, LDAP_DEREF_NEVER); // TODO use ldap_read()
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
return array(array("ERROR", _("Unable to load LDAP entry:") . " " . $dn, ldap_error($_SESSION['ldap']->server())));
|
return array(array("ERROR", _("Unable to load LDAP entry:") . " " . $dn, ldap_error($_SESSION['ldap']->server())));
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ class ddns extends baseModule {
|
||||||
$ldap = $_SESSION['ldap']->server();
|
$ldap = $_SESSION['ldap']->server();
|
||||||
$dn = $_SESSION['config']->get_suffix('dhcp');
|
$dn = $_SESSION['config']->get_suffix('dhcp');
|
||||||
|
|
||||||
$search = @ldap_search($ldap,$dn,"dhcpStatements=ddns-update-style interim", array(), 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$search = @ldap_search($ldap,$dn,"dhcpStatements=ddns-update-style interim", array(), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if ($search) {
|
if ($search) {
|
||||||
$info = @ldap_get_entries($ldap,$search);
|
$info = @ldap_get_entries($ldap,$search);
|
||||||
if ($info && ($info['count'] > 0)) {
|
if ($info && ($info['count'] > 0)) {
|
||||||
|
|
|
@ -193,7 +193,7 @@ class fixed_ip extends baseModule {
|
||||||
if ($_SESSION['account']->getAccountModule('dhcp_settings')->dn!=$_SESSION['config']->get_suffix('dhcp')) {
|
if ($_SESSION['account']->getAccountModule('dhcp_settings')->dn!=$_SESSION['config']->get_suffix('dhcp')) {
|
||||||
|
|
||||||
$sr = @ldap_search($_SESSION['ldap']->server(),'cn='.$_SESSION['account']->getAccountModule('dhcp_settings')->attributes['cn'][0].','.$_SESSION['config']->get_suffix('dhcp'),
|
$sr = @ldap_search($_SESSION['ldap']->server(),'cn='.$_SESSION['account']->getAccountModule('dhcp_settings')->attributes['cn'][0].','.$_SESSION['config']->get_suffix('dhcp'),
|
||||||
'(objectClass=dhcpHost)', array(), 0, 0, 0, LDAP_DEREF_ALWAYS);
|
'(objectClass=dhcpHost)', array(), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if ($sr) {
|
if ($sr) {
|
||||||
$entries = ldap_get_entries($_SESSION['ldap']->server(), $sr);
|
$entries = ldap_get_entries($_SESSION['ldap']->server(), $sr);
|
||||||
for ($i=0; $i < $entries["count"]; $i++) {
|
for ($i=0; $i < $entries["count"]; $i++) {
|
||||||
|
@ -347,7 +347,7 @@ class fixed_ip extends baseModule {
|
||||||
foreach($this->fixed_ip AS $id=>$arr) {
|
foreach($this->fixed_ip AS $id=>$arr) {
|
||||||
// pc name
|
// pc name
|
||||||
$result = @ldap_search($_SESSION['ldap']->server(),"cn=".$_SESSION['account']->getAccountModule('dhcp_settings')->attributes['cn'][0].",".$_SESSION['config']->get_Suffix('dhcp'),
|
$result = @ldap_search($_SESSION['ldap']->server(),"cn=".$_SESSION['account']->getAccountModule('dhcp_settings')->attributes['cn'][0].",".$_SESSION['config']->get_Suffix('dhcp'),
|
||||||
'(cn='.$_POST['pc_'.$id].')', array(), 0, 0, 0, LDAP_DEREF_ALWAYS);
|
'(cn='.$_POST['pc_'.$id].')', array(), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
$num = (@ldap_get_entries($_SESSION['ldap']->server(), $result)=="")?0:ldap_get_entries($_SESSION['ldap']->server(), $result);
|
$num = (@ldap_get_entries($_SESSION['ldap']->server(), $result)=="")?0:ldap_get_entries($_SESSION['ldap']->server(), $result);
|
||||||
$pcError = "";
|
$pcError = "";
|
||||||
if (!$this->processed) {
|
if (!$this->processed) {
|
||||||
|
|
|
@ -824,7 +824,7 @@ class kolabUser extends baseModule {
|
||||||
// delegates
|
// delegates
|
||||||
if (in_array('kolabDelegate', $fields)) {
|
if (in_array('kolabDelegate', $fields)) {
|
||||||
$delegates = array();
|
$delegates = array();
|
||||||
$sr = @ldap_search($_SESSION['ldapHandle'], escapeDN($this->selfServiceSettings->LDAPSuffix), '(&(objectClass=inetOrgPerson)(mail=*))', array('mail'), 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$sr = @ldap_search($_SESSION['ldapHandle'], escapeDN($this->selfServiceSettings->LDAPSuffix), '(&(objectClass=inetOrgPerson)(mail=*))', array('mail'), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if ($sr) {
|
if ($sr) {
|
||||||
$result = ldap_get_entries($_SESSION['ldapHandle'], $sr);
|
$result = ldap_get_entries($_SESSION['ldapHandle'], $sr);
|
||||||
for ($i = 0; $i < $result['count']; $i++) {
|
for ($i = 0; $i < $result['count']; $i++) {
|
||||||
|
|
|
@ -140,7 +140,7 @@ class lamDHCPList extends lamList {
|
||||||
$ldap = $_SESSION['ldap'];
|
$ldap = $_SESSION['ldap'];
|
||||||
$suffix = $_SESSION['config']->get_Suffix('dhcp');
|
$suffix = $_SESSION['config']->get_Suffix('dhcp');
|
||||||
|
|
||||||
$sr = @ldap_search($ldap->server(),"cn=".$entry['cn'][0].",".$suffix,"objectClass=dhcpHost", array(), 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$sr = @ldap_search($ldap->server(),"cn=".$entry['cn'][0].",".$suffix,"objectClass=dhcpHost", array(), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if ($sr) {
|
if ($sr) {
|
||||||
$get = ldap_get_entries($ldap->server(),$sr);
|
$get = ldap_get_entries($ldap->server(),$sr);
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,7 @@ class lamGroupList extends lamList {
|
||||||
for ($i = 0; $i < sizeof($this->entries); $i++) {
|
for ($i = 0; $i < sizeof($this->entries); $i++) {
|
||||||
$gid = $this->entries[$i]['gidnumber'][0];
|
$gid = $this->entries[$i]['gidnumber'][0];
|
||||||
$filter = "(&(&" . $module_filter . ")(gidNumber=" . $gid . "))";
|
$filter = "(&(&" . $module_filter . ")(gidNumber=" . $gid . "))";
|
||||||
$sr = @ldap_search($_SESSION["ldap"]->server(), escapeDN($module_suffix), $filter, $attrs, 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$sr = @ldap_search($_SESSION["ldap"]->server(), escapeDN($module_suffix), $filter, $attrs, 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if (ldap_errno($_SESSION["ldap"]->server()) == 4) {
|
if (ldap_errno($_SESSION["ldap"]->server()) == 4) {
|
||||||
StatusMessage("WARN", _("LDAP sizelimit exceeded, not all entries are shown."), _("See README.openldap.txt to solve this problem."));
|
StatusMessage("WARN", _("LDAP sizelimit exceeded, not all entries are shown."), _("See README.openldap.txt to solve this problem."));
|
||||||
$this->refresh_primary = true;
|
$this->refresh_primary = true;
|
||||||
|
|
|
@ -167,7 +167,7 @@ class lamUserList extends lamList {
|
||||||
$grp_suffix = $_SESSION['config']->get_Suffix('group');
|
$grp_suffix = $_SESSION['config']->get_Suffix('group');
|
||||||
$filter = "objectClass=posixGroup";
|
$filter = "objectClass=posixGroup";
|
||||||
$attrs = array("cn", "gidNumber");
|
$attrs = array("cn", "gidNumber");
|
||||||
$sr = @ldap_search($_SESSION["ldap"]->server(), escapeDN($grp_suffix), $filter, $attrs, 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$sr = @ldap_search($_SESSION["ldap"]->server(), escapeDN($grp_suffix), $filter, $attrs, 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if ($sr) {
|
if ($sr) {
|
||||||
$info = @ldap_get_entries($_SESSION["ldap"]->server(), $sr);
|
$info = @ldap_get_entries($_SESSION["ldap"]->server(), $sr);
|
||||||
unset($info['count']); // delete count entry
|
unset($info['count']); // delete count entry
|
||||||
|
@ -200,7 +200,7 @@ class lamUserList extends lamList {
|
||||||
elseif ($attribute == "jpegphoto") {
|
elseif ($attribute == "jpegphoto") {
|
||||||
if (sizeof($entry[$attribute][0]) < 100) {
|
if (sizeof($entry[$attribute][0]) < 100) {
|
||||||
// looks like we have read broken binary data, reread photo
|
// looks like we have read broken binary data, reread photo
|
||||||
$result = @ldap_search($_SESSION['ldap']->server(), escapeDN($entry['dn']), $attribute . "=*", array($attribute), 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$result = @ldap_search($_SESSION['ldap']->server(), escapeDN($entry['dn']), $attribute . "=*", array($attribute), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$tempEntry = @ldap_first_entry($_SESSION['ldap']->server(), $result);
|
$tempEntry = @ldap_first_entry($_SESSION['ldap']->server(), $result);
|
||||||
if ($tempEntry) {
|
if ($tempEntry) {
|
||||||
|
|
|
@ -254,7 +254,7 @@ if ($_POST['delete']) {
|
||||||
*/
|
*/
|
||||||
function getChildCount($dn) {
|
function getChildCount($dn) {
|
||||||
$return = 0;
|
$return = 0;
|
||||||
$sr = @ldap_search($_SESSION['ldap']->server(), escapeDN($dn), 'objectClass=*', array('dn'), 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$sr = @ldap_search($_SESSION['ldap']->server(), escapeDN($dn), 'objectClass=*', array('dn'), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if ($sr) {
|
if ($sr) {
|
||||||
$entries = ldap_get_entries($_SESSION['ldap']->server(), $sr);
|
$entries = ldap_get_entries($_SESSION['ldap']->server(), $sr);
|
||||||
$return = $entries['count'] - 1;
|
$return = $entries['count'] - 1;
|
||||||
|
|
|
@ -58,7 +58,7 @@ if ($_POST['add_suff'] || $_POST['cancel']) {
|
||||||
// add entries
|
// add entries
|
||||||
for ($i = 0; $i < sizeof($new_suff); $i++) {
|
for ($i = 0; $i < sizeof($new_suff); $i++) {
|
||||||
// check if entry is already present
|
// check if entry is already present
|
||||||
$info = @ldap_search($_SESSION['ldap']->server(), escapeDN($new_suff[$i]), "", array(), 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$info = @ldap_search($_SESSION['ldap']->server(), escapeDN($new_suff[$i]), "", array(), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
$res = @ldap_get_entries($_SESSION['ldap']->server(), $info);
|
$res = @ldap_get_entries($_SESSION['ldap']->server(), $info);
|
||||||
if ($res) continue;
|
if ($res) continue;
|
||||||
$suff = $new_suff[$i];
|
$suff = $new_suff[$i];
|
||||||
|
@ -100,7 +100,7 @@ if ($_POST['add_suff'] || $_POST['cancel']) {
|
||||||
// create missing entries
|
// create missing entries
|
||||||
for ($k = sizeof($subsuffs) - 1; $k >= 0; $k--) {
|
for ($k = sizeof($subsuffs) - 1; $k >= 0; $k--) {
|
||||||
// check if subsuffix is present
|
// check if subsuffix is present
|
||||||
$info = @ldap_search($_SESSION['ldap']->server(), escapeDN($subsuffs[$k]), "", array(), 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$info = @ldap_search($_SESSION['ldap']->server(), escapeDN($subsuffs[$k]), "", array(), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
$res = @ldap_get_entries($_SESSION['ldap']->server(), $info);
|
$res = @ldap_get_entries($_SESSION['ldap']->server(), $info);
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
$suffarray = explode(",", $subsuffs[$k]);
|
$suffarray = explode(",", $subsuffs[$k]);
|
||||||
|
|
|
@ -77,7 +77,7 @@ else {
|
||||||
function search_username($name) {
|
function search_username($name) {
|
||||||
$filter = "(uid=$name)";
|
$filter = "(uid=$name)";
|
||||||
$attrs = array();
|
$attrs = array();
|
||||||
$sr = @ldap_search($_SESSION['ldap']->server(), escapeDN($_SESSION['config']->get_Suffix('user')), $filter, $attrs, 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$sr = @ldap_search($_SESSION['ldap']->server(), escapeDN($_SESSION['config']->get_Suffix('user')), $filter, $attrs, 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if ($sr) {
|
if ($sr) {
|
||||||
$info = ldap_get_entries($_SESSION['ldap']->server(), $sr);
|
$info = ldap_get_entries($_SESSION['ldap']->server(), $sr);
|
||||||
// return only first DN entry
|
// return only first DN entry
|
||||||
|
|
|
@ -437,7 +437,7 @@ if(!empty($_POST['checklogin'])) {
|
||||||
$searchFilter = str_replace('%USER%', $username ,$searchFilter);
|
$searchFilter = str_replace('%USER%', $username ,$searchFilter);
|
||||||
$searchSuccess = true;
|
$searchSuccess = true;
|
||||||
$searchError = '';
|
$searchError = '';
|
||||||
$searchResult = @ldap_search($searchLDAP->server(), $_SESSION['config']->getLoginSearchSuffix(), $searchFilter, array('dn'), 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$searchResult = @ldap_search($searchLDAP->server(), $_SESSION['config']->getLoginSearchSuffix(), $searchFilter, array('dn'), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
if ($searchResult) {
|
if ($searchResult) {
|
||||||
$searchInfo = @ldap_get_entries($searchLDAP->server(), $searchResult);
|
$searchInfo = @ldap_get_entries($searchLDAP->server(), $searchResult);
|
||||||
if ($searchInfo) {
|
if ($searchInfo) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ $new_suffs = array();
|
||||||
// get list of active types
|
// get list of active types
|
||||||
$types = $_SESSION['config']->get_ActiveTypes();
|
$types = $_SESSION['config']->get_ActiveTypes();
|
||||||
for ($i = 0; $i < sizeof($types); $i++) {
|
for ($i = 0; $i < sizeof($types); $i++) {
|
||||||
$info = @ldap_search($_SESSION['ldap']->server(), escapeDN($conf->get_Suffix($types[$i])), "(objectClass=*)", array('objectClass'), 0, 0, 0, LDAP_DEREF_ALWAYS);
|
$info = @ldap_search($_SESSION['ldap']->server(), escapeDN($conf->get_Suffix($types[$i])), "(objectClass=*)", array('objectClass'), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
$res = @ldap_get_entries($_SESSION['ldap']->server(), $info);
|
$res = @ldap_get_entries($_SESSION['ldap']->server(), $info);
|
||||||
if (!$res && !in_array($conf->get_Suffix($types[$i]), $new_suffs)) $new_suffs[] = $conf->get_Suffix($types[$i]);
|
if (!$res && !in_array($conf->get_Suffix($types[$i]), $new_suffs)) $new_suffs[] = $conf->get_Suffix($types[$i]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue