ldaps_search 超出 LDAP 服务器大小限制 ( MSAD )

LDAP server sizelimit was exceeded ( MSAD ) with ldaps_search

使用

call ldaps_search(handle,shandle,filter, attrs, num, rc);

使用 Microsoft Active Directory 我收到警告:已超出 LDAP 服务器大小限制。

有没有办法在 sas 中以某种方式翻页?

我已经尝试 ldaps_setOptions 例如 sizeLimit=2000 但仍然会生成警告,因为我猜是在 Microsoft 方面设置的

谢谢

样本:

more = 1;
do while (more eq 1);
call ldaps_search_page(handle, shandle, filter, attrs, num, rc, more, 1000);
  if rc ne 0 then do;
 more = 0;
 msg = sysmsg();
 put msg;
  end;
/* free search results page */
if shandle NE 0 then do;
call ldaps_free(shandle,rc);
end;
end;

无法从客户端控制 LDAP 服务器大小限制(参见 AD 的 MaxPageSize), but yes you can still work around this via paging controls

想法是请求分页结果集,每页的条目数小于服务器的 MaxPageSize 限制。

SAS 提供 call ldaps_search_page 例程,returns 仅针对给定搜索请求的单个页面,并需要后续调用来检索全部结果:

CALL LDAPS_SEARCH_PAGE(lHandle, sHandle, filter, attr, num, rc, more <, pageSize>);

pageSize (optional) specifies a positive integer value, which is the number of results on a page of output. By default, this value is set to 50. If pageSize is 0, this function acts as if paging is turned off. This argument is case-insensitive.

例如,如果查询匹配 n 个结果(超出服务器端限制)并且页面大小设置为 50,则您最多需要进行 ceil(n/50) 次调用.

这是从文档中获取的示例,它在循环中使用 more 参数继续检索分页结果,直到没有更多信息可检索为止:

more = 1;
do while (more eq 1);
call ldaps_search_page(handle, shandle, filter, attrs, num, rc, more, 50);
...
/* free search results page */
  if shandle NE 0 then do;
  call ldaps_free(shandle,rc);
  end;
end;

https://documentation.sas.com/api/docsets/itechdsref/9.4/content/itechdsref.pdf


对于那些因 more 卡在 1 而导致上面的代码永远循环而遇到麻烦的人(我不知道为什么引用不会更新,但 OP 就是这种情况),实际上你不需要它,递增计数器直到获取的条目数达到 num 应该可以解决问题。