1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

PEP8: fix E123: closing bracket does not match indentation of opening bracket's line

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Joe Guo 2018-07-30 18:14:37 +12:00 committed by Douglas Bagnall
parent 297faf3252
commit 484ce0634b
52 changed files with 234 additions and 234 deletions

View File

@ -25,4 +25,4 @@ from _tevent import (
backend_list, backend_list,
Context, Context,
Signal, Signal,
) )

View File

@ -48,7 +48,7 @@ def confirm(msg, forced=False, allow_all=False):
'': False, '': False,
'N': False, 'N': False,
'NO': False, 'NO': False,
} }
prompt = '[y/N]' prompt = '[y/N]'

View File

@ -26,7 +26,7 @@ from samba.credentials import (
AUTO_USE_KERBEROS, AUTO_USE_KERBEROS,
DONT_USE_KERBEROS, DONT_USE_KERBEROS,
MUST_USE_KERBEROS, MUST_USE_KERBEROS,
) )
import sys import sys

View File

@ -1350,7 +1350,7 @@ class DCJoinContext(object):
"trustAuthIncoming" : ndr_pack(outgoing), "trustAuthIncoming" : ndr_pack(outgoing),
"trustAuthOutgoing" : ndr_pack(outgoing), "trustAuthOutgoing" : ndr_pack(outgoing),
"securityIdentifier" : ndr_pack(ctx.forestsid) "securityIdentifier" : ndr_pack(ctx.forestsid)
} }
ctx.local_samdb.add(rec) ctx.local_samdb.add(rec)
rec = { rec = {
@ -1359,7 +1359,7 @@ class DCJoinContext(object):
"userAccountControl" : str(samba.dsdb.UF_INTERDOMAIN_TRUST_ACCOUNT), "userAccountControl" : str(samba.dsdb.UF_INTERDOMAIN_TRUST_ACCOUNT),
"clearTextPassword" : ctx.trustdom_pass.encode('utf-16-le'), "clearTextPassword" : ctx.trustdom_pass.encode('utf-16-le'),
"samAccountName" : "%s$" % ctx.forest_domain_name "samAccountName" : "%s$" % ctx.forest_domain_name
} }
ctx.local_samdb.add(rec) ctx.local_samdb.add(rec)

View File

@ -28,7 +28,7 @@ from samba.dcerpc import (
drsblobs, drsblobs,
drsuapi, drsuapi,
misc, misc,
) )
from samba.common import dsdb_Dn from samba.common import dsdb_Dn
from samba.ndr import ndr_unpack, ndr_pack from samba.ndr import ndr_unpack, ndr_pack
from collections import Counter from collections import Counter

View File

@ -47,7 +47,7 @@ bitFields["searchflags"] = {
'fEXTENDEDLINKTRACKING': 21, # XL 'fEXTENDEDLINKTRACKING': 21, # XL
'fBASEONLY': 20, # BO 'fBASEONLY': 20, # BO
'fPARTITIONSECRET': 19, # SE 'fPARTITIONSECRET': 19, # SE
} }
# ADTS: 2.2.10 # ADTS: 2.2.10
bitFields["systemflags"] = { bitFields["systemflags"] = {
@ -64,12 +64,12 @@ bitFields["systemflags"] = {
'FLAG_CONFIG_ALLOW_MOVE': 2, # AM 'FLAG_CONFIG_ALLOW_MOVE': 2, # AM
'FLAG_CONFIG_ALLOW_RENAME': 1, # AR 'FLAG_CONFIG_ALLOW_RENAME': 1, # AR
'FLAG_DISALLOW_DELETE': 0 # DD 'FLAG_DISALLOW_DELETE': 0 # DD
} }
# ADTS: 2.2.11 # ADTS: 2.2.11
bitFields["schemaflagsex"] = { bitFields["schemaflagsex"] = {
'FLAG_ATTR_IS_CRITICAL': 31 'FLAG_ATTR_IS_CRITICAL': 31
} }
# ADTS: 3.1.1.2.2.2 # ADTS: 3.1.1.2.2.2
oMObjectClassBER = { oMObjectClassBER = {

View File

@ -39,14 +39,14 @@ from samba import (
Ldb, Ldb,
werror, werror,
WERRORError WERRORError
) )
from samba.netcmd import ( from samba.netcmd import (
Command, Command,
CommandError, CommandError,
SuperCommand, SuperCommand,
Option, Option,
) )
def _is_valid_ip(ip_string, address_families=None): def _is_valid_ip(ip_string, address_families=None):
@ -234,7 +234,7 @@ Example3 shows how to create a new computer in the OrgUnit organizational unit.
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, computername, credopts=None, sambaopts=None, versionopts=None, def run(self, computername, credopts=None, sambaopts=None, versionopts=None,
H=None, computerou=None, description=None, prepare_oldjoin=False, H=None, computerou=None, description=None, prepare_oldjoin=False,
@ -351,7 +351,7 @@ sudo is used so a computer may run the command as root.
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, computername, credopts=None, sambaopts=None, def run(self, computername, credopts=None, sambaopts=None,
versionopts=None, H=None): versionopts=None, H=None):
@ -408,13 +408,13 @@ class cmd_computer_list(Command):
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
type=str, metavar="URL", dest="H"), type=str, metavar="URL", dest="H"),
] ]
takes_optiongroups = { takes_optiongroups = {
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, sambaopts=None, credopts=None, versionopts=None, H=None): def run(self, sambaopts=None, credopts=None, versionopts=None, H=None):
lp = sambaopts.get_loadparm() lp = sambaopts.get_loadparm()
@ -485,7 +485,7 @@ attribute.
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, computername, credopts=None, sambaopts=None, versionopts=None, def run(self, computername, credopts=None, sambaopts=None, versionopts=None,
H=None, computer_attrs=None): H=None, computer_attrs=None):
@ -536,7 +536,7 @@ class cmd_computer_move(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, computername, new_ou_dn, credopts=None, sambaopts=None, def run(self, computername, new_ou_dn, credopts=None, sambaopts=None,
versionopts=None, H=None): versionopts=None, H=None):

View File

@ -24,7 +24,7 @@ from samba.netcmd import (
Command, Command,
CommandError, CommandError,
Option Option
) )
from samba.dbchecker import dbcheck from samba.dbchecker import dbcheck
@ -74,7 +74,7 @@ class cmd_dbcheck(Command):
Option("--reset-well-known-acls", dest="reset_well_known_acls", default=False, action="store_true", help="reset ACLs on objects with well known default ACL values to the default"), Option("--reset-well-known-acls", dest="reset_well_known_acls", default=False, action="store_true", help="reset ACLs on objects with well known default ACL values to the default"),
Option("-H", "--URL", help="LDB URL for database or target server (defaults to local SAM database)", Option("-H", "--URL", help="LDB URL for database or target server (defaults to local SAM database)",
type=str, metavar="URL", dest="H"), type=str, metavar="URL", dest="H"),
] ]
def run(self, DN=None, H=None, verbose=False, fix=False, yes=False, def run(self, DN=None, H=None, verbose=False, fix=False, yes=False,
cross_ncs=False, quiet=False, cross_ncs=False, quiet=False,

View File

@ -30,7 +30,7 @@ from samba.netcmd import (
CommandError, CommandError,
SuperCommand, SuperCommand,
Option Option
) )
class cmd_delegation_show(Command): class cmd_delegation_show(Command):
@ -42,12 +42,12 @@ class cmd_delegation_show(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H"), metavar="URL", dest="H"),
] ]
takes_args = ["accountname"] takes_args = ["accountname"]
@ -98,12 +98,12 @@ class cmd_delegation_for_any_service(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H"), metavar="URL", dest="H"),
] ]
takes_args = ["accountname", "onoff"] takes_args = ["accountname", "onoff"]
@ -151,12 +151,12 @@ class cmd_delegation_for_any_protocol(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H"), metavar="URL", dest="H"),
] ]
takes_args = ["accountname", "onoff"] takes_args = ["accountname", "onoff"]
@ -205,12 +205,12 @@ class cmd_delegation_add_service(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H"), metavar="URL", dest="H"),
] ]
takes_args = ["accountname", "principal"] takes_args = ["accountname", "principal"]
@ -259,12 +259,12 @@ class cmd_delegation_del_service(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H"), metavar="URL", dest="H"),
] ]
takes_args = ["accountname", "principal"] takes_args = ["accountname", "principal"]

View File

@ -36,7 +36,7 @@ from samba.netcmd import (
CommandError, CommandError,
Option, Option,
SuperCommand, SuperCommand,
) )
from samba.dcerpc import dnsp, dnsserver from samba.dcerpc import dnsp, dnsserver
from samba.dnsserver import ARecord, AAAARecord, PTRRecord, CNameRecord, NSRecord, MXRecord, SOARecord, SRVRecord, TXTRecord from samba.dnsserver import ARecord, AAAARecord, PTRRecord, CNameRecord, NSRecord, MXRecord, SOARecord, SRVRecord, TXTRecord

View File

@ -59,7 +59,7 @@ from samba.netcmd import (
CommandError, CommandError,
SuperCommand, SuperCommand,
Option Option
) )
from samba.netcmd.fsmo import get_fsmo_roleowner from samba.netcmd.fsmo import get_fsmo_roleowner
from samba.netcmd.common import netcmd_get_domain_infos_via_cldap from samba.netcmd.common import netcmd_get_domain_infos_via_cldap
from samba.samba3 import Samba3 from samba.samba3 import Samba3
@ -84,14 +84,14 @@ from samba.dsdb import (
UF_SERVER_TRUST_ACCOUNT, UF_SERVER_TRUST_ACCOUNT,
UF_TRUSTED_FOR_DELEGATION, UF_TRUSTED_FOR_DELEGATION,
UF_PARTIAL_SECRETS_ACCOUNT UF_PARTIAL_SECRETS_ACCOUNT
) )
from samba.provision import ( from samba.provision import (
provision, provision,
ProvisioningError, ProvisioningError,
DEFAULT_MIN_PWD_LENGTH, DEFAULT_MIN_PWD_LENGTH,
setup_path setup_path
) )
from samba.provision.common import ( from samba.provision.common import (
FILL_FULL, FILL_FULL,
@ -169,11 +169,11 @@ else:
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("--principal", help="extract only this principal", type=str), Option("--principal", help="extract only this principal", type=str),
] ]
takes_args = ["keytab"] takes_args = ["keytab"]
@ -189,13 +189,13 @@ class cmd_domain_info(Command):
synopsis = "%prog <ip_address> [options]" synopsis = "%prog <ip_address> [options]"
takes_options = [ takes_options = [
] ]
takes_optiongroups = { takes_optiongroups = {
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_args = ["address"] takes_args = ["address"]
@ -282,7 +282,7 @@ class cmd_domain_provision(Command):
Option("--partitions-only", Option("--partitions-only",
help="Configure Samba's partitions, but do not modify them (ie, join a BDC)", action="store_true"), help="Configure Samba's partitions, but do not modify them (ie, join a BDC)", action="store_true"),
Option("--use-rfc2307", action="store_true", help="Use AD to store posix attributes (default = no)"), Option("--use-rfc2307", action="store_true", help="Use AD to store posix attributes (default = no)"),
] ]
openldap_options = [ openldap_options = [
Option("--ldapadminpass", type="string", metavar="PASSWORD", Option("--ldapadminpass", type="string", metavar="PASSWORD",
@ -300,7 +300,7 @@ class cmd_domain_provision(Command):
Option("--ldap-backend-forced-uri", type="string", metavar="LDAP-BACKEND-FORCED-URI", Option("--ldap-backend-forced-uri", type="string", metavar="LDAP-BACKEND-FORCED-URI",
help="Force the LDAP backend connection to be to a particular URI. Use this ONLY for 'existing' backends, or when debugging the interaction with the LDAP backend and you need to intercept the LDA"), help="Force the LDAP backend connection to be to a particular URI. Use this ONLY for 'existing' backends, or when debugging the interaction with the LDAP backend and you need to intercept the LDA"),
Option("--ldap-backend-nosync", help="Configure LDAP backend not to call fsync() (for performance in test environments)", action="store_true"), Option("--ldap-backend-nosync", help="Configure LDAP backend not to call fsync() (for performance in test environments)", action="store_true"),
] ]
ntvfs_options = [ ntvfs_options = [
Option("--use-xattrs", type="choice", choices=["yes","no","auto"], Option("--use-xattrs", type="choice", choices=["yes","no","auto"],
@ -659,7 +659,7 @@ class cmd_domain_join(Command):
Option("--parent-domain", help="parent domain to create subdomain under", type=str), Option("--parent-domain", help="parent domain to create subdomain under", type=str),
Option("--adminpass", type="string", metavar="PASSWORD", Option("--adminpass", type="string", metavar="PASSWORD",
help="choose adminstrator password when joining as a subdomain (otherwise random)"), help="choose adminstrator password when joining as a subdomain (otherwise random)"),
] ]
ntvfs_options = [ ntvfs_options = [
Option("--use-ntvfs", help="Use NTVFS for the fileserver (default = no)", Option("--use-ntvfs", help="Use NTVFS for the fileserver (default = no)",
@ -754,13 +754,13 @@ class cmd_domain_demote(Command):
"to remove ALL references to (rather than this DC)", type=str), "to remove ALL references to (rather than this DC)", type=str),
Option("-q", "--quiet", help="Be quiet", action="store_true"), Option("-q", "--quiet", help="Be quiet", action="store_true"),
Option("-v", "--verbose", help="Be verbose", action="store_true"), Option("-v", "--verbose", help="Be verbose", action="store_true"),
] ]
takes_optiongroups = { takes_optiongroups = {
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, sambaopts=None, credopts=None, def run(self, sambaopts=None, credopts=None,
versionopts=None, server=None, versionopts=None, server=None,
@ -1052,7 +1052,7 @@ class cmd_domain_level(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
@ -1285,7 +1285,7 @@ class cmd_domain_passwordsettings_show(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
@ -1359,7 +1359,7 @@ class cmd_domain_passwordsettings_set(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
@ -2098,7 +2098,7 @@ class cmd_domain_trust_list(DomainTrustCommand):
} }
takes_options = [ takes_options = [
] ]
def run(self, sambaopts=None, versionopts=None, localdcopts=None): def run(self, sambaopts=None, versionopts=None, localdcopts=None):
@ -2143,7 +2143,7 @@ class cmd_domain_trust_show(DomainTrustCommand):
} }
takes_options = [ takes_options = [
] ]
takes_args = ["domain"] takes_args = ["domain"]
@ -2286,7 +2286,7 @@ class cmd_domain_trust_create(DomainTrustCommand):
help="Skip validation of the trust.", help="Skip validation of the trust.",
dest='validate', dest='validate',
default=True), default=True),
] ]
takes_args = ["domain"] takes_args = ["domain"]
@ -2782,7 +2782,7 @@ class cmd_domain_trust_delete(DomainTrustCommand):
help="Where to delete the trusted domain object: 'local' or 'both'.", help="Where to delete the trusted domain object: 'local' or 'both'.",
dest='delete_location', dest='delete_location',
default="both"), default="both"),
] ]
takes_args = ["domain"] takes_args = ["domain"]
@ -2939,7 +2939,7 @@ class cmd_domain_trust_validate(DomainTrustCommand):
help="Where to validate the trusted domain object: 'local' or 'both'.", help="Where to validate the trusted domain object: 'local' or 'both'.",
dest='validate_location', dest='validate_location',
default="both"), default="both"),
] ]
takes_args = ["domain"] takes_args = ["domain"]
@ -3162,7 +3162,7 @@ class cmd_domain_trust_namespaces(DomainTrustCommand):
help="Delete an existing msDS-SPNSuffixes attribute of the local forest. Can be specified multiple times.", help="Delete an existing msDS-SPNSuffixes attribute of the local forest. Can be specified multiple times.",
dest='delete_spn', dest='delete_spn',
default=[]), default=[]),
] ]
takes_args = ["domain?"] takes_args = ["domain?"]
@ -3853,7 +3853,7 @@ This command expunges tombstones from the database."""
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, *ncs, **kwargs): def run(self, *ncs, **kwargs):
sambaopts = kwargs.get("sambaopts") sambaopts = kwargs.get("sambaopts")

View File

@ -30,7 +30,7 @@ from samba.netcmd import (
CommandError, CommandError,
Option, Option,
SuperCommand, SuperCommand,
) )
from samba.samdb import SamDB from samba.samdb import SamDB
from samba import drs_utils, nttime2string, dsdb from samba import drs_utils, nttime2string, dsdb
from samba.dcerpc import drsuapi, misc from samba.dcerpc import drsuapi, misc
@ -431,7 +431,7 @@ class cmd_drs_replicate(Command):
Option("--local-online", help="pull changes into the local database (destination DC is ignored) as a normal online replication", action="store_true"), Option("--local-online", help="pull changes into the local database (destination DC is ignored) as a normal online replication", action="store_true"),
Option("--async-op", help="use ASYNC_OP for the replication", action="store_true"), Option("--async-op", help="use ASYNC_OP for the replication", action="store_true"),
Option("--single-object", help="Replicate only the object specified, instead of the whole Naming Context (only with --local)", action="store_true"), Option("--single-object", help="Replicate only the object specified, instead of the whole Naming Context (only with --local)", action="store_true"),
] ]
def drs_local_replicate(self, SOURCE_DC, NC, full_sync=False, def drs_local_replicate(self, SOURCE_DC, NC, full_sync=False,
single_object=False, single_object=False,
@ -639,7 +639,7 @@ class cmd_drs_bind(Command):
("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V10", "DRS_EXT_GETCHGREQ_V10"), ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V10", "DRS_EXT_GETCHGREQ_V10"),
("DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART2", "DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART2"), ("DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART2", "DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART2"),
("DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART3", "DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART3") ("DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART3", "DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART3")
] ]
optmap_ext = [ optmap_ext = [
("DRSUAPI_SUPPORTED_EXTENSION_ADAM", "DRS_EXT_ADAM"), ("DRSUAPI_SUPPORTED_EXTENSION_ADAM", "DRS_EXT_ADAM"),
@ -689,7 +689,7 @@ class cmd_drs_options(Command):
takes_options = [ takes_options = [
Option("--dsa-option", help="DSA option to enable/disable", type="str", Option("--dsa-option", help="DSA option to enable/disable", type="str",
metavar="{+|-}IS_GC | {+|-}DISABLE_INBOUND_REPL | {+|-}DISABLE_OUTBOUND_REPL | {+|-}DISABLE_NTDSCONN_XLATE" ), metavar="{+|-}IS_GC | {+|-}DISABLE_INBOUND_REPL | {+|-}DISABLE_OUTBOUND_REPL | {+|-}DISABLE_NTDSCONN_XLATE" ),
] ]
option_map = {"IS_GC": 0x00000001, option_map = {"IS_GC": 0x00000001,
"DISABLE_INBOUND_REPL": 0x00000002, "DISABLE_INBOUND_REPL": 0x00000002,
@ -753,7 +753,7 @@ class cmd_drs_clone_dc_database(Command):
Option("-q", "--quiet", help="Be quiet", action="store_true"), Option("-q", "--quiet", help="Be quiet", action="store_true"),
Option("--include-secrets", help="Also replicate secret values", action="store_true"), Option("--include-secrets", help="Also replicate secret values", action="store_true"),
Option("-v", "--verbose", help="Be verbose", action="store_true") Option("-v", "--verbose", help="Be verbose", action="store_true")
] ]
takes_args = ["domain"] takes_args = ["domain"]

View File

@ -40,7 +40,7 @@ from samba.netcmd import (
CommandError, CommandError,
SuperCommand, SuperCommand,
Option, Option,
) )
@ -54,7 +54,7 @@ class cmd_dsacl_set(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
@ -81,7 +81,7 @@ class cmd_dsacl_set(Command):
type="string"), type="string"),
Option("--sddl", help="An ACE or group of ACEs to be added on the object", Option("--sddl", help="An ACE or group of ACEs to be added on the object",
type="string"), type="string"),
] ]
def find_trustee_sid(self, samdb, trusteedn): def find_trustee_sid(self, samdb, trusteedn):
res = samdb.search(base=trusteedn, expression="(objectClass=*)", res = samdb.search(base=trusteedn, expression="(objectClass=*)",

View File

@ -25,7 +25,7 @@ from samba.netcmd import (
CommandError, CommandError,
SuperCommand, SuperCommand,
Option Option
) )
class cmd_forest_show(Command): class cmd_forest_show(Command):
"""Display forest settings. """Display forest settings.
@ -41,12 +41,12 @@ class cmd_forest_show(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
type=str, metavar="URL", dest="H"), type=str, metavar="URL", dest="H"),
] ]
def run(self, H=None, credopts=None, sambaopts=None, versionopts=None): def run(self, H=None, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm() lp = sambaopts.get_loadparm()
@ -89,12 +89,12 @@ class cmd_forest_set(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
type=str, metavar="URL", dest="H"), type=str, metavar="URL", dest="H"),
] ]
takes_args = ["value"] takes_args = ["value"]

View File

@ -28,7 +28,7 @@ from samba.netcmd import (
CommandError, CommandError,
SuperCommand, SuperCommand,
Option, Option,
) )
from samba.samdb import SamDB from samba.samdb import SamDB
def get_fsmo_roleowner(samdb, roledn, role): def get_fsmo_roleowner(samdb, roledn, role):
@ -222,7 +222,7 @@ class cmd_fsmo_seize(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
@ -242,7 +242,7 @@ domaindns=DomainDnsZonesMasterRole\n
forestdns=ForestDnsZonesMasterRole\n forestdns=ForestDnsZonesMasterRole\n
all=all of the above\n all=all of the above\n
You must provide an Admin user and password."""), You must provide an Admin user and password."""),
] ]
takes_args = [] takes_args = []
@ -429,12 +429,12 @@ class cmd_fsmo_show(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
type=str, metavar="URL", dest="H"), type=str, metavar="URL", dest="H"),
] ]
takes_args = [] takes_args = []
@ -483,7 +483,7 @@ class cmd_fsmo_transfer(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
@ -500,7 +500,7 @@ domaindns=DomainDnsZonesMasterRole\n
forestdns=ForestDnsZonesMasterRole\n forestdns=ForestDnsZonesMasterRole\n
all=all of the above\n all=all of the above\n
You must provide an Admin user and password."""), You must provide an Admin user and password."""),
] ]
takes_args = [] takes_args = []

View File

@ -32,7 +32,7 @@ from samba.netcmd import (
CommandError, CommandError,
Option, Option,
SuperCommand, SuperCommand,
) )
from samba.samdb import SamDB from samba.samdb import SamDB
from samba import dsdb from samba import dsdb
from samba.dcerpc import security from samba.dcerpc import security
@ -381,7 +381,7 @@ class cmd_listall(Command):
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H") metavar="URL", dest="H")
] ]
def run(self, H=None, sambaopts=None, credopts=None, versionopts=None): def run(self, H=None, sambaopts=None, credopts=None, versionopts=None):
@ -419,7 +419,7 @@ class cmd_list(Command):
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
type=str, metavar="URL", dest="H") type=str, metavar="URL", dest="H")
] ]
def run(self, username, H=None, sambaopts=None, credopts=None, versionopts=None): def run(self, username, H=None, sambaopts=None, credopts=None, versionopts=None):
@ -534,7 +534,7 @@ class cmd_show(Command):
takes_options = [ takes_options = [
Option("-H", help="LDB URL for database or target server", type=str) Option("-H", help="LDB URL for database or target server", type=str)
] ]
def run(self, gpo, H=None, sambaopts=None, credopts=None, versionopts=None): def run(self, gpo, H=None, sambaopts=None, credopts=None, versionopts=None):
@ -582,7 +582,7 @@ class cmd_getlink(Command):
takes_options = [ takes_options = [
Option("-H", help="LDB URL for database or target server", type=str) Option("-H", help="LDB URL for database or target server", type=str)
] ]
def run(self, container_dn, H=None, sambaopts=None, credopts=None, def run(self, container_dn, H=None, sambaopts=None, credopts=None,
versionopts=None): versionopts=None):
@ -633,7 +633,7 @@ class cmd_setlink(Command):
help="Disable policy"), help="Disable policy"),
Option("--enforce", dest="enforced", default=False, action='store_true', Option("--enforce", dest="enforced", default=False, action='store_true',
help="Enforce policy") help="Enforce policy")
] ]
def run(self, container_dn, gpo, H=None, disabled=False, enforced=False, def run(self, container_dn, gpo, H=None, disabled=False, enforced=False,
sambaopts=None, credopts=None, versionopts=None): sambaopts=None, credopts=None, versionopts=None):
@ -719,7 +719,7 @@ class cmd_dellink(Command):
takes_options = [ takes_options = [
Option("-H", help="LDB URL for database or target server", type=str), Option("-H", help="LDB URL for database or target server", type=str),
] ]
def run(self, container, gpo, H=None, sambaopts=None, credopts=None, def run(self, container, gpo, H=None, sambaopts=None, credopts=None,
versionopts=None): versionopts=None):
@ -758,7 +758,7 @@ class cmd_listcontainers(Command):
takes_options = [ takes_options = [
Option("-H", help="LDB URL for database or target server", type=str) Option("-H", help="LDB URL for database or target server", type=str)
] ]
def run(self, gpo, H=None, sambaopts=None, credopts=None, def run(self, gpo, H=None, sambaopts=None, credopts=None,
versionopts=None): versionopts=None):
@ -794,7 +794,7 @@ class cmd_getinheritance(Command):
takes_options = [ takes_options = [
Option("-H", help="LDB URL for database or target server", type=str) Option("-H", help="LDB URL for database or target server", type=str)
] ]
def run(self, container_dn, H=None, sambaopts=None, credopts=None, def run(self, container_dn, H=None, sambaopts=None, credopts=None,
versionopts=None): versionopts=None):
@ -838,7 +838,7 @@ class cmd_setinheritance(Command):
takes_options = [ takes_options = [
Option("-H", help="LDB URL for database or target server", type=str) Option("-H", help="LDB URL for database or target server", type=str)
] ]
def run(self, container_dn, inherit_state, H=None, sambaopts=None, credopts=None, def run(self, container_dn, inherit_state, H=None, sambaopts=None, credopts=None,
versionopts=None): versionopts=None):
@ -893,7 +893,7 @@ class cmd_fetch(Command):
takes_options = [ takes_options = [
Option("-H", help="LDB URL for database or target server", type=str), Option("-H", help="LDB URL for database or target server", type=str),
Option("--tmpdir", help="Temporary directory for copying policy files", type=str) Option("--tmpdir", help="Temporary directory for copying policy files", type=str)
] ]
def run(self, gpo, H=None, tmpdir=None, sambaopts=None, credopts=None, versionopts=None): def run(self, gpo, H=None, tmpdir=None, sambaopts=None, credopts=None, versionopts=None):
@ -1119,7 +1119,7 @@ class cmd_create(Command):
takes_options = [ takes_options = [
Option("-H", help="LDB URL for database or target server", type=str), Option("-H", help="LDB URL for database or target server", type=str),
Option("--tmpdir", help="Temporary directory for copying policy files", type=str) Option("--tmpdir", help="Temporary directory for copying policy files", type=str)
] ]
def run(self, displayname, H=None, tmpdir=None, sambaopts=None, credopts=None, def run(self, displayname, H=None, tmpdir=None, sambaopts=None, credopts=None,
versionopts=None): versionopts=None):
@ -1418,7 +1418,7 @@ class cmd_del(Command):
takes_options = [ takes_options = [
Option("-H", help="LDB URL for database or target server", type=str), Option("-H", help="LDB URL for database or target server", type=str),
] ]
def run(self, gpo, H=None, sambaopts=None, credopts=None, def run(self, gpo, H=None, sambaopts=None, credopts=None,
versionopts=None): versionopts=None):
@ -1493,7 +1493,7 @@ class cmd_aclcheck(Command):
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H") metavar="URL", dest="H")
] ]
def run(self, H=None, sambaopts=None, credopts=None, versionopts=None): def run(self, H=None, sambaopts=None, credopts=None, versionopts=None):

View File

@ -309,13 +309,13 @@ class cmd_group_list(Command):
help="Verbose output, showing group type and group scope.", help="Verbose output, showing group type and group scope.",
action="store_true"), action="store_true"),
] ]
takes_optiongroups = { takes_optiongroups = {
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, sambaopts=None, credopts=None, versionopts=None, H=None, def run(self, sambaopts=None, credopts=None, versionopts=None, H=None,
verbose=False): verbose=False):
@ -373,13 +373,13 @@ samba-tool group listmembers \"Domain Users\" -H ldap://samba.samdom.example.com
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H"), metavar="URL", dest="H"),
] ]
takes_optiongroups = { takes_optiongroups = {
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_args = ["groupname"] takes_args = ["groupname"]
@ -464,7 +464,7 @@ class cmd_group_move(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, groupname, new_parent_dn, credopts=None, sambaopts=None, def run(self, groupname, new_parent_dn, credopts=None, sambaopts=None,
versionopts=None, H=None): versionopts=None, H=None):
@ -549,7 +549,7 @@ Example3 shows how to display a users objectGUID and member attributes.
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, groupname, credopts=None, sambaopts=None, versionopts=None, def run(self, groupname, credopts=None, sambaopts=None, versionopts=None,
H=None, group_attrs=None): H=None, group_attrs=None):

View File

@ -35,7 +35,7 @@ from samba.netcmd import (
Command, Command,
CommandError, CommandError,
Option, Option,
) )
global summary global summary
summary = {} summary = {}
@ -914,7 +914,7 @@ class cmd_ldapcmp(Command):
help="List of comma separated attributes to ignore in the comparision"), help="List of comma separated attributes to ignore in the comparision"),
Option("--skip-missing-dn", dest="skip_missing_dn", action="store_true", default=False, Option("--skip-missing-dn", dest="skip_missing_dn", action="store_true", default=False,
help="Skip report and failure due to missing DNs in one server or another"), help="Skip report and failure due to missing DNs in one server or another"),
] ]
def run(self, URL1, URL2, def run(self, URL1, URL2,
context1=None, context2=None, context3=None, context4=None, context5=None, context1=None, context2=None, context3=None, context4=None, context5=None,

View File

@ -52,7 +52,7 @@ class cmd_sambatool(SuperCommand):
takes_optiongroups = { takes_optiongroups = {
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
subcommands = cache_loader() subcommands = cache_loader()

View File

@ -22,7 +22,7 @@ from samba.net import Net
from samba.netcmd import ( from samba.netcmd import (
Command, Command,
) )
class cmd_time(Command): class cmd_time(Command):
"""Retrieve the time on a server. """Retrieve the time on a server.
@ -45,7 +45,7 @@ Example2 return the date and time of the local server.
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_args = ["server_name?"] takes_args = ["server_name?"]

View File

@ -35,7 +35,7 @@ from samba.netcmd import (
CommandError, CommandError,
SuperCommand, SuperCommand,
Option, Option,
) )
@ -48,7 +48,7 @@ class cmd_ntacl_set(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("-q", "--quiet", help="Be quiet", action="store_true"), Option("-q", "--quiet", help="Be quiet", action="store_true"),
@ -58,7 +58,7 @@ class cmd_ntacl_set(Command):
Option("--use-ntvfs", help="Set the ACLs directly to the TDB or xattr for use with the ntvfs file server", action="store_true"), Option("--use-ntvfs", help="Set the ACLs directly to the TDB or xattr for use with the ntvfs file server", action="store_true"),
Option("--use-s3fs", help="Set the ACLs for use with the default s3fs file server via the VFS layer", action="store_true"), Option("--use-s3fs", help="Set the ACLs for use with the default s3fs file server via the VFS layer", action="store_true"),
Option("--service", help="Name of the smb.conf service to use when applying the ACLs", type="string") Option("--service", help="Name of the smb.conf service to use when applying the ACLs", type="string")
] ]
takes_args = ["acl","file"] takes_args = ["acl","file"]
@ -103,7 +103,7 @@ class cmd_dosinfo_get(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_args = ["file"] takes_args = ["file"]
@ -124,7 +124,7 @@ class cmd_ntacl_get(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("--as-sddl", help="Output ACL in the SDDL format", action="store_true"), Option("--as-sddl", help="Output ACL in the SDDL format", action="store_true"),
@ -134,7 +134,7 @@ class cmd_ntacl_get(Command):
Option("--use-ntvfs", help="Get the ACLs directly from the TDB or xattr used with the ntvfs file server", action="store_true"), Option("--use-ntvfs", help="Get the ACLs directly from the TDB or xattr used with the ntvfs file server", action="store_true"),
Option("--use-s3fs", help="Get the ACLs for use via the VFS layer used by the default s3fs file server", action="store_true"), Option("--use-s3fs", help="Get the ACLs for use via the VFS layer used by the default s3fs file server", action="store_true"),
Option("--service", help="Name of the smb.conf service to use when getting the ACLs", type="string") Option("--service", help="Name of the smb.conf service to use when getting the ACLs", type="string")
] ]
takes_args = ["file"] takes_args = ["file"]
@ -179,12 +179,12 @@ class cmd_ntacl_sysvolreset(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("--use-ntvfs", help="Set the ACLs for use with the ntvfs file server", action="store_true"), Option("--use-ntvfs", help="Set the ACLs for use with the ntvfs file server", action="store_true"),
Option("--use-s3fs", help="Set the ACLs for use with the default s3fs file server", action="store_true") Option("--use-s3fs", help="Set the ACLs for use with the default s3fs file server", action="store_true")
] ]
def run(self, use_ntvfs=False, use_s3fs=False, def run(self, use_ntvfs=False, use_s3fs=False,
credopts=None, sambaopts=None, versionopts=None): credopts=None, sambaopts=None, versionopts=None):
@ -246,7 +246,7 @@ class cmd_ntacl_sysvolcheck(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, credopts=None, sambaopts=None, versionopts=None): def run(self, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm() lp = sambaopts.get_loadparm()

View File

@ -25,7 +25,7 @@ from samba.netcmd import (
CommandError, CommandError,
Option, Option,
SuperCommand, SuperCommand,
) )
from samba.samdb import SamDB from samba.samdb import SamDB
from samba import dsdb from samba import dsdb
from operator import attrgetter from operator import attrgetter
@ -58,7 +58,7 @@ class cmd_rename(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, old_ou_dn, new_ou_dn, credopts=None, sambaopts=None, def run(self, old_ou_dn, new_ou_dn, credopts=None, sambaopts=None,
versionopts=None, H=None): versionopts=None, H=None):
@ -122,7 +122,7 @@ class cmd_move(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, old_ou_dn, new_parent_dn, credopts=None, sambaopts=None, def run(self, old_ou_dn, new_parent_dn, credopts=None, sambaopts=None,
versionopts=None, H=None): versionopts=None, H=None):
@ -188,7 +188,7 @@ class cmd_create(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, ou_dn, credopts=None, sambaopts=None, versionopts=None, def run(self, ou_dn, credopts=None, sambaopts=None, versionopts=None,
H=None, description=None): H=None, description=None):
@ -238,7 +238,7 @@ class cmd_listobjects(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, ou_dn, credopts=None, sambaopts=None, versionopts=None, def run(self, ou_dn, credopts=None, sambaopts=None, versionopts=None,
H=None, full_dn=False, recursive=False): H=None, full_dn=False, recursive=False):
@ -295,13 +295,13 @@ class cmd_list(Command):
type=str, metavar="URL", dest="H"), type=str, metavar="URL", dest="H"),
Option("--full-dn", dest="full_dn", default=False, action='store_true', Option("--full-dn", dest="full_dn", default=False, action='store_true',
help="Display DNs including the base DN."), help="Display DNs including the base DN."),
] ]
takes_optiongroups = { takes_optiongroups = {
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, sambaopts=None, credopts=None, versionopts=None, H=None, def run(self, sambaopts=None, credopts=None, versionopts=None, H=None,
full_dn=False): full_dn=False):
@ -350,7 +350,7 @@ class cmd_delete(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, ou_dn, credopts=None, sambaopts=None, versionopts=None, def run(self, ou_dn, credopts=None, sambaopts=None, versionopts=None,
H=None, force_subtree_delete=False): H=None, force_subtree_delete=False):

View File

@ -47,7 +47,7 @@ class cmd_processes(Command):
help="Return only processes associated with one particular name"), help="Return only processes associated with one particular name"),
Option("--pid", type=int, Option("--pid", type=int,
help="Return only names assoicated with one particular PID"), help="Return only names assoicated with one particular PID"),
] ]
takes_args = [] takes_args = []

View File

@ -318,12 +318,12 @@ class cmd_domain_pwdsettings_pso_create(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = pwd_settings_options + [ takes_options = pwd_settings_options + [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
metavar="URL", dest="H", type=str) metavar="URL", dest="H", type=str)
] ]
takes_args = ["psoname", "precedence"] takes_args = ["psoname", "precedence"]
def run(self, psoname, precedence, H=None, min_pwd_age=None, def run(self, psoname, precedence, H=None, min_pwd_age=None,
@ -452,7 +452,7 @@ class cmd_domain_pwdsettings_pso_set(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = pwd_settings_options + [ takes_options = pwd_settings_options + [
Option("--precedence", type=int, Option("--precedence", type=int,
@ -460,7 +460,7 @@ class cmd_domain_pwdsettings_pso_set(Command):
"Lower precedence is better (<integer>).")), "Lower precedence is better (<integer>).")),
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
type=str, metavar="URL", dest="H"), type=str, metavar="URL", dest="H"),
] ]
takes_args = ["psoname"] takes_args = ["psoname"]
def run(self, psoname, H=None, precedence=None, min_pwd_age=None, def run(self, psoname, H=None, precedence=None, min_pwd_age=None,
@ -535,12 +535,12 @@ class cmd_domain_pwdsettings_pso_delete(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
metavar="URL", dest="H", type=str) metavar="URL", dest="H", type=str)
] ]
takes_args = ["psoname"] takes_args = ["psoname"]
def run(self, psoname, H=None, credopts=None, sambaopts=None, def run(self, psoname, H=None, credopts=None, sambaopts=None,
@ -575,12 +575,12 @@ class cmd_domain_pwdsettings_pso_list(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
metavar="URL", dest="H", type=str) metavar="URL", dest="H", type=str)
] ]
def run(self, H=None, credopts=None, sambaopts=None, versionopts=None): def run(self, H=None, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm() lp = sambaopts.get_loadparm()
@ -620,12 +620,12 @@ class cmd_domain_pwdsettings_pso_show(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
metavar="URL", dest="H", type=str) metavar="URL", dest="H", type=str)
] ]
takes_args = ["psoname"] takes_args = ["psoname"]
def run(self, psoname, H=None, credopts=None, sambaopts=None, def run(self, psoname, H=None, credopts=None, sambaopts=None,
@ -650,12 +650,12 @@ class cmd_domain_pwdsettings_pso_show_user(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
metavar="URL", dest="H", type=str) metavar="URL", dest="H", type=str)
] ]
takes_args = ["username"] takes_args = ["username"]
def run(self, username, H=None, credopts=None, sambaopts=None, def run(self, username, H=None, credopts=None, sambaopts=None,
@ -686,12 +686,12 @@ class cmd_domain_pwdsettings_pso_apply(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
metavar="URL", dest="H", type=str) metavar="URL", dest="H", type=str)
] ]
takes_args = ["psoname", "user_or_group"] takes_args = ["psoname", "user_or_group"]
def run(self, psoname, user_or_group, H=None, credopts=None, def run(self, psoname, user_or_group, H=None, credopts=None,
@ -746,12 +746,12 @@ class cmd_domain_pwdsettings_pso_unapply(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
metavar="URL", dest="H", type=str), metavar="URL", dest="H", type=str),
] ]
takes_args = ["psoname", "user_or_group"] takes_args = ["psoname", "user_or_group"]
def run(self, psoname, user_or_group, H=None, credopts=None, def run(self, psoname, user_or_group, H=None, credopts=None,

View File

@ -53,7 +53,7 @@ class cmd_rodc_preload(Command):
Option("--server", help="DC to use", type=str), Option("--server", help="DC to use", type=str),
Option("--file", help="Read account list from a file, or - for stdin (one per line)", type=str), Option("--file", help="Read account list from a file, or - for stdin (one per line)", type=str),
Option("--ignore-errors", help="When preloading multiple accounts, skip any failing accounts", action="store_true"), Option("--ignore-errors", help="When preloading multiple accounts, skip any failing accounts", action="store_true"),
] ]
takes_args = ["account*"] takes_args = ["account*"]

View File

@ -26,7 +26,7 @@ from samba.netcmd import (
CommandError, CommandError,
SuperCommand, SuperCommand,
Option Option
) )
class cmd_schema_attribute_modify(Command): class cmd_schema_attribute_modify(Command):
"""Modify attribute settings in the schema partition. """Modify attribute settings in the schema partition.
@ -75,13 +75,13 @@ class cmd_schema_attribute_modify(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("--searchflags", help="Search Flags for the attribute", type=str), Option("--searchflags", help="Search Flags for the attribute", type=str),
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
type=str, metavar="URL", dest="H"), type=str, metavar="URL", dest="H"),
] ]
takes_args = ["attribute"] takes_args = ["attribute"]
@ -140,12 +140,12 @@ class cmd_schema_attribute_show(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
type=str, metavar="URL", dest="H"), type=str, metavar="URL", dest="H"),
] ]
takes_args = ["attribute"] takes_args = ["attribute"]
@ -215,12 +215,12 @@ class cmd_schema_attribute_show_oc(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
type=str, metavar="URL", dest="H"), type=str, metavar="URL", dest="H"),
] ]
takes_args = ["attribute"] takes_args = ["attribute"]
@ -265,12 +265,12 @@ class cmd_schema_objectclass_show(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
} }
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", Option("-H", "--URL", help="LDB URL for database or target server",
type=str, metavar="URL", dest="H"), type=str, metavar="URL", dest="H"),
] ]
takes_args = ["objectclass"] takes_args = ["objectclass"]

View File

@ -26,7 +26,7 @@ from samba.netcmd import (
CommandError, CommandError,
SuperCommand, SuperCommand,
Option, Option,
) )
class cmd_sites_create(Command): class cmd_sites_create(Command):

View File

@ -27,7 +27,7 @@ from samba.netcmd import (
CommandError, CommandError,
SuperCommand, SuperCommand,
Option Option
) )
class cmd_spn_list(Command): class cmd_spn_list(Command):
@ -39,7 +39,7 @@ class cmd_spn_list(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_args = ["user"] takes_args = ["user"]
@ -82,7 +82,7 @@ class cmd_spn_add(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_options = [ takes_options = [
Option("--force", help="Force the addition of the spn" Option("--force", help="Force the addition of the spn"
" even it exists already", action="store_true"), " even it exists already", action="store_true"),
@ -142,7 +142,7 @@ class cmd_spn_delete(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
takes_args = ["name", "user?"] takes_args = ["name", "user?"]

View File

@ -66,7 +66,7 @@ class cmd_testparm(Command):
# These are harder to do with the new code structure # These are harder to do with the new code structure
Option("--show-all-parameters", action="store_true", default=False, Option("--show-all-parameters", action="store_true", default=False,
help="Show the parameters, type, possible values") help="Show the parameters, type, possible values")
] ]
takes_args = [] takes_args = []

View File

@ -45,7 +45,7 @@ from samba import (
gensec, gensec,
generate_random_password, generate_random_password,
Ldb, Ldb,
) )
from samba.net import Net from samba.net import Net
from samba.netcmd import ( from samba.netcmd import (
@ -53,7 +53,7 @@ from samba.netcmd import (
CommandError, CommandError,
SuperCommand, SuperCommand,
Option, Option,
) )
from samba.compat import text_type from samba.compat import text_type
try: try:
@ -67,19 +67,19 @@ except ImportError as e:
"python-gpgme required" "python-gpgme required"
disabled_virtual_attributes = { disabled_virtual_attributes = {
} }
virtual_attributes = { virtual_attributes = {
"virtualClearTextUTF8": { "virtualClearTextUTF8": {
"flags": ldb.ATTR_FLAG_FORCE_BASE64_LDIF, "flags": ldb.ATTR_FLAG_FORCE_BASE64_LDIF,
}, },
"virtualClearTextUTF16": { "virtualClearTextUTF16": {
"flags": ldb.ATTR_FLAG_FORCE_BASE64_LDIF, "flags": ldb.ATTR_FLAG_FORCE_BASE64_LDIF,
}, },
"virtualSambaGPG": { "virtualSambaGPG": {
"flags": ldb.ATTR_FLAG_FORCE_BASE64_LDIF, "flags": ldb.ATTR_FLAG_FORCE_BASE64_LDIF,
}, },
} }
get_random_bytes_fn = None get_random_bytes_fn = None
if get_random_bytes_fn is None: if get_random_bytes_fn is None:
@ -161,7 +161,7 @@ try:
h = hashlib.sha1() h = hashlib.sha1()
h = None h = None
virtual_attributes["virtualSSHA"] = { virtual_attributes["virtualSSHA"] = {
} }
except ImportError as e: except ImportError as e:
reason = "hashlib.sha1()" reason = "hashlib.sha1()"
if random_reason: if random_reason:
@ -169,7 +169,7 @@ except ImportError as e:
reason += " required" reason += " required"
disabled_virtual_attributes["virtualSSHA"] = { disabled_virtual_attributes["virtualSSHA"] = {
"reason" : reason, "reason" : reason,
} }
for (alg, attr) in [("5", "virtualCryptSHA256"), ("6", "virtualCryptSHA512")]: for (alg, attr) in [("5", "virtualCryptSHA256"), ("6", "virtualCryptSHA512")]:
try: try:
@ -180,7 +180,7 @@ for (alg, attr) in [("5", "virtualCryptSHA256"), ("6", "virtualCryptSHA512")]:
v = get_crypt_value(alg, "") v = get_crypt_value(alg, "")
v = None v = None
virtual_attributes[attr] = { virtual_attributes[attr] = {
} }
except ImportError as e: except ImportError as e:
reason = "crypt" reason = "crypt"
if random_reason: if random_reason:
@ -188,12 +188,12 @@ for (alg, attr) in [("5", "virtualCryptSHA256"), ("6", "virtualCryptSHA512")]:
reason += " required" reason += " required"
disabled_virtual_attributes[attr] = { disabled_virtual_attributes[attr] = {
"reason" : reason, "reason" : reason,
} }
except NotImplementedError as e: except NotImplementedError as e:
reason = "modern '$%s$' salt in crypt(3) required" % (alg) reason = "modern '$%s$' salt in crypt(3) required" % (alg)
disabled_virtual_attributes[attr] = { disabled_virtual_attributes[attr] = {
"reason" : reason, "reason" : reason,
} }
# Add the wDigest virtual attributes, virtualWDigest01 to virtualWDigest29 # Add the wDigest virtual attributes, virtualWDigest01 to virtualWDigest29
for x in range(1, 30): for x in range(1, 30):
@ -299,7 +299,7 @@ Example5 shows how to create an RFC2307/NIS domain enabled user account. If
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, username, password=None, credopts=None, sambaopts=None, def run(self, username, password=None, credopts=None, sambaopts=None,
versionopts=None, H=None, must_change_at_next_login=False, versionopts=None, H=None, must_change_at_next_login=False,
@ -429,7 +429,7 @@ Example2 shows how to delete a user in the domain against the local server. su
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, username, credopts=None, sambaopts=None, versionopts=None, def run(self, username, credopts=None, sambaopts=None, versionopts=None,
H=None): H=None):
@ -466,13 +466,13 @@ class cmd_user_list(Command):
takes_options = [ takes_options = [
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H"), metavar="URL", dest="H"),
] ]
takes_optiongroups = { takes_optiongroups = {
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, sambaopts=None, credopts=None, versionopts=None, H=None): def run(self, sambaopts=None, credopts=None, versionopts=None, H=None):
lp = sambaopts.get_loadparm() lp = sambaopts.get_loadparm()
@ -538,7 +538,7 @@ Example3 shows how to enable a user in the domain against a local LDAP server.
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H"), metavar="URL", dest="H"),
Option("--filter", help="LDAP Filter to set password on", type=str), Option("--filter", help="LDAP Filter to set password on", type=str),
] ]
takes_args = ["username?"] takes_args = ["username?"]
@ -571,7 +571,7 @@ class cmd_user_disable(Command):
Option("-H", "--URL", help="LDB URL for database or target server", type=str, Option("-H", "--URL", help="LDB URL for database or target server", type=str,
metavar="URL", dest="H"), metavar="URL", dest="H"),
Option("--filter", help="LDAP Filter to set password on", type=str), Option("--filter", help="LDAP Filter to set password on", type=str),
] ]
takes_args = ["username?"] takes_args = ["username?"]
@ -579,7 +579,7 @@ class cmd_user_disable(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, username=None, sambaopts=None, credopts=None, def run(self, username=None, sambaopts=None, credopts=None,
versionopts=None, filter=None, H=None): versionopts=None, filter=None, H=None):
@ -683,13 +683,13 @@ class cmd_user_password(Command):
takes_options = [ takes_options = [
Option("--newpassword", help="New password", type=str), Option("--newpassword", help="New password", type=str),
] ]
takes_optiongroups = { takes_optiongroups = {
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, credopts=None, sambaopts=None, versionopts=None, def run(self, credopts=None, sambaopts=None, versionopts=None,
newpassword=None): newpassword=None):
@ -774,7 +774,7 @@ Example3 shows how an administrator would reset TestUser3 user's password to pas
Option("--clear-smartcard-required", Option("--clear-smartcard-required",
help="Don't require a smartcard for interactive logons", help="Don't require a smartcard for interactive logons",
action="store_true"), action="store_true"),
] ]
takes_args = ["username?"] takes_args = ["username?"]
@ -1428,7 +1428,7 @@ samba-tool user getpassword --filter=samaccountname=TestUser3 --attributes=msDS-
Option("--decrypt-samba-gpg", Option("--decrypt-samba-gpg",
help=decrypt_samba_gpg_help, help=decrypt_samba_gpg_help,
action="store_true", default=False, dest="decrypt_samba_gpg"), action="store_true", default=False, dest="decrypt_samba_gpg"),
] ]
takes_args = ["username?"] takes_args = ["username?"]
@ -1688,7 +1688,7 @@ samba-tool user syncpasswords --terminate \\
Option("--terminate", Option("--terminate",
help="Send a SIGTERM to an already running (daemon) process", help="Send a SIGTERM to an already running (daemon) process",
action="store_true", default=False, dest="terminate"), action="store_true", default=False, dest="terminate"),
] ]
def run(self, cache_ldb_initialize=False, cache_ldb=None, def run(self, cache_ldb_initialize=False, cache_ldb=None,
H=None, filter=None, H=None, filter=None,
@ -2345,7 +2345,7 @@ LDAP server using the 'nano' editor.
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, username, credopts=None, sambaopts=None, versionopts=None, def run(self, username, credopts=None, sambaopts=None, versionopts=None,
H=None, editor=None): H=None, editor=None):
@ -2477,7 +2477,7 @@ Example3 shows how to display a users objectSid and memberOf attributes.
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, username, credopts=None, sambaopts=None, versionopts=None, def run(self, username, credopts=None, sambaopts=None, versionopts=None,
H=None, user_attrs=None): H=None, user_attrs=None):
@ -2549,7 +2549,7 @@ class cmd_user_move(Command):
"sambaopts": options.SambaOptions, "sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
def run(self, username, new_parent_dn, credopts=None, sambaopts=None, def run(self, username, new_parent_dn, credopts=None, sambaopts=None,
versionopts=None, H=None): versionopts=None, H=None):

View File

@ -60,17 +60,17 @@ from samba import (
valid_netbios_name, valid_netbios_name,
version, version,
is_heimdal_built, is_heimdal_built,
) )
from samba.dcerpc import security, misc from samba.dcerpc import security, misc
from samba.dcerpc.misc import ( from samba.dcerpc.misc import (
SEC_CHAN_BDC, SEC_CHAN_BDC,
SEC_CHAN_WKSTA, SEC_CHAN_WKSTA,
) )
from samba.dsdb import ( from samba.dsdb import (
DS_DOMAIN_FUNCTION_2003, DS_DOMAIN_FUNCTION_2003,
DS_DOMAIN_FUNCTION_2008_R2, DS_DOMAIN_FUNCTION_2008_R2,
ENC_ALL_TYPES, ENC_ALL_TYPES,
) )
from samba.idmap import IDmapDB from samba.idmap import IDmapDB
from samba.ms_display_specifiers import read_ms_ldif from samba.ms_display_specifiers import read_ms_ldif
from samba.ntacls import setntacl, getntacl, dsacl2fsacl from samba.ntacls import setntacl, getntacl, dsacl2fsacl
@ -80,7 +80,7 @@ from samba.provision.backend import (
FDSBackend, FDSBackend,
LDBBackend, LDBBackend,
OpenLDAPBackend, OpenLDAPBackend,
) )
from samba.descriptor import ( from samba.descriptor import (
get_empty_descriptor, get_empty_descriptor,
get_config_descriptor, get_config_descriptor,
@ -102,7 +102,7 @@ from samba.descriptor import (
get_dns_forest_microsoft_dns_descriptor, get_dns_forest_microsoft_dns_descriptor,
get_dns_domain_microsoft_dns_descriptor, get_dns_domain_microsoft_dns_descriptor,
get_managed_service_accounts_descriptor, get_managed_service_accounts_descriptor,
) )
from samba.provision.common import ( from samba.provision.common import (
setup_path, setup_path,
setup_add_ldif, setup_add_ldif,
@ -116,7 +116,7 @@ from samba.provision.sambadns import (
get_dnsadmins_sid, get_dnsadmins_sid,
setup_ad_dns, setup_ad_dns,
create_dns_update_list create_dns_update_list
) )
import samba.param import samba.param
import samba.registry import samba.registry
@ -731,7 +731,7 @@ def make_smbconf(smbconf, hostname, domain, realm, targetdir,
"workgroup": domain, "workgroup": domain,
"realm": realm, "realm": realm,
"server role": serverrole, "server role": serverrole,
} }
if lp is None: if lp is None:
lp = samba.param.LoadParm() lp = samba.param.LoadParm()
@ -1028,14 +1028,14 @@ def setup_secretsdb(paths, session_info, backend_credentials, lp):
setup_path("secrets_simple_ldap.ldif"), { setup_path("secrets_simple_ldap.ldif"), {
"LDAPMANAGERDN": backend_credentials.get_bind_dn(), "LDAPMANAGERDN": backend_credentials.get_bind_dn(),
"LDAPMANAGERPASS_B64": b64encode(backend_credentials.get_password()).decode('utf8') "LDAPMANAGERPASS_B64": b64encode(backend_credentials.get_password()).decode('utf8')
}) })
else: else:
setup_add_ldif(secrets_ldb, setup_add_ldif(secrets_ldb,
setup_path("secrets_sasl_ldap.ldif"), { setup_path("secrets_sasl_ldap.ldif"), {
"LDAPADMINUSER": backend_credentials.get_username(), "LDAPADMINUSER": backend_credentials.get_username(),
"LDAPADMINREALM": backend_credentials.get_realm(), "LDAPADMINREALM": backend_credentials.get_realm(),
"LDAPADMINPASS_B64": b64encode(backend_credentials.get_password()).decode('utf8') "LDAPADMINPASS_B64": b64encode(backend_credentials.get_password()).decode('utf8')
}) })
except: except:
secrets_ldb.transaction_cancel() secrets_ldb.transaction_cancel()
raise raise
@ -1126,7 +1126,7 @@ def setup_samdb_rootdse(samdb, names):
"ROOTDN" : names.rootdn, "ROOTDN" : names.rootdn,
"CONFIGDN": names.configdn, "CONFIGDN": names.configdn,
"SERVERDN": names.serverdn, "SERVERDN": names.serverdn,
}) })
def setup_self_join(samdb, admin_session_info, names, fill, machinepass, def setup_self_join(samdb, admin_session_info, names, fill, machinepass,
@ -1194,7 +1194,7 @@ def setup_self_join(samdb, admin_session_info, names, fill, machinepass,
"DEFAULTSITE": names.sitename, "DEFAULTSITE": names.sitename,
"NETBIOSNAME": names.netbiosname, "NETBIOSNAME": names.netbiosname,
"SERVERDN": names.serverdn, "SERVERDN": names.serverdn,
}) })
system_session_info = system_session() system_session_info = system_session()
samdb.set_session_info(system_session_info) samdb.set_session_info(system_session_info)
@ -1392,7 +1392,7 @@ def fill_samdb(samdb, lp, names, logger, policyguid,
"DOMAIN_FUNCTIONALITY": str(domainFunctionality), "DOMAIN_FUNCTIONALITY": str(domainFunctionality),
"SAMBA_VERSION_STRING": version, "SAMBA_VERSION_STRING": version,
"MIN_PWD_LENGTH": str(DEFAULT_MIN_PWD_LENGTH) "MIN_PWD_LENGTH": str(DEFAULT_MIN_PWD_LENGTH)
}) })
# If we are setting up a subdomain, then this has been replicated in, so we don't need to add it # If we are setting up a subdomain, then this has been replicated in, so we don't need to add it
if fill == FILL_FULL: if fill == FILL_FULL:
@ -1520,7 +1520,7 @@ def fill_samdb(samdb, lp, names, logger, policyguid,
"SYSTEM_DESCRIPTOR": system_desc, "SYSTEM_DESCRIPTOR": system_desc,
"BUILTIN_DESCRIPTOR": builtin_desc, "BUILTIN_DESCRIPTOR": builtin_desc,
"DOMAIN_CONTROLLERS_DESCRIPTOR": controllers_desc, "DOMAIN_CONTROLLERS_DESCRIPTOR": controllers_desc,
}) })
# If we are setting up a subdomain, then this has been replicated in, so we don't need to add it # If we are setting up a subdomain, then this has been replicated in, so we don't need to add it
if fill == FILL_FULL: if fill == FILL_FULL:
@ -1535,7 +1535,7 @@ def fill_samdb(samdb, lp, names, logger, policyguid,
setup_add_ldif(samdb, setup_path("provision_well_known_sec_princ.ldif"), { setup_add_ldif(samdb, setup_path("provision_well_known_sec_princ.ldif"), {
"CONFIGDN": names.configdn, "CONFIGDN": names.configdn,
"WELLKNOWNPRINCIPALS_DESCRIPTOR": protected1wd_descr, "WELLKNOWNPRINCIPALS_DESCRIPTOR": protected1wd_descr,
}, controls=["relax:0", "provision:0"]) }, controls=["relax:0", "provision:0"])
if fill == FILL_FULL or fill == FILL_SUBDOMAIN: if fill == FILL_FULL or fill == FILL_SUBDOMAIN:
setup_modify_ldif(samdb, setup_modify_ldif(samdb,
@ -1550,7 +1550,7 @@ def fill_samdb(samdb, lp, names, logger, policyguid,
"DOMAINSID": str(names.domainsid), "DOMAINSID": str(names.domainsid),
"ADMINPASS_B64": b64encode(adminpass.encode('utf-16-le')).decode('utf8'), "ADMINPASS_B64": b64encode(adminpass.encode('utf-16-le')).decode('utf8'),
"KRBTGTPASS_B64": b64encode(krbtgtpass.encode('utf-16-le')).decode('utf8') "KRBTGTPASS_B64": b64encode(krbtgtpass.encode('utf-16-le')).decode('utf8')
}, controls=["relax:0", "provision:0"]) }, controls=["relax:0", "provision:0"])
logger.info("Setting up self join") logger.info("Setting up self join")
setup_self_join(samdb, admin_session_info, names=names, fill=fill, setup_self_join(samdb, admin_session_info, names=names, fill=fill,
@ -2012,7 +2012,7 @@ _ROLES_MAP = {
"member server": "member server", "member server": "member server",
"standalone": "standalone server", "standalone": "standalone server",
"standalone server": "standalone server", "standalone server": "standalone server",
} }
def sanitize_server_role(role): def sanitize_server_role(role):
@ -2042,7 +2042,7 @@ def provision_fake_ypserver(logger, samdb, domaindn, netbiosname, nisdomain,
"DOMAINDN": domaindn, "DOMAINDN": domaindn,
"NETBIOSNAME": netbiosname, "NETBIOSNAME": netbiosname,
"NISDOMAIN": nisdomain, "NISDOMAIN": nisdomain,
}) })
except: except:
samdb.transaction_cancel() samdb.transaction_cancel()
raise raise
@ -2447,7 +2447,7 @@ def create_krb5_conf(path, dnsdomain, hostname, realm):
"DNSDOMAIN": dnsdomain, "DNSDOMAIN": dnsdomain,
"HOSTNAME": hostname, "HOSTNAME": hostname,
"REALM": realm, "REALM": realm,
}) })
class ProvisioningError(Exception): class ProvisioningError(Exception):

View File

@ -762,7 +762,7 @@ class FDSBackend(LDAPBackend):
setup_file(setup_path("fedorads-samba.ldif"), self.samba_ldif, { setup_file(setup_path("fedorads-samba.ldif"), self.samba_ldif, {
"SAMBADN": self.sambadn, "SAMBADN": self.sambadn,
"LDAPADMINPASS": self.ldapadminpass "LDAPADMINPASS": self.ldapadminpass
}) })
mapping = "schema-map-fedora-ds-1.0" mapping = "schema-map-fedora-ds-1.0"
backend_schema = "99_ad.ldif" backend_schema = "99_ad.ldif"

View File

@ -39,7 +39,7 @@ from samba.dsdb import (
DS_DOMAIN_FUNCTION_2008_R2, DS_DOMAIN_FUNCTION_2008_R2,
DS_DOMAIN_FUNCTION_2012_R2, DS_DOMAIN_FUNCTION_2012_R2,
DS_DOMAIN_FUNCTION_2016 DS_DOMAIN_FUNCTION_2016
) )
from samba.descriptor import ( from samba.descriptor import (
get_domain_descriptor, get_domain_descriptor,
get_domain_delete_protected1_descriptor, get_domain_delete_protected1_descriptor,
@ -47,7 +47,7 @@ from samba.descriptor import (
get_dns_partition_descriptor, get_dns_partition_descriptor,
get_dns_forest_microsoft_dns_descriptor, get_dns_forest_microsoft_dns_descriptor,
get_dns_domain_microsoft_dns_descriptor get_dns_domain_microsoft_dns_descriptor
) )
from samba.provision.common import ( from samba.provision.common import (
setup_path, setup_path,
setup_add_ldif, setup_add_ldif,
@ -57,7 +57,7 @@ from samba.provision.common import (
FILL_SUBDOMAIN, FILL_SUBDOMAIN,
FILL_NT4SYNC, FILL_NT4SYNC,
FILL_DRS, FILL_DRS,
) )
from samba.samdb import get_default_backend_store from samba.samdb import get_default_backend_store
@ -248,7 +248,7 @@ def setup_dns_partitions(samdb, domainsid, domaindn, forestdn, configdn,
setup_add_ldif(samdb, setup_path("provision_dnszones_partitions.ldif"), { setup_add_ldif(samdb, setup_path("provision_dnszones_partitions.ldif"), {
"ZONE_DN": domainzone_dn, "ZONE_DN": domainzone_dn,
"SECDESC" : b64encode(descriptor).decode('utf8') "SECDESC" : b64encode(descriptor).decode('utf8')
}) })
if fill_level != FILL_SUBDOMAIN: if fill_level != FILL_SUBDOMAIN:
setup_add_ldif(samdb, setup_path("provision_dnszones_partitions.ldif"), { setup_add_ldif(samdb, setup_path("provision_dnszones_partitions.ldif"), {
"ZONE_DN": forestzone_dn, "ZONE_DN": forestzone_dn,
@ -269,7 +269,7 @@ def setup_dns_partitions(samdb, domainsid, domaindn, forestdn, configdn,
"SERVERDN": serverdn, "SERVERDN": serverdn,
"LOSTANDFOUND_DESCRIPTOR": b64encode(protected2_desc).decode('utf8'), "LOSTANDFOUND_DESCRIPTOR": b64encode(protected2_desc).decode('utf8'),
"INFRASTRUCTURE_DESCRIPTOR": b64encode(protected1_desc).decode('utf8'), "INFRASTRUCTURE_DESCRIPTOR": b64encode(protected1_desc).decode('utf8'),
}) })
setup_modify_ldif(samdb, setup_path("provision_dnszones_modify.ldif"), { setup_modify_ldif(samdb, setup_path("provision_dnszones_modify.ldif"), {
"CONFIGDN": configdn, "CONFIGDN": configdn,
"SERVERDN": serverdn, "SERVERDN": serverdn,
@ -300,7 +300,7 @@ def setup_dns_partitions(samdb, domainsid, domaindn, forestdn, configdn,
def add_dns_accounts(samdb, domaindn): def add_dns_accounts(samdb, domaindn):
setup_add_ldif(samdb, setup_path("provision_dns_accounts_add.ldif"), { setup_add_ldif(samdb, setup_path("provision_dns_accounts_add.ldif"), {
"DOMAINDN": domaindn, "DOMAINDN": domaindn,
}) })
def add_dns_container(samdb, domaindn, prefix, domain_sid, dnsadmins_sid, forest=False): def add_dns_container(samdb, domaindn, prefix, domain_sid, dnsadmins_sid, forest=False):
@ -763,7 +763,7 @@ def create_zone_file(lp, logger, paths, targetdir, dnsdomain,
"HOSTIP6_HOST_LINE": hostip6_host_line, "HOSTIP6_HOST_LINE": hostip6_host_line,
"GC_MSDCS_IP_LINE": gc_msdcs_ip_line, "GC_MSDCS_IP_LINE": gc_msdcs_ip_line,
"GC_MSDCS_IP6_LINE": gc_msdcs_ip6_line, "GC_MSDCS_IP6_LINE": gc_msdcs_ip6_line,
}) })
if paths.bind_gid is not None: if paths.bind_gid is not None:
try: try:
@ -997,7 +997,7 @@ def create_named_txt(path, realm, dnsdomain, dnsname, binddns_dir,
"DNS_KEYTAB": keytab_name, "DNS_KEYTAB": keytab_name,
"DNS_KEYTAB_ABS": os.path.join(binddns_dir, keytab_name), "DNS_KEYTAB_ABS": os.path.join(binddns_dir, keytab_name),
"PRIVATE_DIR": binddns_dir "PRIVATE_DIR": binddns_dir
}) })
def is_valid_dns_backend(dns_backend): def is_valid_dns_backend(dns_backend):

View File

@ -25,7 +25,7 @@ from samba.getopt import (
DONT_USE_KERBEROS, DONT_USE_KERBEROS,
MUST_USE_KERBEROS, MUST_USE_KERBEROS,
parse_kerberos_arg, parse_kerberos_arg,
) )
import samba.tests import samba.tests
class KerberosOptionTests(samba.tests.TestCase): class KerberosOptionTests(samba.tests.TestCase):

View File

@ -26,7 +26,7 @@ from samba.provision import (
sanitize_server_role, sanitize_server_role,
setup_secretsdb, setup_secretsdb,
findnss, findnss,
) )
import samba.tests import samba.tests
from samba.tests import env_loadparm, TestCase from samba.tests import env_loadparm, TestCase

View File

@ -30,7 +30,7 @@ from samba.dcerpc.netlogon import (
netr_Authenticator, netr_Authenticator,
netr_WorkstationInformation, netr_WorkstationInformation,
MSV1_0_ALLOW_MSVCHAPV2 MSV1_0_ALLOW_MSVCHAPV2
) )
from samba.dcerpc.misc import SEC_CHAN_WKSTA from samba.dcerpc.misc import SEC_CHAN_WKSTA
from samba.dsdb import ( from samba.dsdb import (
UF_WORKSTATION_TRUST_ACCOUNT, UF_WORKSTATION_TRUST_ACCOUNT,

View File

@ -325,7 +325,7 @@ class MapTestCase(MapBaseTestCase):
"sambaSID": "S-1-5-21-4231626423-2410014848-2360679739", "sambaSID": "S-1-5-21-4231626423-2410014848-2360679739",
"sambaNextRid": "2000", "sambaNextRid": "2000",
"sambaDomainName": "TESTS" "sambaDomainName": "TESTS"
}) })
# Add a set of split records # Add a set of split records
self.ldb.add_ldif(""" self.ldb.add_ldif("""

View File

@ -239,7 +239,7 @@ class ComputerCmdTestCase(SambaToolCmdTest):
computer = { computer = {
"name": self.randomName(), "name": self.randomName(),
"description": self.randomName(count=100), "description": self.randomName(count=100),
} }
computer.update(base) computer.update(base)
return computer return computer
@ -250,7 +250,7 @@ class ComputerCmdTestCase(SambaToolCmdTest):
ou = { ou = {
"name": self.randomName(), "name": self.randomName(),
"description": self.randomName(count=100), "description": self.randomName(count=100),
} }
ou.update(base) ou.update(base)
return ou return ou

View File

@ -185,7 +185,7 @@ class GroupCmdTestCase(SambaToolCmdTest):
group = { group = {
"name": self.randomName(), "name": self.randomName(),
"description": self.randomName(count=100), "description": self.randomName(count=100),
} }
group.update(base) group.update(base)
return group return group

View File

@ -251,7 +251,7 @@ class OUCmdTestCase(SambaToolCmdTest):
ou = { ou = {
"name": self.randomName(), "name": self.randomName(),
"description": self.randomName(count=100), "description": self.randomName(count=100),
} }
ou.update(base) ou.update(base)
return ou return ou

View File

@ -512,7 +512,7 @@ sAMAccountName: %s
"description": self.randomName(count=100), "description": self.randomName(count=100),
"createUserFn": self._create_user, "createUserFn": self._create_user,
"checkUserFn": self._check_user, "checkUserFn": self._check_user,
} }
user.update(base) user.update(base)
return user return user

View File

@ -27,7 +27,7 @@ import warnings
from samba.tests import ( from samba.tests import (
TestCase, TestCase,
) )
def get_python_source_files(): def get_python_source_files():

View File

@ -25,7 +25,7 @@ from samba.tests import (
SkipTest, SkipTest,
TestCase, TestCase,
TestCaseInTempDir, TestCaseInTempDir,
) )
import random import random
import shutil import shutil
import os import os

View File

@ -48,7 +48,7 @@ builddirs = {
"pass" : ".", "pass" : ".",
"fail" : ".", "fail" : ".",
"retry" : "." "retry" : "."
} }
defaulttasks = [ "ctdb", defaulttasks = [ "ctdb",
"samba", "samba",
@ -490,7 +490,7 @@ class buildlist(object):
rebase_remote, rebase_branch, rebase_remote, rebase_branch,
rebase_remote, rebase_remote,
rebase_remote, rebase_branch rebase_remote, rebase_branch
), ),
"test/plain" ) ] "test/plain" ) ]
self.retry = builder('retry', retry_task, cp=False) self.retry = builder('retry', retry_task, cp=False)

View File

@ -167,7 +167,7 @@ smbtorture4_options = [
"--maximum-runtime=$SELFTEST_MAXTIME", "--maximum-runtime=$SELFTEST_MAXTIME",
"--basedir=$SELFTEST_TMPDIR", "--basedir=$SELFTEST_TMPDIR",
"--format=subunit" "--format=subunit"
] + get_env_torture_options() ] + get_env_torture_options()
def plansmbtorture4testsuite(name, env, options, target, modname=None): def plansmbtorture4testsuite(name, env, options, target, modname=None):

View File

@ -25,7 +25,7 @@ from selftesthelpers import *
smbtorture4_options.extend([ smbtorture4_options.extend([
'--option=torture:sharedelay=100000', '--option=torture:sharedelay=100000',
'--option=torture:writetimeupdatedelay=500000', '--option=torture:writetimeupdatedelay=500000',
]) ])
def plansmbtorture4testsuite(name, env, options, description=''): def plansmbtorture4testsuite(name, env, options, description=''):
if description == '': if description == '':

View File

@ -1731,7 +1731,7 @@ class SamTests(samba.tests.TestCase):
"sAMAccountName": username, "sAMAccountName": username,
"userAccountControl": str(UF_NORMAL_ACCOUNT), "userAccountControl": str(UF_NORMAL_ACCOUNT),
"unicodePwd": utf16pw, "unicodePwd": utf16pw,
}) })
res1 = ldb.search("cn=ldaptestuser,cn=users," + self.base_dn, res1 = ldb.search("cn=ldaptestuser,cn=users," + self.base_dn,
scope=SCOPE_BASE, scope=SCOPE_BASE,
@ -2553,7 +2553,7 @@ class SamTests(samba.tests.TestCase):
"objectclass": "user", "objectclass": "user",
"userAccountControl": str(UF_NORMAL_ACCOUNT), "userAccountControl": str(UF_NORMAL_ACCOUNT),
"unicodePwd": "\"thatsAcomplPASS2\"".encode('utf-16-le') "unicodePwd": "\"thatsAcomplPASS2\"".encode('utf-16-le')
}) })
res = ldb.search("cn=ldaptestuser,cn=users," + self.base_dn, res = ldb.search("cn=ldaptestuser,cn=users," + self.base_dn,
scope=SCOPE_BASE, scope=SCOPE_BASE,
@ -2656,7 +2656,7 @@ class SamTests(samba.tests.TestCase):
"dn": "cn=ldaptestuser,cn=users," + self.base_dn, "dn": "cn=ldaptestuser,cn=users," + self.base_dn,
"objectclass": "user", "objectclass": "user",
"userAccountControl": str(UF_NORMAL_ACCOUNT|UF_ACCOUNTDISABLE), "userAccountControl": str(UF_NORMAL_ACCOUNT|UF_ACCOUNTDISABLE),
}) })
res = ldb.search("cn=ldaptestuser,cn=users," + self.base_dn, res = ldb.search("cn=ldaptestuser,cn=users," + self.base_dn,
scope=SCOPE_BASE, scope=SCOPE_BASE,
@ -2804,7 +2804,7 @@ class SamTests(samba.tests.TestCase):
"dn": "cn=ldaptestuser,cn=users," + self.base_dn, "dn": "cn=ldaptestuser,cn=users," + self.base_dn,
"objectclass": "user", "objectclass": "user",
"userAccountControl": str(UF_NORMAL_ACCOUNT|UF_SMARTCARD_REQUIRED|UF_ACCOUNTDISABLE), "userAccountControl": str(UF_NORMAL_ACCOUNT|UF_SMARTCARD_REQUIRED|UF_ACCOUNTDISABLE),
}) })
res = ldb.search("cn=ldaptestuser,cn=users," + self.base_dn, res = ldb.search("cn=ldaptestuser,cn=users," + self.base_dn,
scope=SCOPE_BASE, scope=SCOPE_BASE,
@ -3678,7 +3678,7 @@ class SamTests(samba.tests.TestCase):
["CN=Enterprise Admins","CN=Users,"], ["CN=Enterprise Admins","CN=Users,"],
["CN=Administrator","CN=Users,"], ["CN=Administrator","CN=Users,"],
["CN=Domain Controllers","CN=Users,"], ["CN=Domain Controllers","CN=Users,"],
] ]

View File

@ -32,7 +32,7 @@ import time
from ldb import ( from ldb import (
SCOPE_SUBTREE, SCOPE_SUBTREE,
) )
import drs_base, ldb import drs_base, ldb

View File

@ -38,7 +38,7 @@ from ldb import (
SCOPE_BASE, SCOPE_BASE,
Message, Message,
FLAG_MOD_REPLACE, FLAG_MOD_REPLACE,
) )
from samba.compat import cmp_fn from samba.compat import cmp_fn
class DrsBaseTestCase(SambaToolCmdTest): class DrsBaseTestCase(SambaToolCmdTest):

View File

@ -149,20 +149,20 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase):
self.ldb_dc1.add({ self.ldb_dc1.add({
"dn": ou1, "dn": ou1,
"objectclass": "organizationalUnit" "objectclass": "organizationalUnit"
}) })
ou1_id = self._get_identifier(self.ldb_dc1, ou1) ou1_id = self._get_identifier(self.ldb_dc1, ou1)
ou2 = "OU=get_anc2,%s" % ou1 ou2 = "OU=get_anc2,%s" % ou1
self.ldb_dc1.add({ self.ldb_dc1.add({
"dn": ou2, "dn": ou2,
"objectclass": "organizationalUnit" "objectclass": "organizationalUnit"
}) })
ou2_id = self._get_identifier(self.ldb_dc1, ou2) ou2_id = self._get_identifier(self.ldb_dc1, ou2)
dc3 = "CN=test_anc_dc_%u,%s" % (random.randint(0, 4294967295), ou2) dc3 = "CN=test_anc_dc_%u,%s" % (random.randint(0, 4294967295), ou2)
self.ldb_dc1.add({ self.ldb_dc1.add({
"dn": dc3, "dn": dc3,
"objectclass": "computer", "objectclass": "computer",
"userAccountControl": "%d" % (samba.dsdb.UF_ACCOUNTDISABLE | samba.dsdb.UF_SERVER_TRUST_ACCOUNT) "userAccountControl": "%d" % (samba.dsdb.UF_ACCOUNTDISABLE | samba.dsdb.UF_SERVER_TRUST_ACCOUNT)
}) })
dc3_id = self._get_identifier(self.ldb_dc1, dc3) dc3_id = self._get_identifier(self.ldb_dc1, dc3)
# Add some linked attributes (for checking GET_TGT behaviour) # Add some linked attributes (for checking GET_TGT behaviour)
@ -226,7 +226,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase):
self.ldb_dc1.add({ self.ldb_dc1.add({
"dn": non_nc_ou, "dn": non_nc_ou,
"objectclass": "organizationalUnit" "objectclass": "organizationalUnit"
}) })
req8 = self._exop_req8(dest_dsa=None, req8 = self._exop_req8(dest_dsa=None,
invocation_id=self.ldb_dc1.get_invocation_id(), invocation_id=self.ldb_dc1.get_invocation_id(),
nc_dn_str=non_nc_ou, nc_dn_str=non_nc_ou,
@ -247,20 +247,20 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase):
self.ldb_dc1.add({ self.ldb_dc1.add({
"dn": ou1, "dn": ou1,
"objectclass": "organizationalUnit" "objectclass": "organizationalUnit"
}) })
ou1_id = self._get_identifier(self.ldb_dc1, ou1) ou1_id = self._get_identifier(self.ldb_dc1, ou1)
ou2 = "OU=get_anc2,%s" % ou1 ou2 = "OU=get_anc2,%s" % ou1
self.ldb_dc1.add({ self.ldb_dc1.add({
"dn": ou2, "dn": ou2,
"objectclass": "organizationalUnit" "objectclass": "organizationalUnit"
}) })
ou2_id = self._get_identifier(self.ldb_dc1, ou2) ou2_id = self._get_identifier(self.ldb_dc1, ou2)
dc3 = "CN=test_anc_dc_%u,%s" % (random.randint(0, 4294967295), ou2) dc3 = "CN=test_anc_dc_%u,%s" % (random.randint(0, 4294967295), ou2)
self.ldb_dc1.add({ self.ldb_dc1.add({
"dn": dc3, "dn": dc3,
"objectclass": "computer", "objectclass": "computer",
"userAccountControl": "%d" % (samba.dsdb.UF_ACCOUNTDISABLE | samba.dsdb.UF_SERVER_TRUST_ACCOUNT) "userAccountControl": "%d" % (samba.dsdb.UF_ACCOUNTDISABLE | samba.dsdb.UF_SERVER_TRUST_ACCOUNT)
}) })
dc3_id = self._get_identifier(self.ldb_dc1, dc3) dc3_id = self._get_identifier(self.ldb_dc1, dc3)
(hwm1, utdv1) = self._check_replication([ou1,ou2,dc3], (hwm1, utdv1) = self._check_replication([ou1,ou2,dc3],
@ -371,7 +371,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase):
self.ldb_dc1.add({ self.ldb_dc1.add({
"dn": cn3, "dn": cn3,
"objectclass": "container", "objectclass": "container",
}) })
cn3_id = self._get_identifier(self.ldb_dc1, cn3) cn3_id = self._get_identifier(self.ldb_dc1, cn3)
(hwm5, utdv5) = self._check_replication([dc3,ou1,ou2,self.ou,cn3], (hwm5, utdv5) = self._check_replication([dc3,ou1,ou2,self.ou,cn3],

View File

@ -40,7 +40,7 @@ from samba.drs_utils import drs_DsBind
from ldb import ( from ldb import (
SCOPE_BASE, SCOPE_BASE,
SCOPE_SUBTREE, SCOPE_SUBTREE,
) )
import drs_base, ldb import drs_base, ldb
from samba.dcerpc.drsuapi import * from samba.dcerpc.drsuapi import *

View File

@ -39,7 +39,7 @@ from ldb import (
Message, Message,
FLAG_MOD_ADD, FLAG_MOD_ADD,
FLAG_MOD_REPLACE FLAG_MOD_REPLACE
) )
from samba.dcerpc import drsuapi, misc from samba.dcerpc import drsuapi, misc
from samba.drs_utils import drs_DsBind from samba.drs_utils import drs_DsBind
from samba import dsdb from samba import dsdb