@@ -194,15 +194,6 @@ public function readAttribute(string $dn, string $attr, string $filter = 'object
194194 $ this ->logger ->debug ('LDAP resource not available. ' , ['app ' => 'user_ldap ' ]);
195195 return false ;
196196 }
197- //Cancel possibly running Paged Results operation, otherwise we run in
198- //LDAP protocol errors
199- $ this ->abandonPagedSearch ();
200- // openLDAP requires that we init a new Paged Search. Not needed by AD,
201- // but does not hurt either.
202- $ pagingSize = (int )$ this ->connection ->ldapPagingSize ;
203- // 0 won't result in replies, small numbers may leave out groups
204- // (cf. #12306), 500 is default for paging and should work everywhere.
205- $ maxResults = $ pagingSize > 20 ? $ pagingSize : 500 ;
206197 $ attr = mb_strtolower ($ attr , 'UTF-8 ' );
207198 // the actual read attribute later may contain parameters on a ranged
208199 // request, e.g. member;range=99-199. Depends on server reply.
@@ -211,7 +202,7 @@ public function readAttribute(string $dn, string $attr, string $filter = 'object
211202 $ values = [];
212203 $ isRangeRequest = false ;
213204 do {
214- $ result = $ this ->executeRead ($ dn , $ attrToRead , $ filter, $ maxResults );
205+ $ result = $ this ->executeRead ($ dn , $ attrToRead , $ filter );
215206 if (is_bool ($ result )) {
216207 // when an exists request was run and it was successful, an empty
217208 // array must be returned
@@ -258,15 +249,7 @@ public function readAttribute(string $dn, string $attr, string $filter = 'object
258249 * returned data on a successful usual operation
259250 * @throws ServerNotAvailableException
260251 */
261- public function executeRead (string $ dn , string $ attribute , string $ filter , int $ maxResults ) {
262- try {
263- $ this ->initPagedSearch ($ filter , $ dn , [$ attribute ], $ maxResults , 0 );
264- } catch (NoMoreResults $ e ) {
265- // does not happen, no pagination here since offset is 0, but the
266- // previous call is needed for a potential reset of the state.
267- // Tools would still point out a possible NoMoreResults exception.
268- return false ;
269- }
252+ public function executeRead (string $ dn , string $ attribute , string $ filter ) {
270253 $ dn = $ this ->helper ->DNasBaseParameter ($ dn );
271254 $ rr = @$ this ->invokeLDAPMethod ('read ' , $ dn , $ filter , [$ attribute ]);
272255 if (!$ this ->ldap ->isResource ($ rr )) {
@@ -1999,12 +1982,12 @@ private function initPagedSearch(
19991982 $ pagedSearchOK = true ;
20001983 $ this ->invokeLDAPMethod ('controlPagedResult ' , $ limit , false );
20011984 $ this ->logger ->debug ('Ready for a paged search ' , ['app ' => 'user_ldap ' ]);
2002- /* ++ Fixing RHDS searches with pages with zero results ++
2003- * We coudn't get paged searches working with our RHDS for login ($limit = 0),
2004- * due to pages with zero results.
2005- * So we added "&& !empty($this->lastCookie)" to this test to ignore pagination
2006- * if we don't have a previous paged search.
2007- */
1985+ /* ++ Fixing RHDS searches with pages with zero results ++
1986+ * We coudn't get paged searches working with our RHDS for login ($limit = 0),
1987+ * due to pages with zero results.
1988+ * So we added "&& !empty($this->lastCookie)" to this test to ignore pagination
1989+ * if we don't have a previous paged search.
1990+ */
20081991 } elseif (!empty ($ this ->lastCookie )) {
20091992 // a search without limit was requested. However, if we do use
20101993 // Paged Search once, we always must do it. This requires us to
0 commit comments