r11617: fix typo
[kai/samba-autobuild/.git] / source / rpc_server / srv_netlog_nt.c
index a89e3d572ac3fc73946becc0caac819898fff2ef..7903adff6d59a91185ae4f26371565a7d3f4de5b 100644 (file)
@@ -26,8 +26,6 @@
 
 #include "includes.h"
 
-extern struct dcinfo last_dcinfo;
-extern BOOL server_auth2_negotiated;
 extern userdom_struct current_user_info;
 
 #undef DBGC_CLASS
@@ -339,7 +337,7 @@ NTSTATUS _net_auth(pipes_struct *p, NET_Q_AUTH *q_u, NET_R_AUTH *r_u)
        creds_server_init(p->dc,
                        &p->dc->clnt_chal,      /* Stored client chal. */
                        &p->dc->srv_chal,       /* Stored server chal. */
-                       p->dc->mach_pw,
+                       (const char *)p->dc->mach_pw,
                        &srv_chal_out); 
 
        /* Check client credentials are valid. */
@@ -416,7 +414,7 @@ NTSTATUS _net_auth_2(pipes_struct *p, NET_Q_AUTH_2 *q_u, NET_R_AUTH_2 *r_u)
        creds_server_init(p->dc,
                        &p->dc->clnt_chal,      /* Stored client chal. */
                        &p->dc->srv_chal,       /* Stored server chal. */
-                       p->dc->mach_pw,
+                       (const char *)p->dc->mach_pw,
                        &srv_chal_out); 
 
        /* Check client credentials are valid. */
@@ -438,12 +436,15 @@ NTSTATUS _net_auth_2(pipes_struct *p, NET_Q_AUTH_2 *q_u, NET_R_AUTH_2 *r_u)
 
        fstrcpy(p->dc->mach_acct, mach_acct);
        fstrcpy(p->dc->remote_machine, remote_machine);
+       fstrcpy(p->dc->domain, lp_workgroup() );
 
-       server_auth2_negotiated = True;
        p->dc->authenticated = True;
-       last_dcinfo = *p->dc;
 
-       //secrets_store_schannel_session_info(p->dc);
+       /* Store off the state so we can continue after client disconnect. */
+       become_root();
+       secrets_store_schannel_session_info(p->mem_ctx, p->dc);
+       unbecome_root();
+
        return r_u->status;
 }
 
@@ -632,7 +633,7 @@ NTSTATUS _net_sam_logon(pipes_struct *p, NET_Q_SAM_LOGON *q_u, NET_R_SAM_LOGON *
 
        /* checks and updates credentials.  creates reply credentials */
        if (!creds_server_step(p->dc, &q_u->sam_id.client.cred,  &r_u->srv_creds)) {
-               DEBUG(0,("_net_sam_logoff: creds_server_step failed. Rejecting auth "
+               DEBUG(0,("_net_sam_logon: creds_server_step failed. Rejecting auth "
                        "request from client %s machine account %s\n",
                        p->dc->remote_machine, p->dc->mach_acct ));
                return NT_STATUS_ACCESS_DENIED;
@@ -694,6 +695,7 @@ NTSTATUS _net_sam_logon(pipes_struct *p, NET_Q_SAM_LOGON *q_u, NET_R_SAM_LOGON *
                if (!make_user_info_netlogon_network(&user_info, 
                                                     nt_username, nt_domain, 
                                                     wksname,
+                                                    ctr->auth.id2.param_ctrl,
                                                     ctr->auth.id2.lm_chal_resp.buffer,
                                                     ctr->auth.id2.lm_chal_resp.str_str_len,
                                                     ctr->auth.id2.nt_chal_resp.buffer,
@@ -718,7 +720,9 @@ NTSTATUS _net_sam_logon(pipes_struct *p, NET_Q_SAM_LOGON *q_u, NET_R_SAM_LOGON *
 
                if (!make_user_info_netlogon_interactive(&user_info, 
                                                         nt_username, nt_domain, 
-                                                        nt_workstation, chal,
+                                                        nt_workstation, 
+                                                        ctr->auth.id1.param_ctrl,
+                                                        chal,
                                                         ctr->auth.id1.lm_owf.data, 
                                                         ctr->auth.id1.nt_owf.data, 
                                                         p->dc->sess_key)) {