]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Fix "proc num out of range" error. Missing rpc call.
authorJeremy Allison <jra@samba.org>
Mon, 23 Apr 2001 23:31:09 +0000 (23:31 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 23 Apr 2001 23:31:09 +0000 (23:31 +0000)
Jeremy.

source/include/proto.h
source/include/rpc_netlogon.h
source/rpc_parse/parse_net.c
source/rpc_server/srv_netlog.c
source/rpc_server/srv_netlog_nt.c

index e4732f1f9f3d9ebda73a6de80321654dd910ee8c..b18efe0cc29a653f09fd97acaf537c3450cfb2a3 100644 (file)
@@ -2597,6 +2597,8 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c,
                                DOM_CHAL *clnt_chal);
 BOOL net_io_q_req_chal(char *desc,  NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth);
 BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth);
+BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth);
+BOOL net_io_r_auth(char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth);
 void init_q_auth_2(NET_Q_AUTH_2 *q_a,
                char *logon_srv, char *acct_name, uint16 sec_chan, char *comp_name,
                DOM_CHAL *clnt_chal, uint32 clnt_flgs);
@@ -3664,6 +3666,7 @@ BOOL api_netlog_rpc(pipes_struct *p);
 uint32 _net_logon_ctrl2(pipes_struct *p, NET_Q_LOGON_CTRL2 *q_u, NET_R_LOGON_CTRL2 *r_u);
 uint32 _net_trust_dom_list(pipes_struct *p, NET_Q_TRUST_DOM_LIST *q_u, NET_R_TRUST_DOM_LIST *r_u);
 uint32 _net_req_chal(pipes_struct *p, NET_Q_REQ_CHAL *q_u, NET_R_REQ_CHAL *r_u);
+uint32 _net_auth(pipes_struct *p, NET_Q_AUTH *q_u, NET_R_AUTH *r_u);
 uint32 _net_auth_2(pipes_struct *p, NET_Q_AUTH_2 *q_u, NET_R_AUTH_2 *r_u);
 uint32 _net_srv_pwset(pipes_struct *p, NET_Q_SRV_PWSET *q_u, NET_R_SRV_PWSET *r_u);
 uint32 _net_sam_logoff(pipes_struct *p, NET_Q_SAM_LOGOFF *q_u, NET_R_SAM_LOGOFF *r_u);
index 29b17e6a0590f346ba8d18b1e108025e3dc32b70..a0e286d5350f27b56380842582d7302ae65c334e 100644 (file)
 
 
 /* NETLOGON pipe */
-#define NET_REQCHAL            0x04
-#define NET_SRVPWSET           0x06
 #define NET_SAMLOGON           0x02
 #define NET_SAMLOGOFF          0x03
+#define NET_REQCHAL            0x04
+#define NET_AUTH               0x05
+#define NET_SRVPWSET           0x06
 #define NET_AUTH2              0x0f
 #define NET_LOGON_CTRL2        0x0e
+#define NET_SAM_SYNC           0x10
 #define NET_TRUST_DOM_LIST     0x13
 
 /* Secure Channel types.  used in NetrServerAuthenticate negotiation */
 #define SEC_CHAN_WKSTA   2
 #define SEC_CHAN_DOMAIN  4
+#define SEC_CHAN_BDC     6
 
 #if 0
 /* I think this is correct - it's what gets parsed on the wire. JRA. */
@@ -282,7 +285,19 @@ typedef struct net_r_req_chal_info
 
 } NET_R_REQ_CHAL;
 
+/* NET_Q_AUTH */
+typedef struct net_q_auth_info
+{
+       DOM_LOG_INFO clnt_id; /* client identification info */
+       DOM_CHAL clnt_chal;     /* client-calculated credentials */
+} NET_Q_AUTH;
 
+/* NET_R_AUTH */
+typedef struct net_r_auth_info
+{
+       DOM_CHAL srv_chal;     /* server-calculated credentials */
+       uint32 status; /* return code */
+} NET_R_AUTH;
 
 /* NET_Q_AUTH_2 */
 typedef struct net_q_auth2_info
index fbbc09182e8861f0ed7fdf22cb8890ff0111d3fc..50cad248e02e2e7ef96aa4686f2c30c7494d53df 100644 (file)
@@ -485,6 +485,62 @@ BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int dept
 }
 
 
+/*******************************************************************
+ Reads or writes a structure.
+********************************************************************/
+
+BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth)
+{
+       int old_align;
+       if (q_a == NULL)
+               return False;
+
+       prs_debug(ps, depth, desc, "net_io_q_auth");
+       depth++;
+
+       if(!prs_align(ps))
+               return False;
+    
+       if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */
+               return False;
+       /* client challenge is _not_ aligned */
+       old_align = ps->align;
+       ps->align = 0;
+       if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) {
+               /* client-calculated credentials */
+               ps->align = old_align;
+               return False;
+       }
+       ps->align = old_align;
+
+       return True;
+}
+
+/*******************************************************************
+ Reads or writes a structure.
+********************************************************************/
+
+BOOL net_io_r_auth(char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth)
+{
+       if (r_a == NULL)
+               return False;
+
+       prs_debug(ps, depth, desc, "net_io_r_auth");
+       depth++;
+
+       if(!prs_align(ps))
+               return False;
+    
+       if(!smb_io_chal("", &r_a->srv_chal, ps, depth)) /* server challenge */
+               return False;
+
+       if(!prs_uint32("status", ps, depth, &r_a->status))
+               return False;
+
+       return True;
+}
+
+/*******************************************************************
 /*******************************************************************
  Inits a NET_Q_AUTH_2 struct.
 ********************************************************************/
index 01d646bf576f94f683c7a60b5fc6906485d463ba..4c13ad0c6708a02f563f5c855b7407877d01b2ef 100644 (file)
@@ -59,6 +59,37 @@ static BOOL api_net_req_chal(pipes_struct *p)
        return True;
 }
 
+/*************************************************************************
+ api_net_auth:
+ *************************************************************************/
+
+static BOOL api_net_auth(pipes_struct *p)
+{
+       NET_Q_AUTH q_u;
+       NET_R_AUTH r_u;
+       prs_struct *data = &p->in_data.data;
+       prs_struct *rdata = &p->out_data.rdata;
+
+       ZERO_STRUCT(q_u);
+       ZERO_STRUCT(r_u);
+
+       /* grab the challenge... */
+       if(!net_io_q_auth("", &q_u, data, 0)) {
+               DEBUG(0,("api_net_auth: Failed to unmarshall NET_Q_AUTH.\n"));
+               return False;
+       }
+
+       r_u.status = _net_auth(p, &q_u, &r_u);
+
+       /* store the response in the SMB stream */
+       if(!net_io_r_auth("", &r_u, rdata, 0)) {
+               DEBUG(0,("api_net_auth: Failed to marshall NET_R_AUTH.\n"));
+               return False;
+       }
+
+       return True;
+}
+
 /*************************************************************************
  api_net_auth_2:
  *************************************************************************/
@@ -257,6 +288,7 @@ static BOOL api_net_logon_ctrl2(pipes_struct *p)
 static struct api_struct api_net_cmds [] =
 {
        { "NET_REQCHAL"       , NET_REQCHAL       , api_net_req_chal       }, 
+       { "NET_AUTH"          , NET_AUTH          , api_net_auth           }, 
        { "NET_AUTH2"         , NET_AUTH2         , api_net_auth_2         }, 
        { "NET_SRVPWSET"      , NET_SRVPWSET      , api_net_srv_pwset      }, 
        { "NET_SAMLOGON"      , NET_SAMLOGON      , api_net_sam_logon      }, 
index cfcfac1d1adbc06db009f74d8668e3b7597c66a1..6b1fe64ddc0031535dbc8156b04d83268272b02a 100644 (file)
@@ -96,18 +96,6 @@ uint32 _net_trust_dom_list(pipes_struct *p, NET_Q_TRUST_DOM_LIST *q_u, NET_R_TRU
        return r_u->status;
 }
 
-/*************************************************************************
- init_net_r_auth_2:
- *************************************************************************/
-
-static void init_net_r_auth_2(NET_R_AUTH_2 *r_a,
-                              DOM_CHAL *resp_cred, NEG_FLAGS *flgs, int status)
-{
-       memcpy(r_a->srv_chal.data, resp_cred->data, sizeof(resp_cred->data));
-       memcpy(&r_a->srv_flgs, flgs, sizeof(r_a->srv_flgs));
-       r_a->status = status;
-}
-
 /***********************************************************************************
  init_net_r_srv_pwset:
  ***********************************************************************************/
@@ -218,6 +206,62 @@ uint32 _net_req_chal(pipes_struct *p, NET_Q_REQ_CHAL *q_u, NET_R_REQ_CHAL *r_u)
        return r_u->status;
 }
 
+/*************************************************************************
+ init_net_r_auth:
+ *************************************************************************/
+
+static void init_net_r_auth(NET_R_AUTH *r_a, DOM_CHAL *resp_cred, int status)
+{
+       memcpy(r_a->srv_chal.data, resp_cred->data, sizeof(resp_cred->data));
+       r_a->status = status;
+}
+
+/*************************************************************************
+ _net_auth
+ *************************************************************************/
+
+uint32 _net_auth(pipes_struct *p, NET_Q_AUTH *q_u, NET_R_AUTH *r_u)
+{
+       uint32 status = NT_STATUS_NOPROBLEMO;
+       DOM_CHAL srv_cred;
+       UTIME srv_time;
+
+       if (!get_valid_user_struct(p->vuid))
+               return NT_STATUS_NO_SUCH_USER;
+
+       srv_time.time = 0;
+
+       /* check that the client credentials are valid */
+       if (cred_assert(&q_u->clnt_chal, p->dc.sess_key, &p->dc.clnt_cred.challenge, srv_time)) {
+
+               /* create server challenge for inclusion in the reply */
+               cred_create(p->dc.sess_key, &p->dc.srv_cred.challenge, srv_time, &srv_cred);
+
+               /* copy the received client credentials for use next time */
+               memcpy(p->dc.clnt_cred.challenge.data, q_u->clnt_chal.data, sizeof(q_u->clnt_chal.data));
+               memcpy(p->dc.srv_cred .challenge.data, q_u->clnt_chal.data, sizeof(q_u->clnt_chal.data));
+       } else {
+               status = NT_STATUS_ACCESS_DENIED;
+       }
+
+       /* set up the LSA AUTH 2 response */
+       init_net_r_auth(r_u, &srv_cred, status);
+
+       return r_u->status;
+}
+
+/*************************************************************************
+ init_net_r_auth_2:
+ *************************************************************************/
+
+static void init_net_r_auth_2(NET_R_AUTH_2 *r_a,
+                              DOM_CHAL *resp_cred, NEG_FLAGS *flgs, int status)
+{
+       memcpy(r_a->srv_chal.data, resp_cred->data, sizeof(resp_cred->data));
+       memcpy(&r_a->srv_flgs, flgs, sizeof(r_a->srv_flgs));
+       r_a->status = status;
+}
+
 /*************************************************************************
  _net_auth_2
  *************************************************************************/