summaryrefslogtreecommitdiffstats
path: root/source/nsswitch/wins.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/nsswitch/wins.c')
-rw-r--r--source/nsswitch/wins.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/source/nsswitch/wins.c b/source/nsswitch/wins.c
index c88bd379100..a645172e53d 100644
--- a/source/nsswitch/wins.c
+++ b/source/nsswitch/wins.c
@@ -1,5 +1,6 @@
/*
- Unix SMB/CIFS implementation.
+ Unix SMB/Netbios implementation.
+ Version 2.0
a WINS nsswitch module
Copyright (C) Andrew Tridgell 1999
@@ -34,7 +35,6 @@
static int initialised;
-extern BOOL AllowDebugChange;
/* Use our own create socket code so we don't recurse.... */
@@ -77,8 +77,7 @@ static int wins_lookup_open_socket_in(void)
static void nss_wins_init(void)
{
initialised = 1;
- DEBUGLEVEL = 0;
- AllowDebugChange = False;
+ DEBUGLEVEL = 10;
/* needed for lp_xx() functions */
charset_initialise();
@@ -131,7 +130,7 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count)
return NULL;
p = wins_srv_ip();
- if( !is_zero_ip(p) ) {
+ if( !zero_ip(p) ) {
ret = name_query(fd,name,0x20,False,True, p, count);
goto out;
}
@@ -206,7 +205,7 @@ int lookup(nsd_file_t *rq)
if ( status = lookup_byaddr_backend(key, &count)) {
size = strlen(key) + 1;
if (size > len) {
- free(status);
+ SAFE_FREE(status);
return NSD_ERROR;
}
len -= size;
@@ -218,7 +217,7 @@ int lookup(nsd_file_t *rq)
if (status[i].type == 0x20) {
size = sizeof(status[i].name) + 1;
if (size > len) {
- free(status);
+ SAFE_FREE(status);
return NSD_ERROR;
}
len -= size;
@@ -228,7 +227,7 @@ int lookup(nsd_file_t *rq)
}
}
response[strlen(response)-1] = '\n';
- free(status);
+ SAFE_FREE(status);
}
} else if (strcasecmp(map,"hosts.byname") == 0) {
if (ip_list = lookup_byname_backend(key, &count)) {
@@ -236,7 +235,7 @@ int lookup(nsd_file_t *rq)
addr = inet_ntoa(ip_list[i-1]);
size = strlen(addr) + 1;
if (size > len) {
- free(ip_list);
+ SAFE_FREE(ip_list);
return NSD_ERROR;
}
len -= size;
@@ -247,13 +246,13 @@ int lookup(nsd_file_t *rq)
}
size = strlen(key) + 1;
if (size > len) {
- free(ip_list);
+ SAFE_FREE(ip_list);
return NSD_ERROR;
}
strncat(response,key,size);
strncat(response,"\n",1);
found = True;
- free(ip_list);
+ SAFE_FREE(ip_list);
}
}
@@ -311,8 +310,7 @@ _nss_wins_gethostbyname_r(const char *name, struct hostent *he,
host_addresses++;
}
- if (ip_list)
- free(ip_list);
+ SAFE_FREE(ip_list);
memcpy(buffer, name, namelen);
he->h_name = buffer;
@@ -320,3 +318,4 @@ _nss_wins_gethostbyname_r(const char *name, struct hostent *he,
return NSS_STATUS_SUCCESS;
}
#endif
+