From f68a16310e22e007e0b0aff4b4deb4b4d2a64a96 Mon Sep 17 00:00:00 2001 From: Mike Place Date: Mon, 17 Nov 2014 13:32:20 -0700 Subject: [PATCH] quote bsd_shadow --- salt/modules/bsd_shadow.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/salt/modules/bsd_shadow.py b/salt/modules/bsd_shadow.py index 19f767a952..ca3741e51c 100644 --- a/salt/modules/bsd_shadow.py +++ b/salt/modules/bsd_shadow.py @@ -9,6 +9,11 @@ try: except ImportError: pass +try: + from shlex import quote as cmd_quote +except ImportError: + from pipes import quote as cmd_quote + # Define the module's virtual name __virtualname__ = 'shadow' @@ -53,9 +58,9 @@ def info(name): # Get password aging info on FreeBSD # TODO: Implement this for NetBSD, OpenBSD if __salt__['cmd.has_exec']('pw'): - cmd = 'pw user show {0} | cut -f6,7 -d:'.format(name) + cmd = 'pw user show {0} | cut -f6,7 -d:'.format(cmd_quote(name)) try: - change, expire = __salt__['cmd.run_all'](cmd)['stdout'].split(':') + change, expire = __salt__['cmd.run_all'](cmd, python_shell=True)['stdout'].split(':') except ValueError: pass else: