s4:rpc_server/srvsvc: make use dcesrv_call_session_info()
authorStefan Metzmacher <metze@samba.org>
Sat, 3 Nov 2018 00:19:51 +0000 (01:19 +0100)
committerJeremy Allison <jra@samba.org>
Sat, 12 Jan 2019 02:13:33 +0000 (03:13 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/rpc_server/srvsvc/dcesrv_srvsvc.c
source4/rpc_server/srvsvc/srvsvc_ntvfs.c

index a6bee0d..09673f6 100644 (file)
@@ -32,7 +32,8 @@
 #include "param/param.h"
 
 #define SRVSVC_CHECK_ADMIN_ACCESS do { \
 #include "param/param.h"
 
 #define SRVSVC_CHECK_ADMIN_ACCESS do { \
-       struct security_token *t = dce_call->conn->auth_state.session_info->security_token; \
+       struct auth_session_info *si = dcesrv_call_session_info(dce_call); \
+       struct security_token *t = si->security_token; \
        if (!security_token_has_builtin_administrators(t) && \
            !security_token_has_sid(t, &global_sid_Builtin_Server_Operators)) { \
                return WERR_ACCESS_DENIED; \
        if (!security_token_has_builtin_administrators(t) && \
            !security_token_has_sid(t, &global_sid_Builtin_Server_Operators)) { \
                return WERR_ACCESS_DENIED; \
@@ -2045,6 +2046,8 @@ static WERROR dcesrv_srvsvc_NetShareDelCommit(struct dcesrv_call_state *dce_call
 static WERROR dcesrv_srvsvc_NetGetFileSecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                       struct srvsvc_NetGetFileSecurity *r)
 {
 static WERROR dcesrv_srvsvc_NetGetFileSecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                       struct srvsvc_NetGetFileSecurity *r)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        struct sec_desc_buf *sd_buf;
        struct ntvfs_context *ntvfs_ctx = NULL;
        struct ntvfs_request *ntvfs_req;
        struct sec_desc_buf *sd_buf;
        struct ntvfs_context *ntvfs_ctx = NULL;
        struct ntvfs_request *ntvfs_req;
@@ -2055,7 +2058,7 @@ static WERROR dcesrv_srvsvc_NetGetFileSecurity(struct dcesrv_call_state *dce_cal
        if (!NT_STATUS_IS_OK(nt_status)) return ntstatus_to_werror(nt_status);
 
        ntvfs_req = ntvfs_request_create(ntvfs_ctx, mem_ctx,
        if (!NT_STATUS_IS_OK(nt_status)) return ntstatus_to_werror(nt_status);
 
        ntvfs_req = ntvfs_request_create(ntvfs_ctx, mem_ctx,
-                                        dce_call->conn->auth_state.session_info,
+                                        session_info,
                                         0,
                                         dce_call->time,
                                         NULL, NULL, 0);
                                         0,
                                         dce_call->time,
                                         NULL, NULL, 0);
@@ -2087,6 +2090,8 @@ static WERROR dcesrv_srvsvc_NetGetFileSecurity(struct dcesrv_call_state *dce_cal
 static WERROR dcesrv_srvsvc_NetSetFileSecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                       struct srvsvc_NetSetFileSecurity *r)
 {
 static WERROR dcesrv_srvsvc_NetSetFileSecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                       struct srvsvc_NetSetFileSecurity *r)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        struct ntvfs_context *ntvfs_ctx;
        struct ntvfs_request *ntvfs_req;
        union smb_setfileinfo *io;
        struct ntvfs_context *ntvfs_ctx;
        struct ntvfs_request *ntvfs_req;
        union smb_setfileinfo *io;
@@ -2096,7 +2101,7 @@ static WERROR dcesrv_srvsvc_NetSetFileSecurity(struct dcesrv_call_state *dce_cal
        if (!NT_STATUS_IS_OK(nt_status)) return ntstatus_to_werror(nt_status);
 
        ntvfs_req = ntvfs_request_create(ntvfs_ctx, mem_ctx,
        if (!NT_STATUS_IS_OK(nt_status)) return ntstatus_to_werror(nt_status);
 
        ntvfs_req = ntvfs_request_create(ntvfs_ctx, mem_ctx,
-                                        dce_call->conn->auth_state.session_info,
+                                        session_info,
                                         0,
                                         dce_call->time,
                                         NULL, NULL, 0);
                                         0,
                                         dce_call->time,
                                         NULL, NULL, 0);
index 5d6fc92..fe97d60 100644 (file)
@@ -39,6 +39,8 @@ NTSTATUS srvsvc_create_ntvfs_context(struct dcesrv_call_state *dce_call,
                                     const char *share,
                                     struct ntvfs_context **_ntvfs)
 {
                                     const char *share,
                                     struct ntvfs_context **_ntvfs)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        NTSTATUS status;
        struct srvsvc_ntvfs_ctx *c;
        struct ntvfs_request *ntvfs_req;
        NTSTATUS status;
        struct srvsvc_ntvfs_ctx *c;
        struct ntvfs_request *ntvfs_req;
@@ -113,7 +115,7 @@ NTSTATUS srvsvc_create_ntvfs_context(struct dcesrv_call_state *dce_call,
        }
 
        ntvfs_req = ntvfs_request_create(c->ntvfs, mem_ctx,
        }
 
        ntvfs_req = ntvfs_request_create(c->ntvfs, mem_ctx,
-                                        dce_call->conn->auth_state.session_info,
+                                        session_info,
                                         0, /* TODO: fill in PID */
                                         dce_call->time,
                                         NULL, NULL, 0);
                                         0, /* TODO: fill in PID */
                                         dce_call->time,
                                         NULL, NULL, 0);