summaryrefslogtreecommitdiffstats
path: root/source/utils/smbpasswd.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-07-15 00:03:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:13 -0500
commita3589a18b6898e2b51570112c5acb2826ef6ba4a (patch)
tree154aa05d3e1ab91bdd382d4ee1a0d5bda5c355e4 /source/utils/smbpasswd.c
parenta6d0452a2d71201309a5abbe3ebc161ae75b17b8 (diff)
downloadsamba-a3589a18b6898e2b51570112c5acb2826ef6ba4a.tar.gz
samba-a3589a18b6898e2b51570112c5acb2826ef6ba4a.tar.xz
samba-a3589a18b6898e2b51570112c5acb2826ef6ba4a.zip
r1504: Remove insane use of "user password" on the COMMAND LINE !
in smbpasswd. Use -s if you want to script this. Jeremy.
Diffstat (limited to 'source/utils/smbpasswd.c')
-rw-r--r--source/utils/smbpasswd.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/source/utils/smbpasswd.c b/source/utils/smbpasswd.c
index 0476a2e39c0..74480f5fc53 100644
--- a/source/utils/smbpasswd.c
+++ b/source/utils/smbpasswd.c
@@ -29,9 +29,9 @@ extern char *optarg;
extern int optind;
/* forced running in root-mode */
-static BOOL got_pass = False, got_username = False;
+static BOOL got_username = False;
static BOOL stdin_passwd_get = False;
-static fstring user_name, user_password;
+static fstring user_name;
static char *new_passwd = NULL;
static const char *remote_machine = NULL;
@@ -44,9 +44,9 @@ static fstring ldap_secret;
static void usage(void)
{
printf("When run by root:\n");
- printf(" smbpasswd [options] [username] [password]\n");
+ printf(" smbpasswd [options] [username]\n");
printf("otherwise:\n");
- printf(" smbpasswd [options] [password]\n\n");
+ printf(" smbpasswd [options]\n\n");
printf("options:\n");
printf(" -L local mode (must be first option)\n");
@@ -79,6 +79,7 @@ static void set_line_buffering(FILE *f)
/*******************************************************************
Process command line options
******************************************************************/
+
static int process_options(int argc, char **argv, int local_flags)
{
int ch;
@@ -88,7 +89,6 @@ static int process_options(int argc, char **argv, int local_flags)
local_flags |= LOCAL_SET_PASSWORD;
ZERO_STRUCT(user_name);
- ZERO_STRUCT(user_password);
user_name[0] = '\0';
@@ -150,19 +150,8 @@ static int process_options(int argc, char **argv, int local_flags)
DEBUGLEVEL = atoi(optarg);
break;
case 'U': {
- char *lp;
-
got_username = True;
fstrcpy(user_name, optarg);
-
- if ((lp = strchr(user_name, '%'))) {
- *lp = 0;
- fstrcpy(user_password, lp + 1);
- got_pass = True;
- memset(strchr_m(optarg, '%') + 1, 'X',
- strlen(user_password));
- }
-
break;
}
case 'h':
@@ -181,7 +170,7 @@ static int process_options(int argc, char **argv, int local_flags)
break;
case 1:
if (!(local_flags & LOCAL_AM_ROOT)) {
- new_passwd = argv[0];
+ usage();
} else {
if (got_username) {
usage();
@@ -190,14 +179,6 @@ static int process_options(int argc, char **argv, int local_flags)
}
}
break;
- case 2:
- if (!(local_flags & LOCAL_AM_ROOT) || got_username || got_pass) {
- usage();
- }
-
- fstrcpy(user_name, argv[0]);
- new_passwd = smb_xstrdup(argv[1]);
- break;
default:
usage();
}