mirror of
https://github.com/samba-team/samba.git
synced 2025-12-20 16:23:51 +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>
This commit is contained in:
committed by
Andrew Bartlett
parent
1da4ff2e64
commit
14077b6682
@@ -156,10 +156,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:
|
||||
@@ -218,12 +218,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
|
||||
@@ -686,8 +686,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()
|
||||
@@ -701,8 +704,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,
|
||||
|
||||
Reference in New Issue
Block a user