summaryrefslogtreecommitdiff
path: root/nsswitch/libwbclient/wbc_util.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-04-17 19:57:11 +0200
committerVolker Lendecke <vl@samba.org>2010-04-19 14:27:21 +0200
commitd959fec39e636b531c36e4be88d7c97a86a8a1ce (patch)
tree8dfbfe237b21c49ad892e6839a099ac8fb5bd75f /nsswitch/libwbclient/wbc_util.c
parentdf831df6668dcdf3ccc1681383d085f38f402e9c (diff)
downloadsamba-d959fec39e636b531c36e4be88d7c97a86a8a1ce.tar.gz
samba-d959fec39e636b531c36e4be88d7c97a86a8a1ce.tar.bz2
samba-d959fec39e636b531c36e4be88d7c97a86a8a1ce.zip
libwbclient: Make wbcLookupDomainController not use talloc
Diffstat (limited to 'nsswitch/libwbclient/wbc_util.c')
-rw-r--r--nsswitch/libwbclient/wbc_util.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/nsswitch/libwbclient/wbc_util.c b/nsswitch/libwbclient/wbc_util.c
index 0026e87042..3a6f2a2407 100644
--- a/nsswitch/libwbclient/wbc_util.c
+++ b/nsswitch/libwbclient/wbc_util.c
@@ -486,6 +486,13 @@ wbcErr wbcListTrusts(struct wbcDomainInfo **domains, size_t *num_domains)
return wbc_status;
}
+static void wbcDomainControllerInfoDestructor(void *ptr)
+{
+ struct wbcDomainControllerInfo *i =
+ (struct wbcDomainControllerInfo *)ptr;
+ free(i->dc_name);
+}
+
/* Enumerate the domain trusts known by Winbind */
wbcErr wbcLookupDomainController(const char *domain,
uint32_t flags,
@@ -511,7 +518,9 @@ wbcErr wbcLookupDomainController(const char *domain,
request.flags = flags;
- dc = talloc(NULL, struct wbcDomainControllerInfo);
+ dc = (struct wbcDomainControllerInfo *)wbcAllocateMemory(
+ sizeof(struct wbcDomainControllerInfo), 1,
+ wbcDomainControllerInfoDestructor);
BAIL_ON_PTR_ERROR(dc, wbc_status);
/* Send request */
@@ -521,16 +530,14 @@ wbcErr wbcLookupDomainController(const char *domain,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
- dc->dc_name = talloc_strdup(dc, response.data.dsgetdcname.dc_unc);
+ dc->dc_name = strdup(response.data.dsgetdcname.dc_unc);
BAIL_ON_PTR_ERROR(dc->dc_name, wbc_status);
*dc_info = dc;
+ dc = NULL;
done:
- if (!WBC_ERROR_IS_OK(wbc_status)) {
- talloc_free(dc);
- }
-
+ wbcFreeMemory(dc);
return wbc_status;
}