1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-22 16:59:09 +03:00

samba-tool: Moved _get_user_realm_domain fcn to common

_get_user_realm_domain is used by both delegation and spn commands

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Giampaolo Lauria
2011-09-07 11:11:38 -04:00
committed by Andrew Bartlett
parent f4f77bb954
commit 69a2e4b360
3 changed files with 29 additions and 47 deletions

View File

@ -23,11 +23,11 @@
import samba.getopt as options
import ldb
import re
from samba import provision
from samba import dsdb
from samba.samdb import SamDB
from samba.auth import system_session
from samba.netcmd.common import _get_user_realm_domain
from samba.netcmd import (
Command,
CommandError,
@ -35,27 +35,6 @@ from samba.netcmd import (
Option
)
def _get_user_realm_domain(user):
""" get the realm or the domain and the base user
from user like:
* username
* DOMAIN\username
* username@REALM
"""
baseuser = user
realm = ""
domain = ""
m = re.match(r"(\w+)\\(\w+$)", user)
if m:
domain = m.group(1)
baseuser = m.group(2)
return (baseuser.lower(), domain.upper(), realm)
m = re.match(r"(\w+)@(\w+)", user)
if m:
baseuser = m.group(1)
realm = m.group(2)
return (baseuser.lower(), domain, realm.upper())
class cmd_delegation_show(Command):