mirror of
https://github.com/samba-team/samba.git
synced 2025-03-20 22:50:26 +03:00
netcmd: domain backup didn't support prompting for password
The online/rename backups only worked if you specified both the username and password in the actual command itself. If you just entered the username (expecting to be prompted for the password later), then the command was rejected. The problem was the order the code was doing things in. We were checking credopts.creds.get_password() *before* we'd called credopts.get_credentials(lp), whereas it should be the other way around. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13566 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> (cherry picked from commit 14077b6682d7dc1b16e1ccb42ef61e9f4c0a1715)
This commit is contained in:
parent
ec47551138
commit
69583d1d32
@ -150,10 +150,10 @@ def check_targetdir(logger, targetdir):
|
||||
raise CommandError("%s is not a directory" % targetdir)
|
||||
|
||||
|
||||
def check_online_backup_args(logger, credopts, server, targetdir):
|
||||
def check_online_backup_args(logger, creds, server, targetdir):
|
||||
# Make sure we have all the required args.
|
||||
u_p = {'user': credopts.creds.get_username(),
|
||||
'pass': credopts.creds.get_password()}
|
||||
u_p = {'user': creds.get_username(),
|
||||
'pass': creds.get_password()}
|
||||
if None in u_p.values():
|
||||
raise CommandError("Creds required.")
|
||||
if server is None:
|
||||
@ -212,12 +212,12 @@ class cmd_domain_backup_online(samba.netcmd.Command):
|
||||
logger = self.get_logger()
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
# Make sure we have all the required args.
|
||||
check_online_backup_args(logger, credopts, server, targetdir)
|
||||
|
||||
lp = sambaopts.get_loadparm()
|
||||
creds = credopts.get_credentials(lp)
|
||||
|
||||
# Make sure we have all the required args.
|
||||
check_online_backup_args(logger, creds, server, targetdir)
|
||||
|
||||
tmpdir = tempfile.mkdtemp(dir=targetdir)
|
||||
|
||||
# Run a clone join on the remote
|
||||
@ -680,8 +680,11 @@ class cmd_domain_backup_rename(samba.netcmd.Command):
|
||||
logger = self.get_logger()
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
lp = sambaopts.get_loadparm()
|
||||
creds = credopts.get_credentials(lp)
|
||||
|
||||
# Make sure we have all the required args.
|
||||
check_online_backup_args(logger, credopts, server, targetdir)
|
||||
check_online_backup_args(logger, creds, server, targetdir)
|
||||
delete_old_dns = not keep_dns_realm
|
||||
|
||||
new_dns_realm = new_dns_realm.lower()
|
||||
@ -695,8 +698,6 @@ class cmd_domain_backup_rename(samba.netcmd.Command):
|
||||
tmpdir = tempfile.mkdtemp(dir=targetdir)
|
||||
|
||||
# setup a join-context for cloning the remote server
|
||||
lp = sambaopts.get_loadparm()
|
||||
creds = credopts.get_credentials(lp)
|
||||
include_secrets = not no_secrets
|
||||
ctx = DCCloneAndRenameContext(new_base_dn, new_domain_name,
|
||||
new_dns_realm, logger=logger,
|
||||
|
Loading…
x
Reference in New Issue
Block a user