summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-04-23 23:31:09 +0000
committerJeremy Allison <jra@samba.org>2001-04-23 23:31:09 +0000
commit3e4c6d130c3c533831ac6a52e2403132b79f4b28 (patch)
treeba71663afad9645f7d0392190621c28dd96662c0 /source3
parent30daf2e939b6dbc50e9389f26f3b1f4a4d6d5c2e (diff)
downloadsamba-3e4c6d130c3c533831ac6a52e2403132b79f4b28.tar.gz
samba-3e4c6d130c3c533831ac6a52e2403132b79f4b28.tar.bz2
samba-3e4c6d130c3c533831ac6a52e2403132b79f4b28.zip
Fix "proc num out of range" error. Missing rpc call.
Jeremy. (This used to be commit 6248fb22926d72fddaecad5af117af1bdd08fda3)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/include/rpc_netlogon.h19
-rw-r--r--source3/rpc_parse/parse_net.c56
-rw-r--r--source3/rpc_server/srv_netlog.c32
-rw-r--r--source3/rpc_server/srv_netlog_nt.c68
5 files changed, 164 insertions, 14 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index e4732f1f9f..b18efe0cc2 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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);
diff --git a/source3/include/rpc_netlogon.h b/source3/include/rpc_netlogon.h
index 29b17e6a05..a0e286d535 100644
--- a/source3/include/rpc_netlogon.h
+++ b/source3/include/rpc_netlogon.h
@@ -26,17 +26,20 @@
/* 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
diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c
index fbbc09182e..50cad248e0 100644
--- a/source3/rpc_parse/parse_net.c
+++ b/source3/rpc_parse/parse_net.c
@@ -486,6 +486,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.
********************************************************************/
diff --git a/source3/rpc_server/srv_netlog.c b/source3/rpc_server/srv_netlog.c
index 01d646bf57..4c13ad0c67 100644
--- a/source3/rpc_server/srv_netlog.c
+++ b/source3/rpc_server/srv_netlog.c
@@ -60,6 +60,37 @@ static BOOL api_net_req_chal(pipes_struct *p)
}
/*************************************************************************
+ 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 },
diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c
index cfcfac1d1a..6b1fe64ddc 100644
--- a/source3/rpc_server/srv_netlog_nt.c
+++ b/source3/rpc_server/srv_netlog_nt.c
@@ -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:
***********************************************************************************/
@@ -219,6 +207,62 @@ uint32 _net_req_chal(pipes_struct *p, NET_Q_REQ_CHAL *q_u, NET_R_REQ_CHAL *r_u)
}
/*************************************************************************
+ 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
*************************************************************************/