IDirectorySearch.ExecuteSearch not behaving correctly?

  • Thread starter Thread starter Huw
  • Start date Start date
H

Huw

Hi there,

Could anyone help me with this?

I'm performing the following steps in C++..

1) Bind to a gc using AdsGetObject
2) QI for the IDirectorySearch interface
3) Call ExecuteSearch, looking for a user with search criteria
"displayName=whatever"
4) Call GetFirstRow and check for S_ADS_NOMORE_ROWS error.

If I call the code above with a nicely prived user, then it works just fine
and I get my user back. But, if I call this using a user that does not have
enough permissions, then the searhc returns no results (S_ADS_NOMORE_ROWS
returned from GetFirstRow). I thought the ExecuteSearch would at least
fail.

I tried calling AdsGetLastError to see if that would give any clues, but no
error is returned.

So my question is, how do I tell when the search failed or is worked but
there were no results?

Any ideas?

Thanks,
Huw
 
Thanks, I guess that does make sense. Do you know if there's any way of
finding out if a user exists then when I've only got the display name?
 
I don't think you can if you don't have permissions to see their user
object. Your query won't return it. I could be wrong here, but I don't
think so.

Is it feasible to ensure that you have a user with sufficient permissions?
Unless the directory has been locked down beyond the defaults, a member of
the domain users group can usually do what you want.

Joe K.
 
Back
Top