s3-auth Add function to start any GENSEC mech by OID
authorAndrew Bartlett <abartlet@samba.org>
Tue, 26 Jul 2011 04:40:33 +0000 (14:40 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 3 Aug 2011 08:48:04 +0000 (18:48 +1000)
Signed-off-by: Andrew Tridgell <tridge@samba.org>
source3/auth/auth_ntlmssp.c
source3/auth/proto.h

index 0d25ecdf68367d1754aa2f44bb4d4c7692fd3b54..fc197ce605a407727fc6008761212202808d07a5 100644 (file)
@@ -282,11 +282,27 @@ static int auth_ntlmssp_state_destructor(void *ptr)
        return 0;
 }
 
-NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state *auth_ntlmssp_state)
+NTSTATUS auth_generic_start(struct auth_ntlmssp_state *auth_ntlmssp_state, const char *oid)
 {
        if (auth_ntlmssp_state->auth_context->gensec_start_mech_by_oid) {
-               return auth_ntlmssp_state->auth_context->gensec_start_mech_by_oid(auth_ntlmssp_state->gensec_security, GENSEC_OID_NTLMSSP);
+               return auth_ntlmssp_state->auth_context->gensec_start_mech_by_oid(auth_ntlmssp_state->gensec_security, oid);
+       }
+
+       if (strcmp(oid, GENSEC_OID_NTLMSSP) != 0) {
+               /* The caller will then free the auth_ntlmssp_state,
+                * undoing what was done in auth_ntlmssp_prepare().
+                *
+                * We can't do that logic here, as
+                * auth_ntlmssp_want_feature() may have been called in
+                * between.
+                */
+               return NT_STATUS_NOT_IMPLEMENTED;
        }
 
        return NT_STATUS_OK;
 }
+
+NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state *auth_ntlmssp_state)
+{
+       return auth_generic_start(auth_ntlmssp_state, GENSEC_OID_NTLMSSP);
+}
index b9bc748b956ea50ae1b8ce62a6c2930ee6e10497..82bf203b5748b96ecca631995c96a8d27aa4e8f1 100644 (file)
@@ -70,11 +70,12 @@ NTSTATUS auth_netlogond_init(void);
 /* The following definitions come from auth/auth_ntlmssp.c  */
 
 NTSTATUS auth_ntlmssp_steal_session_info(TALLOC_CTX *mem_ctx,
-                               struct auth_ntlmssp_state *auth_ntlmssp_state,
-                               struct auth_session_info **session_info);
+                                        struct auth_ntlmssp_state *auth_ntlmssp_state,
+                                        struct auth_session_info **session_info);
 NTSTATUS auth_ntlmssp_prepare(const struct tsocket_address *remote_address,
-                           struct auth_ntlmssp_state **auth_ntlmssp_state);
+                             struct auth_ntlmssp_state **auth_ntlmssp_state);
 NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state *auth_ntlmssp_state);
+NTSTATUS auth_generic_start(struct auth_ntlmssp_state *auth_ntlmssp_state, const char *oid);
 
 
 /* The following definitions come from auth/auth_sam.c  */