Add quotes to password argument for dump/import

The password is passed on a command line for dump and import and needs
quoting.

Ideally, this would not be passed on a command line at all - any ideas?
Or at least have a stronger form of quoting so that embedded single
quotes will be escaped.
reviewable/pr18780/r1
Jim Kleckner 11 years ago
parent 59396d38e2
commit 8ba9019797

@ -118,7 +118,7 @@ def db_delete(cursor, db):
def db_dump(module, host, user, password, db_name, target, port, socket=None): def db_dump(module, host, user, password, db_name, target, port, socket=None):
cmd = module.get_bin_path('mysqldump', True) cmd = module.get_bin_path('mysqldump', True)
cmd += " --quick --user=%s --password=%s" %(user, password) cmd += " --quick --user=%s --password='%s'" %(user, password)
if socket is not None: if socket is not None:
cmd += " --socket=%s" % socket cmd += " --socket=%s" % socket
else: else:
@ -135,7 +135,7 @@ def db_dump(module, host, user, password, db_name, target, port, socket=None):
def db_import(module, host, user, password, db_name, target, port, socket=None): def db_import(module, host, user, password, db_name, target, port, socket=None):
cmd = module.get_bin_path('mysql', True) cmd = module.get_bin_path('mysql', True)
cmd += " --user=%s --password=%s" %(user, password) cmd += " --user=%s --password='%s'" %(user, password)
if socket is not None: if socket is not None:
cmd += " --socket=%s" % socket cmd += " --socket=%s" % socket
else: else:

Loading…
Cancel
Save