#
+from __future__ import print_function
import sys, os.path, io, string
# parsed error data
Errors.append(newError)
else:
if len(Errors) == 0:
- print "Error parsing file as line %d"%count
+ print("Error parsing file as line %d"%count)
sys.exit()
err = Errors[-1]
if err.err_define == None:
err.err_string = err.err_string + " " + desc
count = count + 1
fileContents.close()
- print "parsed %d lines generated %d error definitions"%(count,len(Errors))
+ print("parsed %d lines generated %d error definitions"%(count,len(Errors)))
def write_license(out_file):
out_file.write("/*\n")
if len(sys.argv) > 1:
input_file1 = sys.argv[1]
else:
- print "usage: %s winerrorfile"%(sys.argv[0])
+ print("usage: %s winerrorfile"%(sys.argv[0]))
sys.exit()
parseErrorDescriptions(input_file1, False)
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+from __future__ import print_function
"""Import generete werror.h/doserr.c files from WSPP HTML"""
import re
# print skipped errors
if self.opt.print_skipped and len(self._errors_skipped):
- print "\nErrors skipped during HTML parsing:"
+ print("\nErrors skipped during HTML parsing:")
pprint.pprint(self._errors_skipped)
- print "\n"
+ print("\n")
return errors
html_str += line.strip()
fp.close()
except IOError as e:
- print "error loading url: " + e.strerror
+ print("error loading url: " + e.strerror)
pass
# currently ERROR codes are rendered as table
(defined_errors,
no_value_errors) = werr_parser.load_err_codes(self.opt.werror_file)
if not defined_errors:
- print "\nUnable to load existing errors file: %s" % self.opt.werror_file
+ print("\nUnable to load existing errors file: %s" % self.opt.werror_file)
sys.exit(1)
if self.opt.verbose and len(no_value_errors):
- print "\nWarning: there are errors defines using macro value:"
+ print("\nWarning: there are errors defines using macro value:")
pprint.pprint(no_value_errors)
- print ""
+ print("")
# filter generated error codes
(new_errors,
diff_code_errors,
#!/usr/bin/python
+from __future__ import print_function
import optparse
import sys
import base64
def printdirsync(ctl):
arr = ctl.split(':')
if arr[0] == 'dirsync':
- print "Need to continue: %s" % arr[1]
+ print("Need to continue: %s" % arr[1])
cookie = ndr_unpack(drsblobs.ldapControlDirSyncCookie, base64.b64decode(arr[3]))
- print "DC's NTDS guid: %s " % cookie.blob.guid1
- print "highest usn %s" % cookie.blob.highwatermark.highest_usn
- print "tmp higest usn %s" % cookie.blob.highwatermark.tmp_highest_usn
- print "reserved usn %s" % cookie.blob.highwatermark.reserved_usn
+ print("DC's NTDS guid: %s " % cookie.blob.guid1)
+ print("highest usn %s" % cookie.blob.highwatermark.highest_usn)
+ print("tmp higest usn %s" % cookie.blob.highwatermark.tmp_highest_usn)
+ print("reserved usn %s" % cookie.blob.highwatermark.reserved_usn)
if cookie.blob.extra_length >0:
- print "highest usn in extra %s" % cookie.blob.extra.ctr.cursors[0].highest_usn
+ print("highest usn in extra %s" % cookie.blob.extra.ctr.cursors[0].highest_usn)
return cookie
remote_ldb= Ldb("ldap://" + opts.host + ":389", credentials=creds, lp=lp)
guid = cookie.blob.guid1
pass
if not guid:
- print "No dirsync control ... strange"
+ print("No dirsync control ... strange")
sys.exit(1)
-print ""
-print "Getting first guest without any cookie"
+print("")
+print("Getting first guest without any cookie")
(msgs, ctrls) = remote_ldb.searchex(expression="(samaccountname=guest)", base=base, attrs=["objectClass"], controls=["dirsync:1:1:50"])
cookie = None
if (len(ctrls)):
for ctl in ctrls:
cookie = printdirsync(ctl)
- print "Returned %d entries" % len(msgs)
+ print("Returned %d entries" % len(msgs))
savedcookie = cookie
-print ""
-print "Getting allusers with cookie"
+print("")
+print("Getting allusers with cookie")
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie))]
(msgs, ctrls) = remote_ldb.searchex(expression="(samaccountname=*)", base=base, attrs=["objectClass"], controls=controls)
if (len(ctrls)):
for ctl in ctrls:
cookie = printdirsync(ctl)
- print "Returned %d entries" % len(msgs)
+ print("Returned %d entries" % len(msgs))
cookie = savedcookie
cookie.blob.guid1 = misc.GUID("128a99bf-e2df-4832-ac0a-1fb625e530db")
if cookie.blob.extra_length > 0:
cookie.blob.extra.ctr.cursors[0].source_dsa_invocation_id = misc.GUID("128a99bf-e2df-4832-ac0a-1fb625e530db")
-print ""
-print "Getting all the entries"
+print("")
+print("Getting all the entries")
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie))]
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
cont = 0
cookie = printdirsync(ctl)
if cookie != None:
cont = (ctl.split(':'))[1]
- print "Returned %d entries" % len(msgs)
+ print("Returned %d entries" % len(msgs))
usn = cookie.blob.highwatermark.tmp_highest_usn
if cookie.blob.extra_length > 0:
else:
bigusn = usn + 1000
while (cont == "1"):
- print ""
+ print("")
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie))]
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
if (len(ctrls)):
cookie = printdirsync(ctl)
if cookie != None:
cont = (ctl.split(':'))[1]
- print "Returned %d entries" % len(msgs)
+ print("Returned %d entries" % len(msgs))
-print ""
-print "Getting with cookie but usn changed to %d we should use the one in extra" % (bigusn - 1)
+print("")
+print("Getting with cookie but usn changed to %d we should use the one in extra" % (bigusn - 1))
cookie.blob.highwatermark.highest_usn = 0
cookie.blob.highwatermark.tmp_highest_usn = usn - 2
if cookie.blob.extra_length > 0:
- print "here"
+ print("here")
cookie.blob.extra.ctr.cursors[0].highest_usn = bigusn - 1
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie))]
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
if (len(ctrls)):
for ctl in ctrls:
cookie = printdirsync(ctl)
- print "Returned %d entries" % len(msgs)
+ print("Returned %d entries" % len(msgs))
-print ""
-print "Getting with cookie but usn %d changed and extra/cursor GUID too" % (usn - 2)
-print " so that it's (tmp)highest_usn that drives the limit"
+print("")
+print("Getting with cookie but usn %d changed and extra/cursor GUID too" % (usn - 2))
+print(" so that it's (tmp)highest_usn that drives the limit")
cookie.blob.highwatermark.highest_usn = 0
cookie.blob.highwatermark.tmp_highest_usn = usn - 2
if cookie.blob.extra_length > 0:
if (len(ctrls)):
for ctl in ctrls:
cookie = printdirsync(ctl)
- print "Returned %d entries" % len(msgs)
+ print("Returned %d entries" % len(msgs))
-print ""
-print "Getting with cookie but usn changed to %d" % (usn - 2)
+print("")
+print("Getting with cookie but usn changed to %d" % (usn - 2))
cookie.blob.highwatermark.highest_usn = 0
cookie.blob.highwatermark.tmp_highest_usn = (usn - 2)
if cookie.blob.extra_length > 0:
if (len(ctrls)):
for ctl in ctrls:
cookie = printdirsync(ctl)
- print "Returned %d entries" % len(msgs)
+ print("Returned %d entries" % len(msgs))
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+from __future__ import print_function
import os
import sys
from optparse import OptionParser
drs = drsuapi.drsuapi(binding_str, lp, creds)
(drs_handle, supported_extensions) = drs_DsBind(drs)
- print "DRS Handle: %s" % drs_handle
+ print("DRS Handle: %s" % drs_handle)
req8 = drsuapi.DsGetNCChangesRequest8()
def _pfm_schi_verify(drs_schi, ldb_schi):
errors = []
- print drs_schi.revision
- print drs_schi.invocation_id
+ print(drs_schi.revision)
+ print(drs_schi.invocation_id)
if drs_schi.marker != ldb_schi.marker:
errors.append("Different marker in schemaInfo: drs = %d, ldb = %d"
% (drs_schi.marker, ldb_schi.marker))
# verify prefixMaps
errors = _pfm_verify(drs_pfm, ldb_pfm)
if len(errors):
- print "prefixMap verification errors:"
- print "%s" % errors
+ print("prefixMap verification errors:")
+ print("%s" % errors)
exit_code = 1
# verify schemaInfos
errors = _pfm_schi_verify(drs_schi, ldb_schi)
if len(errors):
- print "schemaInfo verification errors:"
- print "%s" % errors
+ print("schemaInfo verification errors:")
+ print("%s" % errors)
exit_code = 2
if exit_code != 0:
# $
#
+from __future__ import print_function
import sys
# Find right direction when running from source tree
user_session_key = drs_conn.user_session_key
- print "# starting at usn[%d]" % (highwatermark.highest_usn)
+ print("# starting at usn[%d]" % (highwatermark.highest_usn))
while True:
(level, ctr) = drs_conn.DsGetNCChanges(drs_handle, 8, req8)
f.close()
os.rename(tmp_file, cookie_file)
- print "# up to usn[%d]" % (ctr.new_highwatermark.highest_usn)
+ print("# up to usn[%d]" % (ctr.new_highwatermark.highest_usn))
break
- print "# up to tmp_usn[%d]" % (ctr.new_highwatermark.highest_usn)
+ print("# up to tmp_usn[%d]" % (ctr.new_highwatermark.highest_usn))
req8.highwatermark = ctr.new_highwatermark
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+from __future__ import print_function
import optparse
import sys
import time
self.base_dn = ldb.domain_dn()
self.domain_sid = security.dom_sid(ldb.get_domain_sid())
self.user_pass = "samba123@"
- print "baseDN: %s" % self.base_dn
+ print("baseDN: %s" % self.base_dn)
def create_user(self, user_dn):
ldif = """
super(SpeedTestAddDel, self).setUp()
def run_bundle(self, num):
- print "\n=== Test ADD/DEL %s user objects ===\n" % num
+ print("\n=== Test ADD/DEL %s user objects ===\n" % num)
avg_add = Decimal("0.0")
avg_del = Decimal("0.0")
for x in [1, 2, 3]:
self.create_bundle(num)
res_add = Decimal( str(time.time() - start) )
avg_add += res_add
- print " Attempt %s ADD: %.3fs" % ( x, float(res_add) )
+ print(" Attempt %s ADD: %.3fs" % ( x, float(res_add) ))
#
start = time.time()
self.remove_bundle(num)
res_del = Decimal( str(time.time() - start) )
avg_del += res_del
- print " Attempt %s DEL: %.3fs" % ( x, float(res_del) )
- print "Average ADD: %.3fs" % float( Decimal(avg_add) / Decimal("3.0") )
- print "Average DEL: %.3fs" % float( Decimal(avg_del) / Decimal("3.0") )
- print ""
+ print(" Attempt %s DEL: %.3fs" % ( x, float(res_del) ))
+ print("Average ADD: %.3fs" % float( Decimal(avg_add) / Decimal("3.0") ))
+ print("Average DEL: %.3fs" % float( Decimal(avg_del) / Decimal("3.0") ))
+ print("")
def test_00000(self):
""" Remove possibly undeleted test users from previous test
delete_force(self.ldb_admin, self.get_user_dn("acltestuser"))
def run_search_bundle(self, num, _ldb):
- print "\n=== Creating %s user objects ===\n" % num
+ print("\n=== Creating %s user objects ===\n" % num)
self.create_bundle(num)
mod = "(A;;LC;;;%s)(D;;RP;;;%s)" % (str(self.user_sid), str(self.user_sid))
for i in range(num):
self.sd_utils.dacl_add_ace("cn=speedtestuser%d,cn=Users,%s" %
(i+1, self.base_dn), mod)
- print "\n=== %s user objects created ===\n" % num
- print "\n=== Test search on %s user objects ===\n" % num
+ print("\n=== %s user objects created ===\n" % num)
+ print("\n=== Test search on %s user objects ===\n" % num)
avg_search = Decimal("0.0")
for x in [1, 2, 3]:
start = time.time()
res = _ldb.search(base=self.base_dn, expression="(objectClass=*)", scope=SCOPE_SUBTREE)
res_search = Decimal( str(time.time() - start) )
avg_search += res_search
- print " Attempt %s SEARCH: %.3fs" % ( x, float(res_search) )
- print "Average Search: %.3fs" % float( Decimal(avg_search) / Decimal("3.0") )
+ print(" Attempt %s SEARCH: %.3fs" % ( x, float(res_search) ))
+ print("Average Search: %.3fs" % float( Decimal(avg_search) / Decimal("3.0") ))
self.remove_bundle(num)
def get_user_dn(self, name):