From 56371ea520949289745915377f678e7e97218b2d Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <machniak@kolabsys.com>
Date: Wed, 7 Aug 2019 11:37:05 +0000
Subject: [PATCH] Replace four get_entry_attribute() calls with one
 get_entry_attributes()

---
 lib/Net/LDAP3.php | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 66f74e7..39773b1 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -7,7 +7,7 @@
  | Based on code created by the Roundcube Webmail team.                  |
  |                                                                       |
  | Copyright (C) 2006-2014, The Roundcube Dev Team                       |
- | Copyright (C) 2012-2019, Kolab Systems AG                             |
+ | Copyright (C) 2012-2014, Kolab Systems AG                             |
  |                                                                       |
  | This program is free software: you can redistribute it and/or modify  |
  | it under the terms of the GNU General Public License as published by  |
@@ -278,20 +278,24 @@ class Net_LDAP3
             $ldap->connect();
             $ldap->bind($this->_current_bind_dn, $this->_current_bind_pw);
 
-            $replica_attrs = array(
+            $attrs = array(
+                'nsDS5ReplicaBindDN',
+                'nsDS5ReplicaType',
+                'nsds5ReplicaPurgeDelay',
+                'nsDS5Flags'
+            );
+
+            $replica_attrs = $ldap->get_entry_attributes($replica_dn, $attrs);
+            $replica_attrs = array_merge((array) $replica_attrs, array(
                 'cn' => 'replica',
                 'objectclass' => array(
                     'top',
                     'nsds5replica',
                     'extensibleobject',
                 ),
-                'nsDS5ReplicaBindDN'     => $ldap->get_entry_attribute($replica_dn, "nsDS5ReplicaBindDN"),
-                'nsDS5ReplicaId'         => ($max_repl_id + $num + 1),
-                'nsDS5ReplicaRoot'       => $domain_root_dn,
-                'nsDS5ReplicaType'       => $ldap->get_entry_attribute($replica_dn, "nsDS5ReplicaType"),
-                'nsds5ReplicaPurgeDelay' => $ldap->get_entry_attribute($replica_dn, "nsds5ReplicaPurgeDelay"),
-                'nsDS5Flags'             => $ldap->get_entry_attribute($replica_dn, "nsDS5Flags")
-            );
+                'nsDS5ReplicaId'   => ($max_repl_id + $num + 1),
+                'nsDS5ReplicaRoot' => $domain_root_dn,
+            ));
 
             $new_replica_dn = 'cn=replica,cn="' . $domain_root_dn . '",cn=mapping tree,cn=config';
 
-- 
GitLab