Commit 8f6a9128 authored by bmortier's avatar bmortier
Browse files

Merge branch 'revert-126eef5c' into '1.4-dev'

Revert "Merge branch '6175-compatibility-with-php-8-1' into '1.4-dev'"

See merge request fusiondirectory/fd!915
Showing with 10 additions and 13 deletions
+10 -13
......@@ -308,7 +308,7 @@ class config
{
global $ui;
if (($this->ldapLink === NULL) || ($this->ldapLink->cid === FALSE)) {
if ($this->ldapLink === NULL || !is_resource($this->ldapLink->cid)) {
/* Build new connection */
$this->ldapLink = LDAP::init($this->current['SERVER'], $this->current['BASE'],
$this->current['ADMINDN'], $this->get_credentials($this->current['ADMINPASSWORD']));
......
......@@ -37,12 +37,8 @@ class LDAP
var $reconnect = FALSE;
var $tls = FALSE;
/**
* Connection identifier
*
* @var resource|object|false
*/
var $cid = FALSE;
/* connection identifier */
var $cid;
var $hasres = [];
var $sr = [];
......@@ -298,7 +294,7 @@ class LDAP
function unbind ()
{
@ldap_unbind($this->cid);
$this->cid = FALSE;
$this->cid = NULL;
logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, '', 'unbind');
}
......@@ -773,8 +769,9 @@ class LDAP
$r = ldap_rename($this->cid, $source, $dest_rdn, $parent, TRUE);
$this->error = ldap_error($this->cid);
/* Check if destination dn exists, if not the server may not support this operation */
$r &= $this->dn_exists($dest);
/* Check if destination dn exists, if not the
server may not support this operation */
$r &= is_resource($this->dn_exists($dest));
logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rename("'.$source.'","'.$dest.'")');
return $r;
} else {
......@@ -1205,7 +1202,7 @@ class LDAP
// Try to open the process
$process = proc_open($cmd, $descriptorspec, $pipes);
if ($process !== FALSE) {
if (is_resource($process)) {
// Write the password to stdin
fclose($pipes[0]);
......@@ -1224,10 +1221,10 @@ class LDAP
return $res;
}
function dn_exists ($dn): bool
function dn_exists ($dn)
{
logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, '', 'dn_exists('.$dn.')');
return (@ldap_read($this->cid, $dn, '(objectClass=*)', ['objectClass']) !== FALSE);
return @ldap_read($this->cid, $dn, "(objectClass=*)", ["objectClass"]);
}
function parseLdif (string $str_attr): array
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment