Page MenuHomePhorge

D4352.1775554433.diff
No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None

D4352.1775554433.diff

diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -333,14 +333,16 @@
'nsDS5ReplicaBindDN',
'nsDS5ReplicaCredentials',
'nsDS5ReplicaTransportInfo',
- 'nsDS5ReplicaBindMethod',
- 'nsDS5ReplicaHost',
- 'nsDS5ReplicaPort'
+ 'nsDS5ReplicaBindMethod'
);
+ list($host, $port) = strpos($replicate_to_host, ':') !== false ? explode(':', $replicate_to_host) : array($replicate_to_host, 389);
+
$replica_agreement_attrs = $ldap->get_entry_attributes($replica_agreement_tpl_dn, $attrs);
$replica_agreement_attrs['cn'] = array_shift(explode('.', $replicate_to_host)) . str_replace(array('dc=',','), array('_',''), $domain_root_dn);
$replica_agreement_attrs['nsDS5ReplicaRoot'] = $domain_root_dn;
+ $replica_agreement_attrs['nsDS5ReplicaHost'] = $host;
+ $replica_agreement_attrs['nsDS5ReplicaPort'] = $port;
$replica_agreement_dn = "cn=" . $replica_agreement_attrs['cn'] . "," . $new_replica_dn;
$this->_debug("Adding $replica_agreement_dn to $replica_host with attributes: " . var_export($replica_agreement_attrs, true));
@@ -1088,7 +1090,9 @@
$ldap->connect();
$ldap->bind($this->_current_bind_dn, $this->_current_bind_pw);
- $result = $ldap->search($root_dn, '(objectclass=nsds5replicationagreement)', 'sub', array('nsds5replicahost'));
+ $host_attrs = array('nsds5replicahost', 'nsds5replicaport');
+
+ $result = $ldap->search($root_dn, '(objectclass=nsds5replicationagreement)', 'sub', $host_attrs);
if (!$result) {
$this->_debug("No replicas configured");
@@ -1098,8 +1102,9 @@
$this->_debug("Replication agreements found: " . var_export($result->entries(true), true));
foreach ($result->entries(true) as $dn => $attrs) {
- if (!in_array($attrs['nsds5replicahost'], $replica_hosts)) {
- $replica_hosts[] = $attrs['nsds5replicahost'];
+ $host = $attrs['nsds5replicahost'] . ':' . !empty($attrs['nsds5replicaport']) ? $attrs['nsds5replicaport'] : 389;
+ if (!in_array($host, $replica_hosts)) {
+ $replica_hosts[] = $host;
}
}
@@ -1116,7 +1121,7 @@
$ldap->connect();
$ldap->bind($this->_current_bind_dn, $this->_current_bind_pw);
- $result = $ldap->search($root_dn, '(objectclass=nsds5replicationagreement)', 'sub', array('nsds5replicahost'));
+ $result = $ldap->search($root_dn, '(objectclass=nsds5replicationagreement)', 'sub', $host_attrs);
if (!$result) {
$this->_debug("No replicas configured on $replica_host");
$ldap->close();
@@ -1124,8 +1129,9 @@
}
foreach ($result->entries(true) as $dn => $attrs) {
- if (!in_array($attrs['nsds5replicahost'], $replica_hosts)) {
- $replica_hosts[] = $attrs['nsds5replicahost'];
+ $host = $attrs['nsds5replicahost'] . ':' . !empty($attrs['nsds5replicaport']) ? $attrs['nsds5replicaport'] : 389;
+ if (!in_array($host, $replica_hosts)) {
+ $replica_hosts[] = $host;
}
}

File Metadata

Mime Type
text/plain
Expires
Tue, Apr 7, 9:33 AM (2 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18842034
Default Alt Text
D4352.1775554433.diff (3 KB)

Event Timeline