svn commit: samba r3144 - in trunk/source/libsmb: .

vlendec at samba.org vlendec at samba.org
Sat Oct 23 09:22:36 GMT 2004


Author: vlendec
Date: 2004-10-23 09:22:09 +0000 (Sat, 23 Oct 2004)
New Revision: 3144

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/trunk/source/libsmb&rev=3144&nolog=1

Log:
Allow for multiple DC's to be named as #1c names in lmhosts.

Volker

Modified:
   trunk/source/libsmb/namequery.c


Changeset:
Modified: trunk/source/libsmb/namequery.c
===================================================================
--- trunk/source/libsmb/namequery.c	2004-10-23 09:20:02 UTC (rev 3143)
+++ trunk/source/libsmb/namequery.c	2004-10-23 09:22:09 UTC (rev 3144)
@@ -855,22 +855,35 @@
 
 	fp = startlmhosts(dyn_LMHOSTSFILE);
 	if(fp) {
-		while (getlmhostsent(fp, lmhost_name, &name_type2, &return_ip)) {
-			if (strequal(name, lmhost_name) && 
-                ((name_type2 == -1) || (name_type == name_type2))
-               ) {
-				endlmhosts(fp);
-				if ( (*return_iplist = (struct ip_service *)malloc(sizeof(struct ip_service))) == NULL ) {
-					DEBUG(3,("resolve_lmhosts: malloc fail !\n"));
-					return False;
-				}
-				(*return_iplist)[0].ip   = return_ip;
-				(*return_iplist)[0].port = PORT_NONE;
-				*return_count = 1;
-				return True; 
+		while (getlmhostsent(fp, lmhost_name, &name_type2,
+				     &return_ip)) {
+
+			if (!strequal(name, lmhost_name))
+				continue;
+
+			if ((name_type2 != -1) && (name_type != name_type2))
+				continue;
+
+			*return_iplist = (struct ip_service *)
+				realloc((*return_iplist),
+					sizeof(struct ip_service) *
+					((*return_count)+1));
+
+			if ((*return_iplist) == NULL) {
+				DEBUG(3,("resolve_lmhosts: malloc fail !\n"));
+				return False;
 			}
+
+			(*return_iplist)[*return_count].ip   = return_ip;
+			(*return_iplist)[*return_count].port = PORT_NONE;
+			*return_count += 1;
+
+			/* Multiple names only for DC lookup */
+			if (name_type != 0x1c)
+				break;
 		}
 		endlmhosts(fp);
+		return True;
 	}
 	return False;
 }



More information about the samba-cvs mailing list