diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/libsmb/namequery.c | 22 | ||||
-rw-r--r-- | source3/winbindd/winbindd_wins.c | 18 |
3 files changed, 18 insertions, 25 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 1cde4be9a6..4a19f74d4c 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1052,7 +1052,8 @@ NTSTATUS name_resolve_bcast(const char *name, int *return_count); NTSTATUS resolve_wins(const char *name, int name_type, - struct ip_service **return_iplist, + TALLOC_CTX *mem_ctx, + struct sockaddr_storage **return_iplist, int *return_count); NTSTATUS internal_resolve_name(const char *name, int name_type, diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 511eba4cbf..5969f656c1 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -1799,12 +1799,13 @@ NTSTATUS name_resolve_bcast(const char *name, NTSTATUS resolve_wins(const char *name, int name_type, - struct ip_service **return_iplist, + TALLOC_CTX *mem_ctx, + struct sockaddr_storage **return_iplist, int *return_count) { int t, i; char **wins_tags; - struct sockaddr_storage src_ss, *ss_list = NULL; + struct sockaddr_storage src_ss; struct in_addr src_ip; NTSTATUS status; @@ -1882,8 +1883,8 @@ NTSTATUS resolve_wins(const char *name, false, true, &wins_ss, - talloc_tos(), - &ss_list, + mem_ctx, + return_iplist, return_count, NULL); @@ -1914,10 +1915,6 @@ NTSTATUS resolve_wins(const char *name, success: status = NT_STATUS_OK; - if (!convert_ss2service(return_iplist, ss_list, *return_count)) - status = NT_STATUS_INVALID_PARAMETER; - - TALLOC_FREE(ss_list); wins_srv_tags_free(wins_tags); return status; @@ -2314,11 +2311,18 @@ NTSTATUS internal_resolve_name(const char *name, } } else if(strequal( tok, "wins")) { /* don't resolve 1D via WINS */ + struct sockaddr_storage *ss_list; if (name_type != 0x1D) { status = resolve_wins(name, name_type, - return_iplist, + talloc_tos(), + &ss_list, return_count); if (NT_STATUS_IS_OK(status)) { + if (!convert_ss2service(return_iplist, + ss_list, + *return_count)) { + status = NT_STATUS_NO_MEMORY; + } goto done; } } diff --git a/source3/winbindd/winbindd_wins.c b/source3/winbindd/winbindd_wins.c index 7ed330f81b..25c04df6bc 100644 --- a/source3/winbindd/winbindd_wins.c +++ b/source3/winbindd/winbindd_wins.c @@ -31,29 +31,17 @@ static struct sockaddr_storage *lookup_byname_backend(TALLOC_CTX *mem_ctx, const char *name, int *count) { - struct ip_service *ret = NULL; struct sockaddr_storage *return_ss = NULL; - int j, i; + int j; NTSTATUS status; *count = 0; /* always try with wins first */ - if (NT_STATUS_IS_OK(resolve_wins(name,0x20,&ret,count))) { + status = resolve_wins(name, 0x20, mem_ctx, &return_ss, count); + if (NT_STATUS_IS_OK(status)) { if ( *count == 0 ) return NULL; - return_ss = talloc_array(mem_ctx, struct sockaddr_storage, - *count); - if (return_ss == NULL ) { - free( ret ); - return NULL; - } - - /* copy the IP addresses */ - for ( i=0; i<(*count); i++ ) - return_ss[i] = ret[i].ss; - - free( ret ); return return_ss; } |