s4:rpc_server/winreq: 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/winreg/rpc_winreg.c

index 6cbd1a3..48d191d 100644 (file)
@@ -32,12 +32,14 @@ enum handle_types { HTYPE_REGVAL, HTYPE_REGKEY };
 static NTSTATUS dcerpc_winreg_bind(struct dcesrv_call_state *dce_call,
                                   const struct dcesrv_interface *iface)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        struct registry_context *ctx;
        WERROR err;
 
        err = reg_open_samba(dce_call->context,
                             &ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
-                            dce_call->conn->auth_state.session_info,
+                            session_info,
                             NULL);
 
        if (!W_ERROR_IS_OK(err)) {
@@ -113,6 +115,8 @@ static WERROR dcesrv_winreg_CreateKey(struct dcesrv_call_state *dce_call,
                                      TALLOC_CTX *mem_ctx,
                                      struct winreg_CreateKey *r)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        struct dcesrv_handle *h, *newh;
        struct security_descriptor sd;
        struct registry_key *key;
@@ -123,7 +127,7 @@ static WERROR dcesrv_winreg_CreateKey(struct dcesrv_call_state *dce_call,
 
        newh = dcesrv_handle_new(dce_call->context, HTYPE_REGKEY);
 
-       switch (security_session_user_level(dce_call->conn->auth_state.session_info, NULL))
+       switch (security_session_user_level(session_info, NULL))
        {
        case SECURITY_SYSTEM:
        case SECURITY_ADMINISTRATOR:
@@ -179,6 +183,8 @@ static WERROR dcesrv_winreg_DeleteKey(struct dcesrv_call_state *dce_call,
                                      TALLOC_CTX *mem_ctx,
                                      struct winreg_DeleteKey *r)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        struct dcesrv_handle *h;
        struct registry_key *key;
        WERROR result;
@@ -186,7 +192,7 @@ static WERROR dcesrv_winreg_DeleteKey(struct dcesrv_call_state *dce_call,
        DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
        key = h->data;
 
-       switch (security_session_user_level(dce_call->conn->auth_state.session_info, NULL))
+       switch (security_session_user_level(session_info, NULL))
        {
        case SECURITY_SYSTEM:
        case SECURITY_ADMINISTRATOR:
@@ -207,13 +213,15 @@ static WERROR dcesrv_winreg_DeleteValue(struct dcesrv_call_state *dce_call,
                                        TALLOC_CTX *mem_ctx,
                                        struct winreg_DeleteValue *r)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        struct dcesrv_handle *h;
        struct registry_key *key;
 
        DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
        key = h->data;
 
-       switch (security_session_user_level(dce_call->conn->auth_state.session_info, NULL))
+       switch (security_session_user_level(session_info, NULL))
        {
        case SECURITY_SYSTEM:
        case SECURITY_ADMINISTRATOR:
@@ -345,13 +353,15 @@ static WERROR dcesrv_winreg_FlushKey(struct dcesrv_call_state *dce_call,
                                     TALLOC_CTX *mem_ctx,
                                     struct winreg_FlushKey *r)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        struct dcesrv_handle *h;
        struct registry_key *key;
 
        DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
        key = h->data;
 
-       switch (security_session_user_level(dce_call->conn->auth_state.session_info, NULL))
+       switch (security_session_user_level(session_info, NULL))
        {
        case SECURITY_SYSTEM:
        case SECURITY_ADMINISTRATOR:
@@ -406,6 +416,8 @@ static WERROR dcesrv_winreg_OpenKey(struct dcesrv_call_state *dce_call,
                                    TALLOC_CTX *mem_ctx,
                                    struct winreg_OpenKey *r)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        struct dcesrv_handle *h, *newh;
        struct registry_key *key;
        WERROR result;
@@ -413,7 +425,7 @@ static WERROR dcesrv_winreg_OpenKey(struct dcesrv_call_state *dce_call,
        DCESRV_PULL_HANDLE_FAULT(h, r->in.parent_handle, HTYPE_REGKEY);
        key = h->data;
 
-       switch (security_session_user_level(dce_call->conn->auth_state.session_info, NULL))
+       switch (security_session_user_level(session_info, NULL))
        {
        case SECURITY_SYSTEM:
        case SECURITY_ADMINISTRATOR:
@@ -446,6 +458,8 @@ static WERROR dcesrv_winreg_QueryInfoKey(struct dcesrv_call_state *dce_call,
                                         TALLOC_CTX *mem_ctx,
                                         struct winreg_QueryInfoKey *r)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        struct dcesrv_handle *h;
        struct registry_key *key;
        const char *classname = NULL;
@@ -454,7 +468,7 @@ static WERROR dcesrv_winreg_QueryInfoKey(struct dcesrv_call_state *dce_call,
        DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
        key = h->data;
 
-       switch (security_session_user_level(dce_call->conn->auth_state.session_info, NULL))
+       switch (security_session_user_level(session_info, NULL))
        {
        case SECURITY_SYSTEM:
        case SECURITY_ADMINISTRATOR:
@@ -496,6 +510,8 @@ static WERROR dcesrv_winreg_QueryValue(struct dcesrv_call_state *dce_call,
                                       TALLOC_CTX *mem_ctx,
                                       struct winreg_QueryValue *r)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        struct dcesrv_handle *h;
        struct registry_key *key;
        uint32_t value_type;
@@ -505,7 +521,7 @@ static WERROR dcesrv_winreg_QueryValue(struct dcesrv_call_state *dce_call,
        DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
        key = h->data;
 
-       switch (security_session_user_level(dce_call->conn->auth_state.session_info, NULL))
+       switch (security_session_user_level(session_info, NULL))
        {
        case SECURITY_SYSTEM:
        case SECURITY_ADMINISTRATOR:
@@ -605,6 +621,8 @@ static WERROR dcesrv_winreg_SetValue(struct dcesrv_call_state *dce_call,
                                     TALLOC_CTX *mem_ctx,
                                     struct winreg_SetValue *r)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        struct dcesrv_handle *h;
        struct registry_key *key;
        DATA_BLOB data;
@@ -613,7 +631,7 @@ static WERROR dcesrv_winreg_SetValue(struct dcesrv_call_state *dce_call,
        DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
        key = h->data;
 
-       switch (security_session_user_level(dce_call->conn->auth_state.session_info, NULL))
+       switch (security_session_user_level(session_info, NULL))
        {
        case SECURITY_SYSTEM:
        case SECURITY_ADMINISTRATOR: