summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-07-26 12:32:08 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-10-18 13:13:31 +1100
commit968b3674b130002fde961d57077915394eb1616c (patch)
tree5a51a16f75573f5d05ed6021cca12709a1c27a8f
parent0c6e4adcb26557ae6e55169c051f0260151dc5d9 (diff)
downloadsamba-968b3674b130002fde961d57077915394eb1616c.tar.gz
samba-968b3674b130002fde961d57077915394eb1616c.tar.bz2
samba-968b3674b130002fde961d57077915394eb1616c.zip
ntlmssp: Prepare gensec_ntlmssp_start() for broader use
This moves the allocation of the ntlmssp pointer back to the callers. Andrew Bartlett Signed-off-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--auth/ntlmssp/gensec_ntlmssp.c11
-rw-r--r--source4/auth/ntlmssp/ntlmssp_client.c16
-rw-r--r--source4/auth/ntlmssp/ntlmssp_server.c16
3 files changed, 28 insertions, 15 deletions
diff --git a/auth/ntlmssp/gensec_ntlmssp.c b/auth/ntlmssp/gensec_ntlmssp.c
index 55b2f8748a..9cbd6e1cc4 100644
--- a/auth/ntlmssp/gensec_ntlmssp.c
+++ b/auth/ntlmssp/gensec_ntlmssp.c
@@ -107,7 +107,6 @@ bool gensec_ntlmssp_have_feature(struct gensec_security *gensec_security,
NTSTATUS gensec_ntlmssp_start(struct gensec_security *gensec_security)
{
struct gensec_ntlmssp_context *gensec_ntlmssp;
- struct ntlmssp_state *ntlmssp_state;
gensec_ntlmssp = talloc_zero(gensec_security,
struct gensec_ntlmssp_context);
@@ -117,16 +116,6 @@ NTSTATUS gensec_ntlmssp_start(struct gensec_security *gensec_security)
gensec_ntlmssp->gensec_security = gensec_security;
- ntlmssp_state = talloc_zero(gensec_ntlmssp,
- struct ntlmssp_state);
- if (!ntlmssp_state) {
- return NT_STATUS_NO_MEMORY;
- }
-
- ntlmssp_state->callback_private = gensec_ntlmssp;
-
- gensec_ntlmssp->ntlmssp_state = ntlmssp_state;
-
gensec_security->private_data = gensec_ntlmssp;
return NT_STATUS_OK;
}
diff --git a/source4/auth/ntlmssp/ntlmssp_client.c b/source4/auth/ntlmssp/ntlmssp_client.c
index 858b16f053..6ec56941e6 100644
--- a/source4/auth/ntlmssp/ntlmssp_client.c
+++ b/source4/auth/ntlmssp/ntlmssp_client.c
@@ -329,8 +329,20 @@ NTSTATUS gensec_ntlmssp_client_start(struct gensec_security *gensec_security)
nt_status = gensec_ntlmssp_start(gensec_security);
NT_STATUS_NOT_OK_RETURN(nt_status);
- gensec_ntlmssp = talloc_get_type_abort(gensec_security->private_data,
- struct gensec_ntlmssp_context);
+ gensec_ntlmssp =
+ talloc_get_type_abort(gensec_security->private_data,
+ struct gensec_ntlmssp_context);
+
+ ntlmssp_state = talloc_zero(gensec_ntlmssp,
+ struct ntlmssp_state);
+ if (!ntlmssp_state) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ ntlmssp_state->callback_private = gensec_ntlmssp;
+
+ gensec_ntlmssp->ntlmssp_state = ntlmssp_state;
+
ntlmssp_state = gensec_ntlmssp->ntlmssp_state;
ntlmssp_state->role = NTLMSSP_CLIENT;
diff --git a/source4/auth/ntlmssp/ntlmssp_server.c b/source4/auth/ntlmssp/ntlmssp_server.c
index 68a802ce78..0799e0a994 100644
--- a/source4/auth/ntlmssp/ntlmssp_server.c
+++ b/source4/auth/ntlmssp/ntlmssp_server.c
@@ -245,8 +245,20 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security)
nt_status = gensec_ntlmssp_start(gensec_security);
NT_STATUS_NOT_OK_RETURN(nt_status);
- gensec_ntlmssp = talloc_get_type_abort(gensec_security->private_data,
- struct gensec_ntlmssp_context);
+ gensec_ntlmssp =
+ talloc_get_type_abort(gensec_security->private_data,
+ struct gensec_ntlmssp_context);
+
+ ntlmssp_state = talloc_zero(gensec_ntlmssp,
+ struct ntlmssp_state);
+ if (!ntlmssp_state) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ ntlmssp_state->callback_private = gensec_ntlmssp;
+
+ gensec_ntlmssp->ntlmssp_state = ntlmssp_state;
+
ntlmssp_state = gensec_ntlmssp->ntlmssp_state;
ntlmssp_state->role = NTLMSSP_SERVER;