1 # implement samba_tool drs commands
3 # Copyright Andrew Tridgell 2010
5 # based on C implementation by Kamen Mazdrashki <kamen.mazdrashki@postpath.com>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 import samba
.getopt
as options
24 from samba
.auth
import system_session
25 from samba
.netcmd
import (
31 from samba
.samdb
import SamDB
32 from samba
import drs_utils
, nttime2string
, dsdb
33 from samba
.dcerpc
import drsuapi
, misc
36 def drsuapi_connect(ctx
):
37 '''make a DRSUAPI connection to the server'''
39 (ctx
.drsuapi
, ctx
.drsuapi_handle
, ctx
.bind_supported_extensions
) = drs_utils
.drsuapi_connect(ctx
.server
, ctx
.lp
, ctx
.creds
)
41 raise CommandError("DRS connection to %s failed" % ctx
.server
, e
)
43 def samdb_connect(ctx
):
44 '''make a ldap connection to the server'''
46 ctx
.samdb
= SamDB(url
="ldap://%s" % ctx
.server
,
47 session_info
=system_session(),
48 credentials
=ctx
.creds
, lp
=ctx
.lp
)
50 raise CommandError("LDAP connection to %s failed" % ctx
.server
, e
)
53 '''return "was successful" or an error string'''
54 (ecode
, estring
) = werr
56 return "was successful"
57 return "failed, result %u (%s)" % (ecode
, estring
)
61 def attr_default(msg
, attrname
, default
):
62 '''get an attribute from a ldap msg with a default'''
64 return msg
[attrname
][0]
69 def drs_parse_ntds_dn(ntds_dn
):
70 '''parse a NTDS DN returning a site and server'''
71 a
= ntds_dn
.split(',')
72 if a
[0] != "CN=NTDS Settings" or a
[2] != "CN=Servers" or a
[4] != 'CN=Sites':
73 raise RuntimeError("bad NTDS DN %s" % ntds_dn
)
74 server
= a
[1].split('=')[1]
75 site
= a
[3].split('=')[1]
82 class cmd_drs_showrepl(Command
):
83 """Show replication status."""
85 synopsis
= "%prog [<DC>] [options]"
87 takes_optiongroups
= {
88 "sambaopts": options
.SambaOptions
,
89 "versionopts": options
.VersionOptions
,
90 "credopts": options
.CredentialsOptions
,
95 def print_neighbour(self
, n
):
96 '''print one set of neighbour information'''
97 self
.message("%s" % n
.naming_context_dn
)
99 (site
, server
) = drs_parse_ntds_dn(n
.source_dsa_obj_dn
)
100 self
.message("\t%s\%s via RPC" % (site
, server
))
102 self
.message("\tNTDS DN: %s" % n
.source_dsa_obj_dn
)
103 self
.message("\t\tDSA object GUID: %s" % n
.source_dsa_obj_guid
)
104 self
.message("\t\tLast attempt @ %s %s" % (nttime2string(n
.last_attempt
),
105 drs_errmsg(n
.result_last_attempt
)))
106 self
.message("\t\t%u consecutive failure(s)." % n
.consecutive_sync_failures
)
107 self
.message("\t\tLast success @ %s" % nttime2string(n
.last_success
))
110 def drsuapi_ReplicaInfo(ctx
, info_type
):
111 '''call a DsReplicaInfo'''
113 req1
= drsuapi
.DsReplicaGetInfoRequest1()
114 req1
.info_type
= info_type
116 (info_type
, info
) = ctx
.drsuapi
.DsReplicaGetInfo(ctx
.drsuapi_handle
, 1, req1
)
118 raise CommandError("DsReplicaGetInfo of type %u failed" % info_type
, e
)
119 return (info_type
, info
)
121 def run(self
, DC
=None, sambaopts
=None,
122 credopts
=None, versionopts
=None, server
=None):
124 self
.lp
= sambaopts
.get_loadparm()
126 DC
= common
.netcmd_dnsname(self
.lp
)
128 self
.creds
= credopts
.get_credentials(self
.lp
, fallback_machine
=True)
130 drsuapi_connect(self
)
133 # show domain information
134 ntds_dn
= self
.samdb
.get_dsServiceName()
135 server_dns
= self
.samdb
.search(base
="", scope
=ldb
.SCOPE_BASE
, attrs
=["dnsHostName"])[0]['dnsHostName'][0]
137 (site
, server
) = drs_parse_ntds_dn(ntds_dn
)
139 ntds
= self
.samdb
.search(base
=ntds_dn
, scope
=ldb
.SCOPE_BASE
, attrs
=['options', 'objectGUID', 'invocationId'])
141 raise CommandError("Failed to search NTDS DN %s" % ntds_dn
)
142 conn
= self
.samdb
.search(base
=ntds_dn
, expression
="(objectClass=nTDSConnection)")
144 self
.message("%s\\%s" % (site
, server
))
145 self
.message("DSA Options: 0x%08x" % int(attr_default(ntds
[0], "options", 0)))
146 self
.message("DSA object GUID: %s" % self
.samdb
.schema_format_value("objectGUID", ntds
[0]["objectGUID"][0]))
147 self
.message("DSA invocationId: %s\n" % self
.samdb
.schema_format_value("objectGUID", ntds
[0]["invocationId"][0]))
149 self
.message("==== INBOUND NEIGHBORS ====\n")
150 (info_type
, info
) = self
.drsuapi_ReplicaInfo(drsuapi
.DRSUAPI_DS_REPLICA_INFO_NEIGHBORS
)
152 self
.print_neighbour(n
)
155 self
.message("==== OUTBOUND NEIGHBORS ====\n")
156 (info_type
, info
) = self
.drsuapi_ReplicaInfo(drsuapi
.DRSUAPI_DS_REPLICA_INFO_REPSTO
)
158 self
.print_neighbour(n
)
160 reasons
= ['NTDSCONN_KCC_GC_TOPOLOGY',
161 'NTDSCONN_KCC_RING_TOPOLOGY',
162 'NTDSCONN_KCC_MINIMIZE_HOPS_TOPOLOGY',
163 'NTDSCONN_KCC_STALE_SERVERS_TOPOLOGY',
164 'NTDSCONN_KCC_OSCILLATING_CONNECTION_TOPOLOGY',
165 'NTDSCONN_KCC_INTERSITE_GC_TOPOLOGY',
166 'NTDSCONN_KCC_INTERSITE_TOPOLOGY',
167 'NTDSCONN_KCC_SERVER_FAILOVER_TOPOLOGY',
168 'NTDSCONN_KCC_SITE_FAILOVER_TOPOLOGY',
169 'NTDSCONN_KCC_REDUNDANT_SERVER_TOPOLOGY']
171 self
.message("==== KCC CONNECTION OBJECTS ====\n")
173 self
.message("Connection --")
175 c_rdn
, sep
, c_server_dn
= c
['fromServer'][0].partition(',')
177 c_server_res
= self
.samdb
.search(base
=c_server_dn
, scope
=ldb
.SCOPE_BASE
, attrs
=["dnsHostName"])
178 c_server_dns
= c_server_res
[0]["dnsHostName"][0]
179 except ldb
.LdbError
, (errno
, _
):
180 if errno
== ldb
.ERR_NO_SUCH_OBJECT
:
181 self
.message("\tWARNING: Connection to DELETED server!")
186 self
.message("\tConnection name: %s" % c
['name'][0])
187 self
.message("\tEnabled : %s" % attr_default(c
, 'enabledConnection', 'TRUE'))
188 self
.message("\tServer DNS name : %s" % c_server_dns
)
189 self
.message("\tServer DN name : %s" % c
['fromServer'][0])
190 self
.message("\t\tTransportType: RPC")
191 self
.message("\t\toptions: 0x%08X" % int(attr_default(c
, 'options', 0)))
192 if not 'mS-DS-ReplicatesNCReason' in c
:
193 self
.message("Warning: No NC replicated for Connection!")
195 for r
in c
['mS-DS-ReplicatesNCReason']:
196 a
= str(r
).split(':')
197 self
.message("\t\tReplicatesNC: %s" % a
[3])
198 self
.message("\t\tReason: 0x%08x" % int(a
[2]))
200 if getattr(dsdb
, s
, 0) & int(a
[2]):
201 self
.message("\t\t\t%s" % s
)
205 class cmd_drs_kcc(Command
):
206 """Trigger knowledge consistency center run."""
208 synopsis
= "%prog [<DC>] [options]"
210 takes_optiongroups
= {
211 "sambaopts": options
.SambaOptions
,
212 "versionopts": options
.VersionOptions
,
213 "credopts": options
.CredentialsOptions
,
218 def run(self
, DC
=None, sambaopts
=None,
219 credopts
=None, versionopts
=None, server
=None):
221 self
.lp
= sambaopts
.get_loadparm()
223 DC
= common
.netcmd_dnsname(self
.lp
)
226 self
.creds
= credopts
.get_credentials(self
.lp
, fallback_machine
=True)
228 drsuapi_connect(self
)
230 req1
= drsuapi
.DsExecuteKCC1()
232 self
.drsuapi
.DsExecuteKCC(self
.drsuapi_handle
, 1, req1
)
234 raise CommandError("DsExecuteKCC failed", e
)
235 self
.message("Consistency check on %s successful." % DC
)
239 def drs_local_replicate(self
, SOURCE_DC
, NC
):
240 '''replicate from a source DC to the local SAM'''
242 self
.server
= SOURCE_DC
243 drsuapi_connect(self
)
245 self
.local_samdb
= SamDB(session_info
=system_session(), url
=None,
246 credentials
=self
.creds
, lp
=self
.lp
)
248 self
.samdb
= SamDB(url
="ldap://%s" % self
.server
,
249 session_info
=system_session(),
250 credentials
=self
.creds
, lp
=self
.lp
)
252 # work out the source and destination GUIDs
253 res
= self
.local_samdb
.search(base
="", scope
=ldb
.SCOPE_BASE
, attrs
=["dsServiceName"])
254 self
.ntds_dn
= res
[0]["dsServiceName"][0]
256 res
= self
.local_samdb
.search(base
=self
.ntds_dn
, scope
=ldb
.SCOPE_BASE
, attrs
=["objectGUID"])
257 self
.ntds_guid
= misc
.GUID(self
.samdb
.schema_format_value("objectGUID", res
[0]["objectGUID"][0]))
260 source_dsa_invocation_id
= misc
.GUID(self
.samdb
.get_invocation_id())
261 dest_dsa_invocation_id
= misc
.GUID(self
.local_samdb
.get_invocation_id())
262 destination_dsa_guid
= self
.ntds_guid
264 self
.samdb
.transaction_start()
265 repl
= drs_utils
.drs_Replicate("ncacn_ip_tcp:%s[seal]" % self
.server
, self
.lp
,
266 self
.creds
, self
.local_samdb
, dest_dsa_invocation_id
)
268 # Work out if we are an RODC, so that a forced local replicate
269 # with the admin pw does not sync passwords
270 rodc
= self
.local_samdb
.am_rodc()
272 repl
.replicate(NC
, source_dsa_invocation_id
, destination_dsa_guid
, rodc
=rodc
)
274 raise CommandError("Error replicating DN %s" % NC
, e
)
275 self
.samdb
.transaction_commit()
279 class cmd_drs_replicate(Command
):
280 """Replicate a naming context between two DCs."""
282 synopsis
= "%prog <destinationDC> <sourceDC> <NC> [options]"
284 takes_optiongroups
= {
285 "sambaopts": options
.SambaOptions
,
286 "versionopts": options
.VersionOptions
,
287 "credopts": options
.CredentialsOptions
,
290 takes_args
= ["DEST_DC", "SOURCE_DC", "NC"]
293 Option("--add-ref", help="use ADD_REF to add to repsTo on source", action
="store_true"),
294 Option("--sync-forced", help="use SYNC_FORCED to force inbound replication", action
="store_true"),
295 Option("--sync-all", help="use SYNC_ALL to replicate from all DCs", action
="store_true"),
296 Option("--full-sync", help="resync all objects", action
="store_true"),
297 Option("--local", help="pull changes directly into the local database (destination DC is ignored)", action
="store_true"),
300 def run(self
, DEST_DC
, SOURCE_DC
, NC
,
301 add_ref
=False, sync_forced
=False, sync_all
=False, full_sync
=False,
302 local
=False, sambaopts
=None, credopts
=None, versionopts
=None, server
=None):
304 self
.server
= DEST_DC
305 self
.lp
= sambaopts
.get_loadparm()
307 self
.creds
= credopts
.get_credentials(self
.lp
, fallback_machine
=True)
310 drs_local_replicate(self
, SOURCE_DC
, NC
)
313 drsuapi_connect(self
)
316 # we need to find the NTDS GUID of the source DC
317 msg
= self
.samdb
.search(base
=self
.samdb
.get_config_basedn(),
318 expression
="(&(objectCategory=server)(|(name=%s)(dNSHostName=%s)))" % (
319 ldb
.binary_encode(SOURCE_DC
),
320 ldb
.binary_encode(SOURCE_DC
)),
323 raise CommandError("Failed to find source DC %s" % SOURCE_DC
)
324 server_dn
= msg
[0]['dn']
326 msg
= self
.samdb
.search(base
=server_dn
, scope
=ldb
.SCOPE_ONELEVEL
,
327 expression
="(|(objectCategory=nTDSDSA)(objectCategory=nTDSDSARO))",
328 attrs
=['objectGUID', 'options'])
330 raise CommandError("Failed to find source NTDS DN %s" % SOURCE_DC
)
331 source_dsa_guid
= msg
[0]['objectGUID'][0]
332 dsa_options
= int(attr_default(msg
, 'options', 0))
336 if not (dsa_options
& dsdb
.DS_NTDSDSA_OPT_DISABLE_OUTBOUND_REPL
):
337 req_options |
= drsuapi
.DRSUAPI_DRS_WRIT_REP
339 req_options |
= drsuapi
.DRSUAPI_DRS_ADD_REF
341 req_options |
= drsuapi
.DRSUAPI_DRS_SYNC_FORCED
343 req_options |
= drsuapi
.DRSUAPI_DRS_SYNC_ALL
345 req_options |
= drsuapi
.DRSUAPI_DRS_FULL_SYNC_NOW
348 drs_utils
.sendDsReplicaSync(self
.drsuapi
, self
.drsuapi_handle
, source_dsa_guid
, NC
, req_options
)
349 except drs_utils
.drsException
, estr
:
350 raise CommandError("DsReplicaSync failed", estr
)
351 self
.message("Replicate from %s to %s was successful." % (SOURCE_DC
, DEST_DC
))
355 class cmd_drs_bind(Command
):
356 """Show DRS capabilities of a server."""
358 synopsis
= "%prog [<DC>] [options]"
360 takes_optiongroups
= {
361 "sambaopts": options
.SambaOptions
,
362 "versionopts": options
.VersionOptions
,
363 "credopts": options
.CredentialsOptions
,
368 def run(self
, DC
=None, sambaopts
=None,
369 credopts
=None, versionopts
=None, server
=None):
371 self
.lp
= sambaopts
.get_loadparm()
373 DC
= common
.netcmd_dnsname(self
.lp
)
375 self
.creds
= credopts
.get_credentials(self
.lp
, fallback_machine
=True)
377 drsuapi_connect(self
)
379 bind_info
= drsuapi
.DsBindInfoCtr()
380 bind_info
.length
= 28
381 bind_info
.info
= drsuapi
.DsBindInfo28()
382 (info
, handle
) = self
.drsuapi
.DsBind(misc
.GUID(drsuapi
.DRSUAPI_DS_BIND_GUID
), bind_info
)
385 ("DRSUAPI_SUPPORTED_EXTENSION_BASE", "DRS_EXT_BASE"),
386 ("DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION", "DRS_EXT_ASYNCREPL"),
387 ("DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI", "DRS_EXT_REMOVEAPI"),
388 ("DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2", "DRS_EXT_MOVEREQ_V2"),
389 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS", "DRS_EXT_GETCHG_DEFLATE"),
390 ("DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1", "DRS_EXT_DCINFO_V1"),
391 ("DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION", "DRS_EXT_RESTORE_USN_OPTIMIZATION"),
392 ("DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY", "DRS_EXT_ADDENTRY"),
393 ("DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE", "DRS_EXT_KCC_EXECUTE"),
394 ("DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2", "DRS_EXT_ADDENTRY_V2"),
395 ("DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION", "DRS_EXT_LINKED_VALUE_REPLICATION"),
396 ("DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2", "DRS_EXT_DCINFO_V2"),
397 ("DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD","DRS_EXT_INSTANCE_TYPE_NOT_REQ_ON_MOD"),
398 ("DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND", "DRS_EXT_CRYPTO_BIND"),
399 ("DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO", "DRS_EXT_GET_REPL_INFO"),
400 ("DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION", "DRS_EXT_STRONG_ENCRYPTION"),
401 ("DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01", "DRS_EXT_DCINFO_VFFFFFFFF"),
402 ("DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP", "DRS_EXT_TRANSITIVE_MEMBERSHIP"),
403 ("DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY", "DRS_EXT_ADD_SID_HISTORY"),
404 ("DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3", "DRS_EXT_POST_BETA3"),
405 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V5", "DRS_EXT_GETCHGREQ_V5"),
406 ("DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2", "DRS_EXT_GETMEMBERSHIPS2"),
407 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6", "DRS_EXT_GETCHGREQ_V6"),
408 ("DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS", "DRS_EXT_NONDOMAIN_NCS"),
409 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8", "DRS_EXT_GETCHGREQ_V8"),
410 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5", "DRS_EXT_GETCHGREPLY_V5"),
411 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6", "DRS_EXT_GETCHGREPLY_V6"),
412 ("DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3", "DRS_EXT_WHISTLER_BETA3"),
413 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7", "DRS_EXT_WHISTLER_BETA3"),
414 ("DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT", "DRS_EXT_WHISTLER_BETA3"),
415 ("DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS", "DRS_EXT_W2K3_DEFLATE"),
416 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V10", "DRS_EXT_GETCHGREQ_V10"),
417 ("DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART2", "DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART2"),
418 ("DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART3", "DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART3")
422 ("DRSUAPI_SUPPORTED_EXTENSION_ADAM", "DRS_EXT_ADAM"),
423 ("DRSUAPI_SUPPORTED_EXTENSION_LH_BETA2", "DRS_EXT_LH_BETA2"),
424 ("DRSUAPI_SUPPORTED_EXTENSION_RECYCLE_BIN", "DRS_EXT_RECYCLE_BIN")]
426 self
.message("Bind to %s succeeded." % DC
)
427 self
.message("Extensions supported:")
428 for (opt
, str) in optmap
:
429 optval
= getattr(drsuapi
, opt
, 0)
430 if info
.info
.supported_extensions
& optval
:
434 self
.message(" %-60s: %s (%s)" % (opt
, yesno
, str))
436 if isinstance(info
.info
, drsuapi
.DsBindInfo48
):
437 self
.message("\nExtended Extensions supported:")
438 for (opt
, str) in optmap_ext
:
439 optval
= getattr(drsuapi
, opt
, 0)
440 if info
.info
.supported_extensions_ext
& optval
:
444 self
.message(" %-60s: %s (%s)" % (opt
, yesno
, str))
446 self
.message("\nSite GUID: %s" % info
.info
.site_guid
)
447 self
.message("Repl epoch: %u" % info
.info
.repl_epoch
)
448 if isinstance(info
.info
, drsuapi
.DsBindInfo48
):
449 self
.message("Forest GUID: %s" % info
.info
.config_dn_guid
)
453 class cmd_drs_options(Command
):
454 """Query or change 'options' for NTDS Settings object of a Domain Controller."""
456 synopsis
= "%prog [<DC>] [options]"
458 takes_optiongroups
= {
459 "sambaopts": options
.SambaOptions
,
460 "versionopts": options
.VersionOptions
,
461 "credopts": options
.CredentialsOptions
,
467 Option("--dsa-option", help="DSA option to enable/disable", type="str",
468 metavar
="{+|-}IS_GC | {+|-}DISABLE_INBOUND_REPL | {+|-}DISABLE_OUTBOUND_REPL | {+|-}DISABLE_NTDSCONN_XLATE" ),
471 option_map
= {"IS_GC": 0x00000001,
472 "DISABLE_INBOUND_REPL": 0x00000002,
473 "DISABLE_OUTBOUND_REPL": 0x00000004,
474 "DISABLE_NTDSCONN_XLATE": 0x00000008}
476 def run(self
, DC
=None, dsa_option
=None,
477 sambaopts
=None, credopts
=None, versionopts
=None):
479 self
.lp
= sambaopts
.get_loadparm()
481 DC
= common
.netcmd_dnsname(self
.lp
)
483 self
.creds
= credopts
.get_credentials(self
.lp
, fallback_machine
=True)
487 ntds_dn
= self
.samdb
.get_dsServiceName()
488 res
= self
.samdb
.search(base
=ntds_dn
, scope
=ldb
.SCOPE_BASE
, attrs
=["options"])
489 dsa_opts
= int(res
[0]["options"][0])
491 # print out current DSA options
492 cur_opts
= [x
for x
in self
.option_map
if self
.option_map
[x
] & dsa_opts
]
493 self
.message("Current DSA options: " + ", ".join(cur_opts
))
497 if dsa_option
[:1] not in ("+", "-"):
498 raise CommandError("Unknown option %s" % dsa_option
)
499 flag
= dsa_option
[1:]
500 if flag
not in self
.option_map
.keys():
501 raise CommandError("Unknown option %s" % dsa_option
)
502 if dsa_option
[:1] == "+":
503 dsa_opts |
= self
.option_map
[flag
]
505 dsa_opts
&= ~self
.option_map
[flag
]
508 m
.dn
= ldb
.Dn(self
.samdb
, ntds_dn
)
509 m
["options"]= ldb
.MessageElement(str(dsa_opts
), ldb
.FLAG_MOD_REPLACE
, "options")
511 # print out new DSA options
512 cur_opts
= [x
for x
in self
.option_map
if self
.option_map
[x
] & dsa_opts
]
513 self
.message("New DSA options: " + ", ".join(cur_opts
))
516 class cmd_drs(SuperCommand
):
517 """Directory Replication Services (DRS) management."""
520 subcommands
["bind"] = cmd_drs_bind()
521 subcommands
["kcc"] = cmd_drs_kcc()
522 subcommands
["replicate"] = cmd_drs_replicate()
523 subcommands
["showrepl"] = cmd_drs_showrepl()
524 subcommands
["options"] = cmd_drs_options()