s4-auth Remove event context from privilage database handling
authorAndrew Bartlett <abartlet@samba.org>
Mon, 20 Dec 2010 10:26:35 +0000 (21:26 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 21 Dec 2010 04:10:38 +0000 (15:10 +1100)
These local TDB operations can quite safely be handled in a new/nested
event context, rather than using the main event context.

Andrew Bartlett

source4/auth/session.c
source4/dsdb/samdb/samdb.c
source4/dsdb/samdb/samdb_privilege.c
source4/libnet/libnet_samsync_ldb.c
source4/rpc_server/lsa/lsa_init.c
source4/smbd/server.c

index 37c469b4f715ac667e14428e5e8e9eef8943ec53..bb6a5946e58a4e4abca5c5f8f4b3aa4c7dd7094b 100644 (file)
@@ -177,7 +177,6 @@ _PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
        }
 
        nt_status = security_token_create(session_info,
-                                         auth_context ? auth_context->event_ctx : NULL,
                                          auth_context ? auth_context->lp_ctx : NULL,
                                          server_info->account_sid,
                                          server_info->primary_group_sid,
index 416cf50396cc5af9168d2c942fee40b0c27b8038..7ba440006ae60e6bdc578f39d3cccd18534c1001 100644 (file)
@@ -143,7 +143,6 @@ struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx,
  Create the SID list for this user.
 ****************************************************************************/
 NTSTATUS security_token_create(TALLOC_CTX *mem_ctx, 
-                              struct tevent_context *ev_ctx, 
                               struct loadparm_context *lp_ctx,
                               struct dom_sid *user_sid,
                               struct dom_sid *group_sid, 
@@ -224,7 +223,7 @@ NTSTATUS security_token_create(TALLOC_CTX *mem_ctx,
        }
 
        /* setup the privilege mask for this token */
-       status = samdb_privilege_setup(ev_ctx, lp_ctx, ptoken);
+       status = samdb_privilege_setup(lp_ctx, ptoken);
        if (!NT_STATUS_IS_OK(status)) {
                talloc_free(ptoken);
                return status;
index 69c4ebea6172f594883773057fb263cb47c22bfe..c50243c06a1a61719ed0159fc91aae70505d5565 100644 (file)
 
 /* connect to the privilege database */
 struct ldb_context *privilege_connect(TALLOC_CTX *mem_ctx, 
-                                     struct tevent_context *ev_ctx,
                                      struct loadparm_context *lp_ctx)
 {
-       return ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, "privilege.ldb",
+       return ldb_wrap_connect(mem_ctx, NULL, lp_ctx, "privilege.ldb",
                                NULL, NULL, 0);
 }
 
@@ -88,8 +87,7 @@ static NTSTATUS samdb_privilege_setup_sid(struct ldb_context *pdb, TALLOC_CTX *m
   setup the privilege mask for this security token based on our
   local SAM
 */
-NTSTATUS samdb_privilege_setup(struct tevent_context *ev_ctx, 
-                              struct loadparm_context *lp_ctx, struct security_token *token)
+NTSTATUS samdb_privilege_setup(struct loadparm_context *lp_ctx, struct security_token *token)
 {
        struct ldb_context *pdb;
        TALLOC_CTX *mem_ctx;
@@ -113,7 +111,7 @@ NTSTATUS samdb_privilege_setup(struct tevent_context *ev_ctx,
        }
 
        mem_ctx = talloc_new(token);
-       pdb = privilege_connect(mem_ctx, ev_ctx, lp_ctx);
+       pdb = privilege_connect(mem_ctx, lp_ctx);
        if (pdb == NULL) {
                talloc_free(mem_ctx);
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
index 07e085edb131c8b27912bb50feb45c12572208f8..b82116052551e663e068a18b1092d1eec6ea34bc 100644 (file)
@@ -1189,7 +1189,7 @@ static NTSTATUS libnet_samsync_ldb_init(TALLOC_CTX *mem_ctx,
                ldap_url = talloc_asprintf(state, "ldap://%s", server);
                
                state->remote_ldb = ldb_wrap_connect(mem_ctx, 
-                                                    state->samsync_state->machine_net_ctx->event_ctx,
+                                                    NULL,
                                                     state->samsync_state->machine_net_ctx->lp_ctx,
                                                     ldap_url, 
                                                     NULL, state->samsync_state->machine_net_ctx->cred,
@@ -1227,7 +1227,6 @@ NTSTATUS libnet_samsync_ldb(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, str
        }
 
        state->pdb             = privilege_connect(mem_ctx, 
-                                                  ctx->event_ctx,
                                                   ctx->lp_ctx);
        if (!state->pdb) {
                return NT_STATUS_INTERNAL_DB_ERROR;
index 641add0c97836e8ee08fce706139cdb7983d2f09..9b95374c0570b9cf163847ff89909b8351af1938 100644 (file)
@@ -49,7 +49,7 @@ NTSTATUS dcesrv_lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
        }
 
        /* and the privilege database */
-       state->pdb = privilege_connect(state, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx);
+       state->pdb = privilege_connect(state, dce_call->conn->dce_ctx->lp_ctx);
        if (state->pdb == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
index 1c6a11d950b938147bb355a28bbc1a5790d62d40..0b1ff068f9bf69decb775db242de966596bd657a 100644 (file)
@@ -198,7 +198,7 @@ static void prime_ldb_databases(struct tevent_context *event_ctx)
        db_context = talloc_new(event_ctx);
 
        samdb_connect(db_context, event_ctx, cmdline_lp_ctx, system_session(cmdline_lp_ctx), 0);
-       privilege_connect(db_context, event_ctx, cmdline_lp_ctx);
+       privilege_connect(db_context, cmdline_lp_ctx);
 
        /* we deliberately leave these open, which allows them to be
         * re-used in ldb_wrap_connect() */