hosts allow problem with ip names in 3.0.1rc1

Gerald (Jerry) Carter jerry at samba.org
Tue Dec 9 18:20:11 GMT 2003


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

M A Young wrote:

|> Ah...it's not my bug.  Been there all along apparently.
|> You compiled --enable-developer right ?  The problem
|> is the clobber region call in alpha_strcpy() since we
|> passed in the same string for dest and serc.  I'll fix
|> it up now.  Thanks.
|
| Yes, I thought it might help me understand my printing
| bug (I haven't tested that one in 3.0.1rc1 yet).

Well it was a nice catch either way :-)  Here's the patch.



- --
cheers, jerry
~ ----------------------------------------------------------------------
~ Hewlett-Packard            ------------------------- http://www.hp.com
~ SAMBA Team                 ---------------------- http://www.samba.org
~ GnuPG Key                  ---- http://www.plainjoe.org/gpg_public.asc
~ "If we're adding to the noise, turn off this song" --Switchfoot (2003)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/1hJbIR7qMdg1EfYRAq8UAKDo/UGR7v0ZxilGddLRaSpaFs0vjACgjKj5
f+5/ubX0loCrwD9i7mxeWPo=
=Y8Gr
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: lib/util_sock.c
===================================================================
RCS file: /data/cvs/samba/source/lib/util_sock.c,v
retrieving revision 1.57.2.19
diff -u -r1.57.2.19 util_sock.c
--- lib/util_sock.c	7 Nov 2003 10:11:48 -0000	1.57.2.19
+++ lib/util_sock.c	9 Dec 2003 18:17:25 -0000
@@ -874,6 +874,7 @@
 char *get_peer_name(int fd, BOOL force_lookup)
 {
 	static pstring name_buf;
+	pstring tmp_name;
 	static fstring addr_buf;
 	struct hostent *hp;
 	struct in_addr addr;
@@ -890,10 +891,12 @@
 	p = get_peer_addr(fd);
 
 	/* it might be the same as the last one - save some DNS work */
-	if (strcmp(p, addr_buf) == 0) return name_buf;
+	if (strcmp(p, addr_buf) == 0) 
+		return name_buf;
 
 	pstrcpy(name_buf,"UNKNOWN");
-	if (fd == -1) return name_buf;
+	if (fd == -1) 
+		return name_buf;
 
 	fstrcpy(addr_buf, p);
 
@@ -911,7 +914,12 @@
 		}
 	}
 
-	alpha_strcpy(name_buf, name_buf, "_-.", sizeof(name_buf));
+	/* can't pass the same source and dest strings in when you 
+	   use --enable-developer or the clobber_region() call will 
+	   get you */
+	
+	pstrcpy( tmp_name, name_buf );
+	alpha_strcpy(name_buf, tmp_name, "_-.", sizeof(name_buf));
 	if (strstr(name_buf,"..")) {
 		pstrcpy(name_buf, "UNKNOWN");
 	}


More information about the samba-technical mailing list