(no subject)

Esh, Andrew AEsh at tricord.com
Wed Aug 29 20:07:58 GMT 2001


I am trying to use smbpasswd in a system exec environment to join a domain.
I found that it was prompting for a password. I found a place in
smbpasswd.c, in the function "process_root" where that prompt occurred. The
prompt occurred right after a test of a null in the first character of the
"user_name" argument. Since I am trying to use smbpasswd to join a domain, I
don't need  a user name, so I tried to find out why it wasn't null. It looks
as though it's because it isn't initialized in "process_root". Running this
in a command line environment always happens to place a null in
user_name[0], but my exec environment appears to get something else in
there.

I tested a workaround for the current version. Instead of:

	smbpasswd -j domain -r pdc_host

I can use:

	smbpasswd -j domain -r pdc_host -U ""

I verified that user_name gets zeroed by the empty -U argument by single
stepping through it with gdb. I wrote a fix into smbpasswd.c, and it
compiles. I haven't tested it.

Here's a patch against the latest SAMBA_2_2:

--- utils/smbpasswd.c	Wed Aug 29 15:04:23 2001
+++ utils/smbpasswd.c.new	Wed Aug 29 14:57:45 2001
@@ -578,6 +578,8 @@
 	char *old_passwd = NULL;
 	char *remote_machine = NULL;
 
+	user_name[0] = '\0';
+
 	while ((ch = getopt(argc, argv, "ax:d:e:hmnj:r:sw:R:D:U:L")) != EOF)
{
 		switch(ch) {
 		case 'L':

---
Andrew C. Esh                mail:Andrew.Esh at tricord.com
Tricord Systems, Inc.
2905 Northwest Blvd., Suite 20        763-557-9005 (main)
Plymouth, MN 55441-2644 USA      763-551-6418 (direct)
http://www.tricord.com - Tricord Home Page

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the samba-technical mailing list