From de8e47a4e3e44edea7b0b671f547b950dc518b42 Mon Sep 17 00:00:00 2001 From: Giampaolo Lauria Date: Fri, 2 Sep 2011 12:52:54 -0400 Subject: samba-tool: Fixed "spn" command syntax Signed-off-by: Amitay Isaacs Signed-off-by: Andrew Bartlett --- source4/scripting/python/samba/netcmd/spn.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/source4/scripting/python/samba/netcmd/spn.py b/source4/scripting/python/samba/netcmd/spn.py index d43b0afd02..6e9d2dece8 100644 --- a/source4/scripting/python/samba/netcmd/spn.py +++ b/source4/scripting/python/samba/netcmd/spn.py @@ -32,6 +32,8 @@ from samba.netcmd import ( Option ) + + def _get_user_realm_domain(user): """ get the realm or the domain and the base user from user like: @@ -39,6 +41,7 @@ def _get_user_realm_domain(user): * DOMAIN\username * username@REALM """ + baseuser = user realm = "" domain = "" @@ -53,9 +56,12 @@ def _get_user_realm_domain(user): realm = m.group(2) return (baseuser.lower(), domain, realm.upper()) + + class cmd_spn_list(Command): """List spns of a given user.""" - synopsis = "%prog spn list " + + synopsis = "%prog spn list [options]" takes_args = ["user"] @@ -80,15 +86,17 @@ class cmd_spn_list(Command): print "User %s has the following servicePrincipalName: " % str(res[0].dn) for e in spns: print "\t %s" % (str(e)) - else: print "User %s has no servicePrincipalName" % str(res[0].dn) else: raise CommandError("User %s not found" % user) + + class cmd_spn_add(Command): """Create a new spn.""" - synopsis = "%prog spn add [--force] " + + synopsis = "%prog spn add [options]" takes_options = [ Option("--force", help="Force the addition of the spn"\ @@ -139,9 +147,11 @@ class cmd_spn_add(Command): raise CommandError("User %s not found" % user) + class cmd_spn_delete(Command): """Delete a spn.""" - synopsis = "%prog spn delete [user]" + + synopsis = "%prog spn delete [user] [options]" takes_args = ["name", "user?"] @@ -191,8 +201,10 @@ class cmd_spn_delete(Command): else: raise CommandError("Service principal %s not affected" % name) + + class cmd_spn(SuperCommand): - """Service Principal Name (SPN) management *""" + """Service Principal Name (SPN) management""" subcommands = {} subcommands["add"] = cmd_spn_add() -- cgit