summaryrefslogtreecommitdiff
path: root/source4/scripting/bin
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting/bin')
-rwxr-xr-xsource4/scripting/bin/autoidl (renamed from source4/scripting/bin/autoidl.py)0
-rwxr-xr-x[-rw-r--r--]source4/scripting/bin/epdump (renamed from source4/scripting/bin/epdump.py)0
-rwxr-xr-xsource4/scripting/bin/minschema (renamed from source4/scripting/bin/minschema.py)36
-rwxr-xr-xsource4/scripting/bin/smbstatus6
-rwxr-xr-xsource4/scripting/bin/subunitrun1
5 files changed, 20 insertions, 23 deletions
diff --git a/source4/scripting/bin/autoidl.py b/source4/scripting/bin/autoidl
index eed4ba3a80..eed4ba3a80 100755
--- a/source4/scripting/bin/autoidl.py
+++ b/source4/scripting/bin/autoidl
diff --git a/source4/scripting/bin/epdump.py b/source4/scripting/bin/epdump
index 15dee33774..15dee33774 100644..100755
--- a/source4/scripting/bin/epdump.py
+++ b/source4/scripting/bin/epdump
diff --git a/source4/scripting/bin/minschema.py b/source4/scripting/bin/minschema
index 111557126d..e7d7ed4979 100755
--- a/source4/scripting/bin/minschema.py
+++ b/source4/scripting/bin/minschema
@@ -11,7 +11,8 @@ import os, sys
sys.path.insert(0, "bin/python")
import samba
-from samba import getopt as options
+from samba import getopt as options, Ldb
+from ldb import SCOPE_SUBTREE, SCOPE_BASE, LdbError
import sys
parser = optparse.OptionParser("minschema <URL> <classfile>")
@@ -50,7 +51,9 @@ if len(args) != 2:
(url, classfile) = args
-creds = credopts.get_credentials()
+lp_ctx = sambaopts.get_loadparm()
+
+creds = credopts.get_credentials(lp_ctx)
ldb = Ldb(url, credentials=creds)
objectclasses = []
@@ -131,17 +134,10 @@ attrib_attrs = ["objectClass",
# 2: abstract
# 3: auxiliary
-#
-# print only if verbose is set
-#
-def dprintf(text):
- if verbose is not None:
- print text
-
def get_object_cn(ldb, name):
attrs = ["cn"]
- res = ldb.search("(ldapDisplayName=%s)" % name, rootDse["schemaNamingContext"], ldb.SCOPE_SUBTREE, attrs)
+ res = ldb.search("(ldapDisplayName=%s)" % name, rootDse["schemaNamingContext"], SCOPE_SUBTREE, attrs)
assert len(res) == 1
return res[0]["cn"]
@@ -229,7 +225,7 @@ def find_objectclass_properties(ldb, o):
"""the properties of an objectclass"""
res = ldb.search(
expression="(ldapDisplayName=%s)" % o.name,
- basedn=rootDse["schemaNamingContext"], scope=ldb.SCOPE_SUBTREE, attrs=class_attrs)
+ base=rootDse["schemaNamingContext"], scope=SCOPE_SUBTREE, attrs=class_attrs)
assert(len(res) == 1)
msg = res[0]
for a in msg:
@@ -239,7 +235,7 @@ def find_attribute_properties(ldb, o):
"""find the properties of an attribute"""
res = ldb.search(
expression="(ldapDisplayName=%s)" % o.name,
- basedn=rootDse["schemaNamingContext"], scope=ldb.SCOPE_SUBTREE,
+ base=rootDse["schemaNamingContext"], scope=SCOPE_SUBTREE,
attrs=attrib_attrs)
assert(len(res) == 1)
msg = res[0]
@@ -269,7 +265,7 @@ def find_objectclass_auto(ldb, o):
print "%s\n" % ldif
return
- res = ldb.search("", testdn, ldb.SCOPE_BASE)
+ res = ldb.search(base=testdn, scope=ldb.SCOPE_BASE)
ldb.delete(testdn)
for a in res.msgs[0]:
@@ -284,7 +280,7 @@ def expand_objectclass(ldb, o):
"subClassOf"]
res = ldb.search(
expression="(&(objectClass=classSchema)(ldapDisplayName=%s))" % o.name,
- basedn=rootDse["schemaNamingContext"], scope=ldb.SCOPE_SUBTREE,
+ base=rootDse["schemaNamingContext"], scope=SCOPE_SUBTREE,
attrs=attrs)
print "Expanding class %s\n" % o.name
assert(len(res) == 1)
@@ -322,13 +318,13 @@ def walk_dn(ldb, dn):
# get a list of all possible attributes for this object
attrs = ["allowedAttributes"]
try:
- res = ldb.search("objectClass=*", dn, ldb.SCOPE_BASE, attrs)
+ res = ldb.search("objectClass=*", dn, SCOPE_BASE, attrs)
except LdbError, e:
print "Unable to fetch allowedAttributes for '%s' - %r\n" % (dn, e)
return
allattrs = res[0]["allowedAttributes"]
try:
- res = ldb.search("objectClass=*", dn, ldb.SCOPE_BASE, allattrs)
+ res = ldb.search("objectClass=*", dn, SCOPE_BASE, allattrs)
except LdbError, e:
print "Unable to fetch all attributes for '%s' - %s\n" % (dn, e)
return
@@ -340,7 +336,7 @@ def walk_dn(ldb, dn):
def walk_naming_context(ldb, namingContext):
"""walk a naming context, looking for all records"""
try:
- res = ldb.search("objectClass=*", namingContext, ldb.SCOPE_DEFAULT,
+ res = ldb.search("objectClass=*", namingContext, SCOPE_DEFAULT,
["objectClass"])
except LdbError, e:
print "Unable to fetch objectClasses for '%s' - %s\n" % (namingContext, e)
@@ -398,7 +394,7 @@ def build_objectclass(ldb, name):
try:
res = ldb.search(
expression="(&(objectClass=classSchema)(ldapDisplayName=%s))" % name,
- basedn=rootDse["schemaNamingContext"], scope=ldb.SCOPE_SUBTREE,
+ base=rootDse["schemaNamingContext"], scope=SCOPE_SUBTREE,
attrs=attrs)
except LdbError, e:
print "unknown class '%s'\n" % name
@@ -503,10 +499,10 @@ objectCategory: CN=SubSchema,${SCHEMADN}
def load_list(file):
"""load a list from a file"""
- return open(file, 'r').splitlines()
+ return open(file, 'r').readlines()
# get the rootDSE
-res = ldb.search("", "", ldb.SCOPE_BASE)
+res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["schemaNamingContext"])
rootDse = res[0]
# load the list of classes we are interested in
diff --git a/source4/scripting/bin/smbstatus b/source4/scripting/bin/smbstatus
index bbd0e84826..a9265ead6a 100755
--- a/source4/scripting/bin/smbstatus
+++ b/source4/scripting/bin/smbstatus
@@ -22,7 +22,7 @@ def show_sessions(conn):
sessions = conn.smbsrv_information(irpc.SMBSRV_INFO_SESSIONS).next()
print "User Client Connected at"
- print "-------------------------------------------------------------------------------"
+ print "-" * 79
for session in sessions:
fulluser = "%s/%s" % (session.account_name, session.domain_name)
print "%-30s %16s %s" % (fulluser, session.client_ip, sys.httptime(session.connect_time))
@@ -33,7 +33,7 @@ def show_tcons(open_connection):
conn = open_connection("smb_server")
tcons = conn.smbsrv_information(irpc.SMBSRV_INFO_TCONS).next()
print "Share Client Connected at"
- print "-------------------------------------------------------------------------------"
+ print "-" * 79
for tcon in tcons:
print "%-30s %16s %s" % (tcon.share_name, tcon.client_ip, sys.httptime(tcon.connect_time))
@@ -76,7 +76,7 @@ else:
try:
conn = open_connection("smb_server")
except RuntimeError, (num, msg):
- if msg == 'NT_STATUS_OBJECT_NAME_NOT_FOUND':
+ if msg == 'NT_STATUS_OBJECT_NAME_NOT_FOUND':
print "No active connections"
else:
show_sessions(conn)
diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun
index 6f1086ad37..e7737bdbec 100755
--- a/source4/scripting/bin/subunitrun
+++ b/source4/scripting/bin/subunitrun
@@ -21,6 +21,7 @@ import sys
# Find right directory when running from source tree
sys.path.insert(0, "bin/python")
+sys.path.insert(1, "../lib/subunit/python")
from subunit import SubunitTestRunner
from unittest import TestProgram