Name mangling breaks NT-printing?

Gerald (Jerry) Carter jerry at samba.org
Tue May 11 15:23:36 GMT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Zielinski wrote:

| When I access the samba server from NT via the IP address,
| the NT client  reports for all printers, that there is no
| correct driver installed on the  server.  When using the
| NetBIOS name, it works.
|
| Taking a look at the network trace shows, that the NT client
| fails to resolve  the NetBIOS name "_SMBSERVER<20>" just
| before the message window appears.
|
| I remember having the same problem 2 years ago. It has
| been fixed between  2.2.4 and 2.2.5 by Jerry.
|
| I'm using samba 3.0.4 and NT4 (SP6?).

Talk about timing :-)   volker and I worked on this
yesterday.  Here's the patch.  It will apply to 3.0.4
with a few offsets but should be ok.




cheers, jerry
- ----------------------------------------------------------------------
Hewlett-Packard            ------------------------- http://www.hp.com
SAMBA Team                 ---------------------- http://www.samba.org
GnuPG Key                  ---- http://www.plainjoe.org/gpg_public.asc
"...a hundred billion castaways looking for a home." ----------- Sting
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAoO/4IR7qMdg1EfYRAqHvAKC4pG2GN8wHtU7KAiuNx/UJ6cvR6wCgst/e
WLESxbkzsFoHQM02AbR0ZNY=
=beTS
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: param/loadparm.c
===================================================================
--- param/loadparm.c	(revision 645)
+++ param/loadparm.c	(revision 647)
@@ -4252,7 +4252,7 @@
 	static fstring called_name;
 
 	if (!*local_machine) {
-		fstrcpy(called_name, get_my_primary_ip());
+		fstrcpy(called_name, client_socket_addr());
 		DEBUG(8,("get_called_name: assuming that client used IP address [%s] as called name.\n",
 			 called_name));
 		return called_name;
Index: lib/util.c
===================================================================
--- lib/util.c	(revision 645)
+++ lib/util.c	(revision 647)
@@ -1703,24 +1703,6 @@
 	return(ret);
 }
 
-/********************************************************************
- Return only the first IP address of our configured interfaces
- as a string
- *******************************************************************/
-
-const char* get_my_primary_ip (void)
-{
-	static fstring ip_string;
-	int n;
-	struct iface_struct nics[MAX_INTERFACES];
-
-	if ((n=get_interfaces(nics, MAX_INTERFACES)) <= 0)
-		return NULL;
-
-	fstrcpy(ip_string, inet_ntoa(nics[0].ip));
-	return ip_string;
-}
-
 BOOL is_myname_or_ipaddr(const char *s)
 {
 	/* optimize for the common case */
Index: lib/substitute.c
===================================================================
--- lib/substitute.c	(revision 645)
+++ lib/substitute.c	(revision 647)
@@ -40,24 +40,24 @@
 	static BOOL already_perm = False;
 	fstring tmp_local_machine;
 
+	fstrcpy(tmp_local_machine,local_name);
+	trim_char(tmp_local_machine,' ',' ');
+
 	/*
 	 * Windows NT/2k uses "*SMBSERVER" and XP uses "*SMBSERV"
 	 * arrggg!!! 
 	 */
 
-	if (strequal(local_name, "*SMBSERVER")) 
+	if ( strequal(tmp_local_machine, "*SMBSERVER") || strequal(tmp_local_machine, "*SMBSERV") )  {
+		fstrcpy( local_machine, client_socket_addr() );
 		return;
+	}
 
-	if (strequal(local_name, "*SMBSERV")) 
-		return;
-
 	if (already_perm)
 		return;
 
 	already_perm = perm;
 
-	fstrcpy(tmp_local_machine,local_name);
-	trim_char(tmp_local_machine,' ',' ');
 	alpha_strcpy(local_machine,tmp_local_machine,SAFE_NETBIOS_CHARS,sizeof(local_machine)-1);
 	strlower_m(local_machine);
 }


More information about the samba-technical mailing list