git.samba.org
/
metze
/
samba
/
wb-ndr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
783412e
)
Move domain DN determination out of newuser function.
author
Jelmer Vernooij
<jelmer@samba.org>
Fri, 1 Aug 2008 18:47:22 +0000
(20:47 +0200)
committer
Jelmer Vernooij
<jelmer@samba.org>
Fri, 1 Aug 2008 18:47:22 +0000
(20:47 +0200)
source/scripting/python/samba/samdb.py
patch
|
blob
|
history
diff --git
a/source/scripting/python/samba/samdb.py
b/source/scripting/python/samba/samdb.py
index c47cf4a0dc6c3fd1401c7861977bb8bca7c1a8f9..c7d93d6aff756624b781e500a27698f0e7040926 100644
(file)
--- a/
source/scripting/python/samba/samdb.py
+++ b/
source/scripting/python/samba/samdb.py
@@
-86,6
+86,14
@@
userAccountControl: %u
""" % (user_dn, userAccountControl)
self.modify_ldif(mod)
""" % (user_dn, userAccountControl)
self.modify_ldif(mod)
+ def domain_dn(self):
+ # find the DNs for the domain and the domain users group
+ res = self.search("", scope=ldb.SCOPE_BASE,
+ expression="(defaultNamingContext=*)",
+ attrs=["defaultNamingContext"])
+ assert(len(res) == 1 and res[0]["defaultNamingContext"] is not None)
+ return res[0]["defaultNamingContext"][0]
+
def newuser(self, username, unixname, password):
"""add a new user record.
def newuser(self, username, unixname, password):
"""add a new user record.
@@
-96,12
+104,7
@@
userAccountControl: %u
# connect to the sam
self.transaction_start()
# connect to the sam
self.transaction_start()
- # find the DNs for the domain and the domain users group
- res = self.search("", scope=ldb.SCOPE_BASE,
- expression="(defaultNamingContext=*)",
- attrs=["defaultNamingContext"])
- assert(len(res) == 1 and res[0]["defaultNamingContext"] is not None)
- domain_dn = res[0]["defaultNamingContext"][0]
+ domain_dn = self.domain_dn()
assert(domain_dn is not None)
user_dn = "CN=%s,CN=Users,%s" % (username, domain_dn)
assert(domain_dn is not None)
user_dn = "CN=%s,CN=Users,%s" % (username, domain_dn)