libcli/auth: add netsec_create_state()
authorStefan Metzmacher <metze@samba.org>
Fri, 2 Aug 2013 10:53:42 +0000 (12:53 +0200)
committerStefan Metzmacher <metze@samba.org>
Sat, 10 Aug 2013 07:18:56 +0000 (09:18 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
libcli/auth/schannel_proto.h
libcli/auth/schannel_sign.c

index 0414218614623cd1344a731a435d4deb1cd8f8ad..da7655908e0db22ea7e4cefaa746fbfe47c4ff64 100644 (file)
@@ -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,
index 6e5d4544afe7eb080dadbb16ef3612a82a212663..518a6a90a4f3dd2294409fba1f52a3fd30457443 100644 (file)
        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,