s4-devel/pfm_verify: Move schemaInfo getter into separate function
authorKamen Mazdrashki <kamenim@samba.org>
Tue, 21 Dec 2010 23:09:59 +0000 (01:09 +0200)
committerKamen Mazdrashki <kamenim@samba.org>
Wed, 22 Dec 2010 00:28:49 +0000 (01:28 +0100)
so it can be used against Windows DC without fetching prefixMap
Fetching prefixMap doesn't work against WinDCs for some reason at the moment

Autobuild-User: Kamen Mazdrashki <kamenim@samba.org>
Autobuild-Date: Wed Dec 22 01:28:49 CET 2010 on sn-devel-104

source4/scripting/devel/pfm_verify.py

index 300fd05bdde9cf152cdb797aab98f1a2f90bff07..2b54aadeb4113d8c28b3a422ca1564f8457aef4e 100755 (executable)
@@ -42,14 +42,22 @@ def _samdb_fetch_pfm(samdb):
     assert len(res) == 1
     pfm = ndr_unpack(drsblobs.prefixMapBlob,
                      str(res[0]['prefixMap']))
-    pfm_schi = None
+
+    pfm_schi = _samdb_fetch_schi(samdb)
+
+    return (pfm.ctr, pfm_schi)
+
+def _samdb_fetch_schi(samdb):
+    """Fetch schemaInfo stored in SamDB using LDB connection"""
+    res = samdb.search(base=samdb.get_schema_basedn(), expression="", scope=SCOPE_BASE, attrs=["*"])
+    assert len(res) == 1
     if 'schemaInfo' in res[0]:
-        pfm_schi = pfm_schi = ndr_unpack(drsblobs.schemaInfoBlob,
-                                         str(res[0]['schemaInfo']))
+        pfm_schi = ndr_unpack(drsblobs.schemaInfoBlob,
+                              str(res[0]['schemaInfo']))
     else:
         pfm_schi = drsblobs.schemaInfoBlob()
         pfm_schi.marker = 0xFF;
-    return (pfm.ctr, pfm_schi)
+    return pfm_schi
 
 def _drs_fetch_pfm(server, samdb, creds, lp):
     """Fetch prefixMap using DRS interface"""