res = ldb_user4.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"])
+
TestProgram(module=__name__, opts=subunitopts)
self.ou_groups, self.ou_computers))
self.assertEqual(len(res1), 0)
+
parser = optparse.OptionParser("match_rules.py [options] <host>")
sambaopts = options.SambaOptions(parser)
parser.add_option_group(sambaopts)
def set_flags(self):
return self._wrapped.set_flags
+
_wrap_element = MessageElementTextWrapper._wrap
self.assertEqual(ldb.ERR_OPERATIONS_ERROR, code)
self.assertIn("sub-database index", string)
+
if __name__ == '__main__':
import unittest
unittest.TestProgram()
self.ctx.loop_once()
self.assertEqual(collecting_list, [1, 2])
+
if __name__ == '__main__':
TestProgram()
test_domain_ops(samr, dom_handle)
samr.Close(dom_handle)
+
if len(sys.argv) != 2:
print "Usage: samr.js <BINDING>"
sys.exit(1)
list_values(subkey)
return count
+
if len(args) > 1:
root = args[1]
else:
finally:
f.close()
+
MAX_NETBIOS_NAME_LEN = 15
from samba.crypto import arcfour_crypt_blob
return arcfour_crypt_blob(data, key)
+
version = _glue.version
interface_ips = _glue.interface_ips
fault_setup = _glue.fault_setup
def __str__(self):
pass
+
''' Fetch the hostname of a writable DC '''
nbt.NBT_SERVER_DS))
return cldap_ret.pdc_dns_name
+
''' Fetch a list of GUIDs for applicable GPOs '''
def _color_debug(*args, **kwargs):
DEBUG('%s%s%s' % (kwargs['color'], args[0], C_NORMAL), *args[1:])
+
_globals = globals()
for _color in ('DARK_RED', 'RED', 'DARK_GREEN', 'GREEN', 'YELLOW',
'DARK_YELLOW', 'DARK_BLUE', 'BLUE', 'PURPLE', 'MAGENTA',
class NCType(object):
(unknown, schema, domain, config, application) = range(0, 5)
+
# map the NCType enum to strings for debugging
nctype_lut = dict((v, k) for k, v in NCType.__dict__.items() if k[:2] != '__')
return (line, buffer)
+
# Only compile regexp once.
# Will not match options after the attribute type.
attr_type_re = re.compile("^([A-Za-z][A-Za-z0-9-]*):")
return "\n\n".join(out) + "\n\n"
+
if __name__ == '__main__':
import sys
# print ET.tostring(node, method='text')
+
if __name__ == '__main__':
import sys
return attr_ldif + "\n\n" + classes_ldif + "\n\n"
+
if __name__ == '__main__':
import sys
if ldf is not None:
ldf.close()
+
if __name__ == '__main__':
import sys
return lines[0].strip()
return ""
+
try:
import samba.dckeytab
except ImportError:
return 0
return 0
+
try:
random_reason = check_random()
if random_reason is not None:
conn2.do_single_request(call_id=1, ctx=ctx2, io=inq_if_ids)
return
+
if __name__ == "__main__":
global_ndr_print = True
global_hexdump = True
self.check_all_interfaces()
return self.errcount
+
tests = RpcTests()
errcount = tests.run()
if errcount == 0:
None,
add_rec_buf)
+
TestProgram(module=__name__, opts=subunitopts)
except socket.timeout:
self.fail("DNS server is too slow (timeout %s)" % timeout)
+
TestProgram(module=__name__, opts=subunitopts)
print("\033[00;36m%s\033[00m" % msg)
sys.stdout.flush()
+
timeout = 0
server = SocketServer.UDPServer((host, int(port)), DnsHandler)
server.serve_forever()
+
main()
rcode = self.search_record(self.newrecname)
self.assert_rcode_equals(rcode, dns.DNS_RCODE_NXDOMAIN)
+
TestProgram(module=__name__, opts=subunitopts)
if t.exc:
raise t.exc[0](t.exc[1])
+
if __name__ == "__main__":
import unittest
unittest.main()
self.remove_files(dbfile, dot_file)
+
EXPECTED_DOT_MULTISITE_NO_KEY = r"""/* generated by samba */
digraph A_samba_tool_production {
label="NTDS Connections known to CN=WIN01,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=ad,DC=samba,DC=example,DC=com";
def dummymessage(a=None, b=None):
pass
+
smb_conf_path = "%s/%s/%s" % (os.environ["SELFTEST_PREFIX"], "ad_dc_ntvfs", "etc/smb.conf")
(push_remote, push_branch),
show=True, dir=test_master)
+
def_testbase = os.getenv("AUTOBUILD_TESTBASE", "/memdisk/%s" % os.getenv('USER'))
gitroot = find_git_root()
p = os.path.abspath(os.path.join(p, '..'))
return None
+
cwd = os.getcwd()
gitroot = find_git_root()
os.unlink(f.name)
sys.exit(-1)
+
# run bisect
ret = -1
try:
'deprecated' : deprecated,
'synonyms' : synonyms }
+
# map doc attributes to a section of the generated function
context_dict = {"G": "_GLOBAL", "S": "_LOCAL"}
param_type_dict = {
finally:
f.close()
+
mapping = {
'boolean' : 'bool ',
'string' : 'char *',
finally:
file_out.close()
+
type_dict = {
"boolean" : "P_BOOL",
"boolean-rev" : "P_BOOLREV",
finally:
file_out.close()
+
if options.mode == 'FUNCTIONS':
generate_functions(options.filename, options.output)
elif options.mode == 'S3PROTO':
def binpath(name):
return os.path.join(bindir(), name)
+
# Split perl variable to allow $PERL to be set to e.g. "perl -W"
perl = os.getenv("PERL", "perl").split()
subprocess.Popen([wbinfo, '--%s-to-sid=%s' % (idtype, inid)],
stdout=subprocess.PIPE).communicate()
+
domain = subprocess.Popen([wbinfo, "--own-domain"],
stdout=subprocess.PIPE).communicate()[0].strip()
domsid = subprocess.Popen([wbinfo, "-n", domain + "/"],
sys.exit(1)
i += 1
+
# first round: with filled cache via sid-to-id
check_singular(sids, gids, 'gid')
check_singular(sids, uids, 'uid')
selftesthelpers.plansmbtorture4testsuite(
name, env, options, target='samba3', modname=modname)
+
# find config.h
try:
config_h = os.environ["CONFIG_H"]
os.waitpid(client_pid, 0)
sys.exit(0)
+
if __name__ == "__main__":
main()
list.append(item)
return list
+
classinfo = pull_classinfo(db)
if objectclass is None:
def test_03_13_member_search_linked_users(self):
self._test_member_search(rounds=2)
+
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host
expected = "%s:%s$@%s" % (dns_domainname.lower(), hostname.lower(), dns_domainname.upper())
self.assertEquals(given, expected)
+
if not "://" in host:
if os.path.isfile(host):
host = "tdb://%s" % host
else:
self.assertTrue("msDS-isRODC" in ldb_msg)
+
if not "://" in host:
if os.path.isfile(host):
host = "tdb://%s" % host
(num, _) = e14.args
self.assertEquals(num, ERR_CONSTRAINT_VIOLATION)
+
TestProgram(module=__name__, opts=subunitopts)
self.assert_forward_links(e1, [], attr='addressBookRoots2',
show_deactivated_link=0)
+
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host
def test_login_basics_ntlm(self):
self._test_login_basics(self.lockout1ntlm_creds)
+
host_url = "ldap://%s" % host
TestProgram(module=__name__, opts=subunitopts)
desc = ndr_unpack(drsuapi.DsGetNCChangesCtr6, blob)
self._test_pack(desc, cycles=20)
+
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host
print("va[%s]" % va)
self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
+
if not "://" in url:
if os.path.isfile(url):
url = "tdb://%s" % url
self._test_samr_password_change(self.lockout1ntlm_creds,
other_creds=self.lockout2ntlm_creds)
+
host_url = "ldap://%s" % host
TestProgram(module=__name__, opts=subunitopts)
# Close the second LDB connection (with the user credentials)
self.ldb2 = None
+
if not "://" in host:
if os.path.isfile(host):
host = "tdb://%s" % host
TestProgram(module=__name__, opts=subunitopts)
+
main()
finally:
set_auto_replication(RWDC, True)
+
main()
sub_usn2 = int(sub_res2[0]["uSNChanged"][0])
self.assertTrue(sub_usn2 == sub_usn0)
+
if not "://" in host:
if os.path.isfile(host):
host = "tdb://%s" % host
x = x.decode('utf-8')
return normalize('NFKC', x).upper().encode('utf-8')
+
# Python, Windows, and Samba all sort the following sequence in
# drastically different ways. The order here is what you get from
# Windows2012R2.
self.assertEqual(len(rids.rids), 1)
self.assertEqual(rids.rids[0].rid, user_info.primary_gid)
+
if not "://" in url:
if os.path.isfile(url):
url = "tdb://%s" % url
except: strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
+
import types
try:
_object = types.ObjectType
def __init__(self, *args, **kwargs):
_wmi.IUnknown_swiginit(self, _wmi.new_IUnknown(*args, **kwargs))
__swig_destroy__ = _wmi.delete_IUnknown
+
+
IUnknown.Release = new_instancemethod(_wmi.IUnknown_Release, None, IUnknown)
IUnknown_swigregister = _wmi.IUnknown_swigregister
IUnknown_swigregister(IUnknown)
def __init__(self, *args, **kwargs):
_wmi.IWbemServices_swiginit(self, _wmi.new_IWbemServices(*args, **kwargs))
__swig_destroy__ = _wmi.delete_IWbemServices
+
+
IWbemServices.ExecQuery = new_instancemethod(_wmi.IWbemServices_ExecQuery, None, IWbemServices)
IWbemServices.ExecNotificationQuery = new_instancemethod(_wmi.IWbemServices_ExecNotificationQuery, None, IWbemServices)
IWbemServices.CreateInstanceEnum = new_instancemethod(_wmi.IWbemServices_CreateInstanceEnum, None, IWbemServices)
def __init__(self, *args, **kwargs):
_wmi.IEnumWbemClassObject_swiginit(self, _wmi.new_IEnumWbemClassObject(*args, **kwargs))
__swig_destroy__ = _wmi.delete_IEnumWbemClassObject
+
+
IEnumWbemClassObject.Reset = new_instancemethod(_wmi.IEnumWbemClassObject_Reset, None, IEnumWbemClassObject)
IEnumWbemClassObject_swigregister = _wmi.IEnumWbemClassObject_swigregister
IEnumWbemClassObject_swigregister(IEnumWbemClassObject)
for n in graph[node]:
add_deps(n)
+
add_deps(top)
# Generate output
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)
tab = []
if opts.b:
% (drs_schi.invocation_id, ldb_schi.invocation_id))
return errors
+
########### main code ###########
if __name__ == "__main__":
# command line parsing
def attid_equal(a1, a2):
return (a1 & 0xffffffff) == (a2 & 0xffffffff)
+
########### main code ###########
if __name__ == "__main__":
parser = OptionParser("repl_cleartext_pwd.py [options] server dn cookie_file clear_utf8_name [attid attname attmode] [clear_utf16_name")
# Important unit running information
+
if not "://" in host:
host = "ldap://%s" % host
return selftesthelpers.plansmbtorture4testsuite(name, env, options,
target='samba4', modname=modname)
+
samba4srcdir = source4dir()
samba4bindir = bindir()
validate = os.getenv("VALIDATE", "")