rpc_server3: Remove "pipes_struct->opnum"
authorVolker Lendecke <vl@samba.org>
Mon, 4 Oct 2021 08:19:24 +0000 (10:19 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 8 Oct 2021 19:28:32 +0000 (19:28 +0000)
Also available via dce_call->pkt.u.request.opnum

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
pidl/lib/Parse/Pidl/Samba4/NDR/ServerCompat.pm
source3/rpc_server/lsa/srv_lsa_nt.c
source3/rpc_server/netlogon/srv_netlog_nt.c
source3/rpc_server/rpc_pipes.h
source3/rpc_server/samr/srv_samr_nt.c
source3/rpc_server/spoolss/srv_iremotewinspool.c

index e35813a24abd3fc7db24768d9a3938874d6e8894..b8d9318b9de916aa8a9381930f3d8a6b16fe5b3f 100644 (file)
@@ -296,8 +296,6 @@ sub boilerplate_iface($)
        $self->pidl("");
        $self->pidl("/* Retrieve pipes struct */");
        $self->pidl("p = dcesrv_get_pipes_struct(dce_call->conn);");
-       $self->pidl("/* Update pipes struct opnum */");
-       $self->pidl("p->opnum = opnum;");
        $self->pidl("p->dce_call = dce_call;");
        $self->pidl("p->mem_ctx = mem_ctx;");
        $self->pidl("/* Update pipes struct session info */");
index 817fa3548648d8ad6408dba26f4a15a058d591e8..8d341b616b1c60457cc06d5a8929928a2ee14b2d 100644 (file)
@@ -1002,6 +1002,7 @@ NTSTATUS _lsa_LookupSids(struct pipes_struct *p,
 static NTSTATUS _lsa_LookupSids_common(struct pipes_struct *p,
                                struct lsa_LookupSids2 *r)
 {
+       struct dcesrv_call_state *dce_call = p->dce_call;
        NTSTATUS status;
        struct lsa_info *handle;
        int num_sids = r->in.sids->num_sids;
@@ -1010,7 +1011,7 @@ static NTSTATUS _lsa_LookupSids_common(struct pipes_struct *p,
        struct lsa_TranslatedName2 *names = NULL;
        bool check_policy = true;
 
-       switch (p->opnum) {
+       switch (dce_call->pkt.u.request.opnum) {
                case NDR_LSA_LOOKUPSIDS3:
                        check_policy = false;
                        break;
@@ -1289,6 +1290,7 @@ NTSTATUS _lsa_LookupNames2(struct pipes_struct *p,
 static NTSTATUS _lsa_LookupNames_common(struct pipes_struct *p,
                                        struct lsa_LookupNames3 *r)
 {
+       struct dcesrv_call_state *dce_call = p->dce_call;
        NTSTATUS status;
        struct lsa_info *handle;
        struct lsa_String *names = r->in.names;
@@ -1299,7 +1301,7 @@ static NTSTATUS _lsa_LookupNames_common(struct pipes_struct *p,
        int flags = 0;
        bool check_policy = true;
 
-       switch (p->opnum) {
+       switch (dce_call->pkt.u.request.opnum) {
                case NDR_LSA_LOOKUPNAMES4:
                        check_policy = false;
                        break;
index 51a5663b9da099246773fe411eb8229fa32ce4ff..5d22f83afb0bd943a6839fc3bc968805eed92061 100644 (file)
@@ -28,6 +28,7 @@
 #include "system/passwd.h" /* uid_wrapper */
 #include "ntdomain.h"
 #include "../libcli/auth/schannel.h"
+#include "librpc/rpc/dcesrv_core.h"
 #include "librpc/gen_ndr/ndr_netlogon.h"
 #include "librpc/gen_ndr/ndr_netlogon_scompat.h"
 #include "librpc/gen_ndr/ndr_samr_c.h"
@@ -187,6 +188,7 @@ static bool wb_check_trust_creds(const char *domain, WERROR *tc_status)
 WERROR _netr_LogonControl2Ex(struct pipes_struct *p,
                             struct netr_LogonControl2Ex *r)
 {
+       struct dcesrv_call_state *dce_call = p->dce_call;
        uint32_t flags = 0x0;
        WERROR pdc_connection_status = WERR_OK;
        uint32_t logon_attempts = 0x0;
@@ -203,7 +205,7 @@ WERROR _netr_LogonControl2Ex(struct pipes_struct *p,
        NTSTATUS status;
        struct netr_DsRGetDCNameInfo *dc_info;
 
-       switch (p->opnum) {
+       switch (dce_call->pkt.u.request.opnum) {
        case NDR_NETR_LOGONCONTROL:
                fn = "_netr_LogonControl";
                break;
@@ -850,6 +852,7 @@ NTSTATUS _netr_ServerAuthenticate(struct pipes_struct *p,
 NTSTATUS _netr_ServerAuthenticate3(struct pipes_struct *p,
                                   struct netr_ServerAuthenticate3 *r)
 {
+       struct dcesrv_call_state *dce_call = p->dce_call;
        NTSTATUS status;
        uint32_t srv_flgs;
        /* r->in.negotiate_flags is an aliased pointer to r->out.negotiate_flags,
@@ -917,7 +920,7 @@ NTSTATUS _netr_ServerAuthenticate3(struct pipes_struct *p,
                srv_flgs &= ~NETLOGON_NEG_ARCFOUR;
        }
 
-       switch (p->opnum) {
+       switch (dce_call->pkt.u.request.opnum) {
                case NDR_NETR_SERVERAUTHENTICATE:
                        fn = "_netr_ServerAuthenticate";
                        break;
@@ -1044,6 +1047,7 @@ static NTSTATUS netr_creds_server_step_check(struct pipes_struct *p,
                                             struct netr_Authenticator *return_authenticator,
                                             struct netlogon_creds_CredentialState **creds_out)
 {
+       struct dcesrv_call_state *dce_call = p->dce_call;
        NTSTATUS status;
        bool schannel_global_required = (lp_server_schannel() == true) ? true:false;
        bool schannel_required = schannel_global_required;
@@ -1051,7 +1055,7 @@ static NTSTATUS netr_creds_server_step_check(struct pipes_struct *p,
        struct loadparm_context *lp_ctx;
        struct netlogon_creds_CredentialState *creds = NULL;
        enum dcerpc_AuthType auth_type = DCERPC_AUTH_TYPE_NONE;
-       uint16_t opnum = p->opnum;
+       uint16_t opnum = dce_call->pkt.u.request.opnum;
        const char *opname = "<unknown>";
        static bool warned_global_once = false;
 
@@ -1722,6 +1726,7 @@ static NTSTATUS _netr_LogonSamLogon_base(struct pipes_struct *p,
                                         struct netr_LogonSamLogonEx *r,
                                         struct netlogon_creds_CredentialState *creds)
 {
+       struct dcesrv_call_state *dce_call = p->dce_call;
        NTSTATUS status = NT_STATUS_OK;
        union netr_LogonLevel *logon = r->in.logon;
        const char *nt_username, *nt_domain, *nt_workstation;
@@ -1740,7 +1745,7 @@ static NTSTATUS _netr_LogonSamLogon_base(struct pipes_struct *p,
        }
 #endif
 
-       switch (p->opnum) {
+       switch (dce_call->pkt.u.request.opnum) {
                case NDR_NETR_LOGONSAMLOGON:
                        fn = "_netr_LogonSamLogon";
                        break;
index 5a0dcad852697e232446c6a8862fe242c45b43d2..f2fa11e29cbacabaf526f910c0967ad69e7591cc 100644 (file)
@@ -67,9 +67,6 @@ struct pipes_struct {
        /* handle database to use on this pipe. */
        struct dcesrv_call_state *dce_call;
 
-       /* operation number retrieved from the rpc header */
-       uint16_t opnum;
-
        /* private data for the interface implementation */
        void *private_data;
 
index 07d94c57726a47319b495204615e266da59078b5..32226b09af69209bc0b8419bea614498f1ec6dc4 100644 (file)
@@ -35,6 +35,7 @@
 #include "system/passwd.h"
 #include "../libcli/auth/libcli_auth.h"
 #include "ntdomain.h"
+#include "librpc/rpc/dcesrv_core.h"
 #include "../librpc/gen_ndr/ndr_samr.h"
 #include "../librpc/gen_ndr/ndr_samr_scompat.h"
 #include "rpc_server/samr/srv_samr_util.h"
@@ -4051,6 +4052,7 @@ NTSTATUS _samr_Connect(struct pipes_struct *p,
 NTSTATUS _samr_Connect2(struct pipes_struct *p,
                        struct samr_Connect2 *r)
 {
+       struct dcesrv_call_state *dce_call = p->dce_call;
        struct security_descriptor *psd = NULL;
        uint32_t    acc_granted;
        uint32_t    des_access = r->in.access_mask;
@@ -4058,7 +4060,7 @@ NTSTATUS _samr_Connect2(struct pipes_struct *p,
        size_t    sd_size;
        const char *fn = "_samr_Connect2";
 
-       switch (p->opnum) {
+       switch (dce_call->pkt.u.request.opnum) {
        case NDR_SAMR_CONNECT2:
                fn = "_samr_Connect2";
                break;
index d6a983c722adfd396ab6ba1c881a64b4d16b452f..014fa6cab9b98a75b26259e4a1065c44d7cf7a5c 100644 (file)
@@ -97,8 +97,6 @@ static NTSTATUS iremotewinspool__op_dispatch_internal(struct dcesrv_call_state *
 
        /* Retrieve pipes struct */
        p = dcesrv_get_pipes_struct(dce_call->conn);
-       /* Update pipes struct opnum */
-       p->opnum = opnum;
        p->dce_call = dce_call;
        p->mem_ctx = mem_ctx;
        /* Update pipes struct session info */