rpc_server3: Remove pipes_struct->auth
authorVolker Lendecke <vl@samba.org>
Mon, 4 Oct 2021 11:50:02 +0000 (13:50 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 5 Jan 2022 00:11:38 +0000 (00:11 +0000)
Replace with a call to dcesrv_call_auth_info(p->dce_call)

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 89dc06178390d466ef23922bad2b25819b1dce38..be275cc91092a28abfbb663e385d7c74687c398b 100644 (file)
@@ -292,9 +292,6 @@ sub boilerplate_iface($)
        $self->pidl("p = dcesrv_get_pipes_struct(dce_call->conn);");
        $self->pidl("p->dce_call = dce_call;");
        $self->pidl("p->mem_ctx = mem_ctx;");
-       $self->pidl("p->auth.auth_type = dce_call->auth_state->auth_type;");
-       $self->pidl("p->auth.auth_level = dce_call->auth_state->auth_level;");
-       $self->pidl("p->auth.auth_context_id = dce_call->auth_state->auth_context_id;");
        $self->pidl("/* Reset pipes struct fault state */");
        $self->pidl("p->fault_state = 0;");
        $self->pidl("");
@@ -335,9 +332,6 @@ sub boilerplate_iface($)
 
        $self->pidl("p->dce_call = NULL;");
        $self->pidl("p->mem_ctx = NULL;");
-       $self->pidl("p->auth.auth_type = 0;");
-       $self->pidl("p->auth.auth_level = 0;");
-       $self->pidl("p->auth.auth_context_id = 0;");
        $self->pidl("/* Check pipes struct fault state */");
        $self->pidl("if (p->fault_state != 0) {");
        $self->indent();
index bf4ddd22ee7fad4d625e081e08c914356e24302c..4cb9dae639e42ca74e924b1ef678c567e11bd0d5 100644 (file)
@@ -1090,6 +1090,9 @@ NTSTATUS _lsa_LookupSids2(struct pipes_struct *p,
 NTSTATUS _lsa_LookupSids3(struct pipes_struct *p,
                          struct lsa_LookupSids3 *r)
 {
+       struct dcesrv_call_state *dce_call = p->dce_call;
+       enum dcerpc_AuthType auth_type = DCERPC_AUTH_TYPE_NONE;
+       enum dcerpc_AuthLevel auth_level = DCERPC_AUTH_LEVEL_NONE;
        struct lsa_LookupSids2 q;
 
        if (p->transport != NCACN_IP_TCP) {
@@ -1097,9 +1100,11 @@ NTSTATUS _lsa_LookupSids3(struct pipes_struct *p,
                return NT_STATUS_ACCESS_DENIED;
        }
 
+       dcesrv_call_auth_info(dce_call, &auth_type, &auth_level);
+
        /* No policy handle on this call. Restrict to crypto connections. */
-       if (p->auth.auth_type != DCERPC_AUTH_TYPE_SCHANNEL ||
-           p->auth.auth_level < DCERPC_AUTH_LEVEL_INTEGRITY) {
+       if (auth_type != DCERPC_AUTH_TYPE_SCHANNEL ||
+           auth_level < DCERPC_AUTH_LEVEL_INTEGRITY) {
                DEBUG(1, ("_lsa_LookupSids3: The client %s is not using "
                          "a secure connection over netlogon\n",
                          get_remote_machine_name() ));
@@ -1402,6 +1407,9 @@ NTSTATUS _lsa_LookupNames3(struct pipes_struct *p,
 NTSTATUS _lsa_LookupNames4(struct pipes_struct *p,
                           struct lsa_LookupNames4 *r)
 {
+       struct dcesrv_call_state *dce_call = p->dce_call;
+       enum dcerpc_AuthType auth_type = DCERPC_AUTH_TYPE_NONE;
+       enum dcerpc_AuthLevel auth_level = DCERPC_AUTH_LEVEL_NONE;
        struct lsa_LookupNames3 q;
 
        if (p->transport != NCACN_IP_TCP) {
@@ -1409,9 +1417,11 @@ NTSTATUS _lsa_LookupNames4(struct pipes_struct *p,
                return NT_STATUS_ACCESS_DENIED;
        }
 
+       dcesrv_call_auth_info(dce_call, &auth_type, &auth_level);
+
        /* No policy handle on this call. Restrict to crypto connections. */
-       if (p->auth.auth_type != DCERPC_AUTH_TYPE_SCHANNEL ||
-           p->auth.auth_level < DCERPC_AUTH_LEVEL_INTEGRITY) {
+       if (auth_type != DCERPC_AUTH_TYPE_SCHANNEL ||
+           auth_level < DCERPC_AUTH_LEVEL_INTEGRITY) {
                DEBUG(1, ("_lsa_LookupNames4: The client %s is not using "
                          "a secure connection over netlogon\n",
                          get_remote_machine_name()));
index 05a51bef37cc84265815117501dbbc146eaa0389..f3c56a6bef157b079b96c4b7080a3b3cebe6634d 100644 (file)
@@ -1091,7 +1091,7 @@ static NTSTATUS netr_creds_server_step_check(struct pipes_struct *p,
                opname = ndr_table_netlogon.calls[opnum].name;
        }
 
-       auth_type = p->auth.auth_type;
+       dcesrv_call_auth_info(dce_call, &auth_type, NULL);
 
        lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_helpers());
        if (lp_ctx == NULL) {
@@ -2014,9 +2014,13 @@ static NTSTATUS _netr_LogonSamLogon_base(struct pipes_struct *p,
                status = serverinfo_to_SamInfo3(server_info,
                                                r->out.validation->sam3);
                break;
-       case 6:
+       case 6: {
+               enum dcerpc_AuthLevel auth_level = DCERPC_AUTH_LEVEL_NONE;
+
+               dcesrv_call_auth_info(dce_call, NULL, &auth_level);
+
                /* Only allow this if the pipe is protected. */
-               if (p->auth.auth_level < DCERPC_AUTH_LEVEL_PRIVACY) {
+               if (auth_level < DCERPC_AUTH_LEVEL_PRIVACY) {
                        DEBUG(0,("netr_Validation6: client %s not using privacy for netlogon\n",
                                get_remote_machine_name()));
                        status = NT_STATUS_INVALID_PARAMETER;
@@ -2027,6 +2031,7 @@ static NTSTATUS _netr_LogonSamLogon_base(struct pipes_struct *p,
                                                r->out.validation->sam6);
                break;
        }
+       }
 
        TALLOC_FREE(server_info);
 
@@ -2125,6 +2130,8 @@ NTSTATUS _netr_LogonSamLogon(struct pipes_struct *p,
 NTSTATUS _netr_LogonSamLogonEx(struct pipes_struct *p,
                               struct netr_LogonSamLogonEx *r)
 {
+       struct dcesrv_call_state *dce_call = p->dce_call;
+       enum dcerpc_AuthType auth_type = DCERPC_AUTH_TYPE_NONE;
        NTSTATUS status;
        struct netlogon_creds_CredentialState *creds = NULL;
        struct loadparm_context *lp_ctx;
@@ -2137,7 +2144,10 @@ NTSTATUS _netr_LogonSamLogonEx(struct pipes_struct *p,
        }
 
        /* Only allow this if the pipe is protected. */
-       if (p->auth.auth_type != DCERPC_AUTH_TYPE_SCHANNEL) {
+
+       dcesrv_call_auth_info(dce_call, &auth_type, NULL);
+
+       if (auth_type != DCERPC_AUTH_TYPE_SCHANNEL) {
                DEBUG(0,("_netr_LogonSamLogonEx: client %s not using schannel for netlogon\n",
                        get_remote_machine_name() ));
                return NT_STATUS_INVALID_PARAMETER;
index cb34e83b92751bff214c2286a1588f8be977315c..1f9325ed22970bcd6c7873faeedf654f00b3d9b0 100644 (file)
@@ -41,8 +41,6 @@ struct pipes_struct {
 
        struct messaging_context *msg_ctx;
 
-       struct pipe_auth_data auth;
-
        /*
         * Set the DCERPC_FAULT to return.
         */
index dc8bdb9585799fd113ddca53c5ee2b99627fc756..7f2c0a861f56f9175dcf0010d11bb1fb57c5cf17 100644 (file)
@@ -7242,6 +7242,8 @@ static enum samr_ValidationStatus samr_ValidatePassword_Reset(TALLOC_CTX *mem_ct
 NTSTATUS _samr_ValidatePassword(struct pipes_struct *p,
                                struct samr_ValidatePassword *r)
 {
+       struct dcesrv_call_state *dce_call = p->dce_call;
+       enum dcerpc_AuthLevel auth_level = DCERPC_AUTH_LEVEL_NONE;
        union samr_ValidatePasswordRep *rep;
        NTSTATUS status;
        struct samr_GetDomPwInfo pw;
@@ -7252,7 +7254,9 @@ NTSTATUS _samr_ValidatePassword(struct pipes_struct *p,
                return NT_STATUS_ACCESS_DENIED;
        }
 
-       if (p->auth.auth_level != DCERPC_AUTH_LEVEL_PRIVACY) {
+       dcesrv_call_auth_info(dce_call, NULL, &auth_level);
+
+       if (auth_level != DCERPC_AUTH_LEVEL_PRIVACY) {
                p->fault_state = DCERPC_FAULT_ACCESS_DENIED;
                return NT_STATUS_ACCESS_DENIED;
        }
index 90fd997cadd89a947d6cdd4a1c4fbc4f5a70026b..2fc7e74d5464cac71a2f33e4242ffaaf4971fefb 100644 (file)
@@ -93,9 +93,6 @@ static NTSTATUS iremotewinspool__op_dispatch_internal(struct dcesrv_call_state *
        p = dcesrv_get_pipes_struct(dce_call->conn);
        p->dce_call = dce_call;
        p->mem_ctx = mem_ctx;
-       p->auth.auth_type = dce_call->auth_state->auth_type;
-       p->auth.auth_level = dce_call->auth_state->auth_level;
-       p->auth.auth_context_id = dce_call->auth_state->auth_context_id;
        /* Reset pipes struct fault state */
        p->fault_state = 0;
 
@@ -1230,9 +1227,6 @@ fail:
 
        p->dce_call = NULL;
        p->mem_ctx = NULL;
-       p->auth.auth_type = 0;
-       p->auth.auth_level = 0;
-       p->auth.auth_context_id = 0;
        /* Check pipes struct fault state */
        if (p->fault_state != 0) {
                dce_call->fault_code = p->fault_state;