From 59b852fd723ef5d46dfeb50ba5856826cb38cc63 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Mon, 19 Nov 2001 08:12:06 +0000 Subject: [PATCH] Make the smbpasswd options/usage message a little less bizarre: it now shows all the available options, but explains that you must be root to use them. Surely this is less confusing? (This used to be commit 19f5f813995d1cf3874df705ab5e71aa5eb14ae6) --- source3/utils/smbpasswd.c | 42 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index 1e637ede355..ea8fffc2951 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -1,7 +1,5 @@ /* * Unix SMB/Netbios implementation. - * Version 1.9. - * smbpasswd module. * Copyright (C) Jeremy Allison 1995-1998 * Copyright (C) Tim Potter 2001 * @@ -30,36 +28,36 @@ extern pstring global_myname; extern char *optarg; extern int optind; -/* forced running in root-mode */ +/** forced running in root-mode **/ static BOOL local_mode; -/********************************************************* - Print command usage on stderr and die. -**********************************************************/ +/** + * Print command usage on stderr and die. + **/ static void usage(void) { - if (getuid() == 0) { - printf("smbpasswd [options] [username] [password]\n"); - } else { - printf("smbpasswd [options] [password]\n"); - } + printf("When run by root:\n"); + printf(" smbpasswd [options] [username] [password]\n"); + printf("otherwise:\n"); + printf(" smbpasswd [options] [password]\n\n"); + printf("options:\n"); printf(" -s use stdin for password prompt\n"); printf(" -D LEVEL debug level\n"); printf(" -U USER remote username\n"); printf(" -r MACHINE remote machine\n"); - if (getuid() == 0 || local_mode) { - printf(" -L local mode (must be first option)\n"); - printf(" -R ORDER name resolve order\n"); - printf(" -j DOMAIN join domain name\n"); - printf(" -a add user\n"); - printf(" -x delete user\n"); - printf(" -d disable user\n"); - printf(" -e enable user\n"); - printf(" -n set no password\n"); - printf(" -m machine trust account\n"); - } + printf("extra options when run by root or in local mode:\n"); + printf(" -L local mode (must be first option)\n"); + printf(" -R ORDER name resolve order\n"); + printf(" -j DOMAIN join domain name\n"); + printf(" -a add user\n"); + printf(" -x delete user\n"); + printf(" -d disable user\n"); + printf(" -e enable user\n"); + printf(" -n set no password\n"); + printf(" -m machine trust account\n"); + exit(1); } -- 2.34.1