mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
samba-tool: Don't require full prog line to be in synopsis.
This commit is contained in:
@ -66,8 +66,8 @@ class Command(object):
|
||||
outf = sys.stdout
|
||||
errf = sys.stderr
|
||||
|
||||
def usage(self, *args):
|
||||
parser, _ = self._create_parser()
|
||||
def usage(self, prog, *args):
|
||||
parser, _ = self._create_parser(prog)
|
||||
parser.print_usage()
|
||||
|
||||
def show_command_error(self, e):
|
||||
@ -103,9 +103,11 @@ class Command(object):
|
||||
if force_traceback or samba.get_debug_level() >= 3:
|
||||
traceback.print_tb(etraceback)
|
||||
|
||||
def _create_parser(self):
|
||||
parser = optparse.OptionParser(usage=self.synopsis,
|
||||
description=self.full_description)
|
||||
def _create_parser(self, prog):
|
||||
parser = optparse.OptionParser(
|
||||
usage=self.synopsis,
|
||||
description=self.full_description,
|
||||
prog=prog)
|
||||
parser.add_options(self.takes_options)
|
||||
optiongroups = {}
|
||||
for name, optiongroup in self.takes_optiongroups.iteritems():
|
||||
@ -117,7 +119,7 @@ class Command(object):
|
||||
self.outf.write(text+"\n")
|
||||
|
||||
def _run(self, *argv):
|
||||
parser, optiongroups = self._create_parser()
|
||||
parser, optiongroups = self._create_parser(argv[0])
|
||||
opts, args = parser.parse_args(list(argv))
|
||||
# Filter out options from option groups
|
||||
args = args[1:]
|
||||
@ -170,13 +172,10 @@ class SuperCommand(Command):
|
||||
|
||||
def _run(self, myname, subcommand=None, *args):
|
||||
if subcommand in self.subcommands:
|
||||
return self.subcommands[subcommand]._run(subcommand, *args)
|
||||
return self.subcommands[subcommand]._run(
|
||||
"%s %s" % (myname, subcommand), *args)
|
||||
|
||||
if myname == "samba-tool":
|
||||
usage = "samba-tool <subcommand>"
|
||||
else:
|
||||
usage = "samba-tool %s <subcommand>" % myname
|
||||
self.outf.write("Usage: %s [options]\n" % usage)
|
||||
self.usage(myname)
|
||||
self.outf.write("Available subcommands:\n")
|
||||
subcmds = self.subcommands.keys()
|
||||
subcmds.sort()
|
||||
@ -187,14 +186,15 @@ class SuperCommand(Command):
|
||||
if subcommand in [None]:
|
||||
raise CommandError("You must specify a subcommand")
|
||||
if subcommand in ['help', '-h', '--help']:
|
||||
self.outf.write("For more help on a specific subcommand, please type: %s (-h|--help)\n" % usage)
|
||||
self.outf.write("For more help on a specific subcommand, please type: %s (-h|--help)\n" % myname)
|
||||
return 0
|
||||
raise CommandError("No such subcommand '%s'" % subcommand)
|
||||
|
||||
|
||||
|
||||
class CommandError(Exception):
|
||||
'''an exception class for samba-tool cmd errors'''
|
||||
"""An exception class for samba-tool Command errors."""
|
||||
|
||||
def __init__(self, message, inner_exception=None):
|
||||
self.message = message
|
||||
self.inner_exception = inner_exception
|
||||
|
@ -33,7 +33,7 @@ from samba.dbchecker import dbcheck
|
||||
|
||||
class cmd_dbcheck(Command):
|
||||
"""check local AD database for errors"""
|
||||
synopsis = "%prog dbcheck [<DN>] [options]"
|
||||
synopsis = "%prog [<DN>] [options]"
|
||||
|
||||
takes_args = ["DN?"]
|
||||
|
||||
|
@ -36,11 +36,10 @@ from samba.netcmd import (
|
||||
)
|
||||
|
||||
|
||||
|
||||
class cmd_delegation_show(Command):
|
||||
"""Show the delegation setting of an account."""
|
||||
|
||||
synopsis = "%prog delegation show <accountname> [options]"
|
||||
synopsis = "%prog show <accountname> [options]"
|
||||
|
||||
takes_args = ["accountname"]
|
||||
|
||||
@ -74,11 +73,10 @@ class cmd_delegation_show(Command):
|
||||
self.outf.write("msDS-AllowedToDelegateTo: %s\n" % a)
|
||||
|
||||
|
||||
|
||||
class cmd_delegation_for_any_service(Command):
|
||||
"""Set/unset UF_TRUSTED_FOR_DELEGATION for an account."""
|
||||
|
||||
synopsis = "%prog delegation for-any-service <accountname> [(on|off)] [options]"
|
||||
synopsis = "%prog <accountname> [(on|off)] [options]"
|
||||
|
||||
takes_args = ["accountname", "onoff"]
|
||||
|
||||
@ -109,11 +107,10 @@ class cmd_delegation_for_any_service(Command):
|
||||
raise CommandError(err)
|
||||
|
||||
|
||||
|
||||
class cmd_delegation_for_any_protocol(Command):
|
||||
"""Set/unset UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION (S4U2Proxy) for an account."""
|
||||
|
||||
synopsis = "%prog delegation for-any-protocol <accountname> [(on|off)] [options]"
|
||||
synopsis = "%prog <accountname> [(on|off)] [options]"
|
||||
|
||||
takes_args = ["accountname", "onoff"]
|
||||
|
||||
@ -144,11 +141,10 @@ class cmd_delegation_for_any_protocol(Command):
|
||||
raise CommandError(err)
|
||||
|
||||
|
||||
|
||||
class cmd_delegation_add_service(Command):
|
||||
"""Add a service principal as msDS-AllowedToDelegateTo"""
|
||||
|
||||
synopsis = "%prog delegation add-service <accountname> <principal> [options]"
|
||||
synopsis = "%prog <accountname> <principal> [options]"
|
||||
|
||||
takes_args = ["accountname", "principal"]
|
||||
|
||||
@ -180,11 +176,10 @@ class cmd_delegation_add_service(Command):
|
||||
raise CommandError(err)
|
||||
|
||||
|
||||
|
||||
class cmd_delegation_del_service(Command):
|
||||
"""Delete a service principal as msDS-AllowedToDelegateTo"""
|
||||
|
||||
synopsis = "%prog delegation del-service <accountname> <principal> [options]"
|
||||
synopsis = "%prog <accountname> <principal> [options]"
|
||||
|
||||
takes_args = ["accountname", "principal"]
|
||||
|
||||
@ -216,7 +211,6 @@ class cmd_delegation_del_service(Command):
|
||||
raise CommandError(err)
|
||||
|
||||
|
||||
|
||||
class cmd_delegation(SuperCommand):
|
||||
"""Delegation management"""
|
||||
|
||||
|
@ -62,7 +62,7 @@ def get_testparm_var(testparm, smbconf, varname):
|
||||
class cmd_domain_export_keytab(Command):
|
||||
"""Dumps kerberos keys of the domain into a keytab"""
|
||||
|
||||
synopsis = "%prog domain exportkeytab <keytab> [options]"
|
||||
synopsis = "%prog <keytab> [options]"
|
||||
|
||||
takes_options = [
|
||||
]
|
||||
@ -79,7 +79,7 @@ class cmd_domain_export_keytab(Command):
|
||||
class cmd_domain_join(Command):
|
||||
"""Joins domain as either member or backup domain controller *"""
|
||||
|
||||
synopsis = "%prog domain join <dnsdomain> [DC|RODC|MEMBER|SUBDOMAIN] [options]"
|
||||
synopsis = "%prog <dnsdomain> [DC|RODC|MEMBER|SUBDOMAIN] [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("--server", help="DC to join", type=str),
|
||||
@ -140,7 +140,7 @@ class cmd_domain_join(Command):
|
||||
class cmd_domain_level(Command):
|
||||
"""Raises domain and forest function levels"""
|
||||
|
||||
synopsis = "%prog domain level (show|raise <options>) [options]"
|
||||
synopsis = "%prog (show|raise <options>) [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -339,7 +339,7 @@ class cmd_domain_level(Command):
|
||||
class cmd_domain_machinepassword(Command):
|
||||
"""Gets a machine password out of our SAM"""
|
||||
|
||||
synopsis = "%prog domain machinepassword <accountname> [options]"
|
||||
synopsis = "%prog <accountname> [options]"
|
||||
|
||||
takes_args = ["secret"]
|
||||
|
||||
@ -370,7 +370,7 @@ class cmd_domain_passwordsettings(Command):
|
||||
and maximum password age) on a Samba4 server.
|
||||
"""
|
||||
|
||||
synopsis = "%prog domain passwordsettings (show|set <options>) [options]"
|
||||
synopsis = "%prog (show|set <options>) [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -534,7 +534,7 @@ class cmd_domain_samba3upgrade(Command):
|
||||
samba3 testparm utility (with --testparm).
|
||||
"""
|
||||
|
||||
synopsis = "%prog domain samba3upgrade [options] <samba3_smb_conf>"
|
||||
synopsis = "%prog [options] <samba3_smb_conf>"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
|
@ -101,7 +101,7 @@ def get_dsServiceName(samdb):
|
||||
class cmd_drs_showrepl(Command):
|
||||
"""show replication status"""
|
||||
|
||||
synopsis = "%prog drs showrepl [<DC>] [options]"
|
||||
synopsis = "%prog [<DC>] [options]"
|
||||
|
||||
takes_args = ["DC?"]
|
||||
|
||||
@ -206,7 +206,7 @@ class cmd_drs_showrepl(Command):
|
||||
class cmd_drs_kcc(Command):
|
||||
"""trigger knowledge consistency center run"""
|
||||
|
||||
synopsis = "%prog drs kcc [<DC>] [options]"
|
||||
synopsis = "%prog [<DC>] [options]"
|
||||
|
||||
takes_args = ["DC?"]
|
||||
|
||||
@ -269,7 +269,7 @@ def drs_local_replicate(self, SOURCE_DC, NC):
|
||||
class cmd_drs_replicate(Command):
|
||||
"""replicate a naming context between two DCs"""
|
||||
|
||||
synopsis = "%prog drs replicate <destinationDC> <sourceDC> <NC> [options]"
|
||||
synopsis = "%prog <destinationDC> <sourceDC> <NC> [options]"
|
||||
|
||||
takes_args = ["DEST_DC", "SOURCE_DC", "NC"]
|
||||
|
||||
@ -344,7 +344,7 @@ class cmd_drs_replicate(Command):
|
||||
class cmd_drs_bind(Command):
|
||||
"""show DRS capabilities of a server"""
|
||||
|
||||
synopsis = "%prog drs bind [<DC>] [options]"
|
||||
synopsis = "%prog [<DC>] [options]"
|
||||
|
||||
takes_args = ["DC?"]
|
||||
|
||||
@ -437,7 +437,7 @@ class cmd_drs_bind(Command):
|
||||
class cmd_drs_options(Command):
|
||||
"""query or change 'options' for NTDS Settings object of a domain controller"""
|
||||
|
||||
synopsis = ("%prog drs options [<DC>] [options]")
|
||||
synopsis = "%prog [<DC>] [options]"
|
||||
|
||||
takes_args = ["DC?"]
|
||||
|
||||
|
@ -50,7 +50,7 @@ from samba.netcmd import (
|
||||
class cmd_dsacl_set(Command):
|
||||
"""Modify access list on a directory object"""
|
||||
|
||||
synopsis = "%prog dsacl set [options]"
|
||||
synopsis = "%prog [options]"
|
||||
car_help = """ The access control right to allow or deny """
|
||||
|
||||
takes_options = [
|
||||
|
@ -34,11 +34,10 @@ from samba.netcmd import (
|
||||
from samba.samdb import SamDB
|
||||
|
||||
|
||||
|
||||
class cmd_fsmo_seize(Command):
|
||||
"""Seize the role"""
|
||||
|
||||
synopsis = "%prog fsmo seize [options]"
|
||||
synopsis = "%prog [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -116,11 +115,10 @@ all=all of the above"""),
|
||||
self.seize_role(role, samdb, force)
|
||||
|
||||
|
||||
|
||||
class cmd_fsmo_show(Command):
|
||||
"""Show the roles"""
|
||||
|
||||
synopsis = "%prog fsmo show [options]"
|
||||
synopsis = "%prog [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -129,8 +127,7 @@ class cmd_fsmo_show(Command):
|
||||
|
||||
takes_args = []
|
||||
|
||||
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()
|
||||
creds = credopts.get_credentials(lp, fallback_machine=True)
|
||||
|
||||
@ -175,11 +172,10 @@ class cmd_fsmo_show(Command):
|
||||
self.message("SchemaMasterRole owner: " + self.schemaMaster)
|
||||
|
||||
|
||||
|
||||
class cmd_fsmo_transfer(Command):
|
||||
"""Transfer the role"""
|
||||
|
||||
synopsis = "%prog fsmo transfer [options]"
|
||||
synopsis = "%prog [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -252,7 +248,6 @@ all=all of the above"""),
|
||||
self.transfer_role(role, samdb)
|
||||
|
||||
|
||||
|
||||
class cmd_fsmo(SuperCommand):
|
||||
"""Flexible Single Master Operations (FSMO) roles management"""
|
||||
|
||||
|
@ -237,7 +237,7 @@ def create_directory_hier(conn, remotedir):
|
||||
class cmd_listall(Command):
|
||||
"""list all GPOs"""
|
||||
|
||||
synopsis = "%prog gpo listall [options]"
|
||||
synopsis = "%prog [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -268,13 +268,13 @@ class cmd_listall(Command):
|
||||
class cmd_list(Command):
|
||||
"""list GPOs for an account"""
|
||||
|
||||
synopsis = "%prog gpo list <username> [options]"
|
||||
synopsis = "%prog <username> [options]"
|
||||
|
||||
takes_args = [ 'username' ]
|
||||
takes_args = ['username']
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
metavar="URL", dest="H")
|
||||
Option("-H", "--URL", help="LDB URL for database or target server",
|
||||
type=str, metavar="URL", dest="H")
|
||||
]
|
||||
|
||||
def run(self, username, H=None, sambaopts=None, credopts=None, versionopts=None):
|
||||
@ -377,7 +377,7 @@ class cmd_list(Command):
|
||||
class cmd_show(Command):
|
||||
"""Show information for a GPO"""
|
||||
|
||||
synopsis = "%prog gpo show <gpo> [options]"
|
||||
synopsis = "%prog <gpo> [options]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
@ -385,7 +385,7 @@ class cmd_show(Command):
|
||||
"credopts": options.CredentialsOptions,
|
||||
}
|
||||
|
||||
takes_args = [ 'gpo' ]
|
||||
takes_args = ['gpo']
|
||||
|
||||
takes_options = [
|
||||
Option("-H", help="LDB URL for database or target server", type=str)
|
||||
@ -421,7 +421,7 @@ class cmd_show(Command):
|
||||
class cmd_getlink(Command):
|
||||
"""List GPO Links for a container"""
|
||||
|
||||
synopsis = "%prog gpo getlink <container_dn> [options]"
|
||||
synopsis = "%prog <container_dn> [options]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
@ -429,7 +429,7 @@ class cmd_getlink(Command):
|
||||
"credopts": options.CredentialsOptions,
|
||||
}
|
||||
|
||||
takes_args = [ 'container_dn' ]
|
||||
takes_args = ['container_dn']
|
||||
|
||||
takes_options = [
|
||||
Option("-H", help="LDB URL for database or target server", type=str)
|
||||
@ -468,7 +468,7 @@ class cmd_getlink(Command):
|
||||
class cmd_setlink(Command):
|
||||
"""Add or Update a GPO link to a container"""
|
||||
|
||||
synopsis = "%prog gpo setlink <container_dn> <gpo> [options]"
|
||||
synopsis = "%prog <container_dn> <gpo> [options]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
@ -476,7 +476,7 @@ class cmd_setlink(Command):
|
||||
"credopts": options.CredentialsOptions,
|
||||
}
|
||||
|
||||
takes_args = [ 'container_dn', 'gpo' ]
|
||||
takes_args = ['container_dn', 'gpo']
|
||||
|
||||
takes_options = [
|
||||
Option("-H", help="LDB URL for database or target server", type=str),
|
||||
@ -556,7 +556,7 @@ class cmd_setlink(Command):
|
||||
class cmd_dellink(Command):
|
||||
"""Delete GPO link from a container"""
|
||||
|
||||
synopsis = "%prog gpo dellink <container_dn> <gpo> [options]"
|
||||
synopsis = "%prog <container_dn> <gpo> [options]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
@ -564,7 +564,7 @@ class cmd_dellink(Command):
|
||||
"credopts": options.CredentialsOptions,
|
||||
}
|
||||
|
||||
takes_args = [ 'container_dn', 'gpo' ]
|
||||
takes_args = ['container_dn', 'gpo']
|
||||
|
||||
takes_options = [
|
||||
Option("-H", help="LDB URL for database or target server", type=str),
|
||||
@ -625,7 +625,7 @@ class cmd_dellink(Command):
|
||||
class cmd_getinheritance(Command):
|
||||
"""Get inheritance flag for a container"""
|
||||
|
||||
synopsis = "%prog gpo getinheritance <container_dn> [options]"
|
||||
synopsis = "%prog <container_dn> [options]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
@ -633,7 +633,7 @@ class cmd_getinheritance(Command):
|
||||
"credopts": options.CredentialsOptions,
|
||||
}
|
||||
|
||||
takes_args = [ 'container_dn' ]
|
||||
takes_args = ['container_dn']
|
||||
|
||||
takes_options = [
|
||||
Option("-H", help="LDB URL for database or target server", type=str)
|
||||
@ -669,7 +669,7 @@ class cmd_getinheritance(Command):
|
||||
class cmd_setinheritance(Command):
|
||||
"""Set inheritance flag on a container"""
|
||||
|
||||
synopsis = "%prog gpo setinheritance <container_dn> <block|inherit> [options]"
|
||||
synopsis = "%prog <container_dn> <block|inherit> [options]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
@ -724,7 +724,7 @@ class cmd_setinheritance(Command):
|
||||
class cmd_fetch(Command):
|
||||
"""Download a GPO"""
|
||||
|
||||
synopsis = "%prog gpo fetch <gpo> [options]"
|
||||
synopsis = "%prog <gpo> [options]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
@ -732,7 +732,7 @@ class cmd_fetch(Command):
|
||||
"credopts": options.CredentialsOptions,
|
||||
}
|
||||
|
||||
takes_args = [ 'gpo' ]
|
||||
takes_args = ['gpo']
|
||||
|
||||
takes_options = [
|
||||
Option("-H", help="LDB URL for database or target server", type=str),
|
||||
@ -792,7 +792,7 @@ class cmd_fetch(Command):
|
||||
class cmd_create(Command):
|
||||
"""Create an empty GPO"""
|
||||
|
||||
synopsis = "%prog gpo create <displayname> [options]"
|
||||
synopsis = "%prog <displayname> [options]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
@ -800,7 +800,7 @@ class cmd_create(Command):
|
||||
"credopts": options.CredentialsOptions,
|
||||
}
|
||||
|
||||
takes_args = [ 'displayname' ]
|
||||
takes_args = ['displayname']
|
||||
|
||||
takes_options = [
|
||||
Option("-H", help="LDB URL for database or target server", type=str),
|
||||
|
@ -43,7 +43,7 @@ distribution_group = dict({"Domain": GTYPE_DISTRIBUTION_DOMAIN_LOCAL_GROUP, "Glo
|
||||
class cmd_group_add(Command):
|
||||
"""Creates a new group"""
|
||||
|
||||
synopsis = "%prog group add <groupname> [options]"
|
||||
synopsis = "%prog <groupname> [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -88,7 +88,7 @@ class cmd_group_add(Command):
|
||||
class cmd_group_delete(Command):
|
||||
"""Delete a group"""
|
||||
|
||||
synopsis = "%prog group delete <groupname> [options]"
|
||||
synopsis = "%prog <groupname> [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -115,7 +115,7 @@ class cmd_group_delete(Command):
|
||||
class cmd_group_add_members(Command):
|
||||
"""Add (comma-separated list of) group members"""
|
||||
|
||||
synopsis = "%prog group addmembers <groupname> <listofmembers> [options]"
|
||||
synopsis = "%prog <groupname> <listofmembers> [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -144,7 +144,7 @@ class cmd_group_add_members(Command):
|
||||
class cmd_group_remove_members(Command):
|
||||
"""Remove (comma-separated list of) group members"""
|
||||
|
||||
synopsis = "%prog group removemembers <groupname> <listofmembers> [options]"
|
||||
synopsis = "%prog <groupname> <listofmembers> [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
|
@ -850,7 +850,7 @@ class LDAPBundel(object):
|
||||
|
||||
class cmd_ldapcmp(Command):
|
||||
"""compare two ldap databases"""
|
||||
synopsis = "%prog ldapcmp <URL1> <URL2> (domain|configuration|schema) [options]"
|
||||
synopsis = "%prog <URL1> <URL2> (domain|configuration|schema) [options]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts": options.SambaOptions,
|
||||
|
@ -41,7 +41,7 @@ from samba.netcmd import (
|
||||
|
||||
class cmd_ntacl_set(Command):
|
||||
"""Set ACLs on a file"""
|
||||
synopsis = "%prog set <acl> <file> [options]"
|
||||
synopsis = "%prog <acl> <file> [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("--quiet", help="Be quiet", action="store_true"),
|
||||
@ -77,7 +77,7 @@ class cmd_ntacl_set(Command):
|
||||
|
||||
class cmd_ntacl_get(Command):
|
||||
"""Set ACLs on a file"""
|
||||
synopsis = "%prog get <file> [options]"
|
||||
synopsis = "%prog <file> [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("--as-sddl", help="Output ACL in the SDDL format", action="store_true"),
|
||||
|
@ -25,15 +25,13 @@ from samba.samdb import SamDB
|
||||
from samba.auth import system_session
|
||||
import ldb
|
||||
from samba.dcerpc import misc, drsuapi
|
||||
from samba.credentials import Credentials
|
||||
from samba.drs_utils import drs_Replicate
|
||||
|
||||
|
||||
|
||||
class cmd_rodc_preload(Command):
|
||||
"""Preload one account for an RODC"""
|
||||
|
||||
synopsis = "%prog rodc preload (<SID>|<DN>|<accountname>) [options]"
|
||||
synopsis = "%prog (<SID>|<DN>|<accountname>) [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("--server", help="DC to use", type=str),
|
||||
|
@ -33,11 +33,10 @@ from samba.netcmd import (
|
||||
)
|
||||
|
||||
|
||||
|
||||
class cmd_spn_list(Command):
|
||||
"""List spns of a given user."""
|
||||
|
||||
synopsis = "%prog spn list <user> [options]"
|
||||
synopsis = "%prog <user> [options]"
|
||||
|
||||
takes_args = ["user"]
|
||||
|
||||
@ -71,11 +70,10 @@ class cmd_spn_list(Command):
|
||||
raise CommandError("User %s not found" % user)
|
||||
|
||||
|
||||
|
||||
class cmd_spn_add(Command):
|
||||
"""Create a new spn."""
|
||||
|
||||
synopsis = "%prog spn add <name> <user> [options]"
|
||||
synopsis = "%prog <name> <user> [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("--force", help="Force the addition of the spn"\
|
||||
@ -126,11 +124,10 @@ class cmd_spn_add(Command):
|
||||
raise CommandError("User %s not found" % user)
|
||||
|
||||
|
||||
|
||||
class cmd_spn_delete(Command):
|
||||
"""Delete a spn."""
|
||||
|
||||
synopsis = "%prog spn delete <name> [user] [options]"
|
||||
synopsis = "%prog <name> [user] [options]"
|
||||
|
||||
takes_args = ["name", "user?"]
|
||||
|
||||
@ -181,7 +178,6 @@ class cmd_spn_delete(Command):
|
||||
raise CommandError("Service principal %s not affected" % name)
|
||||
|
||||
|
||||
|
||||
class cmd_spn(SuperCommand):
|
||||
"""Service Principal Name (SPN) management"""
|
||||
|
||||
|
@ -44,7 +44,7 @@ from samba.netcmd import Command, CommandError, Option
|
||||
class cmd_testparm(Command):
|
||||
"""Syntax check the configuration file."""
|
||||
|
||||
synopsis = "%prog testparm [options]"
|
||||
synopsis = "%prog [options]"
|
||||
|
||||
takes_optiongroups = {
|
||||
"sambaopts" : options.SambaOptions,
|
||||
|
@ -29,7 +29,7 @@ from samba.netcmd import (
|
||||
|
||||
class cmd_time(Command):
|
||||
"""Retrieve the time on a remote server"""
|
||||
synopsis = "%prog time [server-name] [options]"
|
||||
synopsis = "%prog [server-name] [options]"
|
||||
|
||||
takes_args = ["server_name?"]
|
||||
|
||||
|
@ -36,11 +36,10 @@ from samba.netcmd import (
|
||||
)
|
||||
|
||||
|
||||
|
||||
class cmd_user_add(Command):
|
||||
"""Creates a new user"""
|
||||
|
||||
synopsis = "%prog user add <username> [<password>] [options]"
|
||||
synopsis = "%prog <username> [<password>] [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -107,7 +106,7 @@ class cmd_user_add(Command):
|
||||
class cmd_user_delete(Command):
|
||||
"""Delete a user"""
|
||||
|
||||
synopsis = "%prog user delete <username> [options]"
|
||||
synopsis = "%prog <username> [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -133,7 +132,7 @@ class cmd_user_delete(Command):
|
||||
class cmd_user_enable(Command):
|
||||
"""Enables a user"""
|
||||
|
||||
synopsis = "%prog user enable (<username>|--filter <filter>) [options]"
|
||||
synopsis = "%prog (<username>|--filter <filter>) [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -166,7 +165,7 @@ class cmd_user_enable(Command):
|
||||
class cmd_user_setexpiry(Command):
|
||||
"""Sets the expiration of a user account"""
|
||||
|
||||
synopsis = "%prog user setexpiry (<username>|--filter <filter>) [options]"
|
||||
synopsis = "%prog (<username>|--filter <filter>) [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -205,7 +204,7 @@ class cmd_user_setexpiry(Command):
|
||||
class cmd_user_password(Command):
|
||||
"""Change password for a user account (the one provided in authentication)"""
|
||||
|
||||
synopsis = "%prog user password [options]"
|
||||
synopsis = "%prog [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("--newpassword", help="New password", type=str),
|
||||
@ -239,7 +238,7 @@ class cmd_user_password(Command):
|
||||
class cmd_user_setpassword(Command):
|
||||
"""(Re)sets the password of a user account"""
|
||||
|
||||
synopsis = "%prog user setpassword (<username>|--filter <filter>) [options]"
|
||||
synopsis = "%prog (<username>|--filter <filter>) [options]"
|
||||
|
||||
takes_options = [
|
||||
Option("-H", "--URL", help="LDB URL for database or target server", type=str,
|
||||
@ -286,7 +285,6 @@ class cmd_user_setpassword(Command):
|
||||
self.outf.write("Changed password OK\n")
|
||||
|
||||
|
||||
|
||||
class cmd_user(SuperCommand):
|
||||
"""User management"""
|
||||
|
||||
|
@ -30,9 +30,10 @@ from samba.netcmd import (
|
||||
CommandError
|
||||
)
|
||||
|
||||
|
||||
class cmd_vampire(Command):
|
||||
"""Join and synchronise a remote AD domain to the local server"""
|
||||
synopsis = "%prog vampire [options] <domain>"
|
||||
synopsis = "%prog [options] <domain>"
|
||||
|
||||
takes_options = [
|
||||
Option("--target-dir", help="Target directory.", type=str),
|
||||
|
Reference in New Issue
Block a user