summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/sbus/sssd_dbus.h1
-rw-r--r--server/sbus/sssd_dbus_connection.c5
-rw-r--r--server/sbus/sssd_dbus_server.c14
3 files changed, 13 insertions, 7 deletions
diff --git a/server/sbus/sssd_dbus.h b/server/sbus/sssd_dbus.h
index 321bd603..94447a6e 100644
--- a/server/sbus/sssd_dbus.h
+++ b/server/sbus/sssd_dbus.h
@@ -82,6 +82,7 @@ int sbus_default_connection_destructor(void *ctx);
DBusConnection *sbus_get_connection(struct sbus_conn_ctx *conn_ctx);
void sbus_disconnect(struct sbus_conn_ctx *conn_ctx);
void sbus_conn_set_private_data(struct sbus_conn_ctx *conn_ctx, void *pvt_data);
+void *sbus_conn_get_private_data(struct sbus_conn_ctx *conn_ctx);
int sbus_conn_add_method_ctx(struct sbus_conn_ctx *conn_ctx,
struct sbus_method_ctx *method_ctx);
diff --git a/server/sbus/sssd_dbus_connection.c b/server/sbus/sssd_dbus_connection.c
index 15086f3b..996c0e85 100644
--- a/server/sbus/sssd_dbus_connection.c
+++ b/server/sbus/sssd_dbus_connection.c
@@ -602,3 +602,8 @@ void sbus_conn_set_private_data(struct sbus_conn_ctx *conn_ctx, void *pvt_data)
{
conn_ctx->pvt_data = pvt_data;
}
+
+void *sbus_conn_get_private_data(struct sbus_conn_ctx *conn_ctx)
+{
+ return conn_ctx->pvt_data;
+}
diff --git a/server/sbus/sssd_dbus_server.c b/server/sbus/sssd_dbus_server.c
index f8396b5c..3b3f9f1a 100644
--- a/server/sbus/sssd_dbus_server.c
+++ b/server/sbus/sssd_dbus_server.c
@@ -56,7 +56,7 @@ struct dbus_srv_timeout_ctx {
struct sbus_srv_ctx *top;
};
-static int sbus_server_destructor(void **server);
+static int sbus_server_destructor(void *ctx);
/*
* dbus_server_read_write_handler
@@ -209,7 +209,7 @@ static void sbus_server_init_new_connection(DBusServer *server,
int ret;
DEBUG(3,("Entering.\n"));
- srv_ctx = talloc_get_type(data,struct sbus_srv_ctx);
+ srv_ctx = talloc_get_type(data, struct sbus_srv_ctx);
if (srv_ctx == NULL) {
return;
}
@@ -259,7 +259,6 @@ int sbus_new_server(struct event_context *ev, struct sbus_method_ctx *ctx,
{
struct sbus_srv_ctx *srv_ctx;
DBusServer *dbus_server;
- DBusServer **dbus_server_talloc;
DBusError dbus_error;
dbus_bool_t dbret;
@@ -280,14 +279,14 @@ int sbus_new_server(struct event_context *ev, struct sbus_method_ctx *ctx,
return ENOMEM;
}
- dbus_server_talloc = sssd_mem_takeover(ctx, dbus_server,
- sbus_server_destructor);
srv_ctx->ev = ev;
srv_ctx->server = dbus_server;
srv_ctx->sd_ctx = ctx;
srv_ctx->init_fn = init_fn;
srv_ctx->init_pvt_data = init_pvt_data;
+ talloc_set_destructor((TALLOC_CTX *)srv_ctx, sbus_server_destructor);
+
/* Set up D-BUS new connection handler */
dbus_server_set_new_connection_function(srv_ctx->server,
sbus_server_init_new_connection,
@@ -322,8 +321,9 @@ int sbus_new_server(struct event_context *ev, struct sbus_method_ctx *ctx,
return EOK;
}
-static int sbus_server_destructor(void **server)
+static int sbus_server_destructor(void *ctx)
{
- dbus_server_disconnect(*server);
+ struct sbus_srv_ctx *srv_ctx = talloc_get_type(ctx, struct sbus_srv_ctx);
+ dbus_server_disconnect(srv_ctx->server);
return 0;
}