summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2004-10-23 09:20:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:02 -0500
commit98ed2ecc1c585f1ebe8bef54faf07486ccc8306e (patch)
tree748405002bd4cdc3c517b10fc4d661e792ae103e /source3
parent841868d290400272e50bcfb5fadd7b9dba4638b6 (diff)
downloadsamba-98ed2ecc1c585f1ebe8bef54faf07486ccc8306e.tar.gz
samba-98ed2ecc1c585f1ebe8bef54faf07486ccc8306e.tar.bz2
samba-98ed2ecc1c585f1ebe8bef54faf07486ccc8306e.zip
r3143: Allow for multiple DC's to be named as #1c names in lmhosts.
Volker (This used to be commit 2af98ec054508055a63552cfdb48cfaf43f76b62)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/namequery.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index cee0015e25..2e6842088a 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -855,22 +855,35 @@ static BOOL resolve_lmhosts(const char *name, int name_type,
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;
}