From 93fed62543ae6cee5ec26fda532c4ed8a650f74f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 31 Jan 2012 15:52:17 +1100 Subject: [PATCH] s3-auth: Use the lpcfg_ wrapper calls to set some variables Signed-off-by: Stefan Metzmacher --- source3/auth/auth_ntlmssp.c | 41 +++++++++---------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/source3/auth/auth_ntlmssp.c b/source3/auth/auth_ntlmssp.c index 6bfd4e0ee84..8feb45a8c96 100644 --- a/source3/auth/auth_ntlmssp.c +++ b/source3/auth/auth_ntlmssp.c @@ -205,22 +205,11 @@ NTSTATUS auth3_check_password(struct auth4_context *auth4_context, static NTSTATUS gensec_ntlmssp3_server_start(struct gensec_security *gensec_security) { NTSTATUS nt_status; - bool is_standalone; - const char *netbios_name; - const char *netbios_domain; const char *dns_name; char *dns_domain; struct gensec_ntlmssp_context *gensec_ntlmssp; struct ntlmssp_state *ntlmssp_state; - if ((enum server_role)lp_server_role() == ROLE_STANDALONE) { - is_standalone = true; - } else { - is_standalone = false; - } - - netbios_name = lp_netbios_name(); - netbios_domain = lp_workgroup(); /* This should be a 'netbios domain -> DNS domain' mapping */ dns_domain = get_mydnsdomname(talloc_tos()); if (dns_domain) { @@ -235,14 +224,6 @@ static NTSTATUS gensec_ntlmssp3_server_start(struct gensec_security *gensec_secu talloc_get_type_abort(gensec_security->private_data, struct gensec_ntlmssp_context); - if (!netbios_name) { - netbios_name = ""; - } - - if (!netbios_domain) { - netbios_domain = ""; - } - if (!dns_domain) { dns_domain = ""; } @@ -261,8 +242,6 @@ static NTSTATUS gensec_ntlmssp3_server_start(struct gensec_security *gensec_secu ntlmssp_state->role = NTLMSSP_SERVER; - ntlmssp_state->server.is_standalone = is_standalone; - ntlmssp_state->expected_state = NTLMSSP_NEGOTIATE; if (lpcfg_lanman_auth(gensec_security->settings->lp_ctx) && @@ -281,16 +260,6 @@ static NTSTATUS gensec_ntlmssp3_server_start(struct gensec_security *gensec_secu NTLMSSP_NEGOTIATE_NTLM2 | NTLMSSP_NEGOTIATE_KEY_EXCH; - ntlmssp_state->server.netbios_name = talloc_strdup(ntlmssp_state, netbios_name); - if (!ntlmssp_state->server.netbios_name) { - talloc_free(ntlmssp_state); - return NT_STATUS_NO_MEMORY; - } - ntlmssp_state->server.netbios_domain = talloc_strdup(ntlmssp_state, netbios_domain); - if (!ntlmssp_state->server.netbios_domain) { - talloc_free(ntlmssp_state); - return NT_STATUS_NO_MEMORY; - } ntlmssp_state->server.dns_name = talloc_strdup(ntlmssp_state, dns_name); if (!ntlmssp_state->server.dns_name) { return NT_STATUS_NO_MEMORY; @@ -316,6 +285,16 @@ static NTSTATUS gensec_ntlmssp3_server_start(struct gensec_security *gensec_secu ntlmssp_state->set_challenge = auth_ntlmssp_set_challenge; ntlmssp_state->check_password = auth_ntlmssp_check_password; + if (lpcfg_server_role(gensec_security->settings->lp_ctx) == ROLE_STANDALONE) { + ntlmssp_state->server.is_standalone = true; + } else { + ntlmssp_state->server.is_standalone = false; + } + + ntlmssp_state->server.netbios_name = lpcfg_netbios_name(gensec_security->settings->lp_ctx); + + ntlmssp_state->server.netbios_domain = lpcfg_workgroup(gensec_security->settings->lp_ctx); + return NT_STATUS_OK; } -- 2.34.1