diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-08-13 11:37:38 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-08-14 00:14:15 +0200 |
commit | 44dfb2902e338924736447236989c6ed231f411b (patch) | |
tree | b9ba6bc3f016aaa84ebb4d6a20d019d1805931a4 | |
parent | e2b12c6f6acf9ed833bf584cd2556a83d59b01eb (diff) | |
download | samba-44dfb2902e338924736447236989c6ed231f411b.tar.gz samba-44dfb2902e338924736447236989c6ed231f411b.tar.xz samba-44dfb2902e338924736447236989c6ed231f411b.zip |
s4: Better way to call "dom_sid_to_rid" from ldap.py
-rwxr-xr-x | source4/lib/ldb/tests/python/ldap.py | 6 | ||||
-rw-r--r-- | source4/scripting/python/samba/__init__.py | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py index 00fb307689..24c6226ce4 100755 --- a/source4/lib/ldb/tests/python/ldap.py +++ b/source4/lib/ldb/tests/python/ldap.py @@ -18,10 +18,8 @@ from ldb import ERR_NO_SUCH_OBJECT, ERR_ATTRIBUTE_OR_VALUE_EXISTS from ldb import ERR_ENTRY_ALREADY_EXISTS, ERR_UNWILLING_TO_PERFORM from ldb import ERR_NOT_ALLOWED_ON_NON_LEAF, ERR_OTHER, ERR_INVALID_DN_SYNTAX from ldb import Message, Dn -from samba import Ldb +from samba import Ldb, param, dom_sid_to_rid from subunit import SubunitTestRunner -from samba import param -from samba import glue import unittest parser = optparse.OptionParser("ldap [options] <host>") @@ -173,7 +171,7 @@ class BasicTests(unittest.TestCase): self.assertTrue(len(res1) == 1) primary_group_token = int(res1[0]["primaryGroupToken"][0]) - rid = glue.dom_sid_to_rid(ldb.schema_format_value("objectSID", res1[0]["objectSID"][0])) + rid = dom_sid_to_rid(ldb.schema_format_value("objectSID", res1[0]["objectSID"][0])) self.assertEquals(primary_group_token, rid) # Has to wait until we support read-only generated attributes correctly diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py index 164803bb65..e6875b3f02 100644 --- a/source4/scripting/python/samba/__init__.py +++ b/source4/scripting/python/samba/__init__.py @@ -242,6 +242,16 @@ def valid_netbios_name(name): return False return True + +def dom_sid_to_rid(sid_str): + """Converts a domain SID to the relative RID. + + :param sid_str: The domain SID formatted as string + """ + + return glue.dom_sid_to_rid(sid_str) + + version = glue.version DS_BEHAVIOR_WIN2000 = glue.DS_BEHAVIOR_WIN2000 |