diff options
author | Stephen Gallagher <sgallagh@sgallagh.bos.redhat.com> | 2008-12-15 10:35:49 -0500 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2008-12-15 15:41:50 -0500 |
commit | 519a8e9cba9df29a396d6509fb71a10ef1aacec0 (patch) | |
tree | 0efea08883d6a3fff9cbdd1f1689140bd5e702e0 | |
parent | 124083f5801312aeef6f97402dba181d98eb708c (diff) | |
download | sssd-519a8e9cba9df29a396d6509fb71a10ef1aacec0.tar.gz sssd-519a8e9cba9df29a396d6509fb71a10ef1aacec0.tar.bz2 sssd-519a8e9cba9df29a396d6509fb71a10ef1aacec0.zip |
Adding a parameter to the sbus_service_sbus_init function to allow passing in an sbus_conn_destructor_fn to the sbus_new_connection() function. Fixing minor warning about the usage of talloc_reference.
-rw-r--r-- | server/nss/nsssrv.c | 2 | ||||
-rw-r--r-- | server/providers/data_provider.c | 2 | ||||
-rw-r--r-- | server/providers/data_provider_be.c | 2 | ||||
-rw-r--r-- | server/sbus/sssd_dbus_connection.c | 6 | ||||
-rw-r--r-- | server/util/service_helpers.c | 5 | ||||
-rw-r--r-- | server/util/service_helpers.h | 3 |
6 files changed, 13 insertions, 7 deletions
diff --git a/server/nss/nsssrv.c b/server/nss/nsssrv.c index a3fd6726..4e911254 100644 --- a/server/nss/nsssrv.c +++ b/server/nss/nsssrv.c @@ -252,7 +252,7 @@ static int nss_sbus_init(struct nss_ctx *nctx) /* Set up SBUS connection to the monitor */ ss_ctx = sssd_service_sbus_init(nctx, nctx->ev, nctx->cdb, - nss_sbus_methods); + nss_sbus_methods, NULL); if (ss_ctx == NULL) { DEBUG(0, ("Could not initialize D-BUS.\n")); return ENOMEM; diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c index 150c6f6a..40012808 100644 --- a/server/providers/data_provider.c +++ b/server/providers/data_provider.c @@ -133,7 +133,7 @@ static int dp_monitor_init(struct dp_ctx *dpctx) /* Set up SBUS connection to the monitor */ ss_ctx = sssd_service_sbus_init(dpctx, dpctx->ev, dpctx->cdb, - mon_sbus_methods); + mon_sbus_methods, NULL); if (ss_ctx == NULL) { DEBUG(0, ("Could not initialize D-BUS.\n")); return ENOMEM; diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c index cce4446f..982978aa 100644 --- a/server/providers/data_provider_be.c +++ b/server/providers/data_provider_be.c @@ -191,7 +191,7 @@ static int mon_cli_init(struct be_ctx *ctx) /* Set up SBUS connection to the monitor */ ss_ctx = sssd_service_sbus_init(ctx, ctx->ev, ctx->cdb, - mon_sbus_methods); + mon_sbus_methods, NULL); if (ss_ctx == NULL) { DEBUG(0, ("Could not initialize D-BUS.\n")); return ENOMEM; diff --git a/server/sbus/sssd_dbus_connection.c b/server/sbus/sssd_dbus_connection.c index e4e12264..79f138ab 100644 --- a/server/sbus/sssd_dbus_connection.c +++ b/server/sbus/sssd_dbus_connection.c @@ -533,6 +533,7 @@ int sbus_conn_add_method_ctx(struct sbus_conn_ctx *dct_ctx, { DBusObjectPathVTable *connection_vtable; struct sbus_message_handler_ctx *msg_handler_ctx; + TALLOC_CTX *tmp_ctx; dbus_bool_t dbret; if (!dct_ctx||!method_ctx) { @@ -548,7 +549,10 @@ int sbus_conn_add_method_ctx(struct sbus_conn_ctx *dct_ctx, } DLIST_ADD(dct_ctx->method_ctx_list, method_ctx); - talloc_reference(dct_ctx, method_ctx); + if((tmp_ctx = talloc_reference(dct_ctx, method_ctx))!=method_ctx) { + /* talloc_reference only fails on insufficient memory */ + return ENOMEM; + } /* Set up the vtable for the object path */ connection_vtable = talloc_zero(dct_ctx, DBusObjectPathVTable); diff --git a/server/util/service_helpers.c b/server/util/service_helpers.c index 1630946f..0c5661b2 100644 --- a/server/util/service_helpers.c +++ b/server/util/service_helpers.c @@ -33,7 +33,8 @@ struct service_sbus_ctx *sssd_service_sbus_init(TALLOC_CTX *mem_ctx, struct event_context *ev, struct confdb_ctx *cdb, - struct sbus_method *methods) + struct sbus_method *methods, + sbus_conn_destructor_fn destructor) { struct service_sbus_ctx *ss_ctx; struct sbus_method_ctx *sm_ctx; @@ -61,7 +62,7 @@ struct service_sbus_ctx *sssd_service_sbus_init(TALLOC_CTX *mem_ctx, ret = sbus_new_connection(ss_ctx, ss_ctx->ev, sbus_address, &ss_ctx->scon_ctx, - NULL); + destructor); if (ret != EOK) goto error; conn = sbus_get_connection(ss_ctx->scon_ctx); diff --git a/server/util/service_helpers.h b/server/util/service_helpers.h index f2701d51..05777ea2 100644 --- a/server/util/service_helpers.h +++ b/server/util/service_helpers.h @@ -33,6 +33,7 @@ struct service_sbus_ctx { struct service_sbus_ctx *sssd_service_sbus_init(TALLOC_CTX *mem_ctx, struct event_context *ev, struct confdb_ctx *cdb, - struct sbus_method *methods); + struct sbus_method *methods, + sbus_conn_destructor_fn destructor); #endif /*SERVICE_HELPERS_H_*/ |