summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-03-06 11:53:49 +0100
committerVolker Lendecke <vl@samba.org>2011-03-06 12:51:02 +0100
commit4daf01f38b85580f60d459491ef2131f918996d1 (patch)
tree4ff9d650841c9a2d80ff63bee4452736b7c71e5f /source3
parent41c85650c98d1e130036cec160afdf1312b11d71 (diff)
downloadsamba-4daf01f38b85580f60d459491ef2131f918996d1.tar.gz
samba-4daf01f38b85580f60d459491ef2131f918996d1.tar.bz2
samba-4daf01f38b85580f60d459491ef2131f918996d1.zip
s3: Replace idmap_ad_close by a destructor
Diffstat (limited to 'source3')
-rw-r--r--source3/winbindd/idmap_ad.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/source3/winbindd/idmap_ad.c b/source3/winbindd/idmap_ad.c
index 1c46798052..dfaa03497c 100644
--- a/source3/winbindd/idmap_ad.c
+++ b/source3/winbindd/idmap_ad.c
@@ -196,6 +196,17 @@ static ADS_STATUS ad_idmap_cached_connection(struct idmap_domain *dom)
return status;
}
+static int idmap_ad_context_destructor(struct idmap_ad_context *ctx)
+{
+ if (ctx->ads != NULL) {
+ /* we own this ADS_STRUCT so make sure it goes away */
+ ctx->ads->is_mine = True;
+ ads_destroy( &ctx->ads );
+ ctx->ads = NULL;
+ }
+ return 0;
+}
+
/************************************************************************
***********************************************************************/
@@ -211,6 +222,7 @@ static NTSTATUS idmap_ad_initialize(struct idmap_domain *dom,
DEBUG(0, ("Out of memory!\n"));
return NT_STATUS_NO_MEMORY;
}
+ talloc_set_destructor(ctx, idmap_ad_context_destructor);
config_option = talloc_asprintf(ctx, "idmap config %s", dom->name);
if (config_option == NULL) {
@@ -688,17 +700,6 @@ done:
static NTSTATUS idmap_ad_close(struct idmap_domain *dom)
{
- struct idmap_ad_context * ctx;
-
- ctx = talloc_get_type(dom->private_data, struct idmap_ad_context);
-
- if (ctx->ads != NULL) {
- /* we own this ADS_STRUCT so make sure it goes away */
- ctx->ads->is_mine = True;
- ads_destroy( &ctx->ads );
- ctx->ads = NULL;
- }
-
return NT_STATUS_OK;
}