summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-03-17 00:57:46 +0000
committerJeremy Allison <jra@samba.org>1998-03-17 00:57:46 +0000
commitf912f5d872c346951347bb81116136dcc937ac96 (patch)
tree3d3f08fe7959bb9566c550d4bc503fb1ad9de240 /source3/libsmb
parent8ffcec16feaced3716554f3885085381815c99bf (diff)
downloadsamba-f912f5d872c346951347bb81116136dcc937ac96.tar.gz
samba-f912f5d872c346951347bb81116136dcc937ac96.tar.bz2
samba-f912f5d872c346951347bb81116136dcc937ac96.zip
Fixes for the static data bugs & incorrect use of strtok
that Andrew pointed out. Jeremy. (This used to be commit 734dde8d686827c387e17922fa6ac56af60780d9)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/namequery.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 6bf41b9f9e..7b8a01b28f 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -424,9 +424,11 @@ void endlmhosts(FILE *fp)
BOOL resolve_name(char *name, struct in_addr *return_ip)
{
- char *p;
int i;
BOOL pure_address = True;
+ pstring name_resolve_list;
+ fstring tok;
+ char *ptr;
if (strcmp(name,"0.0.0.0") == 0) {
return_ip->s_addr = 0;
@@ -447,8 +449,10 @@ BOOL resolve_name(char *name, struct in_addr *return_ip)
return True;
}
- for (p=strtok(lp_name_resolve_order(),LIST_SEP); p; p = strtok(NULL,LIST_SEP)) {
- if(strequal(p, "host") || strequal(p, "hosts")) {
+ pstrcpy(name_resolve_list, lp_name_resolve_order());
+ ptr = name_resolve_list;
+ while (next_token(&ptr, tok, LIST_SEP)) {
+ if(strequal(tok, "host") || strequal(tok, "hosts")) {
/*
* "host" means do a localhost, or dns lookup.
@@ -463,7 +467,7 @@ BOOL resolve_name(char *name, struct in_addr *return_ip)
return True;
}
- } else if(strequal( p, "lmhosts")) {
+ } else if(strequal( tok, "lmhosts")) {
/*
* "lmhosts" means parse the local lmhosts file.
@@ -486,7 +490,7 @@ BOOL resolve_name(char *name, struct in_addr *return_ip)
endlmhosts(fp);
}
- } else if(strequal( p, "wins")) {
+ } else if(strequal( tok, "wins")) {
int sock;
@@ -524,7 +528,7 @@ BOOL resolve_name(char *name, struct in_addr *return_ip)
} else {
DEBUG(3,("resolve_name: WINS server resolution selected and no WINS server present.\n"));
}
- } else if(strequal( p, "bcast")) {
+ } else if(strequal( tok, "bcast")) {
int sock;
@@ -560,7 +564,7 @@ BOOL resolve_name(char *name, struct in_addr *return_ip)
}
} else {
- DEBUG(0,("resolve_name: unknown name switch type %s\n", p));
+ DEBUG(0,("resolve_name: unknown name switch type %s\n", tok));
}
}