From 33215398f32c76f4b8ada7b547c6d0741cb2ac16 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Aug 2013 12:53:42 +0200 Subject: libcli/auth: add netsec_create_state() Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- libcli/auth/schannel_proto.h | 3 +++ libcli/auth/schannel_sign.c | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'libcli') diff --git a/libcli/auth/schannel_proto.h b/libcli/auth/schannel_proto.h index 0414218614..da7655908e 100644 --- a/libcli/auth/schannel_proto.h +++ b/libcli/auth/schannel_proto.h @@ -28,6 +28,9 @@ struct schannel_state; struct db_context *open_schannel_session_store(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx); +struct schannel_state *netsec_create_state(TALLOC_CTX *mem_ctx, + struct netlogon_creds_CredentialState *creds, + bool initiator); NTSTATUS netsec_incoming_packet(struct schannel_state *state, bool do_unseal, uint8_t *data, size_t length, diff --git a/libcli/auth/schannel_sign.c b/libcli/auth/schannel_sign.c index 6e5d4544af..518a6a90a4 100644 --- a/libcli/auth/schannel_sign.c +++ b/libcli/auth/schannel_sign.c @@ -35,6 +35,29 @@ RSIVAL(_buf, 4, _seq_num_high); \ } while(0) +struct schannel_state *netsec_create_state(TALLOC_CTX *mem_ctx, + struct netlogon_creds_CredentialState *creds, + bool initiator) +{ + struct schannel_state *state; + + state = talloc(mem_ctx, struct schannel_state); + if (state == NULL) { + return NULL; + } + + state->state = SCHANNEL_STATE_UPDATE_1; + state->initiator = initiator; + state->seq_num = 0; + state->creds = netlogon_creds_copy(state, creds); + if (state->creds == NULL) { + talloc_free(state); + return NULL; + } + + return state; +} + static void netsec_offset_and_sizes(struct schannel_state *state, bool do_seal, uint32_t *_min_sig_size, -- cgit