mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
nss_wins: Add a stackframe to lookup_byname_backend()
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sun Jun 5 15:17:42 CEST 2011 on sn-devel-104
This commit is contained in:
parent
10f5fa8a1e
commit
13ac91d9a1
@ -59,6 +59,7 @@ static void nss_wins_init(void)
|
|||||||
|
|
||||||
static struct in_addr *lookup_byname_backend(const char *name, int *count)
|
static struct in_addr *lookup_byname_backend(const char *name, int *count)
|
||||||
{
|
{
|
||||||
|
TALLOC_CTX *frame = talloc_stackframe();
|
||||||
struct ip_service *address = NULL;
|
struct ip_service *address = NULL;
|
||||||
struct in_addr *ret = NULL;
|
struct in_addr *ret = NULL;
|
||||||
int j;
|
int j;
|
||||||
@ -73,16 +74,19 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count)
|
|||||||
if (NT_STATUS_IS_OK(resolve_wins(name,0x00,&address,count))) {
|
if (NT_STATUS_IS_OK(resolve_wins(name,0x00,&address,count))) {
|
||||||
if ( (ret = SMB_MALLOC_P(struct in_addr)) == NULL ) {
|
if ( (ret = SMB_MALLOC_P(struct in_addr)) == NULL ) {
|
||||||
free( address );
|
free( address );
|
||||||
|
TALLOC_FREE(frame);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (address[0].ss.ss_family != AF_INET) {
|
if (address[0].ss.ss_family != AF_INET) {
|
||||||
free(address);
|
free(address);
|
||||||
free(ret);
|
free(ret);
|
||||||
|
TALLOC_FREE(frame);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*ret = ((struct sockaddr_in *)(void *)&address[0].ss)
|
*ret = ((struct sockaddr_in *)(void *)&address[0].ss)
|
||||||
->sin_addr;
|
->sin_addr;
|
||||||
free( address );
|
free( address );
|
||||||
|
TALLOC_FREE(frame);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,17 +102,17 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count)
|
|||||||
}
|
}
|
||||||
in_addr_to_sockaddr_storage(&ss, *bcast);
|
in_addr_to_sockaddr_storage(&ss, *bcast);
|
||||||
status = name_query(name, 0x00, True, True, &ss,
|
status = name_query(name, 0x00, True, True, &ss,
|
||||||
NULL, &pss, count, NULL);
|
talloc_tos(), &pss, count, NULL);
|
||||||
if (NT_STATUS_IS_OK(status) && (*count > 0)) {
|
if (NT_STATUS_IS_OK(status) && (*count > 0)) {
|
||||||
if ((ret = SMB_MALLOC_P(struct in_addr)) == NULL) {
|
if ((ret = SMB_MALLOC_P(struct in_addr)) == NULL) {
|
||||||
|
TALLOC_FREE(frame);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*ret = ((struct sockaddr_in *)pss)->sin_addr;
|
*ret = ((struct sockaddr_in *)pss)->sin_addr;
|
||||||
TALLOC_FREE(pss);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TALLOC_FREE(frame);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user