diff options
Diffstat (limited to 'source/nsswitch/winbindd_wins.c')
-rw-r--r-- | source/nsswitch/winbindd_wins.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/source/nsswitch/winbindd_wins.c b/source/nsswitch/winbindd_wins.c index 8ddd5dc10df..79f88ed6c2c 100644 --- a/source/nsswitch/winbindd_wins.c +++ b/source/nsswitch/winbindd_wins.c @@ -23,9 +23,6 @@ #include "winbindd.h" -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_WINBIND - /* Use our own create socket code so we don't recurse.... */ static int wins_lookup_open_socket_in(void) @@ -87,18 +84,25 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count) { int fd; struct in_addr *ret = NULL; - int j, flags = 0; + struct in_addr p; + int j, flags; *count = 0; - /* always try with wins first */ - if (resolve_wins(name,0x20,&ret,count)) { - return ret; - } - fd = wins_lookup_open_socket_in(); - if (fd == -1) { + if (fd == -1) return NULL; + + p = wins_srv_ip(); + if( !is_zero_ip(p) ) { + ret = name_query(fd,name,0x20,False,True, p, count, &flags); + goto out; + } + + if (lp_wins_support()) { + /* we are our own WINS server */ + ret = name_query(fd,name,0x20,False,True, *interpret_addr2("127.0.0.1"), count, &flags); + goto out; } /* uggh, we have to broadcast to each interface in turn */ @@ -106,10 +110,12 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count) j >= 0; j--) { struct in_addr *bcast = iface_n_bcast(j); - ret = name_query(fd,name,0x20,True,True,*bcast,count, &flags, NULL); + ret = name_query(fd,name,0x20,True,True,*bcast,count, &flags); if (ret) break; } + out: + close(fd); return ret; } @@ -122,9 +128,6 @@ enum winbindd_result winbindd_wins_byip(struct winbindd_cli_state *state) int i, count, maxlen, size; struct node_status *status; - /* Ensure null termination */ - state->request.data.winsreq[sizeof(state->request.data.winsreq)-1]='\0'; - DEBUG(3, ("[%5d]: wins_byip %s\n", state->pid, state->request.data.winsreq)); @@ -169,9 +172,6 @@ enum winbindd_result winbindd_wins_byname(struct winbindd_cli_state *state) fstring response; char * addr; - /* Ensure null termination */ - state->request.data.winsreq[sizeof(state->request.data.winsreq)-1]='\0'; - DEBUG(3, ("[%5d]: wins_byname %s\n", state->pid, state->request.data.winsreq)); |