s4:rpc_server: only use context within op_bind() hooks and dcesrv_interface_bind_...
[samba.git] / source4 / rpc_server / drsuapi / dcesrv_drsuapi.c
index 250b4c74c760a1eb0622df3f5992b659d5c5f9ea..347823ebca321c405a93ec4817807af7791496ba 100644 (file)
@@ -47,7 +47,8 @@
 static NTSTATUS dcesrv_interface_drsuapi_bind(struct dcesrv_call_state *dce_call,
                                              const struct dcesrv_interface *iface)
 {
-       return dcesrv_interface_bind_require_privacy(dce_call, iface);
+       struct dcesrv_connection_context *context = dce_call->context;
+       return dcesrv_interface_bind_require_privacy(context, iface);
 }
 
 /* 
@@ -90,7 +91,7 @@ static WERROR dcesrv_drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_C
                auth_info = system_session(dce_call->conn->dce_ctx->lp_ctx);
                connected_as_system = true;
        } else {
-               auth_info = dce_call->conn->auth_state.session_info;
+               auth_info = dcesrv_call_session_info(dce_call);
        }
 
        /*
@@ -293,7 +294,7 @@ static WERROR dcesrv_drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_C
        /*
         * allocate a bind handle
         */
-       handle = dcesrv_handle_new(dce_call->context, DRSUAPI_BIND_HANDLE);
+       handle = dcesrv_handle_create(dce_call, DRSUAPI_BIND_HANDLE);
        W_ERROR_HAVE_NO_MEMORY(handle);
        handle->data = talloc_steal(handle, b_state);
 
@@ -1011,14 +1012,17 @@ static WERROR dcesrv_drsuapi_DsExecuteKCC(struct dcesrv_call_state *dce_call, TA
 static WERROR dcesrv_drsuapi_DsReplicaGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                       struct drsuapi_DsReplicaGetInfo *r)
 {
+       struct auth_session_info *session_info =
+               dcesrv_call_session_info(dce_call);
        enum security_user_level level;
 
        if (!lpcfg_parm_bool(dce_call->conn->dce_ctx->lp_ctx, NULL,
                         "drs", "disable_sec_check", false)) {
-               level = security_session_user_level(dce_call->conn->auth_state.session_info, NULL);
+               level = security_session_user_level(session_info, NULL);
                if (level < SECURITY_DOMAIN_CONTROLLER) {
                        DEBUG(1,(__location__ ": Administrator access required for DsReplicaGetInfo\n"));
-                       security_token_debug(0, 2, dce_call->conn->auth_state.session_info->security_token);
+                       security_token_debug(DBGC_DRS_REPL, 2,
+                                            session_info->security_token);
                        return WERR_DS_DRA_ACCESS_DENIED;
                }
        }