s3:netlogon: implement LogonGetCapabilities() with NT_STATUS_NOT_IMPLEMENTED
authorStefan Metzmacher <metze@samba.org>
Fri, 21 Aug 2009 14:29:34 +0000 (16:29 +0200)
committerStefan Metzmacher <metze@samba.org>
Sat, 7 Nov 2009 08:45:26 +0000 (09:45 +0100)
This fixes incoming trusts against w2k8r2.

metze

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 b4b014d0c32ed538ff727d7b7683ee935691a437..b599a94856ca9697d73db8f1db64c8b72bb4b2d0 100644 (file)
@@ -39,6 +39,7 @@
 #define NET_SAM_SYNC           0x10
 #define NET_TRUST_DOM_LIST     0x13
 #define NET_DSR_GETDCNAME      0x14
+#define NET_LOGON_CAPA         0x15
 #define NET_AUTH3              0x1a
 #define NET_DSR_GETDCNAMEEX    0x1b
 #define NET_DSR_GETSITENAME    0x1c
@@ -1191,5 +1192,25 @@ typedef struct net_r_dsr_getsitename {
        WERROR result;
 } NET_R_DSR_GETSITENAME;
 
+/* NET_Q_LOGON_CAPA */
+typedef struct net_q_logon_capa {
+       UNISTR2         uni_server_name;
+       uint32          ptr_computer_name;
+       UNISTR2         uni_computer_name;
+       DOM_CRED        cli_creds;
+       DOM_CRED        rtrn_creds;
+       uint32          query_level;
+} NET_Q_LOGON_CAPA;
+
+/* NET_R_LOGON_CAPA */
+typedef struct net_r_logon_capa {
+       DOM_CRED srv_creds;
+
+       uint32 query_level;
+
+       NEG_FLAGS srv_flgs;
+
+       NTSTATUS status;
+} NET_R_LOGON_CAPA;
 
 #endif /* _RPC_NETLOGON_H */
index 8d99e808e6c6071885d7c97c6717621a5f0411c5..b078a409e290dae450b6594f14f80ac35f4ffd61 100644 (file)
@@ -3900,4 +3900,69 @@ BOOL net_io_r_dsr_getsitename(const char *desc, NET_R_DSR_GETSITENAME *r_t,
        return True;
 }
 
+BOOL net_io_q_logon_capa(const char *desc, NET_Q_LOGON_CAPA *r_l, prs_struct *ps, int depth)
+{
+       if (r_l == NULL)
+               return False;
+
+       prs_debug(ps, depth, desc, "net_io_q_logon_capa");
+       depth++;
+
+       if(!prs_align(ps))
+               return False;
+
+       if(!smb_io_unistr2("server_name", &r_l->uni_server_name, True, ps, depth))
+               return False;
+
+       if(!prs_uint32("ptr_computer_name", ps, depth, &r_l->ptr_computer_name))
+               return False;
+
+       if (r_l->ptr_computer_name)
+               if(!smb_io_unistr2("computer_name", &r_l->uni_computer_name, True, ps, depth))
+                       return False;
+
+       if(!smb_io_cred("cli_creds", &r_l->cli_creds, ps, depth))
+               return False;
+
+       if(!smb_io_cred("rtrn_creds", &r_l->rtrn_creds, ps, depth))
+               return False;
+
+       if(!prs_uint32("query_level", ps, depth, &r_l->query_level))
+               return False;
+
+       if(!prs_align(ps))
+               return False;
+
+       return True;
+}
+
+BOOL net_io_r_logon_capa(const char *desc, NET_R_LOGON_CAPA *r_l, prs_struct *ps, int depth)
+{
+       if (r_l == NULL)
+               return False;
+
+       prs_debug(ps, depth, desc, "net_io_r_logon_capa");
+       depth++;
+
+       if(!smb_io_cred("", &r_l->srv_creds, ps, depth))
+               return False;
+
+       if(!prs_uint32("query_level", ps, depth, &r_l->query_level))
+               return False;
+
+       if(!prs_align(ps))
+               return False;
+
+       if(r_l->query_level == 1)
+               if(!net_io_neg_flags("", &r_l->srv_flgs, ps, depth))
+                       return False;
+
+       if(!prs_ntstatus("status      ", ps, depth, &r_l->status))
+               return False;
+
+       if(!prs_align(ps))
+               return False;
+
+       return True;
+}
 
index 78ffb2e9f1a1ef2c6a0ed756890921911c59e462..21bcad23f6320ad9e932958d864dc83780652198 100644 (file)
@@ -336,6 +336,35 @@ static BOOL api_net_sam_logon_ex(pipes_struct *p)
        return True;
 }
 
+/*************************************************************************
+ api_net_logon_capa:
+ *************************************************************************/
+
+static BOOL api_net_logon_capa(pipes_struct *p)
+{
+       NET_Q_LOGON_CAPA q_u;
+       NET_R_LOGON_CAPA r_u;
+       prs_struct *data = &p->in_data.data;
+       prs_struct *rdata = &p->out_data.rdata;
+
+       ZERO_STRUCT(q_u);
+       ZERO_STRUCT(r_u);
+
+       if(!net_io_q_logon_capa("", &q_u, data, 0)) {
+               DEBUG(0, ("api_net_logon_capa: Failed to unmarshall NET_Q_LOGON_capa.\n"));
+               return False;
+       }
+
+       r_u.status = _net_logon_capa(p, &q_u, &r_u);
+
+       /* store the response in the SMB stream */
+       if(!net_io_r_logon_capa("", &r_u, rdata, 0)) {
+               DEBUG(0,("api_net_logon_capa: Failed to marshall NET_R_LOGON_CAPA.\n"));
+               return False;
+       }
+
+       return True;
+}
 
 /*************************************************************************
  api_ds_enum_dom_trusts:
@@ -388,6 +417,7 @@ static struct api_struct api_net_cmds [] =
       { "NET_TRUST_DOM_LIST", NET_TRUST_DOM_LIST, api_net_trust_dom_list },
       { "NET_LOGON_CTRL"    , NET_LOGON_CTRL    , api_net_logon_ctrl     },
       { "NET_SAMLOGON_EX"   , NET_SAMLOGON_EX   , api_net_sam_logon_ex   },
+      { "NET_LOGON_CAPA"    , NET_LOGON_CAPA    , api_net_logon_capa     },
 #if 0  /* JERRY */
       { "DS_ENUM_DOM_TRUSTS", DS_ENUM_DOM_TRUSTS, api_ds_enum_dom_trusts }
 #endif /* JERRY */
index 3a79957de0ff6c538169670ff67323a98c7f61db..5b2a26433c8a33ffb63a811bec81018e8c20a438 100644 (file)
@@ -522,6 +522,40 @@ NTSTATUS _net_auth_2(pipes_struct *p, NET_Q_AUTH_2 *q_u, NET_R_AUTH_2 *r_u)
        return r_u->status;
 }
 
+/*************************************************************************
+ init_net_r_logon_capa:
+ *************************************************************************/
+
+static void init_net_r_logon_capa(NET_R_LOGON_CAPA *r_a,
+                              DOM_CRED *resp_cred,
+                             NEG_FLAGS *flgs,
+                             NTSTATUS status)
+{
+       memcpy(&r_a->srv_creds, resp_cred, sizeof(r_a->srv_creds));
+       r_a->query_level = 1;
+       memcpy(&r_a->srv_flgs, flgs, sizeof(r_a->srv_flgs));
+       r_a->status = status;
+}
+
+/*************************************************************************
+ _net_logon_capa
+ *************************************************************************/
+
+NTSTATUS _net_logon_capa(pipes_struct *p, NET_Q_LOGON_CAPA *q_u, NET_R_LOGON_CAPA *r_u)
+{
+       NEG_FLAGS srv_flgs;
+       DOM_CRED srv_cred_out;
+       NTSTATUS status;
+
+       ZERO_STRUCT(srv_flgs);
+       ZERO_STRUCT(srv_cred_out);
+       status = NT_STATUS_NOT_IMPLEMENTED;
+
+       init_net_r_logon_capa(r_u, &srv_cred_out, &srv_flgs, status);
+
+       return r_u->status;
+}
+
 /*************************************************************************
  _net_srv_pwset
  *************************************************************************/