+
+NTSTATUS samba_server_gensec_start(TALLOC_CTX *mem_ctx,
+ struct tevent_context *event_ctx,
+ struct imessaging_context *msg_ctx,
+ struct loadparm_context *lp_ctx,
+ struct cli_credentials *server_credentials,
+ const char *target_service,
+ struct gensec_security **gensec_context)
+{
+ struct gensec_settings *settings = NULL;
+ NTSTATUS status;
+
+ settings = lpcfg_gensec_settings(mem_ctx, lp_ctx);
+ if (settings == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ status = samba_server_gensec_start_settings(mem_ctx, event_ctx,
+ msg_ctx, lp_ctx,
+ settings, server_credentials,
+ target_service,
+ gensec_context);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(settings);
+ return status;
+ }
+
+ talloc_reparent(mem_ctx, *gensec_context, settings);
+ return NT_STATUS_OK;
+}