#include "auth/gensec/gensec.h"
#include "param/param.h"
-NTSTATUS samba_server_gensec_start(TALLOC_CTX *mem_ctx,
+static NTSTATUS samba_server_gensec_start_settings(TALLOC_CTX *mem_ctx,
struct tevent_context *event_ctx,
struct imessaging_context *msg_ctx,
struct loadparm_context *lp_ctx,
+ struct gensec_settings *settings,
struct cli_credentials *server_credentials,
const char *target_service,
struct gensec_security **gensec_context)
}
nt_status = gensec_server_start(tmp_ctx,
- lpcfg_gensec_settings(mem_ctx, lp_ctx),
+ settings,
auth_context,
&gensec_ctx);
if (!NT_STATUS_IS_OK(nt_status)) {
talloc_free(tmp_ctx);
return nt_status;
}
+
+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;
+}