ldb.FLAG_MOD_ADD, "enableOptionalFeature")
res = sam_ldb.modify(msg)
-print "Recycle Bin feature enabled"
+print("Recycle Bin feature enabled")
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-
import sys
import optparse
sys.path.insert(0, "bin/python")
if res and len(res) == 1 and res[0]["invocationId"]:
invocation = str(ndr_unpack(misc.GUID, res[0]["invocationId"][0]))
else:
- print "Unable to find invocation ID"
+ print("Unable to find invocation ID")
sys.exit(1)
else:
- print "Unable to find attribute dsServiceName in rootDSE"
+ print("Unable to find attribute dsServiceName in rootDSE")
sys.exit(1)
minobj = 5
(hash_id, nb_obj) = findprovisionrange(samdb, basedn)
-print "Here is a list of changes that modified more than %d objects in 1 minute." % minobj
-print "Usually changes made by provision and upgradeprovision are those who affect a couple"\
- " of hundred of objects or more"
-print "Total number of objects: %d" % nb_obj
-print
+print("Here is a list of changes that modified more than %d objects in 1 minute." % minobj)
+print("Usually changes made by provision and upgradeprovision are those who affect a couple"
+ " of hundred of objects or more")
+print("Total number of objects: %d\n" % nb_obj)
print_provision_ranges(hash_id, minobj, opts.storedir, str(paths.samdb), invocation)
def write_ldif_one(o, attrs):
"""dump an object as ldif"""
- print "dn: CN=%s,${SCHEMADN}" % o["cn"]
+ print("dn: CN=%s,${SCHEMADN}" % o["cn"])
for a in attrs:
if not o.has_key(a):
continue
for line in ldif_entry:
length = 79
if len(line) <= length + 1:
- print line
+ print(line)
else:
for i in range(len(line) / length + 1):
if i == 0:
def write_ldif_one(o, attrs):
"""dump an object as ldif"""
- print "dn: CN=%s,${SCHEMADN}" % o["cn"]
+ print("dn: CN=%s,${SCHEMADN}" % o["cn"])
for a in attrs:
if not o.has_key(a):
continue
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-
import samba.param as param, ldb, sys, getopt
optlist, args = getopt.getopt(sys.argv[1:], "s:")
msg = secrets.search(expression=search, attrs=['secret'])
if not msg:
- print "Error:"
- print "Password for host[%s] not found in path[%s]." % (netbios, path)
- print "You may want to pass the smb.conf location via the -s option."
+ print("Error:")
+ print("Password for host[%s] not found in path[%s]." % (netbios, path))
+ print("You may want to pass the smb.conf location via the -s option.")
exit(1)
password=msg[0]['secret'][0]
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-
+from __future__ import print_function
import optparse
import os
import sys
def message(text):
"""print a message if quiet is not set."""
if not opts.quiet:
- print text
+ print(text)
if len(sys.argv) == 1:
opts.interactive = True
smbconf = param.default_path()
if not os.path.exists(smbconf):
- print >>sys.stderr, "Unable to find smb.conf .. "+smbconf
+ print("Unable to find smb.conf .. "+smbconf, file=sys.stderr)
parser.print_usage()
sys.exit(1)
sam_ldb.modify(m)
res3 = sam_ldb.search(expression="(&(distinguishedName=%s)(%s=*))"%(dn,att),scope=SCOPE_SUBTREE, attrs=[att],controls=["search_options:1:2"])
if( len(res3) == 0 or (len(res3[0][att])!= len(saveatt))):
- print >>sys.stderr, str(dn) + " has no attr " +att+ " or a wrong value"
+ print(str(dn) + " has no attr " +att+ " or a wrong value",
+ file=sys.stderr)
for satt in saveatt:
- print >>sys.stderr,str(att)+" = "+satt
+ print("%s = %s" % (att, satt),
+ file=sys.stderr)
sam_ldb.transaction_cancel()
sam_ldb.transaction_commit()
samdb.transaction_commit()
-print "Re-opening with the full DB stack"
+print("Re-opening with the full DB stack")
samdb = SamDB(url=url,
lp=lp_ctx)
print "Re-triggering another re-index"
"""show open sessions"""
sessions = next(conn.smbsrv_information(irpc.SMBSRV_INFO_SESSIONS))
- print "User Client Connected at"
- print "-" * 79
+ print("User Client Connected at")
+ 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))
- print ""
+ print("%-30s %16s %s" % (fulluser,
+ session.client_ip,
+ sys.httptime(session.connect_time)))
+ print()
def show_tcons(open_connection):
"""show open tree connects"""
ldbs.sam.add(msg)
- print "Creating %d contacts" % num_contacts
+ print("Creating %d contacts" % num_contacts)
count = 0
increment = num_contacts / 10
if increment > 5000:
options = options.replace("${PREFIX}", prefix)
-print options
+print(options)
drs = drsuapi.drsuapi(binding_str, lp, creds)
drs_handle = do_DsBind(drs)
- print "DRS Handle: %s" % drs_handle
+ print("DRS Handle: %s" % drs_handle)
req = drsuapi.DsNameRequest1()
names = drsuapi.DsNameString()
(handle, privs) = lsaconn.EnumPrivs(pol_handle, 0, 100)
for p in privs.privs:
disp_name = get_display_name(lsaconn, pol_handle, p.name.string)
- print "0x%08x %31s \"%s\"" % (p.luid.low, p.name.string, disp_name)
+ print("0x%08x %31s \"%s\"" % (p.luid.low, p.name.string, disp_name))
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()