You are not logged in.
Pages: 1
Hi,
I have used this code for extract a list of users of an Active Directory.
Congratulations, really fast!
But it return only the first 1000 elements, while the users are 16000.
What am I doing wrong? Or is there a preset limit?
Thanks in advance!
with TLdapClient.Create do
try
if BindSaslKerberos then
memo1.Lines.Add(' authenticated via Kerberos');
//Search(WellKnownObjects.Users, false, '', []);
tmpBaseDN := 'OU=GroupA1,DC=dmlocaltest,DC=com';
Search(tmpBaseDN, false, '', []);
memo1.Lines.Add(SearchResult.Dump);
finally
Free;
end;
Last edited by Stemon63 (2023-09-06 15:09:29)
Offline
Ok, Ab.
There is anny little example of a paging ? Thanks in advance!
(I take advantage: in function TLdapClient.GetUserInfo(const AN, DN, UPN: RawUtf8;
out Info: TLdapUser; const BaseDN: RawUtf8; WithMemberOf: boolean;
const CustomAttributes: TRawUtf8DynArray): boolean;
Param UPN Declared but never used)
Thanks a lot :-)
Offline
You should set SearchPageSize to a number of items per chunk.
Then call Search() again until it is eventually empty.
And don't forget to reset SearchCookie to '' for the next query. And SearchPageSize back to 0 to disable paging.
I have added the new TLdapClient.SearchBegin/SearchEnd wrapper methods, which may help.
See https://github.com/synopse/mORMot2/commit/6b496795
About the UPN, see https://github.com/synopse/mORMot2/commit/bef7b085
Offline
Hi Ab.
Thanks, It works.
Although it took some time to understand that it was the cookie that should return empty :-)
However I take advantage of a small oversight: in .GetUserInfo, .userPrincipalName is always empty in out Info: LdapUser.
Thanks a lot for help :-)
Offline
Hi Ab.
The call
TLdapClient.GetGroupInfo('', vBaseDN, vLdapGroup, '', True);
Successfully returns the corresponding group (vLdapGroup) with N members.
One of the member from this group has DN returned by vLdapGroup.member[k] kind of 'CN=Super User,OU=1\+2 MEDIA,OU=Domain Users,DC=1plus2,DC=corp';
To determine sAMAccountName for this user, the next call
TLdapClient.GetUserInfo('', vLdapGroup.member[k], '', vLdapUser);
returns an error
Invalid input name: CN=Super User,OU=1\+2 MEDIA,OU=Domain Users,DC=1plus2,DC=corp
If I remove \ before +, then such a user does not exist.
The actual name of this OU is "1+2 Media" without quotes.
How to correctly call a TLdapClient.GetUserInfo with such a parameter?
In continuation of our conversation, this is not a problem of non ASCII characters, rather this is a problem of special characters for AD.
Thanks a lot.
Offline
Please try https://github.com/synopse/mORMot2/commit/5a61008e
I was not able to find an AD to reproduce your problem, but at least it should pass the right parameter, and I was able to use escaped chars in the DN value on Samba.
Which kind of AD is it using? (MS/Samba?)
Offline
It is MS.
I tried it, but unfortunately parameter passes, but TLdapClient.GetUserInfo returns false.
I.e. Search returns true but SearchResult.Count = 0.
Offline
Offline
Did you try both OU=1\+2 MEDIA and OU=1+2 MEDIA content?
Yes. Same results.
Can you enable the application console, and define a ASNDEBUG conditional and report the output to the console during the search?
Sorry. I do not have permission to publish the log of communication with the corporate AD server. Can I send the log to your email address?
Offline
Hi Ab.
Was the log I sent useful?
Offline
For today's commit, "2.2.6617" works fine. Thank you!
But strangely, I followed https://github.com/synopse/mORMot2/commits/master every day and did not see any changes regarding this issue.
Probably I was inattentive and missed it))))
That's why I decided to bother you today.
Offline
Pages: 1