samba-tool: Expanded acronym descriptions
[Samba.git] / source4 / scripting / python / samba / netcmd / drs.py
blob94029405ae0dcf18f0f31ab2c99927e1c1562c7c
1 #!/usr/bin/env python
3 # implement samba_tool drs commands
5 # Copyright Andrew Tridgell 2010
6 # Copyright Giampaolo Lauria 2011 <lauria2@yahoo.com>
8 # based on C implementation by Kamen Mazdrashki <kamen.mazdrashki@postpath.com>
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 3 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 import samba.getopt as options
25 import ldb
27 from samba.auth import system_session
28 from samba.netcmd import (
29 Command,
30 CommandError,
31 Option,
32 SuperCommand,
34 from samba.samdb import SamDB
35 from samba import drs_utils, nttime2string, dsdb
36 from samba.dcerpc import drsuapi, misc
37 import common
39 def drsuapi_connect(ctx):
40 '''make a DRSUAPI connection to the server'''
41 binding_options = "seal"
42 if int(ctx.lp.get("log level")) >= 5:
43 binding_options += ",print"
44 binding_string = "ncacn_ip_tcp:%s[%s]" % (ctx.server, binding_options)
45 try:
46 ctx.drsuapi = drsuapi.drsuapi(binding_string, ctx.lp, ctx.creds)
47 (ctx.drsuapi_handle, ctx.bind_supported_extensions) = drs_utils.drs_DsBind(ctx.drsuapi)
48 except Exception, e:
49 raise CommandError("DRS connection to %s failed" % ctx.server, e)
52 def samdb_connect(ctx):
53 '''make a ldap connection to the server'''
54 try:
55 ctx.samdb = SamDB(url="ldap://%s" % ctx.server,
56 session_info=system_session(),
57 credentials=ctx.creds, lp=ctx.lp)
58 except Exception, e:
59 raise CommandError("LDAP connection to %s failed" % ctx.server, e)
62 def drs_errmsg(werr):
63 '''return "was successful" or an error string'''
64 (ecode, estring) = werr
65 if ecode == 0:
66 return "was successful"
67 return "failed, result %u (%s)" % (ecode, estring)
70 def attr_default(msg, attrname, default):
71 '''get an attribute from a ldap msg with a default'''
72 if attrname in msg:
73 return msg[attrname][0]
74 return default
77 def drs_parse_ntds_dn(ntds_dn):
78 '''parse a NTDS DN returning a site and server'''
79 a = ntds_dn.split(',')
80 if a[0] != "CN=NTDS Settings" or a[2] != "CN=Servers" or a[4] != 'CN=Sites':
81 raise RuntimeError("bad NTDS DN %s" % ntds_dn)
82 server = a[1].split('=')[1]
83 site = a[3].split('=')[1]
84 return (site, server)
87 def get_dsServiceName(samdb):
88 '''get the NTDS DN from the rootDSE'''
89 res = samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dsServiceName"])
90 return res[0]["dsServiceName"][0]
93 class cmd_drs_showrepl(Command):
94 """show replication status"""
96 synopsis = "%prog drs showrepl <DC> [options]"
98 takes_args = ["DC?"]
100 def print_neighbour(self, n):
101 '''print one set of neighbour information'''
102 self.message("%s" % n.naming_context_dn)
103 try:
104 (site, server) = drs_parse_ntds_dn(n.source_dsa_obj_dn)
105 self.message("\t%s\%s via RPC" % (site, server))
106 except RuntimeError:
107 self.message("\tNTDS DN: %s" % n.source_dsa_obj_dn)
108 self.message("\t\tDSA object GUID: %s" % n.source_dsa_obj_guid)
109 self.message("\t\tLast attempt @ %s %s" % (nttime2string(n.last_attempt),
110 drs_errmsg(n.result_last_attempt)))
111 self.message("\t\t%u consecutive failure(s)." % n.consecutive_sync_failures)
112 self.message("\t\tLast success @ %s" % nttime2string(n.last_success))
113 self.message("")
115 def drsuapi_ReplicaInfo(ctx, info_type):
116 '''call a DsReplicaInfo'''
118 req1 = drsuapi.DsReplicaGetInfoRequest1()
119 req1.info_type = info_type
120 try:
121 (info_type, info) = ctx.drsuapi.DsReplicaGetInfo(ctx.drsuapi_handle, 1, req1)
122 except Exception, e:
123 raise CommandError("DsReplicaGetInfo of type %u failed" % info_type, e)
124 return (info_type, info)
127 def run(self, DC=None, sambaopts=None,
128 credopts=None, versionopts=None, server=None):
130 self.lp = sambaopts.get_loadparm()
131 if DC is None:
132 DC = common.netcmd_dnsname(self.lp)
133 self.server = DC
134 self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
136 drsuapi_connect(self)
137 samdb_connect(self)
139 # show domain information
140 ntds_dn = get_dsServiceName(self.samdb)
141 server_dns = self.samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dnsHostName"])[0]['dnsHostName'][0]
143 (site, server) = drs_parse_ntds_dn(ntds_dn)
144 try:
145 ntds = self.samdb.search(base=ntds_dn, scope=ldb.SCOPE_BASE, attrs=['options', 'objectGUID', 'invocationId'])
146 except Exception, e:
147 raise CommandError("Failed to search NTDS DN %s" % ntds_dn)
148 conn = self.samdb.search(base=ntds_dn, expression="(objectClass=nTDSConnection)")
150 self.message("%s\\%s" % (site, server))
151 self.message("DSA Options: 0x%08x" % int(attr_default(ntds[0], "options", 0)))
152 self.message("DSA object GUID: %s" % self.samdb.schema_format_value("objectGUID", ntds[0]["objectGUID"][0]))
153 self.message("DSA invocationId: %s\n" % self.samdb.schema_format_value("objectGUID", ntds[0]["invocationId"][0]))
155 self.message("==== INBOUND NEIGHBORS ====\n")
156 (info_type, info) = self.drsuapi_ReplicaInfo(drsuapi.DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)
157 for n in info.array:
158 self.print_neighbour(n)
161 self.message("==== OUTBOUND NEIGHBORS ====\n")
162 (info_type, info) = self.drsuapi_ReplicaInfo(drsuapi.DRSUAPI_DS_REPLICA_INFO_REPSTO)
163 for n in info.array:
164 self.print_neighbour(n)
166 reasons = ['NTDSCONN_KCC_GC_TOPOLOGY',
167 'NTDSCONN_KCC_RING_TOPOLOGY',
168 'NTDSCONN_KCC_MINIMIZE_HOPS_TOPOLOGY',
169 'NTDSCONN_KCC_STALE_SERVERS_TOPOLOGY',
170 'NTDSCONN_KCC_OSCILLATING_CONNECTION_TOPOLOGY',
171 'NTDSCONN_KCC_INTERSITE_GC_TOPOLOGY',
172 'NTDSCONN_KCC_INTERSITE_TOPOLOGY',
173 'NTDSCONN_KCC_SERVER_FAILOVER_TOPOLOGY',
174 'NTDSCONN_KCC_SITE_FAILOVER_TOPOLOGY',
175 'NTDSCONN_KCC_REDUNDANT_SERVER_TOPOLOGY']
177 self.message("==== KCC CONNECTION OBJECTS ====\n")
178 for c in conn:
179 self.message("Connection --")
180 self.message("\tConnection name: %s" % c['name'][0])
181 self.message("\tEnabled : %s" % attr_default(c, 'enabledConnection', 'TRUE'))
182 self.message("\tServer DNS name : %s" % server_dns)
183 self.message("\tServer DN name : %s" % c['fromServer'][0])
184 self.message("\t\tTransportType: RPC")
185 self.message("\t\toptions: 0x%08X" % int(attr_default(c, 'options', 0)))
186 if not 'mS-DS-ReplicatesNCReason' in c:
187 self.message("Warning: No NC replicated for Connection!")
188 continue
189 for r in c['mS-DS-ReplicatesNCReason']:
190 a = str(r).split(':')
191 self.message("\t\tReplicatesNC: %s" % a[3])
192 self.message("\t\tReason: 0x%08x" % int(a[2]))
193 for s in reasons:
194 if getattr(dsdb, s, 0) & int(a[2]):
195 self.message("\t\t\t%s" % s)
198 class cmd_drs_kcc(Command):
199 """trigger knowledge consistency center run"""
201 synopsis = "%prog drs kcc <DC> [options]"
203 takes_args = ["DC?"]
205 def run(self, DC=None, sambaopts=None,
206 credopts=None, versionopts=None, server=None):
208 self.lp = sambaopts.get_loadparm()
209 if DC is None:
210 DC = common.netcmd_dnsname(self.lp)
211 self.server = DC
213 self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
215 drsuapi_connect(self)
217 req1 = drsuapi.DsExecuteKCC1()
218 try:
219 self.drsuapi.DsExecuteKCC(self.drsuapi_handle, 1, req1)
220 except Exception, e:
221 raise CommandError("DsExecuteKCC failed", e)
222 self.message("Consistency check on %s successful." % DC)
225 def drs_local_replicate(self, SOURCE_DC, NC):
226 '''replicate from a source DC to the local SAM'''
227 self.server = SOURCE_DC
228 drsuapi_connect(self)
230 self.local_samdb = SamDB(session_info=system_session(), url=None,
231 credentials=self.creds, lp=self.lp)
233 self.samdb = SamDB(url="ldap://%s" % self.server,
234 session_info=system_session(),
235 credentials=self.creds, lp=self.lp)
237 # work out the source and destination GUIDs
238 res = self.local_samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dsServiceName"])
239 self.ntds_dn = res[0]["dsServiceName"][0]
241 res = self.local_samdb.search(base=self.ntds_dn, scope=ldb.SCOPE_BASE, attrs=["objectGUID"])
242 self.ntds_guid = misc.GUID(self.samdb.schema_format_value("objectGUID", res[0]["objectGUID"][0]))
245 source_dsa_invocation_id = misc.GUID(self.samdb.get_invocation_id())
246 destination_dsa_guid = self.ntds_guid
248 self.samdb.transaction_start()
249 repl = drs_utils.drs_Replicate("ncacn_ip_tcp:%s[seal]" % self.server, self.lp,
250 self.creds, self.local_samdb)
251 try:
252 repl.replicate(NC, source_dsa_invocation_id, destination_dsa_guid)
253 except Exception, e:
254 raise CommandError("Error replicating DN %s" % NC, e)
255 self.samdb.transaction_commit()
259 class cmd_drs_replicate(Command):
260 """replicate a naming context between two DCs"""
262 synopsis = "%prog drs replicate <destinationDC> <sourceDC> <NC> [options]"
264 takes_args = ["DEST_DC", "SOURCE_DC", "NC"]
266 takes_options = [
267 Option("--add-ref", help="use ADD_REF to add to repsTo on source", action="store_true"),
268 Option("--sync-forced", help="use SYNC_FORCED to force inbound replication", action="store_true"),
269 Option("--local", help="pull changes directly into the local database (destination DC is ignored)", action="store_true"),
272 def run(self, DEST_DC, SOURCE_DC, NC, add_ref=False, sync_forced=False, local=False,
273 sambaopts=None,
274 credopts=None, versionopts=None, server=None):
276 self.server = DEST_DC
277 self.lp = sambaopts.get_loadparm()
279 self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
281 if local:
282 drs_local_replicate(self, SOURCE_DC, NC)
283 return
285 drsuapi_connect(self)
286 samdb_connect(self)
288 # we need to find the NTDS GUID of the source DC
289 msg = self.samdb.search(base=self.samdb.get_config_basedn(),
290 expression="(&(objectCategory=server)(|(name=%s)(dNSHostName=%s)))" % (
291 ldb.binary_encode(SOURCE_DC),
292 ldb.binary_encode(SOURCE_DC)),
293 attrs=[])
294 if len(msg) == 0:
295 raise CommandError("Failed to find source DC %s" % SOURCE_DC)
296 server_dn = msg[0]['dn']
298 msg = self.samdb.search(base=server_dn, scope=ldb.SCOPE_ONELEVEL,
299 expression="(|(objectCategory=nTDSDSA)(objectCategory=nTDSDSARO))",
300 attrs=['objectGUID', 'options'])
301 if len(msg) == 0:
302 raise CommandError("Failed to find source NTDS DN %s" % SOURCE_DC)
303 source_dsa_guid = msg[0]['objectGUID'][0]
304 options = int(attr_default(msg, 'options', 0))
306 nc = drsuapi.DsReplicaObjectIdentifier()
307 nc.dn = NC
309 req1 = drsuapi.DsReplicaSyncRequest1()
310 req1.naming_context = nc;
311 req1.options = 0
312 if not (options & dsdb.DS_NTDSDSA_OPT_DISABLE_OUTBOUND_REPL):
313 req1.options |= drsuapi.DRSUAPI_DRS_WRIT_REP
314 if add_ref:
315 req1.options |= drsuapi.DRSUAPI_DRS_ADD_REF
316 if sync_forced:
317 req1.options |= drsuapi.DRSUAPI_DRS_SYNC_FORCED
318 req1.source_dsa_guid = misc.GUID(source_dsa_guid)
320 try:
321 self.drsuapi.DsReplicaSync(self.drsuapi_handle, 1, req1)
322 except Exception, estr:
323 raise CommandError("DsReplicaSync failed", estr)
324 self.message("Replicate from %s to %s was successful." % (SOURCE_DC, DEST_DC))
328 class cmd_drs_bind(Command):
329 """show DRS capabilities of a server"""
331 synopsis = "%prog drs bind <DC> [options]"
333 takes_args = ["DC?"]
335 def run(self, DC=None, sambaopts=None,
336 credopts=None, versionopts=None, server=None):
338 self.lp = sambaopts.get_loadparm()
339 if DC is None:
340 DC = common.netcmd_dnsname(self.lp)
341 self.server = DC
342 self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
344 drsuapi_connect(self)
345 samdb_connect(self)
347 bind_info = drsuapi.DsBindInfoCtr()
348 bind_info.length = 28
349 bind_info.info = drsuapi.DsBindInfo28()
350 (info, handle) = self.drsuapi.DsBind(misc.GUID(drsuapi.DRSUAPI_DS_BIND_GUID), bind_info)
352 optmap = [
353 ("DRSUAPI_SUPPORTED_EXTENSION_BASE" , "DRS_EXT_BASE"),
354 ("DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION" , "DRS_EXT_ASYNCREPL"),
355 ("DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI" , "DRS_EXT_REMOVEAPI"),
356 ("DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2" , "DRS_EXT_MOVEREQ_V2"),
357 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS" , "DRS_EXT_GETCHG_DEFLATE"),
358 ("DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1" , "DRS_EXT_DCINFO_V1"),
359 ("DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION" , "DRS_EXT_RESTORE_USN_OPTIMIZATION"),
360 ("DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY" , "DRS_EXT_ADDENTRY"),
361 ("DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE" , "DRS_EXT_KCC_EXECUTE"),
362 ("DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2" , "DRS_EXT_ADDENTRY_V2"),
363 ("DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION" , "DRS_EXT_LINKED_VALUE_REPLICATION"),
364 ("DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2" , "DRS_EXT_DCINFO_V2"),
365 ("DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD","DRS_EXT_INSTANCE_TYPE_NOT_REQ_ON_MOD"),
366 ("DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND" , "DRS_EXT_CRYPTO_BIND"),
367 ("DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO" , "DRS_EXT_GET_REPL_INFO"),
368 ("DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION" , "DRS_EXT_STRONG_ENCRYPTION"),
369 ("DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01" , "DRS_EXT_DCINFO_VFFFFFFFF"),
370 ("DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP" , "DRS_EXT_TRANSITIVE_MEMBERSHIP"),
371 ("DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY" , "DRS_EXT_ADD_SID_HISTORY"),
372 ("DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3" , "DRS_EXT_POST_BETA3"),
373 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V5" , "DRS_EXT_GETCHGREQ_V5"),
374 ("DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2" , "DRS_EXT_GETMEMBERSHIPS2"),
375 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6" , "DRS_EXT_GETCHGREQ_V6"),
376 ("DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS" , "DRS_EXT_NONDOMAIN_NCS"),
377 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8" , "DRS_EXT_GETCHGREQ_V8"),
378 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5" , "DRS_EXT_GETCHGREPLY_V5"),
379 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6" , "DRS_EXT_GETCHGREPLY_V6"),
380 ("DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3" , "DRS_EXT_WHISTLER_BETA3"),
381 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7" , "DRS_EXT_WHISTLER_BETA3"),
382 ("DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT" , "DRS_EXT_WHISTLER_BETA3"),
383 ("DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS" , "DRS_EXT_W2K3_DEFLATE"),
384 ("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V10" , "DRS_EXT_GETCHGREQ_V10"),
385 ("DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART2" , "DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART2"),
386 ("DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART3" , "DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART3")
389 optmap_ext = [
390 ("DRSUAPI_SUPPORTED_EXTENSION_ADAM", "DRS_EXT_ADAM"),
391 ("DRSUAPI_SUPPORTED_EXTENSION_LH_BETA2", "DRS_EXT_LH_BETA2"),
392 ("DRSUAPI_SUPPORTED_EXTENSION_RECYCLE_BIN", "DRS_EXT_RECYCLE_BIN")]
394 self.message("Bind to %s succeeded." % DC)
395 self.message("Extensions supported:")
396 for (opt, str) in optmap:
397 optval = getattr(drsuapi, opt, 0)
398 if info.info.supported_extensions & optval:
399 yesno = "Yes"
400 else:
401 yesno = "No "
402 self.message(" %-60s: %s (%s)" % (opt, yesno, str))
404 if isinstance(info.info, drsuapi.DsBindInfo48):
405 self.message("\nExtended Extensions supported:")
406 for (opt, str) in optmap_ext:
407 optval = getattr(drsuapi, opt, 0)
408 if info.info.supported_extensions_ext & optval:
409 yesno = "Yes"
410 else:
411 yesno = "No "
412 self.message(" %-60s: %s (%s)" % (opt, yesno, str))
414 self.message("\nSite GUID: %s" % info.info.site_guid)
415 self.message("Repl epoch: %u" % info.info.repl_epoch)
416 if isinstance(info.info, drsuapi.DsBindInfo48):
417 self.message("Forest GUID: %s" % info.info.config_dn_guid)
421 class cmd_drs_options(Command):
422 """query or change 'options' for NTDS Settings object of a domain controller"""
424 synopsis = ("%prog drs options <DC>"
425 " [--dsa-option={+|-}IS_GC | {+|-}DISABLE_INBOUND_REPL"
426 " |{+|-}DISABLE_OUTBOUND_REPL | {+|-}DISABLE_NTDSCONN_XLATE] [options]")
428 takes_args = ["DC?"]
430 takes_options = [
431 Option("--dsa-option", help="DSA option to enable/disable", type="str"),
434 option_map = {"IS_GC": 0x00000001,
435 "DISABLE_INBOUND_REPL": 0x00000002,
436 "DISABLE_OUTBOUND_REPL": 0x00000004,
437 "DISABLE_NTDSCONN_XLATE": 0x00000008}
439 def run(self, DC=None, dsa_option=None,
440 sambaopts=None, credopts=None, versionopts=None):
442 self.lp = sambaopts.get_loadparm()
443 if DC is None:
444 DC = common.netcmd_dnsname(self.lp)
445 self.server = DC
446 self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
448 samdb_connect(self)
450 ntds_dn = get_dsServiceName(self.samdb)
451 res = self.samdb.search(base=ntds_dn, scope=ldb.SCOPE_BASE, attrs=["options"])
452 dsa_opts = int(res[0]["options"][0])
454 # print out current DSA options
455 cur_opts = [x for x in self.option_map if self.option_map[x] & dsa_opts]
456 self.message("Current DSA options: " + ", ".join(cur_opts))
458 # modify options
459 if dsa_option:
460 if dsa_option[:1] not in ("+", "-"):
461 raise CommandError("Unknown option %s" % dsa_option)
462 flag = dsa_option[1:]
463 if flag not in self.option_map.keys():
464 raise CommandError("Unknown option %s" % dsa_option)
465 if dsa_option[:1] == "+":
466 dsa_opts |= self.option_map[flag]
467 else:
468 dsa_opts &= ~self.option_map[flag]
469 #save new options
470 m = ldb.Message()
471 m.dn = ldb.Dn(self.samdb, ntds_dn)
472 m["options"]= ldb.MessageElement(str(dsa_opts), ldb.FLAG_MOD_REPLACE, "options")
473 self.samdb.modify(m)
474 # print out new DSA options
475 cur_opts = [x for x in self.option_map if self.option_map[x] & dsa_opts]
476 self.message("New DSA options: " + ", ".join(cur_opts))
479 class cmd_drs(SuperCommand):
480 """Directory Replication Services (DRS) management"""
482 subcommands = {}
483 subcommands["bind"] = cmd_drs_bind()
484 subcommands["kcc"] = cmd_drs_kcc()
485 subcommands["replicate"] = cmd_drs_replicate()
486 subcommands["showrepl"] = cmd_drs_showrepl()
487 subcommands["options"] = cmd_drs_options()