From 57df88bb0b4ce656855410a8c2969d93475c2f11 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 24 Feb 2009 16:36:16 -0500 Subject: Proper fix for memory handling problem. sbus_message_handler is not responsible anymore for sending back data in any case. Transfer this responsibility to the handler function called. This way both synchronous and asynchronous funstions use the interface the same way and can properly free memory referenced by the reply after the send buffer has been filled in and all copies are done in sbus_conn_send_reply() --- server/infopipe/infopipe.c | 68 +++++++++++++++++++----------- server/infopipe/infopipe.h | 26 ++++++------ server/infopipe/infopipe_groups.c | 55 ++++++++++++++++++++----- server/infopipe/infopipe_users.c | 66 +++++++++++++++++++++++------ server/infopipe/sysbus.c | 1 + server/monitor/monitor.c | 18 ++++---- server/nss/nsssrv.c | 31 ++++++++++---- server/nss/nsssrv_dp.c | 13 ++++-- server/polkit/sssd_polkit.c | 25 ++++++++--- server/providers/data_provider.c | 54 ++++++++++++++---------- server/providers/data_provider_be.c | 82 +++++++++++++++++++++---------------- server/sbus/sssd_dbus.h | 11 ++--- server/sbus/sssd_dbus_connection.c | 23 +++++++---- server/sbus/sssd_dbus_server.c | 1 + 14 files changed, 313 insertions(+), 161 deletions(-) (limited to 'server') diff --git a/server/infopipe/infopipe.c b/server/infopipe/infopipe.c index dc7abc54..a4ab5e9e 100644 --- a/server/infopipe/infopipe.c +++ b/server/infopipe/infopipe.c @@ -39,7 +39,7 @@ struct infp_ctx { struct sysbus_ctx *sysbus; }; -static int service_identity(DBusMessage *message, void *data, DBusMessage **r) +static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn) { dbus_uint16_t version = INFOPIPE_VERSION; const char *name = INFOPIPE_SERVICE_NAME; @@ -49,41 +49,54 @@ static int service_identity(DBusMessage *message, void *data, DBusMessage **r) DEBUG(4, ("Sending identity data [%s,%d]\n", name, version)); reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; + ret = dbus_message_append_args(reply, DBUS_TYPE_STRING, &name, DBUS_TYPE_UINT16, &version, DBUS_TYPE_INVALID); if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } -static int service_pong(DBusMessage *message, void *data, DBusMessage **r) +static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn) { DBusMessage *reply; dbus_bool_t ret; reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; + ret = dbus_message_append_args(reply, DBUS_TYPE_INVALID); if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } -static int service_reload(DBusMessage *message, void *data, DBusMessage **r) { +static int service_reload(DBusMessage *message, struct sbus_conn_ctx *sconn) +{ /* Monitor calls this function when we need to reload * our configuration information. Perform whatever steps * are needed to update the configuration objects. */ /* Send an empty reply to acknowledge receipt */ - return service_pong(message, data, r); + return service_pong(message, sconn); } struct sbus_method mon_sbus_methods[] = { @@ -140,12 +153,11 @@ struct sbus_method infp_methods[] = { #define INTROSPECT_CHUNK_SIZE 4096 /* Read in one memory page at a time */ -int infp_introspect(DBusMessage *message, void *data, DBusMessage **r) +int infp_introspect(DBusMessage *message, struct sbus_conn_ctx *sconn) { - struct sbus_message_handler_ctx *mh_ctx; DBusMessage *reply; FILE *xml_stream; - char *introspect_xml; + char *introspect_xml = NULL; char *chunk; TALLOC_CTX *tmp_ctx; unsigned long xml_size; @@ -153,14 +165,13 @@ int infp_introspect(DBusMessage *message, void *data, DBusMessage **r) int ret; dbus_bool_t dbret; - mh_ctx = talloc_get_type(data, struct sbus_message_handler_ctx); - tmp_ctx = talloc_new(NULL); if(tmp_ctx == NULL) { return ENOMEM; } - if (mh_ctx->introspection_xml == NULL) { + /* currently always null, to be retrieved form a private pointer later */ + if (introspect_xml == NULL) { /* Read in the Introspection XML the first time */ xml_stream = fopen(SSSD_INTROSPECT_PATH"/"INFP_INTROSPECT_XML, "r"); if(xml_stream == NULL) { @@ -189,12 +200,7 @@ int infp_introspect(DBusMessage *message, void *data, DBusMessage **r) introspect_xml[xml_size] = '\0'; talloc_free(chunk); - /* Store the instrospection XML for future calls */ - mh_ctx->introspection_xml = introspect_xml; - } - else { - /* Subsequent calls should just reuse the saved value */ - introspect_xml = mh_ctx->introspection_xml; + /* TODO: Store the instrospection XML for future calls */ } /* Return the Introspection XML */ @@ -211,6 +217,10 @@ int infp_introspect(DBusMessage *message, void *data, DBusMessage **r) goto done; } + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + DEBUG(9, ("%s\n", introspect_xml)); ret = EOK; @@ -346,9 +356,8 @@ bool infp_get_permissions(const char *username, /* CheckPermissions(STRING domain, STRING object, STRING instance * ARRAY(STRING action_type, STRING attribute) actions) */ -int infp_check_permissions(DBusMessage *message, void *data, DBusMessage **r) +int infp_check_permissions(DBusMessage *message, struct sbus_conn_ctx *sconn) { - struct sbus_message_handler_ctx *mh_ctx; DBusMessage *reply; TALLOC_CTX *tmp_ctx; int current_type; @@ -371,18 +380,17 @@ int infp_check_permissions(DBusMessage *message, void *data, DBusMessage **r) dbus_bool_t *permissions; size_t count; - mh_ctx = talloc_get_type(data, struct sbus_message_handler_ctx); - tmp_ctx = talloc_new(NULL); if(tmp_ctx == NULL) { return ENOMEM; } /* Get the connection UID */ - conn = sbus_get_connection(mh_ctx->conn_ctx); + conn = sbus_get_connection(sconn); conn_name = dbus_message_get_sender(message); if (conn_name == NULL) { DEBUG(0, ("Critical error: D-BUS client has no unique name\n")); + talloc_free(tmp_ctx); return EIO; } dbus_error_init(&error); @@ -390,11 +398,13 @@ int infp_check_permissions(DBusMessage *message, void *data, DBusMessage **r) if (uid == -1) { DEBUG(0, ("Could not identify unix user. Error message was '%s:%s'\n", error.name, error.message)); dbus_error_free(&error); + talloc_free(tmp_ctx); return EIO; } username = get_username_from_uid(tmp_ctx, uid); if (username == NULL) { DEBUG(0, ("No username matched the connected UID\n")); + talloc_free(tmp_ctx); return EIO; } @@ -500,17 +510,27 @@ int infp_check_permissions(DBusMessage *message, void *data, DBusMessage **r) /* Create response message */ reply = dbus_message_new_method_return(message); - if (reply == NULL) return ENOMEM; + if (reply == NULL) { + talloc_free(tmp_ctx); + return ENOMEM; + } dbus_message_append_args(reply, DBUS_TYPE_ARRAY, DBUS_TYPE_BOOLEAN, &permissions, count, DBUS_TYPE_INVALID); + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + talloc_free(tmp_ctx); return EOK; einval: reply = dbus_message_new_error(message, DBUS_ERROR_INVALID_ARGS, einval_msg); + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + talloc_free(tmp_ctx); return EOK; } diff --git a/server/infopipe/infopipe.h b/server/infopipe/infopipe.h index ed5092ed..6e6b7583 100644 --- a/server/infopipe/infopipe.h +++ b/server/infopipe/infopipe.h @@ -47,13 +47,13 @@ * org.freedesktop.DBus.Introspectable interface */ #define INFP_INTROSPECT "Introspect" -int infp_introspect(DBusMessage *message, void *data, DBusMessage **r); +int infp_introspect(DBusMessage *message, struct sbus_conn_ctx *sconn); /********************************************************** * Permission Methods (from infopipe.c) * **********************************************************/ #define INFP_CHECK_PERMISSIONS "CheckPermissions1" -int infp_check_permissions(DBusMessage *message, void *data, DBusMessage **r); +int infp_check_permissions(DBusMessage *message, struct sbus_conn_ctx *sconn); #define INFP_PERMISSION_METHODS \ {INFP_CHECK_PERMISSIONS,infp_check_permissions}, @@ -62,22 +62,22 @@ int infp_check_permissions(DBusMessage *message, void *data, DBusMessage **r); * User Methods (from infopipe_users.c) * **********************************************************/ #define INFP_USERS_GET_CACHED "GetCachedUsers1" -int infp_users_get_cached(DBusMessage *message, void *data, DBusMessage **r); +int infp_users_get_cached(DBusMessage *message, struct sbus_conn_ctx *sconn); #define INFP_USERS_CREATE "CreateUser1" -int infp_users_create(DBusMessage *message, void *data, DBusMessage **r); +int infp_users_create(DBusMessage *message, struct sbus_conn_ctx *sconn); #define INFP_USERS_DELETE "DeleteUser1" -int infp_users_delete(DBusMessage *message, void *data, DBusMessage **r); +int infp_users_delete(DBusMessage *message, struct sbus_conn_ctx *sconn); #define INFP_USERS_GET_ATTR "GetUserAttributes1" -int infp_users_get_attr(DBusMessage *message, void *data, DBusMessage **r); +int infp_users_get_attr(DBusMessage *message, struct sbus_conn_ctx *sconn); #define INFP_USERS_SET_ATTR "SetUserAttributes1" -int infp_users_set_attr(DBusMessage *message, void *data, DBusMessage **r); +int infp_users_set_attr(DBusMessage *message, struct sbus_conn_ctx *sconn); #define INFP_USERS_SET_UID "Set_YouReallyDoNotWantToUseThisFunction_UserUID1" -int infp_users_set_uid(DBusMessage *message, void *data, DBusMessage **r); +int infp_users_set_uid(DBusMessage *message, struct sbus_conn_ctx *sconn); #define INFP_USER_METHODS \ {INFP_USERS_GET_CACHED, infp_users_get_cached}, \ @@ -92,19 +92,19 @@ int infp_users_set_uid(DBusMessage *message, void *data, DBusMessage **r); **********************************************************/ #define INFP_GROUPS_CREATE "CreateGroup1" -int infp_groups_create(DBusMessage *message, void *data, DBusMessage **r); +int infp_groups_create(DBusMessage *message, struct sbus_conn_ctx *sconn); #define INFP_GROUPS_DELETE "DeleteGroup1" -int infp_groups_delete(DBusMessage *message, void *data, DBusMessage **r); +int infp_groups_delete(DBusMessage *message, struct sbus_conn_ctx *sconn); #define INFP_GROUPS_ADD_MEMBERS "AddGroupMembers1" -int infp_groups_add_members(DBusMessage *message, void *data, DBusMessage **r); +int infp_groups_add_members(DBusMessage *message, struct sbus_conn_ctx *sconn); #define INFP_GROUPS_REMOVE_MEMBERS "RemoveGroupMembers1" -int infp_groups_remove_members(DBusMessage *message, void *data, DBusMessage **r); +int infp_groups_remove_members(DBusMessage *message, struct sbus_conn_ctx *sconn); #define INFP_GROUPS_SET_GID "Set_YouReallyDoNotWantToUseThisFunction_GroupGID1" -int infp_groups_set_gid(DBusMessage *message, void *data, DBusMessage **r); +int infp_groups_set_gid(DBusMessage *message, struct sbus_conn_ctx *sconn); #define INFP_GROUP_METHODS \ {INFP_GROUPS_CREATE, infp_groups_create}, \ diff --git a/server/infopipe/infopipe_groups.c b/server/infopipe/infopipe_groups.c index 4b9cfc22..7ec85296 100644 --- a/server/infopipe/infopipe_groups.c +++ b/server/infopipe/infopipe_groups.c @@ -23,32 +23,67 @@ #include "util/util.h" #include "infopipe.h" -int infp_groups_create(DBusMessage *message, void *data, DBusMessage **r) +int infp_groups_create(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_groups_delete(DBusMessage *message, void *data, DBusMessage **r) +int infp_groups_delete(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_groups_add_members(DBusMessage *message, void *data, DBusMessage **r) +int infp_groups_add_members(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_groups_remove_members(DBusMessage *message, void *data, DBusMessage **r) +int infp_groups_remove_members(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_groups_set_gid(DBusMessage *message, void *data, DBusMessage **r) +int infp_groups_set_gid(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } diff --git a/server/infopipe/infopipe_users.c b/server/infopipe/infopipe_users.c index 632e624f..2c107bc4 100644 --- a/server/infopipe/infopipe_users.c +++ b/server/infopipe/infopipe_users.c @@ -22,38 +22,80 @@ #include "util/util.h" #include "infopipe.h" -int infp_users_get_cached(DBusMessage *message, void *data, DBusMessage **r) +int infp_users_get_cached(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_users_create(DBusMessage *message, void *data, DBusMessage **r) +int infp_users_create(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_users_delete(DBusMessage *message, void *data, DBusMessage **r) +int infp_users_delete(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_users_get_attr(DBusMessage *message, void *data, DBusMessage **r) +int infp_users_get_attr(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_users_set_attr(DBusMessage *message, void *data, DBusMessage **r) +int infp_users_set_attr(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_users_set_uid(DBusMessage *message, void *data, DBusMessage **r) +int infp_users_set_uid(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } diff --git a/server/infopipe/sysbus.c b/server/infopipe/sysbus.c index a6b352fa..5c272e66 100644 --- a/server/infopipe/sysbus.c +++ b/server/infopipe/sysbus.c @@ -125,6 +125,7 @@ int sysbus_init(TALLOC_CTX *mem_ctx, struct sysbus_ctx **sysbus, if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { /* We were unable to register on the system bus */ DEBUG(0, ("Unable to request name on the system bus. Error: %s\n", dbus_error.message)); + if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); talloc_free(system_bus); return EIO; } diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c index 166cf3cd..759a6881 100644 --- a/server/monitor/monitor.c +++ b/server/monitor/monitor.c @@ -88,22 +88,25 @@ static void set_global_checker(struct mt_ctx *ctx); /* dbus_get_monitor_version * Return the monitor version over D-BUS */ static int dbus_get_monitor_version(DBusMessage *message, - void *data, - DBusMessage **r) + struct sbus_conn_ctx *sconn) { const char *version = MONITOR_VERSION; DBusMessage *reply; dbus_bool_t ret; reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; ret = dbus_message_append_args(reply, DBUS_TYPE_STRING, &version, DBUS_TYPE_INVALID); - if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } @@ -525,14 +528,12 @@ static int dbus_service_init(struct sbus_conn_ctx *conn_ctx, void *data) DBusMessage *msg; DBusPendingCall *pending_reply; DBusConnection *conn; - DBusError dbus_error; dbus_bool_t dbret; DEBUG(3, ("Initializing D-BUS Service\n")); ctx = talloc_get_type(data, struct mt_ctx); conn = sbus_get_connection(conn_ctx); - dbus_error_init(&dbus_error); /* hang off this memory to the connection so that when the connection * is freed we can call a destructor to clear up the structure and @@ -633,6 +634,7 @@ static void identity_check(DBusPendingCall *pending, void *data) DBUS_TYPE_INVALID); if (!ret) { DEBUG(1,("Failed, to parse message, killing connection\n")); + if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); sbus_disconnect(conn_ctx); goto done; } @@ -694,7 +696,6 @@ static int service_send_ping(struct mt_svc *svc) DBusMessage *msg; DBusPendingCall *pending_reply; DBusConnection *conn; - DBusError dbus_error; dbus_bool_t dbret; if (!svc->mt_conn) { @@ -704,7 +705,6 @@ static int service_send_ping(struct mt_svc *svc) DEBUG(4,("Pinging %s\n", svc->name)); conn = sbus_get_connection(svc->mt_conn->conn_ctx); - dbus_error_init(&dbus_error); /* * Set up identity request @@ -746,13 +746,11 @@ static void ping_check(DBusPendingCall *pending, void *data) struct mt_svc *svc; struct sbus_conn_ctx *conn_ctx; DBusMessage *reply; - DBusError dbus_error; const char *dbus_error_name; int type; svc = talloc_get_type(data, struct mt_svc); conn_ctx = svc->mt_conn->conn_ctx; - dbus_error_init(&dbus_error); reply = dbus_pending_call_steal_reply(pending); if (!reply) { diff --git a/server/nss/nsssrv.c b/server/nss/nsssrv.c index b6191cce..c48aed4a 100644 --- a/server/nss/nsssrv.c +++ b/server/nss/nsssrv.c @@ -44,9 +44,9 @@ #define SSS_NSS_PIPE_NAME "nss" -static int service_identity(DBusMessage *message, void *data, DBusMessage **r); -static int service_pong(DBusMessage *message, void *data, DBusMessage **r); -static int service_reload(DBusMessage *message, void *data, DBusMessage **r); +static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn); +static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn); +static int service_reload(DBusMessage *message, struct sbus_conn_ctx *sconn); static int nss_init_domains(struct nss_ctx *nctx); static int _domain_comparator(const void *key1, const void *key2); @@ -227,7 +227,7 @@ static void accept_fd_handler(struct event_context *ev, return; } -static int service_identity(DBusMessage *message, void *data, DBusMessage **r) +static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn) { dbus_uint16_t version = NSS_SBUS_SERVICE_VERSION; const char *name = NSS_SBUS_SERVICE_NAME; @@ -238,41 +238,54 @@ static int service_identity(DBusMessage *message, void *data, DBusMessage **r) name, version)); reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; + ret = dbus_message_append_args(reply, DBUS_TYPE_STRING, &name, DBUS_TYPE_UINT16, &version, DBUS_TYPE_INVALID); if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } -static int service_pong(DBusMessage *message, void *data, DBusMessage **r) +static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn) { DBusMessage *reply; dbus_bool_t ret; reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; + ret = dbus_message_append_args(reply, DBUS_TYPE_INVALID); if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } -static int service_reload(DBusMessage *message, void *data, DBusMessage **r) { +static int service_reload(DBusMessage *message, struct sbus_conn_ctx *sconn) +{ /* Monitor calls this function when we need to reload * our configuration information. Perform whatever steps * are needed to update the configuration objects. */ /* Send an empty reply to acknowledge receipt */ - return service_pong(message, data, r); + return service_pong(message, sconn); } static int nss_sbus_init(struct nss_ctx *nctx) diff --git a/server/nss/nsssrv_dp.c b/server/nss/nsssrv_dp.c index 487ac285..ec8aea8b 100644 --- a/server/nss/nsssrv_dp.c +++ b/server/nss/nsssrv_dp.c @@ -101,7 +101,6 @@ int nss_dp_send_acct_req(struct nss_ctx *nctx, TALLOC_CTX *memctx, DBusMessage *msg; DBusPendingCall *pending_reply; DBusConnection *conn; - DBusError dbus_error; dbus_bool_t ret; uint32_t be_type; const char *attrs = "core"; @@ -144,7 +143,6 @@ int nss_dp_send_acct_req(struct nss_ctx *nctx, TALLOC_CTX *memctx, } conn = sbus_get_connection(nctx->dp_ctx->scon_ctx); - dbus_error_init(&dbus_error); /* create the message */ msg = dbus_message_new_method_call(NULL, @@ -248,6 +246,7 @@ static int nss_dp_get_reply(DBusPendingCall *pending, if (!ret) { DEBUG(1,("Filed to parse message\n")); /* FIXME: Destroy this connection ? */ + if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); err = EIO; goto done; } @@ -281,7 +280,7 @@ done: return err; } -static int nss_dp_identity(DBusMessage *message, void *data, DBusMessage **r) +static int nss_dp_identity(DBusMessage *message, struct sbus_conn_ctx *sconn) { dbus_uint16_t version = DATA_PROVIDER_VERSION; dbus_uint16_t clitype = DP_CLI_FRONTEND; @@ -294,6 +293,8 @@ static int nss_dp_identity(DBusMessage *message, void *data, DBusMessage **r) clitype, version, cliname)); reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; + ret = dbus_message_append_args(reply, DBUS_TYPE_UINT16, &clitype, DBUS_TYPE_UINT16, &version, @@ -301,10 +302,14 @@ static int nss_dp_identity(DBusMessage *message, void *data, DBusMessage **r) DBUS_TYPE_STRING, &nullname, DBUS_TYPE_INVALID); if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } diff --git a/server/polkit/sssd_polkit.c b/server/polkit/sssd_polkit.c index 6c7d0e1e..03436472 100644 --- a/server/polkit/sssd_polkit.c +++ b/server/polkit/sssd_polkit.c @@ -35,7 +35,7 @@ struct spk_ctx { struct sbus_srv_ctx *sbus_srv; }; -static int service_identity(DBusMessage *message, void *data, DBusMessage **r) +static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn) { dbus_uint16_t version = POLKIT_VERSION; const char *name = POLKIT_SERVICE_NAME; @@ -45,41 +45,54 @@ static int service_identity(DBusMessage *message, void *data, DBusMessage **r) DEBUG(4, ("Sending identity data [%s,%d]\n", name, version)); reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; + ret = dbus_message_append_args(reply, DBUS_TYPE_STRING, &name, DBUS_TYPE_UINT16, &version, DBUS_TYPE_INVALID); if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } -static int service_pong(DBusMessage *message, void *data, DBusMessage **r) +static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn) { DBusMessage *reply; dbus_bool_t ret; reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; + ret = dbus_message_append_args(reply, DBUS_TYPE_INVALID); if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } -static int service_reload(DBusMessage *message, void *data, DBusMessage **r) { +static int service_reload(DBusMessage *message, struct sbus_conn_ctx *sconn) +{ /* Monitor calls this function when we need to reload * our configuration information. Perform whatever steps * are needed to update the configuration objects. */ /* Send an empty reply to acknowledge receipt */ - return service_pong(message, data, r); + return service_pong(message, sconn); } struct sbus_method mon_sbus_methods[] = { diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c index aa66c8e5..c6dc8d12 100644 --- a/server/providers/data_provider.c +++ b/server/providers/data_provider.c @@ -76,9 +76,9 @@ struct dp_frontend { static int dp_backend_destructor(void *ctx); static int dp_frontend_destructor(void *ctx); -static int service_identity(DBusMessage *message, void *data, DBusMessage **r); -static int service_pong(DBusMessage *message, void *data, DBusMessage **r); -static int service_reload(DBusMessage *message, void *data, DBusMessage **r); +static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn); +static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn); +static int service_reload(DBusMessage *message, struct sbus_conn_ctx *sconn); struct sbus_method mon_sbus_methods[] = { { SERVICE_METHOD_IDENTITY, service_identity }, @@ -87,7 +87,7 @@ struct sbus_method mon_sbus_methods[] = { { NULL, NULL } }; -static int dp_get_account_info(DBusMessage *message, void *data, DBusMessage **r); +static int dp_get_account_info(DBusMessage *message, struct sbus_conn_ctx *sconn); struct sbus_method dp_sbus_methods[] = { { DP_SRV_METHOD_GETACCTINFO, dp_get_account_info }, @@ -108,7 +108,7 @@ struct dp_be_request { struct dp_backend *be; }; -static int service_identity(DBusMessage *message, void *data, DBusMessage **r) +static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn) { dbus_uint16_t version = DATA_PROVIDER_VERSION; const char *name = DATA_PROVIDER_SERVICE_NAME; @@ -118,41 +118,54 @@ static int service_identity(DBusMessage *message, void *data, DBusMessage **r) DEBUG(4, ("Sending identity data [%s,%d]\n", name, version)); reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; + ret = dbus_message_append_args(reply, DBUS_TYPE_STRING, &name, DBUS_TYPE_UINT16, &version, DBUS_TYPE_INVALID); if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } -static int service_pong(DBusMessage *message, void *data, DBusMessage **r) +static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn) { DBusMessage *reply; dbus_bool_t ret; reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; + ret = dbus_message_append_args(reply, DBUS_TYPE_INVALID); if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } -static int service_reload(DBusMessage *message, void *data, DBusMessage **r) { +static int service_reload(DBusMessage *message, struct sbus_conn_ctx *sconn) +{ /* Monitor calls this function when we need to reload * our configuration information. Perform whatever steps * are needed to update the configuration objects. */ /* Send an empty reply to acknowledge receipt */ - return service_pong(message, data, r); + return service_pong(message, sconn); } static int dp_monitor_init(struct dp_ctx *dpctx) @@ -203,12 +216,10 @@ static int dbus_dp_init(struct sbus_conn_ctx *conn_ctx, void *data) DBusMessage *msg; DBusPendingCall *pending_reply; DBusConnection *conn; - DBusError dbus_error; dbus_bool_t dbret; dpctx = talloc_get_type(data, struct dp_ctx); conn = sbus_get_connection(conn_ctx); - dbus_error_init(&dbus_error); /* hang off this memory to the connection so that when the connection * is freed we can potentially call a destructor */ @@ -300,6 +311,7 @@ static void be_identity_check(DBusPendingCall *pending, void *data) DBUS_TYPE_INVALID); if (!ret) { DEBUG(1,("be_identity_check failed, to parse message, killing connection\n")); + if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); sbus_disconnect(dpcli->conn_ctx); goto done; } @@ -422,6 +434,7 @@ static void be_got_account_info(DBusPendingCall *pending, void *data) DBUS_TYPE_INVALID); if (!ret) { DEBUG(1,("Failed to parse message, killing connection\n")); + if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); sbus_disconnect(bereq->be->dpcli->conn_ctx); goto done; } @@ -489,11 +502,9 @@ static int dp_send_acct_req(struct dp_be_request *bereq, DBusMessage *msg; DBusPendingCall *pending_reply; DBusConnection *conn; - DBusError dbus_error; dbus_bool_t ret; conn = sbus_get_connection(bereq->be->dpcli->conn_ctx); - dbus_error_init(&dbus_error); /* create the message */ msg = dbus_message_new_method_call(NULL, @@ -538,9 +549,8 @@ static int dp_send_acct_req(struct dp_be_request *bereq, return EOK; } -static int dp_get_account_info(DBusMessage *message, void *data, DBusMessage **r) +static int dp_get_account_info(DBusMessage *message, struct sbus_conn_ctx *sconn) { - struct sbus_message_handler_ctx *smh_ctx; struct dp_client *dpcli; struct dp_be_request *bereq; struct dp_request *dpreq = NULL; @@ -554,10 +564,7 @@ static int dp_get_account_info(DBusMessage *message, void *data, DBusMessage **r const char *errmsg = NULL; int dpret = 0, ret = 0; - if (!data) return EINVAL; - smh_ctx = talloc_get_type(data, struct sbus_message_handler_ctx); - if (!smh_ctx) return EINVAL; - user_data = sbus_conn_get_private_data(smh_ctx->conn_ctx); + user_data = sbus_conn_get_private_data(sconn); if (!user_data) return EINVAL; dpcli = talloc_get_type(user_data, struct dp_client); if (!dpcli) return EINVAL; @@ -572,6 +579,7 @@ static int dp_get_account_info(DBusMessage *message, void *data, DBusMessage **r DBUS_TYPE_INVALID); if (!ret) { DEBUG(1,("Failed, to parse message!\n")); + if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); return EIO; } @@ -579,6 +587,7 @@ static int dp_get_account_info(DBusMessage *message, void *data, DBusMessage **r domain, type, attrs, filter)); reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; /* search for domain */ if (!domain) { @@ -705,7 +714,10 @@ respond: DBUS_TYPE_INVALID); if (!dbret) return EIO; - *r = reply; + /* send reply back immediately */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c index 7b491ce7..26a78efb 100644 --- a/server/providers/data_provider_be.c +++ b/server/providers/data_provider_be.c @@ -44,8 +44,8 @@ typedef int (*be_init_fn_t)(TALLOC_CTX *, struct be_mod_ops **, void **); -static int service_identity(DBusMessage *message, void *data, DBusMessage **r); -static int service_pong(DBusMessage *message, void *data, DBusMessage **r); +static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn); +static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn); struct sbus_method mon_sbus_methods[] = { { SERVICE_METHOD_IDENTITY, service_identity }, @@ -53,9 +53,9 @@ struct sbus_method mon_sbus_methods[] = { { NULL, NULL } }; -static int be_identity(DBusMessage *message, void *data, DBusMessage **r); -static int be_check_online(DBusMessage *message, void *data, DBusMessage **r); -static int be_get_account_info(DBusMessage *message, void *data, DBusMessage **r); +static int be_identity(DBusMessage *message, struct sbus_conn_ctx *sconn); +static int be_check_online(DBusMessage *message, struct sbus_conn_ctx *sconn); +static int be_get_account_info(DBusMessage *message, struct sbus_conn_ctx *sconn); struct sbus_method be_methods[] = { { DP_CLI_METHOD_IDENTITY, be_identity }, @@ -64,19 +64,15 @@ struct sbus_method be_methods[] = { { NULL, NULL } }; -static int service_identity(DBusMessage *message, void *data, DBusMessage **r) +static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn) { dbus_uint16_t version = DATA_PROVIDER_VERSION; - struct sbus_message_handler_ctx *smh_ctx; struct be_ctx *ctx; DBusMessage *reply; dbus_bool_t ret; void *user_data; - if (!data) return EINVAL; - smh_ctx = talloc_get_type(data, struct sbus_message_handler_ctx); - if (!smh_ctx) return EINVAL; - user_data = sbus_conn_get_private_data(smh_ctx->conn_ctx); + user_data = sbus_conn_get_private_data(sconn); if (!user_data) return EINVAL; ctx = talloc_get_type(user_data, struct be_ctx); if (!ctx) return EINVAL; @@ -84,47 +80,55 @@ static int service_identity(DBusMessage *message, void *data, DBusMessage **r) DEBUG(4,("Sending ID reply: (%s,%d)\n", ctx->identity, version)); reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; + ret = dbus_message_append_args(reply, DBUS_TYPE_STRING, &ctx->identity, DBUS_TYPE_UINT16, &version, DBUS_TYPE_INVALID); if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } -static int service_pong(DBusMessage *message, void *data, DBusMessage **r) +static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn) { DBusMessage *reply; dbus_bool_t ret; reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; + ret = dbus_message_append_args(reply, DBUS_TYPE_INVALID); if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } -static int be_identity(DBusMessage *message, void *data, DBusMessage **r) +static int be_identity(DBusMessage *message, struct sbus_conn_ctx *sconn) { dbus_uint16_t version = DATA_PROVIDER_VERSION; dbus_uint16_t clitype = DP_CLI_BACKEND; - struct sbus_message_handler_ctx *smh_ctx; struct be_ctx *ctx; DBusMessage *reply; dbus_bool_t ret; void *user_data; - if (!data) return EINVAL; - smh_ctx = talloc_get_type(data, struct sbus_message_handler_ctx); - if (!smh_ctx) return EINVAL; - user_data = sbus_conn_get_private_data(smh_ctx->conn_ctx); + user_data = sbus_conn_get_private_data(sconn); if (!user_data) return EINVAL; ctx = talloc_get_type(user_data, struct be_ctx); if (!ctx) return EINVAL; @@ -133,6 +137,8 @@ static int be_identity(DBusMessage *message, void *data, DBusMessage **r) clitype, version, ctx->name, ctx->domain)); reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; + ret = dbus_message_append_args(reply, DBUS_TYPE_UINT16, &clitype, DBUS_TYPE_UINT16, &version, @@ -140,10 +146,14 @@ static int be_identity(DBusMessage *message, void *data, DBusMessage **r) DBUS_TYPE_STRING, &ctx->domain, DBUS_TYPE_INVALID); if (!ret) { + dbus_message_unref(reply); return EIO; } - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } @@ -237,9 +247,8 @@ static void online_chk_callback(struct be_req *req, int status, } -static int be_check_online(DBusMessage *message, void *data, DBusMessage **r) +static int be_check_online(DBusMessage *message, struct sbus_conn_ctx *sconn) { - struct sbus_message_handler_ctx *smh_ctx; struct be_online_req *req; struct be_req *be_req; struct be_ctx *ctx; @@ -252,15 +261,13 @@ static int be_check_online(DBusMessage *message, void *data, DBusMessage **r) dbus_uint32_t err_min; const char *err_msg; - if (!data) return EINVAL; - smh_ctx = talloc_get_type(data, struct sbus_message_handler_ctx); - if (!smh_ctx) return EINVAL; - user_data = sbus_conn_get_private_data(smh_ctx->conn_ctx); + user_data = sbus_conn_get_private_data(sconn); if (!user_data) return EINVAL; ctx = talloc_get_type(user_data, struct be_ctx); if (!ctx) return EINVAL; reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; /* process request */ be_req = talloc(ctx, struct be_req); @@ -311,7 +318,10 @@ done: DBUS_TYPE_INVALID); if (!dbret) return EIO; - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } @@ -355,9 +365,8 @@ static void acctinfo_callback(struct be_req *req, int status, talloc_free(req); } -static int be_get_account_info(DBusMessage *message, void *data, DBusMessage **r) +static int be_get_account_info(DBusMessage *message, struct sbus_conn_ctx *sconn) { - struct sbus_message_handler_ctx *smh_ctx; struct be_acct_req *req; struct be_req *be_req; struct be_ctx *ctx; @@ -375,12 +384,8 @@ static int be_get_account_info(DBusMessage *message, void *data, DBusMessage **r const char *err_msg; be_req = NULL; - *r = NULL; - if (!data) return EINVAL; - smh_ctx = talloc_get_type(data, struct sbus_message_handler_ctx); - if (!smh_ctx) return EINVAL; - user_data = sbus_conn_get_private_data(smh_ctx->conn_ctx); + user_data = sbus_conn_get_private_data(sconn); if (!user_data) return EINVAL; ctx = talloc_get_type(user_data, struct be_ctx); if (!ctx) return EINVAL; @@ -394,12 +399,14 @@ static int be_get_account_info(DBusMessage *message, void *data, DBusMessage **r DBUS_TYPE_INVALID); if (!ret) { DEBUG(1,("Failed, to parse message!\n")); + if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); return EIO; } DEBUG(4, ("Got request for [%u][%s][%s]\n", type, attrs, filter)); reply = dbus_message_new_method_return(message); + if (!reply) return ENOMEM; if (attrs) { if (strcmp(attrs, "core") == 0) attr_type = BE_ATTR_CORE; @@ -489,7 +496,10 @@ done: DEBUG(4, ("Request processed. Returned %d,%d,%s\n", err_maj, err_min, err_msg)); - *r = reply; + /* send reply back */ + sbus_conn_send_reply(sconn, reply); + dbus_message_unref(reply); + return EOK; } diff --git a/server/sbus/sssd_dbus.h b/server/sbus/sssd_dbus.h index 5fec9c80..a05d229a 100644 --- a/server/sbus/sssd_dbus.h +++ b/server/sbus/sssd_dbus.h @@ -27,7 +27,7 @@ struct sbus_srv_ctx; #include "dbus/dbus.h" -typedef int (*sbus_msg_handler_fn)(DBusMessage *, void *, DBusMessage **); +typedef int (*sbus_msg_handler_fn)(DBusMessage *, struct sbus_conn_ctx *); /* * sbus_conn_destructor_fn @@ -66,12 +66,6 @@ struct sbus_method_ctx { sbus_msg_handler_fn introspect_fn; }; -struct sbus_message_handler_ctx { - struct sbus_conn_ctx *conn_ctx; - struct sbus_method_ctx *method_ctx; - char *introspection_xml; -}; - /* Server Functions */ int sbus_new_server(TALLOC_CTX *mem_ctx, struct event_context *ev, struct sbus_method_ctx *ctx, @@ -129,4 +123,7 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn, DBusMessage *message, void *user_data); +void sbus_conn_send_reply(struct sbus_conn_ctx *conn_ctx, + DBusMessage *reply); + #endif /* _SSSD_DBUS_H_*/ diff --git a/server/sbus/sssd_dbus_connection.c b/server/sbus/sssd_dbus_connection.c index d02dc6c8..9b3da9cc 100644 --- a/server/sbus/sssd_dbus_connection.c +++ b/server/sbus/sssd_dbus_connection.c @@ -18,6 +18,11 @@ struct sbus_conn_ctx { void *pvt_data; /* Private data for this connection */ }; +struct sbus_message_handler_ctx { + struct sbus_conn_ctx *conn_ctx; + struct sbus_method_ctx *method_ctx; +}; + struct sbus_conn_watch_ctx { DBusWatch *watch; int fd; @@ -354,6 +359,7 @@ int sbus_new_connection(TALLOC_CTX *ctx, struct event_context *ev, if (!dbus_conn) { DEBUG(1, ("Failed to open connection: name=%s, message=%s\n", dbus_error.name, dbus_error.message)); + if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); return EIO; } @@ -509,7 +515,7 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn, for (i = 0; ctx->method_ctx->methods[i].method != NULL; i++) { if (strcmp(method, ctx->method_ctx->methods[i].method) == 0) { found = 1; - ret = ctx->method_ctx->methods[i].fn(message, ctx, &reply); + ret = ctx->method_ctx->methods[i].fn(message, ctx->conn_ctx); if (ret != EOK) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; break; } @@ -532,7 +538,7 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn, /* If we have been asked for introspection data and we have * an introspection function registered, user that. */ - ret = ctx->method_ctx->introspect_fn(message, ctx, &reply); + ret = ctx->method_ctx->introspect_fn(message, ctx->conn_ctx); if (ret != EOK) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } @@ -540,13 +546,6 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn, return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } - DEBUG(5, ("Method %s complete. Reply was %ssent.\n", method, reply?"":"not ")); - - if (reply) { - dbus_connection_send(conn, reply, NULL); - dbus_message_unref(reply); - } - return DBUS_HANDLER_RESULT_HANDLED; } @@ -654,3 +653,9 @@ bool sbus_conn_disconnecting(struct sbus_conn_ctx *conn_ctx) if (conn_ctx->disconnect == 1) return true; return false; } + +void sbus_conn_send_reply(struct sbus_conn_ctx *conn_ctx, DBusMessage *reply) +{ + dbus_connection_send(conn_ctx->conn, reply, NULL); +} + diff --git a/server/sbus/sssd_dbus_server.c b/server/sbus/sssd_dbus_server.c index 03cd6524..eae1ce67 100644 --- a/server/sbus/sssd_dbus_server.c +++ b/server/sbus/sssd_dbus_server.c @@ -272,6 +272,7 @@ int sbus_new_server(TALLOC_CTX *mem_ctx, if (!dbus_server) { DEBUG(1,("dbus_server_listen failed! (name=%s, message=%s)\n", dbus_error.name, dbus_error.message)); + if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); return EIO; } -- cgit