From ffdb0ca8b099ce638854dbb974093b2021f7ed50 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 27 Jun 2019 16:57:21 +1200 Subject: s4/scripting/mymachinepw: print usage with bad arguments Also, use sys.exit() function, not exit(), because sys.exit() reliably exists. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- source4/scripting/bin/mymachinepw | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source4') diff --git a/source4/scripting/bin/mymachinepw b/source4/scripting/bin/mymachinepw index 921cd53bffc..5ad9c7e96dc 100755 --- a/source4/scripting/bin/mymachinepw +++ b/source4/scripting/bin/mymachinepw @@ -30,7 +30,8 @@ for o, v in optlist: if o == "-s": if not conf.load(v): print(v + " not found") - exit(1) + print("\nUsage: mymachinepw [-s SMBCONF]") + sys.exit(1) loaded = True if not loaded: @@ -50,9 +51,11 @@ if not msg: print("Error:") print("Password for host[%s] not found in path[%s]." % (netbios, path)) print("You may want to pass the smb.conf location via the -s option.") - exit(1) + print() + print("Usage: mymachinepw [-s SMBCONF]") + sys.exit(1) password=msg[0]['secret'][0] print(password) -exit(0) +sys.exit(0) -- cgit v1.2.1