[PATCH] smbpasswd command-line arguments processing fix

Andrew Patterson andrew at lvadp.fc.hp.com
Wed Aug 22 22:34:06 GMT 2001


The username argument for smbpasswd used with the -x, -d, and -e
argument was being thrown away, so the user was always set to root.
This patch handles this argument correctly.  This patch applies to the
most recent version of samba-2.2 in CVS.

Andrew Patterson

--- samba-2.2.1.orig/source/utils/smbpasswd.c	Thu Aug  9 18:21:18 2001
+++ samba-2.2.1/source/utils/smbpasswd.c	Wed Aug 22 22:11:49 2001
@@ -555,7 +555,7 @@
 	char *old_passwd = NULL;
 	char *remote_machine = NULL;
 
-	while ((ch = getopt(argc, argv, "ax:d:e:hmnj:r:sR:D:U:L")) != EOF) {
+	while ((ch = getopt(argc, argv, "axdehmnj:r:sR:D:U:L")) != EOF) {
 		switch(ch) {
 		case 'L':
 			local_mode = True;
@@ -565,17 +565,14 @@
 			break;
 		case 'x':
 			local_flags |= LOCAL_DELETE_USER;
-			fstrcpy(user_name, optarg);
 			new_passwd = xstrdup("XXXXXX");
 			break;
 		case 'd':
 			local_flags |= LOCAL_DISABLE_USER;
-			fstrcpy(user_name, optarg);
 			new_passwd = xstrdup("XXXXXX");
 			break;
 		case 'e':
 			local_flags |= LOCAL_ENABLE_USER;
-			fstrcpy(user_name, optarg);
 			break;
 		case 'm':
 			local_flags |= LOCAL_TRUST_ACCOUNT;








More information about the samba-technical mailing list