summaryrefslogtreecommitdiff
path: root/source3
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
commit645d67c3770026495baf55713b778926cca420d9 (patch)
tree06d5b75f0b24c58783aca59413c1ceb9db7e40e5 /source3
parentde22eab16dad4372a12c2e95f5fdb5fe9a8d162b (diff)
downloadsamba-645d67c3770026495baf55713b778926cca420d9.tar.gz
samba-645d67c3770026495baf55713b778926cca420d9.tar.bz2
samba-645d67c3770026495baf55713b778926cca420d9.zip
r1504: Remove insane use of "user password" on the COMMAND LINE !
in smbpasswd. Use -s if you want to script this. Jeremy. (This used to be commit a3589a18b6898e2b51570112c5acb2826ef6ba4a)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/smbpasswd.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index 0476a2e39c..74480f5fc5 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/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();
}