summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-08-02 12:53:42 +0200
committerStefan Metzmacher <metze@samba.org>2013-08-10 09:18:56 +0200
commit33215398f32c76f4b8ada7b547c6d0741cb2ac16 (patch)
tree5ab9f957d9c06f09984962adebfbc1fa464bc3a7
parent9f2e81ae02549369db49c05edf7071612a03a8b8 (diff)
downloadsamba-33215398f32c76f4b8ada7b547c6d0741cb2ac16.tar.gz
samba-33215398f32c76f4b8ada7b547c6d0741cb2ac16.tar.bz2
samba-33215398f32c76f4b8ada7b547c6d0741cb2ac16.zip
libcli/auth: add netsec_create_state()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--libcli/auth/schannel_proto.h3
-rw-r--r--libcli/auth/schannel_sign.c23
2 files changed, 26 insertions, 0 deletions
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,