summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-11-22 15:03:59 +0200
committerKamen Mazdrashki <kamenim@samba.org>2010-11-22 15:37:40 +0200
commit9c2bd08498fe6f2caebd42d8a165d282913825bb (patch)
tree0bdbed6f97818cb4f3090beda8ff0c5bb21f020d /source4
parentbc6ba4b04cf063fa01199c2a605b48fa9ecd2055 (diff)
downloadsamba-9c2bd08498fe6f2caebd42d8a165d282913825bb.tar.gz
samba-9c2bd08498fe6f2caebd42d8a165d282913825bb.tar.bz2
samba-9c2bd08498fe6f2caebd42d8a165d282913825bb.zip
s4-tests: Wrap connect_samdb() into a connect_samdb_ex() helper
Thus caller will be able to connect to SamDB and fetch RootDSE info in a single step
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/tests/__init__.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py
index 63faf16919..0519fd8dc5 100644
--- a/source4/scripting/python/samba/tests/__init__.py
+++ b/source4/scripting/python/samba/tests/__init__.py
@@ -157,3 +157,21 @@ def connect_samdb(samdb_url, lp=None, session_info=None,
credentials=credentials,
flags=flags,
options=ldb_options)
+
+def connect_samdb_ex(samdb_url, lp=None, session_info=None,
+ credentials=None, flags=0, ldb_options=None, ldap_only=False):
+ """Connects to samdb_url database
+
+ :param samdb_url: Url for database to connect to.
+ :param lp: Optional loadparm object
+ :param session_info: Optional session information
+ :param credentials: Optional credentials, defaults to anonymous.
+ :param flags: Optional LDB flags
+ :param ldap_only: If set, only remote LDAP connection will be created.
+ :return: (sam_db_connection, rootDse_record) tuple
+ """
+ sam_db = connect_samdb(samdb_url, lp, session_info, credentials,
+ flags, ldb_options, ldap_only)
+ # fetch RootDse
+ res = sam_db.search(base="", expression="", scope=ldb.SCOPE_BASE, attrs=["*"])
+ return (sam_db, res[0])