r22582: Cleanups towards making winbind work again. We still have a long way to...
authorAndrew Bartlett <abartlet@samba.org>
Sun, 29 Apr 2007 21:40:48 +0000 (21:40 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:51:47 +0000 (14:51 -0500)
This change in particular catches winbind up with the next
composite_create() function.

We also needed to remove an unused flags field, and fill in the lm
response.

Andrew Bartlett
(This used to be commit bd26e4ffaf1c060fdc3aae28fd4393e83c5a83ea)

source4/auth/auth_winbind.c
source4/librpc/idl/winbind.idl
source4/winbind/wb_connect_lsa.c
source4/winbind/wb_connect_sam.c
source4/winbind/wb_dom_info.c
source4/winbind/wb_init_domain.c
source4/winbind/wb_pam_auth.c
source4/winbind/wb_sam_logon.c

index 0f31caa04768d37484c14cd250ec7e9b58d2b976..dff81cd64d5b0edfb25ef44947679a52c9845f3d 100644 (file)
@@ -210,8 +210,8 @@ static NTSTATUS winbind_check_password(struct auth_method_context *ctx,
                network_info->nt.length = user_info->password.response.nt.length;
                network_info->nt.data   = user_info->password.response.nt.data;
 
-               network_info->nt.length = user_info->password.response.lanman.length;
-               network_info->nt.data   = user_info->password.response.lanman.data;
+               network_info->lm.length = user_info->password.response.lanman.length;
+               network_info->lm.data   = user_info->password.response.lanman.data;
 
                identity_info = &network_info->identity_info;
                s->req.in.logon_level   = 2;
@@ -226,6 +226,9 @@ static NTSTATUS winbind_check_password(struct auth_method_context *ctx,
        identity_info->workstation.string       = user_info->workstation_name;
 
        s->req.in.validation_level      = 3;
+
+       NDR_PRINT_IN_DEBUG(winbind_SamLogon, &s->req);
+
        status = IRPC_CALL(ctx->auth_ctx->msg_ctx, winbind_servers[0],
                           winbind, WINBIND_SAMLOGON,
                           &s->req, s);
index a6b8173aef6093597a5e242a3841a1dbc13c408e..222ac0d6c03b594fb266a9b23db2a61b75c30600 100644 (file)
@@ -33,7 +33,6 @@ interface winbind
                [in]  [switch_is(logon_level)] netr_LogonLevel logon,
                [in]  uint16 validation_level,
                [out] [switch_is(validation_level)] netr_Validation validation,
-               [out] uint8 authoritative,
-               [in,out] uint32 flags
+               [out] uint8 authoritative
        );
 }
index 6ba14a2f17cb8b1ce98df4fac8e4b7895a63ee6a..5a72e59954847eadd44116f83021a60585a298b4 100644 (file)
@@ -55,11 +55,8 @@ struct composite_context *wb_init_lsa_send(TALLOC_CTX *mem_ctx,
        struct composite_context *result, *ctx;
        struct init_lsa_state *state;
 
-       result = talloc(mem_ctx, struct composite_context);
+       result = composite_create(mem_ctx, tree->session->transport->socket->event.ctx);
        if (result == NULL) goto failed;
-       result->state = COMPOSITE_STATE_IN_PROGRESS;
-       result->async.fn = NULL;
-       result->event_ctx = tree->session->transport->socket->event.ctx;
 
        state = talloc(result, struct init_lsa_state);
        if (state == NULL) goto failed;
@@ -237,11 +234,8 @@ struct composite_context *wb_connect_lsa_send(TALLOC_CTX *mem_ctx,
        struct composite_context *result, *ctx;
        struct connect_lsa_state *state;
 
-       result = talloc(mem_ctx, struct composite_context);
+       result = composite_create(mem_ctx, tree->session->transport->socket->event.ctx);
        if (result == NULL) goto failed;
-       result->state = COMPOSITE_STATE_IN_PROGRESS;
-       result->async.fn = NULL;
-       result->event_ctx = tree->session->transport->socket->event.ctx;
 
        state = talloc(result, struct connect_lsa_state);
        if (state == NULL) goto failed;
index 393c5f84378b639d9daeaa94e219d58c9d0f0cc4..a14b7bd83b252f4883d340fd43e0cd9699a0cb83 100644 (file)
@@ -61,11 +61,8 @@ struct composite_context *wb_connect_sam_send(TALLOC_CTX *mem_ctx,
        struct composite_context *result, *ctx;
        struct connect_samr_state *state;
 
-       result = talloc(mem_ctx, struct composite_context);
+       result = composite_create(mem_ctx, tree->session->transport->socket->event.ctx);
        if (result == NULL) goto failed;
-       result->state = COMPOSITE_STATE_IN_PROGRESS;
-       result->async.fn = NULL;
-       result->event_ctx = tree->session->transport->socket->event.ctx;
 
        state = talloc(result, struct connect_samr_state);
        if (state == NULL) goto failed;
index 41334b420ab6638b9ab9f0e165cd0faf95b58700..28f35c20952c9b4d70793cc3b6fd21049eebac35 100644 (file)
@@ -50,11 +50,8 @@ struct composite_context *wb_get_dom_info_send(TALLOC_CTX *mem_ctx,
        struct get_dom_info_state *state;
        struct nbt_name name;
 
-       result = talloc(mem_ctx, struct composite_context);
+       result = composite_create(mem_ctx, service->task->event_ctx);
        if (result == NULL) goto failed;
-       result->state = COMPOSITE_STATE_IN_PROGRESS;
-       result->async.fn = NULL;
-       result->event_ctx = service->task->event_ctx;
 
        state = talloc(result, struct get_dom_info_state);
        if (state == NULL) goto failed;
index 8700dd637e5c0a3c670081c4063e69c27b733de9..5d868cd432773b12ded91868805c7b57f418bf4b 100644 (file)
@@ -85,11 +85,8 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx,
        struct composite_context *result, *ctx;
        struct init_domain_state *state;
 
-       result = talloc(mem_ctx, struct composite_context);
+       result = composite_create(mem_ctx, service->task->event_ctx);
        if (result == NULL) goto failed;
-       result->state = COMPOSITE_STATE_IN_PROGRESS;
-       result->async.fn = NULL;
-       result->event_ctx = service->task->event_ctx;
 
        state = talloc_zero(result, struct init_domain_state);
        if (state == NULL) goto failed;
index 97798861caaad02464adb1d02c2a76cb1f7e5835..b8c1cacbf0afd7d4c2a857ea65e4b4b47ddb78f1 100644 (file)
@@ -267,6 +267,8 @@ static void pam_auth_crap_recv_samlogon(struct rpc_request *req)
        composite_done(state->ctx);
 }
 
+/* Having received a NTLM authentication reply, parse out the useful
+ * reply data for the caller */
 NTSTATUS wb_cmd_pam_auth_crap_recv(struct composite_context *c,
                                   TALLOC_CTX *mem_ctx,
                                   DATA_BLOB *info3,
@@ -288,25 +290,8 @@ NTSTATUS wb_cmd_pam_auth_crap_recv(struct composite_context *c,
        return status;
 }
 
-NTSTATUS wb_cmd_pam_auth_crap(TALLOC_CTX *mem_ctx,
-                             struct wbsrv_service *service,
-                             uint32_t logon_parameters,
-                             const char *domain, const char *user,
-                             const char *workstation,
-                             DATA_BLOB chal, DATA_BLOB nt_resp,
-                             DATA_BLOB lm_resp,
-                             DATA_BLOB *info3,
-                             struct netr_UserSessionKey *user_session_key,
-                             struct netr_LMSessionKey *lm_key,
-                             char **unix_username)
-{
-       struct composite_context *c =
-               wb_cmd_pam_auth_crap_send(mem_ctx, service, logon_parameters, 
-                                         domain, user, workstation,
-                                         chal, nt_resp, lm_resp);
-       return wb_cmd_pam_auth_crap_recv(c, mem_ctx, info3, user_session_key,
-                                        lm_key, unix_username);
-}
+/* Handle plaintext authentication, by encrypting the password and
+ * then sending via the NTLM calls */
 
 struct composite_context *wb_cmd_pam_auth_send(TALLOC_CTX *mem_ctx,
                                               struct wbsrv_service *service,
@@ -371,18 +356,9 @@ struct composite_context *wb_cmd_pam_auth_send(TALLOC_CTX *mem_ctx,
 
 NTSTATUS wb_cmd_pam_auth_recv(struct composite_context *c)
 {
-       struct pam_auth_crap_state *state =
-               talloc_get_type(c->private_data, struct pam_auth_crap_state);
-       NTSTATUS status = composite_wait(c);
-       talloc_free(state);
-       return status;
-}
-
-NTSTATUS wb_cmd_pam_auth(TALLOC_CTX *mem_ctx, struct wbsrv_service *service,
-                        const char *domain, const char *user,
-                        const char *password)
-{
-       struct composite_context *c =
-               wb_cmd_pam_auth_send(mem_ctx, service, domain, user, password);
-       return wb_cmd_pam_auth_recv(c);
+       struct pam_auth_crap_state *state =
+               talloc_get_type(c->private_data, struct pam_auth_crap_state);
+       NTSTATUS status = composite_wait(c);
+       talloc_free(state);
+       return status;
 }
index bf8b4c7ad47ca79bf130520f382da35ba6716e92..842e144c168e4d0a3dc1905de14748db3ff548d3 100644 (file)
@@ -160,7 +160,6 @@ NTSTATUS wb_sam_logon_recv(struct composite_context *c,
                talloc_steal(mem_ctx, s->r_mem_ctx);
                req->out.validation     = s->r.out.validation;
                req->out.authoritative  = 1;
-               req->out.flags          = 0;
        }
 
        talloc_free(s);