summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'source4/librpc/rpc')
-rw-r--r--source4/librpc/rpc/dcerpc_schannel.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/source4/librpc/rpc/dcerpc_schannel.c b/source4/librpc/rpc/dcerpc_schannel.c
index ab32a82934..635735a55d 100644
--- a/source4/librpc/rpc/dcerpc_schannel.c
+++ b/source4/librpc/rpc/dcerpc_schannel.c
@@ -266,6 +266,18 @@ NTSTATUS dcerpc_schannel_creds(struct gensec_security *gensec_security,
}
+/*
+ end crypto state
+*/
+static int dcerpc_schannel_destroy(void *ptr)
+{
+ struct dcerpc_schannel_state *dce_schan_state = ptr;
+
+ schannel_end(&dce_schan_state->schannel_state);
+
+ return 0;
+}
+
static NTSTATUS dcerpc_schannel_start(struct gensec_security *gensec_security)
{
struct dcerpc_schannel_state *dce_schan_state;
@@ -281,6 +293,8 @@ static NTSTATUS dcerpc_schannel_start(struct gensec_security *gensec_security)
GENSEC_FEATURE_SESSION_KEY |
GENSEC_FEATURE_SIGN |
GENSEC_FEATURE_SEAL;
+
+ talloc_set_destructor(dce_schan_state, dcerpc_schannel_destroy);
return NT_STATUS_OK;
}
@@ -309,20 +323,6 @@ static NTSTATUS dcerpc_schannel_client_start(struct gensec_security *gensec_secu
return NT_STATUS_OK;
}
-/*
- end crypto state
-*/
-static void dcerpc_schannel_end(struct gensec_security *gensec_security)
-{
- struct dcerpc_schannel_state *dce_schan_state = gensec_security->private_data;
-
- schannel_end(&dce_schan_state->schannel_state);
-
- talloc_free(dce_schan_state);
-
- gensec_security->private_data = NULL;
-}
-
/*
get a schannel key using a netlogon challenge on a secondary pipe
@@ -522,7 +522,6 @@ static const struct gensec_security_ops gensec_dcerpc_schannel_security_ops = {
.session_key = dcerpc_schannel_session_key,
.session_info = dcerpc_schannel_session_info,
.sig_size = dcerpc_schannel_sig_size,
- .end = dcerpc_schannel_end
};
NTSTATUS gensec_dcerpc_schannel_init(void)