本文整理汇总了Python中samba.Ldb.searchex方法的典型用法代码示例。如果您正苦于以下问题:Python Ldb.searchex方法的具体用法?Python Ldb.searchex怎么用?Python Ldb.searchex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类samba.Ldb
的用法示例。
在下文中一共展示了Ldb.searchex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ndr_unpack
# 需要导入模块: from samba import Ldb [as 别名]
# 或者: from samba.Ldb import searchex [as 别名]
guid = None
(msgs, ctrls) = remote_ldb.search(expression="(samaccountname=administrator)", base=base, attrs=["objectClass"], controls=["dirsync:1:1:50"])
if (len(ctrls)):
for ctl in ctrls:
arr = ctl.split(':')
if arr[0] == 'dirsync':
cookie = ndr_unpack(drsblobs.ldapControlDirSyncCookie, base64.b64decode(arr[3]))
guid = cookie.blob.guid1
pass
if not guid:
print "No dirsync control ... strange"
sys.exit(1)
print ""
print "Getting first guest without any cookie"
(msgs, ctrls) = remote_ldb.searchex(expression="(samaccountname=guest)", base=base, attrs=["objectClass"], controls=["dirsync:1:1:50"])
cookie = None
if (len(ctrls)):
for ctl in ctrls:
cookie = printdirsync(ctl)
print "Returned {0:d} entries".format(len(msgs))
savedcookie = cookie
print ""
print "Getting allusers with cookie"
controls=["dirsync:1:1:50:{0!s}".format(base64.b64encode(ndr_pack(cookie)))]
(msgs, ctrls) = remote_ldb.searchex(expression="(samaccountname=*)", base=base, attrs=["objectClass"], controls=controls)
if (len(ctrls)):
for ctl in ctrls:
cookie = printdirsync(ctl)