zakird / pyad

Python Active Directory Tools | *Not actively maintained*
http://zakird.github.io/pyad/
176 stars 72 forks source link

from_cn returns multiple results #51

Open dshepherd21 opened 8 years ago

dshepherd21 commented 8 years ago

I have cross forest trust in place and am using from_cn to return a handle on an individual domains administrator.

The following line of code...

adhandle=aduser.ADUser.from_cn(user,options=dict(ldap_server=dns))

Gives an exception when the user var is set to administrator and states ...

Traceback (most recent call last): File "", line 1001, in File "", line 796, in connect File "C:\nwscript\build\nwscipt\out00-PYZ.pyz\pyad.adobject", line 132, in fro m_cn File "C:\nwscript\build\nwscipt\out00-PYZ.pyz\pyad.adsearch", line 17, in by_c n File "C:\nwscript\build\nwscipt\out00-PYZ.pyz\pyad.adquery", line 73, in get_s ingle_result pyad.pyadexceptions.invalidResults: The specified query resturned 3 results. get SingleResults only functions with a single result.

By default how can an AD query for CN return multiple results, and if it is due to the cross forest trust how can you scope the query ?

Any thoughts ?