summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-12-28 13:47:35 +0100
committerVolker Lendecke <vlendec@samba.org>2010-12-28 18:21:05 +0100
commit4622812a41eb5ce07dd8f74534217e858743883f (patch)
tree3a07c7d4971c9e11fe3a623311098baaa7a925e4 /source3/winbindd
parent28d997a89056f144de6a7b95af0e54a044c5e5b3 (diff)
downloadsamba-4622812a41eb5ce07dd8f74534217e858743883f.tar.gz
samba-4622812a41eb5ce07dd8f74534217e858743883f.tar.bz2
samba-4622812a41eb5ce07dd8f74534217e858743883f.zip
s3: Make name_query return NTSTATUS
Also use talloc for the result Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Tue Dec 28 18:21:05 CET 2010 on sn-devel-104
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd_wins.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/source3/winbindd/winbindd_wins.c b/source3/winbindd/winbindd_wins.c
index 484b39342a..720feaf83a 100644
--- a/source3/winbindd/winbindd_wins.c
+++ b/source3/winbindd/winbindd_wins.c
@@ -96,13 +96,15 @@ static struct node_status *lookup_byaddr_backend(TALLOC_CTX *mem_ctx,
return result;
}
-static struct sockaddr_storage *lookup_byname_backend(const char *name,
- int *count)
+static struct sockaddr_storage *lookup_byname_backend(TALLOC_CTX *mem_ctx,
+ const char *name,
+ int *count)
{
int fd;
struct ip_service *ret = NULL;
struct sockaddr_storage *return_ss = NULL;
int j, i, flags = 0;
+ NTSTATUS status;
*count = 0;
@@ -110,7 +112,9 @@ static struct sockaddr_storage *lookup_byname_backend(const char *name,
if (NT_STATUS_IS_OK(resolve_wins(name,0x20,&ret,count))) {
if ( *count == 0 )
return NULL;
- if ( (return_ss = SMB_MALLOC_ARRAY(struct sockaddr_storage, *count)) == NULL ) {
+ return_ss = TALLOC_ARRAY(mem_ctx, struct sockaddr_storage,
+ *count);
+ if (return_ss == NULL ) {
free( ret );
return NULL;
}
@@ -136,8 +140,9 @@ static struct sockaddr_storage *lookup_byname_backend(const char *name,
if (!bcast_ss) {
continue;
}
- return_ss = name_query(fd,name,0x20,True,True,bcast_ss,count, &flags, NULL);
- if (return_ss) {
+ status = name_query(fd, name, 0x20, True, True,bcast_ss,
+ mem_ctx, &return_ss, count, &flags, NULL);
+ if (NT_STATUS_IS_OK(status)) {
break;
}
}
@@ -213,12 +218,14 @@ void winbindd_wins_byname(struct winbindd_cli_state *state)
*response = '\0';
maxlen = sizeof(response) - 1;
- if ((ip_list = lookup_byname_backend(state->request->data.winsreq,&count))){
+ ip_list = lookup_byname_backend(
+ state->mem_ctx, state->request->data.winsreq, &count);
+ if (ip_list != NULL){
for (i = count; i ; i--) {
print_sockaddr(addr, sizeof(addr), &ip_list[i-1]);
size = strlen(addr);
if (size > maxlen) {
- SAFE_FREE(ip_list);
+ TALLOC_FREE(ip_list);
request_error(state);
return;
}
@@ -235,13 +242,13 @@ void winbindd_wins_byname(struct winbindd_cli_state *state)
}
size = strlen(state->request->data.winsreq) + strlen(response);
if (size > maxlen) {
- SAFE_FREE(ip_list);
+ TALLOC_FREE(ip_list);
request_error(state);
return;
}
fstrcat(response,state->request->data.winsreq);
fstrcat(response,"\n");
- SAFE_FREE(ip_list);
+ TALLOC_FREE(ip_list);
} else {
request_error(state);
return;