mirror of
https://github.com/samba-team/samba.git
synced 2025-07-31 20:22:15 +03:00
samba-tool {user,group,computer,contact} show: avoid base64 encoded strings if possible
Be more user friendly and use clear text argument strings if possible. Signed-off-by: Björn Baumbach <bb@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
committed by
Andrew Bartlett
parent
0b04d9f2ec
commit
6d1a0eb8d1
@ -36,6 +36,7 @@ from samba.auth import system_session
|
||||
from samba.samdb import SamDB
|
||||
from samba.compat import get_bytes
|
||||
from subprocess import check_call, CalledProcessError
|
||||
from . import common
|
||||
|
||||
from samba import (
|
||||
credentials,
|
||||
@ -457,8 +458,6 @@ class cmd_computer_edit(Command):
|
||||
|
||||
def run(self, computername, credopts=None, sambaopts=None, versionopts=None,
|
||||
H=None, editor=None):
|
||||
from . import common
|
||||
|
||||
lp = sambaopts.get_loadparm()
|
||||
creds = credopts.get_credentials(lp, fallback_machine=True)
|
||||
samdb = SamDB(url=H, session_info=system_session(),
|
||||
@ -639,7 +638,7 @@ attribute.
|
||||
samaccountname)
|
||||
|
||||
for msg in res:
|
||||
computer_ldif = samdb.write_ldif(msg, ldb.CHANGETYPE_NONE)
|
||||
computer_ldif = common.get_ldif_for_editor(samdb, msg)
|
||||
self.outf.write(computer_ldif)
|
||||
|
||||
|
||||
|
@ -37,6 +37,7 @@ from samba.netcmd import (
|
||||
Option,
|
||||
)
|
||||
from samba.compat import get_bytes
|
||||
from . import common
|
||||
|
||||
|
||||
class cmd_create(Command):
|
||||
@ -365,8 +366,6 @@ class cmd_edit(Command):
|
||||
versionopts=None,
|
||||
H=None,
|
||||
editor=None):
|
||||
from . import common
|
||||
|
||||
lp = sambaopts.get_loadparm()
|
||||
creds = credopts.get_credentials(lp, fallback_machine=True)
|
||||
samdb = SamDB(url=H, session_info=system_session(),
|
||||
@ -548,7 +547,7 @@ class cmd_show(Command):
|
||||
contactname)
|
||||
|
||||
for msg in res:
|
||||
contact_ldif = samdb.write_ldif(msg, ldb.CHANGETYPE_NONE)
|
||||
contact_ldif = common.get_ldif_for_editor(samdb, msg)
|
||||
self.outf.write(contact_ldif)
|
||||
|
||||
|
||||
|
@ -39,6 +39,7 @@ from subprocess import check_call, CalledProcessError
|
||||
from samba.compat import get_bytes
|
||||
import os
|
||||
import tempfile
|
||||
from . import common
|
||||
|
||||
security_group = dict({"Builtin": GTYPE_SECURITY_BUILTIN_LOCAL_GROUP,
|
||||
"Domain": GTYPE_SECURITY_DOMAIN_LOCAL_GROUP,
|
||||
@ -589,7 +590,7 @@ Example3 shows how to display a groups objectGUID and member attributes.
|
||||
raise CommandError('Unable to find group "%s"' % (groupname))
|
||||
|
||||
for msg in res:
|
||||
group_ldif = samdb.write_ldif(msg, ldb.CHANGETYPE_NONE)
|
||||
group_ldif = common.get_ldif_for_editor(samdb, msg)
|
||||
self.outf.write(group_ldif)
|
||||
|
||||
|
||||
@ -747,8 +748,6 @@ class cmd_group_edit(Command):
|
||||
|
||||
def run(self, groupname, credopts=None, sambaopts=None, versionopts=None,
|
||||
H=None, editor=None):
|
||||
from . import common
|
||||
|
||||
lp = sambaopts.get_loadparm()
|
||||
creds = credopts.get_credentials(lp, fallback_machine=True)
|
||||
samdb = SamDB(url=H, session_info=system_session(),
|
||||
|
@ -56,7 +56,7 @@ from samba.netcmd import (
|
||||
from samba.compat import text_type
|
||||
from samba.compat import get_bytes
|
||||
from samba.compat import get_string
|
||||
|
||||
from . import common
|
||||
|
||||
# python[3]-gpgme is abandoned since ubuntu 1804 and debian 9
|
||||
# have to use python[3]-gpg instead
|
||||
@ -2389,8 +2389,6 @@ LDAP server using the 'nano' editor.
|
||||
|
||||
def run(self, username, credopts=None, sambaopts=None, versionopts=None,
|
||||
H=None, editor=None):
|
||||
from . import common
|
||||
|
||||
lp = sambaopts.get_loadparm()
|
||||
creds = credopts.get_credentials(lp, fallback_machine=True)
|
||||
samdb = SamDB(url=H, session_info=system_session(),
|
||||
@ -2520,7 +2518,7 @@ Example3 shows how to display a users objectSid and memberOf attributes.
|
||||
raise CommandError('Unable to find user "%s"' % (username))
|
||||
|
||||
for msg in res:
|
||||
user_ldif = samdb.write_ldif(msg, ldb.CHANGETYPE_NONE)
|
||||
user_ldif = common.get_ldif_for_editor(samdb, msg)
|
||||
self.outf.write(user_ldif)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user