/* Special name type used to cause a _kerberos DNS lookup. */
#define KDC_NAME_TYPE 0xDCDC
-static NTSTATUS resolve_ads(const char *name,
+static NTSTATUS resolve_ads(TALLOC_CTX *ctx,
+ const char *name,
int name_type,
const char *sitename,
struct ip_service **return_iplist,
{
int i;
NTSTATUS status;
- TALLOC_CTX *ctx;
struct dns_rr_srv *dcs = NULL;
int numdcs = 0;
int numaddrs = 0;
return NT_STATUS_INVALID_PARAMETER;
}
- if ( (ctx = talloc_init("resolve_ads")) == NULL ) {
- DEBUG(0,("resolve_ads: talloc_init() failed!\n"));
- return NT_STATUS_NO_MEMORY;
- }
-
switch (name_type) {
case 0x1b:
DEBUG(5,("resolve_ads: Attempting to resolve "
}
if ( !NT_STATUS_IS_OK( status ) ) {
- talloc_destroy(ctx);
return status;
}
if (numdcs == 0) {
*return_iplist = NULL;
*return_count = 0;
- talloc_destroy(ctx);
return NT_STATUS_OK;
}
NULL ) {
DEBUG(0,("resolve_ads: malloc failed for %d entries\n",
numaddrs ));
- talloc_destroy(ctx);
return NT_STATUS_NO_MEMORY;
}
if (res) {
freeaddrinfo(res);
}
- talloc_destroy(ctx);
return NT_STATUS_NO_MEMORY;
}
}
}
}
- talloc_destroy(ctx);
return NT_STATUS_OK;
}
} else if(strequal( tok, "kdc")) {
/* deal with KDC_NAME_TYPE names here.
* This will result in a SRV record lookup */
- status = resolve_ads(name,
+ status = resolve_ads(talloc_tos(),
+ name,
KDC_NAME_TYPE,
sitename,
return_iplist,
} else if(strequal( tok, "ads")) {
/* deal with 0x1c and 0x1b names here.
* This will result in a SRV record lookup */
- status = resolve_ads(name,
+ status = resolve_ads(talloc_tos(),
+ name,
name_type,
sitename,
return_iplist,