summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/monitor/monitor.c80
-rw-r--r--server/providers/data_provider.c124
-rw-r--r--server/providers/data_provider_be.c82
-rw-r--r--server/providers/dp_backend.h4
-rw-r--r--server/responder/common/responder.h2
-rw-r--r--server/responder/common/responder_common.c4
-rw-r--r--server/responder/common/responder_dp.c20
-rw-r--r--server/responder/nss/nsssrv.c30
-rw-r--r--server/responder/nss/nsssrv_dp.c4
-rw-r--r--server/responder/pam/pamsrv.c30
-rw-r--r--server/responder/pam/pamsrv_dp.c12
-rw-r--r--server/sbus/sbus_client.c16
-rw-r--r--server/sbus/sbus_client.h2
-rw-r--r--server/sbus/sssd_dbus.h30
-rw-r--r--server/sbus/sssd_dbus_connection.c294
-rw-r--r--server/sbus/sssd_dbus_server.c16
16 files changed, 375 insertions, 375 deletions
diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c
index 4e92213e6..a2b2de587 100644
--- a/server/monitor/monitor.c
+++ b/server/monitor/monitor.c
@@ -59,7 +59,7 @@
#define MONITOR_CONF_ENTRY "config/services/monitor"
struct mt_conn {
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
struct mt_svc *svc_ptr;
};
@@ -121,7 +121,7 @@ struct mt_ctx {
static int start_service(struct mt_svc *mt_svc);
-static int dbus_service_init(struct sbus_conn_ctx *conn_ctx, void *data);
+static int dbus_service_init(struct sbus_connection *conn, void *data);
static void identity_check(DBusPendingCall *pending, void *data);
static int service_send_ping(struct mt_svc *svc);
@@ -148,7 +148,7 @@ static int monitor_cleanup(void);
/* dbus_get_monitor_version
* Return the monitor version over D-BUS */
static int dbus_get_monitor_version(DBusMessage *message,
- struct sbus_conn_ctx *sconn)
+ struct sbus_connection *conn)
{
const char *version = MONITOR_VERSION;
DBusMessage *reply;
@@ -164,7 +164,7 @@ static int dbus_get_monitor_version(DBusMessage *message,
}
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
@@ -407,10 +407,10 @@ static void shutdown_reply(DBusPendingCall *pending, void *data)
{
DBusMessage *reply;
int type;
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
struct mt_svc *svc = talloc_get_type(data, struct mt_svc);
- conn_ctx = svc->mt_conn->conn_ctx;
+ conn = svc->mt_conn->conn;
reply = dbus_pending_call_steal_reply(pending);
if (!reply) {
/* reply should never be null. This function shouldn't be called
@@ -454,14 +454,14 @@ done:
*/
static int monitor_shutdown_service(struct mt_svc *svc)
{
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
DBusMessage *msg;
DBusPendingCall *pending_reply;
dbus_bool_t dbret;
/* Stop the service checker */
- conn = sbus_get_connection(svc->mt_conn->conn_ctx);
+ dbus_conn = sbus_get_connection(svc->mt_conn->conn);
/* Construct a shutdown message */
msg = dbus_message_new_method_call(NULL,
@@ -475,7 +475,7 @@ static int monitor_shutdown_service(struct mt_svc *svc)
return ENOMEM;
}
- dbret = dbus_connection_send_with_reply(conn, msg, &pending_reply,
+ dbret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply,
svc->mt_ctx->service_id_timeout);
if (!dbret || pending_reply == NULL) {
DEBUG(0, ("D-BUS send failed.\n"));
@@ -495,10 +495,10 @@ static int monitor_shutdown_service(struct mt_svc *svc)
static void reload_reply(DBusPendingCall *pending, void *data)
{
DBusMessage *reply;
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
struct mt_svc *svc = talloc_get_type(data, struct mt_svc);
- conn_ctx = svc->mt_conn->conn_ctx;
+ conn = svc->mt_conn->conn;
reply = dbus_pending_call_steal_reply(pending);
if (!reply) {
/* reply should never be null. This function shouldn't be called
@@ -509,7 +509,7 @@ static void reload_reply(DBusPendingCall *pending, void *data)
" and no timeout occurred\n"));
/* Destroy this connection */
- sbus_disconnect(conn_ctx);
+ sbus_disconnect(conn);
goto done;
}
@@ -563,7 +563,7 @@ static int service_signal(struct mt_svc *svc, const char *svc_signal)
{
DBusMessage *msg;
dbus_bool_t dbret;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
DBusPendingCall *pending_reply;
if (svc->provider && strcasecmp(svc->provider, "local") == 0) {
@@ -580,7 +580,7 @@ static int service_signal(struct mt_svc *svc, const char *svc_signal)
return EIO;
}
- conn = sbus_get_connection(svc->mt_conn->conn_ctx);
+ dbus_conn = sbus_get_connection(svc->mt_conn->conn);
msg = dbus_message_new_method_call(NULL,
SERVICE_PATH,
SERVICE_INTERFACE,
@@ -592,7 +592,7 @@ static int service_signal(struct mt_svc *svc, const char *svc_signal)
return ENOMEM;
}
- dbret = dbus_connection_send_with_reply(conn, msg, &pending_reply,
+ dbret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply,
svc->mt_ctx->service_id_timeout);
if (!dbret || pending_reply == NULL) {
DEBUG(0, ("D-BUS send failed.\n"));
@@ -1777,31 +1777,31 @@ static int mt_conn_destructor(void *ptr)
* method on the new client). The reply callback for this request
* should set the connection destructor appropriately.
*/
-static int dbus_service_init(struct sbus_conn_ctx *conn_ctx, void *data)
+static int dbus_service_init(struct sbus_connection *conn, void *data)
{
struct mt_ctx *ctx;
struct mt_svc *svc;
struct mt_conn *mt_conn;
DBusMessage *msg;
DBusPendingCall *pending_reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
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_conn = sbus_get_connection(conn);
/* 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
* have a way to know we need to restart the service */
- mt_conn = talloc(conn_ctx, struct mt_conn);
+ mt_conn = talloc(conn, struct mt_conn);
if (!mt_conn) {
DEBUG(0,("Out of memory?!\n"));
- talloc_free(conn_ctx);
+ talloc_free(conn);
return ENOMEM;
}
- mt_conn->conn_ctx = conn_ctx;
+ mt_conn->conn = conn;
/* at this stage we still do not know what service is this
* we will know only after we get its identity, so we make
@@ -1809,7 +1809,7 @@ static int dbus_service_init(struct sbus_conn_ctx *conn_ctx, void *data)
* when we receive the reply */
svc = talloc_zero(mt_conn, struct mt_svc);
if (!svc) {
- talloc_free(conn_ctx);
+ talloc_free(conn);
return ENOMEM;
}
svc->mt_ctx = ctx;
@@ -1829,10 +1829,10 @@ static int dbus_service_init(struct sbus_conn_ctx *conn_ctx, void *data)
SERVICE_METHOD_IDENTITY);
if (msg == NULL) {
DEBUG(0,("Out of memory?!\n"));
- talloc_free(conn_ctx);
+ talloc_free(conn);
return ENOMEM;
}
- dbret = dbus_connection_send_with_reply(conn, msg, &pending_reply,
+ dbret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply,
ctx->service_id_timeout);
if (!dbret || pending_reply == NULL) {
/*
@@ -1842,7 +1842,7 @@ static int dbus_service_init(struct sbus_conn_ctx *conn_ctx, void *data)
*/
DEBUG(0, ("D-BUS send failed.\n"));
dbus_message_unref(msg);
- talloc_free(conn_ctx);
+ talloc_free(conn);
return EIO;
}
@@ -1857,7 +1857,7 @@ static void identity_check(DBusPendingCall *pending, void *data)
{
struct mt_svc *fake_svc;
struct mt_svc *svc;
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
DBusMessage *reply;
DBusError dbus_error;
dbus_uint16_t svc_ver;
@@ -1866,7 +1866,7 @@ static void identity_check(DBusPendingCall *pending, void *data)
int type;
fake_svc = talloc_get_type(data, struct mt_svc);
- conn_ctx = fake_svc->mt_conn->conn_ctx;
+ conn = fake_svc->mt_conn->conn;
dbus_error_init(&dbus_error);
reply = dbus_pending_call_steal_reply(pending);
@@ -1878,7 +1878,7 @@ static void identity_check(DBusPendingCall *pending, void *data)
DEBUG(0, ("Serious error. A reply callback was called but no reply was received and no timeout occurred\n"));
/* Destroy this connection */
- sbus_disconnect(conn_ctx);
+ sbus_disconnect(conn);
goto done;
}
@@ -1892,7 +1892,7 @@ static void identity_check(DBusPendingCall *pending, void *data)
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);
+ sbus_disconnect(conn);
goto done;
}
@@ -1909,7 +1909,7 @@ static void identity_check(DBusPendingCall *pending, void *data)
}
if (!svc) {
DEBUG(0,("Unable to find peer [%s] in list of services, killing connection!\n", svc_name));
- sbus_disconnect(conn_ctx);
+ sbus_disconnect(conn);
goto done;
}
@@ -1935,7 +1935,7 @@ static void identity_check(DBusPendingCall *pending, void *data)
* know that this connection isn't trustworthy.
* We'll destroy it now.
*/
- sbus_disconnect(conn_ctx);
+ sbus_disconnect(conn);
return;
}
@@ -1954,7 +1954,7 @@ static int service_send_ping(struct mt_svc *svc)
{
DBusMessage *msg;
DBusPendingCall *pending_reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
dbus_bool_t dbret;
if (!svc->mt_conn) {
@@ -1963,7 +1963,7 @@ 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_conn = sbus_get_connection(svc->mt_conn->conn);
/*
* Set up identity request
@@ -1976,11 +1976,11 @@ static int service_send_ping(struct mt_svc *svc)
SERVICE_METHOD_PING);
if (!msg) {
DEBUG(0,("Out of memory?!\n"));
- talloc_free(svc->mt_conn->conn_ctx);
+ talloc_free(svc->mt_conn->conn);
return ENOMEM;
}
- dbret = dbus_connection_send_with_reply(conn, msg, &pending_reply,
+ dbret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply,
svc->mt_ctx->service_id_timeout);
if (!dbret || pending_reply == NULL) {
/*
@@ -1989,7 +1989,7 @@ static int service_send_ping(struct mt_svc *svc)
* We'll drop it using the default destructor.
*/
DEBUG(0, ("D-BUS send failed.\n"));
- talloc_free(svc->mt_conn->conn_ctx);
+ talloc_free(svc->mt_conn->conn);
return EIO;
}
@@ -2003,13 +2003,13 @@ static int service_send_ping(struct mt_svc *svc)
static void ping_check(DBusPendingCall *pending, void *data)
{
struct mt_svc *svc;
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
DBusMessage *reply;
const char *dbus_error_name;
int type;
svc = talloc_get_type(data, struct mt_svc);
- conn_ctx = svc->mt_conn->conn_ctx;
+ conn = svc->mt_conn->conn;
reply = dbus_pending_call_steal_reply(pending);
if (!reply) {
@@ -2021,7 +2021,7 @@ static void ping_check(DBusPendingCall *pending, void *data)
" and no timeout occurred\n"));
/* Destroy this connection */
- sbus_disconnect(conn_ctx);
+ sbus_disconnect(conn);
goto done;
}
@@ -2055,7 +2055,7 @@ static void ping_check(DBusPendingCall *pending, void *data)
* know that this connection isn't trustworthy.
* We'll destroy it now.
*/
- sbus_disconnect(conn_ctx);
+ sbus_disconnect(conn);
}
done:
diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c
index 6a19247fd..29bfe9461 100644
--- a/server/providers/data_provider.c
+++ b/server/providers/data_provider.c
@@ -62,7 +62,7 @@ struct dp_ctx {
struct dp_client {
struct dp_ctx *dpctx;
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
};
struct dp_backend {
@@ -84,10 +84,10 @@ struct dp_frontend {
static int dp_backend_destructor(void *ctx);
static int dp_frontend_destructor(void *ctx);
-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 service_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn);
+static int service_identity(DBusMessage *message, struct sbus_connection *conn);
+static int service_pong(DBusMessage *message, struct sbus_connection *conn);
+static int service_reload(DBusMessage *message, struct sbus_connection *conn);
+static int service_res_init(DBusMessage *message, struct sbus_connection *conn);
struct sbus_method mon_sbus_methods[] = {
{ SERVICE_METHOD_IDENTITY, service_identity },
@@ -97,8 +97,8 @@ struct sbus_method mon_sbus_methods[] = {
{ NULL, NULL }
};
-static int dp_get_account_info(DBusMessage *message, struct sbus_conn_ctx *sconn);
-static int dp_pamhandler(DBusMessage *message, struct sbus_conn_ctx *sconn);
+static int dp_get_account_info(DBusMessage *message, struct sbus_connection *conn);
+static int dp_pamhandler(DBusMessage *message, struct sbus_connection *conn);
struct sbus_method dp_sbus_methods[] = {
{ DP_SRV_METHOD_GETACCTINFO, dp_get_account_info },
@@ -120,7 +120,7 @@ struct dp_be_request {
struct dp_backend *be;
};
-static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_identity(DBusMessage *message, struct sbus_connection *conn)
{
dbus_uint16_t version = DATA_PROVIDER_VERSION;
const char *name = DATA_PROVIDER_SERVICE_NAME;
@@ -142,13 +142,13 @@ static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
}
-static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_pong(DBusMessage *message, struct sbus_connection *conn)
{
DBusMessage *reply;
dbus_bool_t ret;
@@ -163,13 +163,13 @@ static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
}
-static int service_reload(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_reload(DBusMessage *message, struct sbus_connection *conn)
{
/* Monitor calls this function when we need to reload
* our configuration information. Perform whatever steps
@@ -177,10 +177,10 @@ static int service_reload(DBusMessage *message, struct sbus_conn_ctx *sconn)
*/
/* Send an empty reply to acknowledge receipt */
- return service_pong(message, sconn);
+ return service_pong(message, conn);
}
-static int service_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_res_init(DBusMessage *message, struct sbus_connection *conn)
{
int ret;
@@ -189,12 +189,12 @@ static int service_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn)
return EIO;
}
- return service_pong(message, sconn);
+ return service_pong(message, conn);
}
static int dp_monitor_init(struct dp_ctx *dpctx)
{
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
struct sbus_method_ctx *sm_ctx;
char *sbus_address;
int ret;
@@ -219,7 +219,7 @@ static int dp_monitor_init(struct dp_ctx *dpctx)
}
ret = sbus_client_init(dpctx, dpctx->ev, sm_ctx,
- sbus_address, &conn_ctx,
+ sbus_address, &conn,
NULL, NULL);
if (ret != EOK) {
DEBUG(0, ("Failed to connect to monitor services.\n"));
@@ -235,33 +235,33 @@ static int dp_monitor_init(struct dp_ctx *dpctx)
static void be_identity_check(DBusPendingCall *pending, void *data);
static void be_got_account_info(DBusPendingCall *pending, void *data);
-static int dbus_dp_init(struct sbus_conn_ctx *conn_ctx, void *data)
+static int dbus_dp_init(struct sbus_connection *conn, void *data)
{
struct dp_ctx *dpctx;
struct dp_client *dpcli;
DBusMessage *msg;
DBusPendingCall *pending_reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
dbus_bool_t dbret;
dpctx = talloc_get_type(data, struct dp_ctx);
- conn = sbus_get_connection(conn_ctx);
+ dbus_conn = sbus_get_connection(conn);
/* hang off this memory to the connection so that when the connection
* is freed we can potentially call a destructor */
- dpcli = talloc(conn_ctx, struct dp_client);
+ dpcli = talloc(conn, struct dp_client);
if (!dpcli) {
DEBUG(0,("Out of memory?!\n"));
- talloc_free(conn_ctx);
+ talloc_free(conn);
return ENOMEM;
}
dpcli->dpctx = dpctx;
- dpcli->conn_ctx = conn_ctx;
+ dpcli->conn = conn;
/* Attach the client context to the connection context, so that it is
* always available when we need to manage the connection. */
- sbus_conn_set_private_data(conn_ctx, dpcli);
+ sbus_conn_set_private_data(conn, dpcli);
/* identify the connecting client */
msg = dbus_message_new_method_call(NULL,
@@ -270,10 +270,10 @@ static int dbus_dp_init(struct sbus_conn_ctx *conn_ctx, void *data)
DP_CLI_METHOD_IDENTITY);
if (msg == NULL) {
DEBUG(0,("Out of memory?!\n"));
- talloc_free(conn_ctx);
+ talloc_free(conn);
return ENOMEM;
}
- dbret = dbus_connection_send_with_reply(conn, msg, &pending_reply,
+ dbret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply,
600000 /* TODO: set timeout */);
if (!dbret || pending_reply == NULL) {
/*
@@ -282,7 +282,7 @@ static int dbus_dp_init(struct sbus_conn_ctx *conn_ctx, void *data)
* We'll drop it using the default destructor.
*/
DEBUG(0, ("D-BUS send failed.\n"));
- talloc_free(conn_ctx);
+ talloc_free(conn);
dbus_message_unref(msg);
return EIO;
}
@@ -300,7 +300,7 @@ static void be_identity_check(DBusPendingCall *pending, void *data)
struct dp_frontend *dpfe;
struct dp_client *dpcli;
DBusMessage *reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
DBusError dbus_error;
dbus_uint16_t cli_ver;
dbus_uint16_t cli_type;
@@ -310,7 +310,7 @@ static void be_identity_check(DBusPendingCall *pending, void *data)
int type;
dpcli = talloc_get_type(data, struct dp_client);
- conn = sbus_get_connection(dpcli->conn_ctx);
+ dbus_conn = sbus_get_connection(dpcli->conn);
dbus_error_init(&dbus_error);
reply = dbus_pending_call_steal_reply(pending);
@@ -322,7 +322,7 @@ static void be_identity_check(DBusPendingCall *pending, void *data)
DEBUG(0, ("Severe error. A reply callback was called but no reply was received and no timeout occurred\n"));
/* Destroy this connection */
- sbus_disconnect(dpcli->conn_ctx);
+ sbus_disconnect(dpcli->conn);
goto done;
}
@@ -338,7 +338,7 @@ static void be_identity_check(DBusPendingCall *pending, void *data)
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);
+ sbus_disconnect(dpcli->conn);
goto done;
}
@@ -347,7 +347,7 @@ static void be_identity_check(DBusPendingCall *pending, void *data)
dpbe = talloc_zero(dpcli->dpctx, struct dp_backend);
if (!dpbe) {
DEBUG(0, ("Out of memory!\n"));
- sbus_disconnect(dpcli->conn_ctx);
+ sbus_disconnect(dpcli->conn);
goto done;
}
@@ -355,7 +355,7 @@ static void be_identity_check(DBusPendingCall *pending, void *data)
dpbe->domain = talloc_strdup(dpbe, cli_domain);
if (!dpbe->name || !dpbe->domain) {
DEBUG(0, ("Out of memory!\n"));
- sbus_disconnect(dpcli->conn_ctx);
+ sbus_disconnect(dpcli->conn);
goto done;
}
@@ -373,14 +373,14 @@ static void be_identity_check(DBusPendingCall *pending, void *data)
dpfe = talloc_zero(dpcli->dpctx, struct dp_frontend);
if (!dpfe) {
DEBUG(0, ("Out of memory!\n"));
- sbus_disconnect(dpcli->conn_ctx);
+ sbus_disconnect(dpcli->conn);
goto done;
}
dpfe->name = talloc_strdup(dpfe, cli_name);
if (!dpfe->name) {
DEBUG(0, ("Out of memory!\n"));
- sbus_disconnect(dpcli->conn_ctx);
+ sbus_disconnect(dpcli->conn);
goto done;
}
@@ -395,7 +395,7 @@ static void be_identity_check(DBusPendingCall *pending, void *data)
default:
DEBUG(1, ("Unknown client type, killing connection\n"));
- sbus_disconnect(dpcli->conn_ctx);
+ sbus_disconnect(dpcli->conn);
goto done;
}
@@ -414,7 +414,7 @@ static void be_identity_check(DBusPendingCall *pending, void *data)
* know that this connection isn't trustworthy.
* We'll destroy it now.
*/
- sbus_disconnect(dpcli->conn_ctx);
+ sbus_disconnect(dpcli->conn);
}
done:
@@ -426,7 +426,7 @@ static void be_got_account_info(DBusPendingCall *pending, void *data)
{
struct dp_be_request *bereq;
DBusMessage *reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
DBusError dbus_error;
dbus_uint16_t err_maj = 0;
dbus_uint32_t err_min = 0;
@@ -446,7 +446,7 @@ static void be_got_account_info(DBusPendingCall *pending, void *data)
DEBUG(0, ("Severe error. A reply callback was called but no reply was received and no timeout occurred\n"));
/* Destroy this connection */
- sbus_disconnect(bereq->be->dpcli->conn_ctx);
+ sbus_disconnect(bereq->be->dpcli->conn);
goto done;
}
@@ -461,7 +461,7 @@ static void be_got_account_info(DBusPendingCall *pending, void *data)
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);
+ sbus_disconnect(bereq->be->dpcli->conn);
goto done;
}
@@ -483,7 +483,7 @@ static void be_got_account_info(DBusPendingCall *pending, void *data)
* know that this connection isn't trustworthy.
* We'll destroy it now.
*/
- sbus_disconnect(bereq->be->dpcli->conn_ctx);
+ sbus_disconnect(bereq->be->dpcli->conn);
}
if (err_maj) {
@@ -496,7 +496,7 @@ static void be_got_account_info(DBusPendingCall *pending, void *data)
bereq->req->pending_replies--;
talloc_free(bereq);
} else {
- conn = sbus_get_connection(bereq->req->src_cli->conn_ctx);
+ dbus_conn = sbus_get_connection(bereq->req->src_cli->conn);
err_maj = 0;
err_min = 0;
err_msg = "Success";
@@ -512,7 +512,7 @@ static void be_got_account_info(DBusPendingCall *pending, void *data)
}
/* finally send it */
- dbus_connection_send(conn, bereq->req->reply, NULL);
+ dbus_connection_send(dbus_conn, bereq->req->reply, NULL);
dbus_message_unref(bereq->req->reply);
talloc_free(bereq->req);
}
@@ -527,10 +527,10 @@ static int dp_send_acct_req(struct dp_be_request *bereq,
{
DBusMessage *msg;
DBusPendingCall *pending_reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
dbus_bool_t ret;
- conn = sbus_get_connection(bereq->be->dpcli->conn_ctx);
+ dbus_conn = sbus_get_connection(bereq->be->dpcli->conn);
/* create the message */
msg = dbus_message_new_method_call(NULL,
@@ -554,7 +554,7 @@ static int dp_send_acct_req(struct dp_be_request *bereq,
return EIO;
}
- ret = dbus_connection_send_with_reply(conn, msg, &pending_reply,
+ ret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply,
600000 /* TODO: set timeout */);
if (!ret || pending_reply == NULL) {
/*
@@ -575,7 +575,7 @@ static int dp_send_acct_req(struct dp_be_request *bereq,
return EOK;
}
-static int dp_get_account_info(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int dp_get_account_info(DBusMessage *message, struct sbus_connection *conn)
{
struct dp_client *dpcli;
struct dp_be_request *bereq;
@@ -590,7 +590,7 @@ static int dp_get_account_info(DBusMessage *message, struct sbus_conn_ctx *sconn
const char *errmsg = NULL;
int dpret = 0, ret = 0;
- user_data = sbus_conn_get_private_data(sconn);
+ user_data = sbus_conn_get_private_data(conn);
if (!user_data) return EINVAL;
dpcli = talloc_get_type(user_data, struct dp_client);
if (!dpcli) return EINVAL;
@@ -733,7 +733,7 @@ respond:
if (!dbret) return EIO;
/* send reply back immediately */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
@@ -743,7 +743,7 @@ static void be_got_pam_reply(DBusPendingCall *pending, void *data)
{
struct dp_be_request *bereq;
DBusMessage *reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
DBusError dbus_error;
dbus_bool_t ret;
struct pam_data *pd = NULL;
@@ -761,7 +761,7 @@ static void be_got_pam_reply(DBusPendingCall *pending, void *data)
DEBUG(0, ("Severe error. A reply callback was called but no reply was received and no timeout occurred\n"));
/* Destroy this connection */
- sbus_disconnect(bereq->be->dpcli->conn_ctx);
+ sbus_disconnect(bereq->be->dpcli->conn);
goto done;
}
@@ -773,7 +773,7 @@ static void be_got_pam_reply(DBusPendingCall *pending, void *data)
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);
+ sbus_disconnect(bereq->be->dpcli->conn);
pd->pam_status = PAM_SYSTEM_ERR;
pd->domain = talloc_strdup(pd, "");
goto done;
@@ -797,11 +797,11 @@ static void be_got_pam_reply(DBusPendingCall *pending, void *data)
* We'll destroy it now.
*/
DEBUG(1,("Maybe timeout?\n"));
- sbus_disconnect(bereq->be->dpcli->conn_ctx);
+ sbus_disconnect(bereq->be->dpcli->conn);
goto done;
}
- conn = sbus_get_connection(bereq->req->src_cli->conn_ctx);
+ dbus_conn = sbus_get_connection(bereq->req->src_cli->conn);
ret = dp_pack_pam_response(bereq->req->reply, pd);
if (!ret) {
@@ -811,7 +811,7 @@ static void be_got_pam_reply(DBusPendingCall *pending, void *data)
}
/* finally send it */
- dbus_connection_send(conn, bereq->req->reply, NULL);
+ dbus_connection_send(dbus_conn, bereq->req->reply, NULL);
dbus_message_unref(bereq->req->reply);
talloc_free(bereq->req);
@@ -824,10 +824,10 @@ static int dp_call_pamhandler(struct dp_be_request *bereq, struct pam_data *pd)
{
DBusMessage *msg;
DBusPendingCall *pending_reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
dbus_bool_t ret;
- conn = sbus_get_connection(bereq->be->dpcli->conn_ctx);
+ dbus_conn = sbus_get_connection(bereq->be->dpcli->conn);
/* create the message */
msg = dbus_message_new_method_call(NULL,
@@ -848,8 +848,8 @@ static int dp_call_pamhandler(struct dp_be_request *bereq, struct pam_data *pd)
return EIO;
}
- ret = dbus_connection_send_with_reply(conn, msg, &pending_reply,
- 600000 /* TODO: set timeout */);
+ ret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply,
+ 600000 /* TODO: set timeout */);
if (!ret || pending_reply == NULL) {
/*
* Critical Failure
@@ -869,7 +869,7 @@ static int dp_call_pamhandler(struct dp_be_request *bereq, struct pam_data *pd)
return EOK;
}
-static int dp_pamhandler(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int dp_pamhandler(DBusMessage *message, struct sbus_connection *conn)
{
DBusMessage *reply;
DBusError dbus_error;
@@ -884,7 +884,7 @@ static int dp_pamhandler(DBusMessage *message, struct sbus_conn_ctx *sconn)
int pam_status=PAM_SUCCESS;
int domain_found=0;
- user_data = sbus_conn_get_private_data(sconn);
+ user_data = sbus_conn_get_private_data(conn);
if (!user_data) return EINVAL;
dpcli = talloc_get_type(user_data, struct dp_client);
if (!dpcli) return EINVAL;
@@ -964,7 +964,7 @@ respond:
if (!dbret) return EIO;
/* send reply back immediately */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
talloc_free(pd);
diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c
index d5cd6dd0a..7db2047ff 100644
--- a/server/providers/data_provider_be.c
+++ b/server/providers/data_provider_be.c
@@ -54,9 +54,9 @@
#define BE_CONF_ENTRY "config/domains/%s"
-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_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn);
+static int service_identity(DBusMessage *message, struct sbus_connection *conn);
+static int service_pong(DBusMessage *message, struct sbus_connection *conn);
+static int service_res_init(DBusMessage *message, struct sbus_connection *conn);
struct sbus_method mon_sbus_methods[] = {
{ SERVICE_METHOD_IDENTITY, service_identity },
@@ -65,10 +65,10 @@ struct sbus_method mon_sbus_methods[] = {
{ NULL, NULL }
};
-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);
-static int be_pam_handler(DBusMessage *message, struct sbus_conn_ctx *sconn);
+static int be_identity(DBusMessage *message, struct sbus_connection *conn);
+static int be_check_online(DBusMessage *message, struct sbus_connection *conn);
+static int be_get_account_info(DBusMessage *message, struct sbus_connection *conn);
+static int be_pam_handler(DBusMessage *message, struct sbus_connection *conn);
struct sbus_method be_methods[] = {
{ DP_CLI_METHOD_IDENTITY, be_identity },
@@ -89,7 +89,7 @@ static struct bet_data bet_data[] = {
-static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_identity(DBusMessage *message, struct sbus_connection *conn)
{
dbus_uint16_t version = DATA_PROVIDER_VERSION;
struct be_ctx *ctx;
@@ -97,7 +97,7 @@ static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
dbus_bool_t ret;
void *user_data;
- user_data = sbus_conn_get_private_data(sconn);
+ user_data = sbus_conn_get_private_data(conn);
if (!user_data) return EINVAL;
ctx = talloc_get_type(user_data, struct be_ctx);
if (!ctx) return EINVAL;
@@ -117,13 +117,13 @@ static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
}
-static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_pong(DBusMessage *message, struct sbus_connection *conn)
{
DBusMessage *reply;
dbus_bool_t ret;
@@ -138,13 +138,13 @@ static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
}
-static int service_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_res_init(DBusMessage *message, struct sbus_connection *conn)
{
int ret;
@@ -153,10 +153,10 @@ static int service_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn)
return EIO;
}
- return service_pong(message, sconn);
+ return service_pong(message, conn);
}
-static int be_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int be_identity(DBusMessage *message, struct sbus_connection *conn)
{
dbus_uint16_t version = DATA_PROVIDER_VERSION;
dbus_uint16_t clitype = DP_CLI_BACKEND;
@@ -165,7 +165,7 @@ static int be_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
dbus_bool_t ret;
void *user_data;
- user_data = sbus_conn_get_private_data(sconn);
+ user_data = sbus_conn_get_private_data(conn);
if (!user_data) return EINVAL;
ctx = talloc_get_type(user_data, struct be_ctx);
if (!ctx) return EINVAL;
@@ -188,7 +188,7 @@ static int be_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
@@ -244,7 +244,7 @@ static void online_chk_callback(struct be_req *req, int status,
{
struct be_online_req *oreq;
DBusMessage *reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
dbus_bool_t dbret;
dbus_uint16_t online;
dbus_uint16_t err_maj = 0;
@@ -274,8 +274,8 @@ static void online_chk_callback(struct be_req *req, int status,
return;
}
- conn = sbus_get_connection(req->be_ctx->dp_conn_ctx);
- dbus_connection_send(conn, reply, NULL);
+ dbus_conn = sbus_get_connection(req->be_ctx->dp_conn);
+ dbus_connection_send(dbus_conn, reply, NULL);
dbus_message_unref(reply);
DEBUG(4, ("Request processed. Returned %d,%d,%s\n",
@@ -286,7 +286,7 @@ static void online_chk_callback(struct be_req *req, int status,
}
-static int be_check_online(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int be_check_online(DBusMessage *message, struct sbus_connection *conn)
{
struct be_online_req *req;
struct be_req *be_req;
@@ -300,7 +300,7 @@ static int be_check_online(DBusMessage *message, struct sbus_conn_ctx *sconn)
dbus_uint32_t err_min;
const char *err_msg;
- user_data = sbus_conn_get_private_data(sconn);
+ user_data = sbus_conn_get_private_data(conn);
if (!user_data) return EINVAL;
ctx = talloc_get_type(user_data, struct be_ctx);
if (!ctx) return EINVAL;
@@ -358,7 +358,7 @@ done:
if (!dbret) return EIO;
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
@@ -369,7 +369,7 @@ static void acctinfo_callback(struct be_req *req, int status,
const char *errstr)
{
DBusMessage *reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
dbus_bool_t dbret;
dbus_uint16_t err_maj = 0;
dbus_uint32_t err_min = 0;
@@ -393,8 +393,8 @@ static void acctinfo_callback(struct be_req *req, int status,
return;
}
- conn = sbus_get_connection(req->be_ctx->dp_conn_ctx);
- dbus_connection_send(conn, reply, NULL);
+ dbus_conn = sbus_get_connection(req->be_ctx->dp_conn);
+ dbus_connection_send(dbus_conn, reply, NULL);
dbus_message_unref(reply);
DEBUG(4, ("Request processed. Returned %d,%d,%s\n",
@@ -404,7 +404,7 @@ static void acctinfo_callback(struct be_req *req, int status,
talloc_free(req);
}
-static int be_get_account_info(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int be_get_account_info(DBusMessage *message, struct sbus_connection *conn)
{
struct be_acct_req *req;
struct be_req *be_req;
@@ -424,7 +424,7 @@ static int be_get_account_info(DBusMessage *message, struct sbus_conn_ctx *sconn
be_req = NULL;
- user_data = sbus_conn_get_private_data(sconn);
+ user_data = sbus_conn_get_private_data(conn);
if (!user_data) return EINVAL;
ctx = talloc_get_type(user_data, struct be_ctx);
if (!ctx) return EINVAL;
@@ -536,7 +536,7 @@ done:
err_maj, err_min, err_msg));
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
@@ -546,7 +546,7 @@ static void be_pam_handler_callback(struct be_req *req, int status,
const char *errstr) {
struct pam_data *pd;
DBusMessage *reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
dbus_bool_t dbret;
pd = talloc_get_type(req->req_data, struct pam_data);
@@ -559,8 +559,8 @@ static void be_pam_handler_callback(struct be_req *req, int status,
return;
}
- conn = sbus_get_connection(req->be_ctx->dp_conn_ctx);
- dbus_connection_send(conn, reply, NULL);
+ dbus_conn = sbus_get_connection(req->be_ctx->dp_conn);
+ dbus_connection_send(dbus_conn, reply, NULL);
dbus_message_unref(reply);
DEBUG(4, ("Sent result [%d][%s]\n", pd->pam_status, pd->domain));
@@ -568,7 +568,7 @@ static void be_pam_handler_callback(struct be_req *req, int status,
talloc_free(req);
}
-static int be_pam_handler(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int be_pam_handler(DBusMessage *message, struct sbus_connection *conn)
{
DBusError dbus_error;
DBusMessage *reply;
@@ -580,7 +580,7 @@ static int be_pam_handler(DBusMessage *message, struct sbus_conn_ctx *sconn)
uint32_t pam_status = PAM_SYSTEM_ERR;
enum bet_type target = BET_NULL;
- user_data = sbus_conn_get_private_data(sconn);
+ user_data = sbus_conn_get_private_data(conn);
if (!user_data) return EINVAL;
ctx = talloc_get_type(user_data, struct be_ctx);
if (!ctx) return EINVAL;
@@ -660,7 +660,7 @@ done:
if (!ret) return EIO;
/* send reply back immediately */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
talloc_free(pd);
@@ -694,7 +694,7 @@ static int mon_cli_init(struct be_ctx *ctx)
}
ret = sbus_client_init(ctx, ctx->ev, ctx->mon_sm_ctx,
- sbus_address, &ctx->mon_conn_ctx,
+ sbus_address, &ctx->mon_conn,
NULL, ctx);
if (ret != EOK) {
DEBUG(0, ("Failed to connect to monitor services.\n"));
@@ -704,7 +704,7 @@ static int mon_cli_init(struct be_ctx *ctx)
return EOK;
}
-static void be_cli_reconnect_init(struct sbus_conn_ctx *sconn, int status, void *pvt);
+static void be_cli_reconnect_init(struct sbus_connection *conn, int status, void *pvt);
/* be_cli_init
* sbus channel to the data provider daemon */
@@ -733,7 +733,7 @@ static int be_cli_init(struct be_ctx *ctx)
}
ret = sbus_client_init(ctx, ctx->ev, ctx->dp_sm_ctx,
- sbus_address, &ctx->dp_conn_ctx,
+ sbus_address, &ctx->dp_conn,
NULL, ctx);
if (ret != EOK) {
DEBUG(0, ("Failed to connect to monitor services.\n"));
@@ -748,7 +748,7 @@ static int be_cli_init(struct be_ctx *ctx)
return ret;
}
- sbus_reconnect_init(ctx->dp_conn_ctx, max_retries,
+ sbus_reconnect_init(ctx->dp_conn, max_retries,
be_cli_reconnect_init, ctx);
return EOK;
@@ -757,7 +757,7 @@ static int be_cli_init(struct be_ctx *ctx)
static int be_finalize(struct be_ctx *ctx);
static void be_shutdown(struct be_req *req, int status, const char *errstr);
-static void be_cli_reconnect_init(struct sbus_conn_ctx *sconn, int status, void *pvt)
+static void be_cli_reconnect_init(struct sbus_connection *conn, int status, void *pvt)
{
int ret;
struct be_ctx *be_ctx = talloc_get_type(pvt, struct be_ctx);
@@ -765,7 +765,7 @@ static void be_cli_reconnect_init(struct sbus_conn_ctx *sconn, int status, void
/* Did we reconnect successfully? */
if (status == SBUS_RECONNECT_SUCCESS) {
/* Add the methods back to the new connection */
- ret = sbus_conn_add_method_ctx(be_ctx->dp_conn_ctx,
+ ret = sbus_conn_add_method_ctx(be_ctx->dp_conn,
be_ctx->dp_sm_ctx);
if (ret != EOK) {
DEBUG(0, ("Could not re-add methods on reconnection.\n"));
diff --git a/server/providers/dp_backend.h b/server/providers/dp_backend.h
index 759dd996e..f05a54204 100644
--- a/server/providers/dp_backend.h
+++ b/server/providers/dp_backend.h
@@ -71,10 +71,10 @@ struct be_ctx {
const char *conf_path;
struct sbus_method_ctx *mon_sm_ctx;
- struct sbus_conn_ctx *mon_conn_ctx;
+ struct sbus_connection *mon_conn;
struct sbus_method_ctx *dp_sm_ctx;
- struct sbus_conn_ctx *dp_conn_ctx;
+ struct sbus_connection *dp_conn;
struct loaded_be loaded_be[BET_MAX];
struct bet_info bet_info[BET_MAX];
diff --git a/server/responder/common/responder.h b/server/responder/common/responder.h
index 408ee4dac..5bde42acf 100644
--- a/server/responder/common/responder.h
+++ b/server/responder/common/responder.h
@@ -64,7 +64,7 @@ struct resp_ctx {
const char *sock_name;
const char *priv_sock_name;
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
struct sbus_method_ctx *sm_ctx;
struct sss_domain_info *domains;
diff --git a/server/responder/common/responder_common.c b/server/responder/common/responder_common.c
index f8744b676..1fd669071 100644
--- a/server/responder/common/responder_common.c
+++ b/server/responder/common/responder_common.c
@@ -311,7 +311,7 @@ static int sss_sbus_init(struct resp_ctx *rctx)
}
ret = sbus_client_init(rctx, rctx->ev, rctx->sm_ctx,
- sbus_address, &rctx->conn_ctx,
+ sbus_address, &rctx->conn,
NULL, NULL);
if (ret != EOK) {
DEBUG(0, ("Failed to connect to monitor services.\n"));
@@ -497,7 +497,7 @@ int sss_process_init(TALLOC_CTX *mem_ctx,
DEBUG(0, ("fatal error setting up backend connector\n"));
return ret;
}
- else if (!rctx->conn_ctx) {
+ else if (!rctx->conn) {
DEBUG(0, ("Data Provider is not yet available. Retrying.\n"));
return EIO;
}
diff --git a/server/responder/common/responder_dp.c b/server/responder/common/responder_dp.c
index 9083a173f..bdd9a9efc 100644
--- a/server/responder/common/responder_dp.c
+++ b/server/responder/common/responder_dp.c
@@ -62,7 +62,7 @@ static void sss_dp_conn_reconnect(struct sss_dp_pvt_ctx *pvt)
}
ret = sbus_client_init(rctx, rctx->ev, rctx->sm_ctx,
- sbus_address, &rctx->conn_ctx,
+ sbus_address, &rctx->conn,
sss_dp_conn_destructor, pvt);
if (ret != EOK) {
DEBUG(4, ("Failed to reconnect [%d(%s)]!\n", ret, strerror(ret)));
@@ -92,15 +92,15 @@ static void sss_dp_reconnect(struct tevent_context *ev,
int sss_dp_conn_destructor(void *data)
{
struct sss_dp_pvt_ctx *pvt;
- struct sbus_conn_ctx *scon;
+ struct sbus_connection *conn;
- scon = talloc_get_type(data, struct sbus_conn_ctx);
- if (!scon) return 0;
+ conn = talloc_get_type(data, struct sbus_connection);
+ if (!conn) return 0;
/* if this is a regular disconnect just quit */
- if (sbus_conn_disconnecting(scon)) return 0;
+ if (sbus_conn_disconnecting(conn)) return 0;
- pvt = talloc_get_type(sbus_conn_get_private_data(scon),
+ pvt = talloc_get_type(sbus_conn_get_private_data(conn),
struct sss_dp_pvt_ctx);
if (pvt) return 0;
@@ -198,7 +198,7 @@ int nss_dp_send_acct_req(struct resp_ctx *rctx, TALLOC_CTX *memctx,
struct nss_dp_req *ndp_req;
DBusMessage *msg;
DBusPendingCall *pending_reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
dbus_bool_t ret;
uint32_t be_type;
const char *attrs = "core";
@@ -243,12 +243,12 @@ int nss_dp_send_acct_req(struct resp_ctx *rctx, TALLOC_CTX *memctx,
* in some pathological cases it may happen that nss starts up before
* dp connection code is actually able to establish a connection.
*/
- if (!rctx->conn_ctx) {
+ if (!rctx->conn) {
DEBUG(1, ("The Data Provider connection is not available yet!"
" This maybe a bug, it shouldn't happen!\n"));
return EIO;
}
- conn = sbus_get_connection(rctx->conn_ctx);
+ dbus_conn = sbus_get_connection(rctx->conn);
/* create the message */
msg = dbus_message_new_method_call(NULL,
@@ -274,7 +274,7 @@ int nss_dp_send_acct_req(struct resp_ctx *rctx, TALLOC_CTX *memctx,
return EIO;
}
- ret = dbus_connection_send_with_reply(conn, msg, &pending_reply,
+ ret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply,
600000 /* TODO: set timeout */);
if (!ret || pending_reply == NULL) {
/*
diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c
index 419ed1de9..d104c7c8a 100644
--- a/server/responder/nss/nsssrv.c
+++ b/server/responder/nss/nsssrv.c
@@ -52,10 +52,10 @@
#define SSS_NSS_PIPE_NAME "nss"
-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 service_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn);
+static int service_identity(DBusMessage *message, struct sbus_connection *conn);
+static int service_pong(DBusMessage *message, struct sbus_connection *conn);
+static int service_reload(DBusMessage *message, struct sbus_connection *conn);
+static int service_res_init(DBusMessage *message, struct sbus_connection *conn);
struct sbus_method nss_sbus_methods[] = {
{SERVICE_METHOD_IDENTITY, service_identity},
@@ -65,7 +65,7 @@ struct sbus_method nss_sbus_methods[] = {
{NULL, NULL}
};
-static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_identity(DBusMessage *message, struct sbus_connection *conn)
{
dbus_uint16_t version = NSS_SBUS_SERVICE_VERSION;
const char *name = NSS_SBUS_SERVICE_NAME;
@@ -88,13 +88,13 @@ static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
}
-static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_pong(DBusMessage *message, struct sbus_connection *conn)
{
DBusMessage *reply;
dbus_bool_t ret;
@@ -109,13 +109,13 @@ static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
}
-static int service_reload(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_reload(DBusMessage *message, struct sbus_connection *conn)
{
/* Monitor calls this function when we need to reload
* our configuration information. Perform whatever steps
@@ -123,10 +123,10 @@ static int service_reload(DBusMessage *message, struct sbus_conn_ctx *sconn)
*/
/* Send an empty reply to acknowledge receipt */
- return service_pong(message, sconn);
+ return service_pong(message, conn);
}
-static int service_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_res_init(DBusMessage *message, struct sbus_connection *conn)
{
int ret;
@@ -135,7 +135,7 @@ static int service_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn)
return EIO;
}
- return service_pong(message, sconn);
+ return service_pong(message, conn);
}
static int nss_get_config(struct nss_ctx *nctx,
@@ -250,7 +250,7 @@ static void nss_shutdown(struct resp_ctx *rctx)
}
-static void nss_dp_reconnect_init(struct sbus_conn_ctx *sconn, int status, void *pvt)
+static void nss_dp_reconnect_init(struct sbus_connection *conn, int status, void *pvt)
{
int ret;
struct resp_ctx *rctx = talloc_get_type(pvt, struct resp_ctx);
@@ -258,7 +258,7 @@ static void nss_dp_reconnect_init(struct sbus_conn_ctx *sconn, int status, void
/* Did we reconnect successfully? */
if (status == SBUS_RECONNECT_SUCCESS) {
/* Add the methods back to the new connection */
- ret = sbus_conn_add_method_ctx(rctx->conn_ctx,
+ ret = sbus_conn_add_method_ctx(rctx->conn,
rctx->sm_ctx);
if (ret != EOK) {
DEBUG(0, ("Could not re-add methods on reconnection.\n"));
@@ -327,7 +327,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
return ret;
}
- sbus_reconnect_init(nctx->rctx->conn_ctx,
+ sbus_reconnect_init(nctx->rctx->conn,
max_retries,
nss_dp_reconnect_init, nctx->rctx);
diff --git a/server/responder/nss/nsssrv_dp.c b/server/responder/nss/nsssrv_dp.c
index 943a872c2..7150a5942 100644
--- a/server/responder/nss/nsssrv_dp.c
+++ b/server/responder/nss/nsssrv_dp.c
@@ -28,7 +28,7 @@
#include "sbus/sbus_client.h"
#include "providers/dp_sbus.h"
-static int nss_dp_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int nss_dp_identity(DBusMessage *message, struct sbus_connection *conn)
{
dbus_uint16_t version = DATA_PROVIDER_VERSION;
dbus_uint16_t clitype = DP_CLI_FRONTEND;
@@ -55,7 +55,7 @@ static int nss_dp_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
diff --git a/server/responder/pam/pamsrv.c b/server/responder/pam/pamsrv.c
index 05e3a12d6..cd423714c 100644
--- a/server/responder/pam/pamsrv.c
+++ b/server/responder/pam/pamsrv.c
@@ -55,10 +55,10 @@
#define PAM_SBUS_SERVICE_NAME "pam"
#define PAM_SRV_CONFIG "config/services/pam"
-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 service_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn);
+static int service_identity(DBusMessage *message, struct sbus_connection *conn);
+static int service_pong(DBusMessage *message, struct sbus_connection *conn);
+static int service_reload(DBusMessage *message, struct sbus_connection *conn);
+static int service_res_init(DBusMessage *message, struct sbus_connection *conn);
struct sbus_method sss_sbus_methods[] = {
{SERVICE_METHOD_IDENTITY, service_identity},
@@ -68,7 +68,7 @@ struct sbus_method sss_sbus_methods[] = {
{NULL, NULL}
};
-static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_identity(DBusMessage *message, struct sbus_connection *conn)
{
dbus_uint16_t version = PAM_SBUS_SERVICE_VERSION;
const char *name = PAM_SBUS_SERVICE_NAME;
@@ -90,13 +90,13 @@ static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
}
-static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_pong(DBusMessage *message, struct sbus_connection *conn)
{
DBusMessage *reply;
dbus_bool_t ret;
@@ -110,13 +110,13 @@ static int service_pong(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
}
-static int service_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int service_res_init(DBusMessage *message, struct sbus_connection *conn)
{
int ret;
@@ -125,22 +125,22 @@ static int service_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn)
return EIO;
}
- return service_pong(message, sconn);
+ return service_pong(message, conn);
}
static void pam_shutdown(struct resp_ctx *ctx);
-static int service_reload(DBusMessage *message, struct sbus_conn_ctx *sconn) {
+static int service_reload(DBusMessage *message, struct sbus_connection *conn) {
/* 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, sconn);
+ return service_pong(message, conn);
}
-static void pam_dp_reconnect_init(struct sbus_conn_ctx *sconn, int status, void *pvt)
+static void pam_dp_reconnect_init(struct sbus_connection *conn, int status, void *pvt)
{
int ret;
struct resp_ctx *rctx = talloc_get_type(pvt, struct resp_ctx);
@@ -148,7 +148,7 @@ static void pam_dp_reconnect_init(struct sbus_conn_ctx *sconn, int status, void
/* Did we reconnect successfully? */
if (status == SBUS_RECONNECT_SUCCESS) {
/* Add the methods back to the new connection */
- ret = sbus_conn_add_method_ctx(rctx->conn_ctx,
+ ret = sbus_conn_add_method_ctx(rctx->conn,
rctx->sm_ctx);
if (ret != EOK) {
DEBUG(0, ("Could not re-add methods on reconnection.\n"));
@@ -190,7 +190,7 @@ static int pam_process_init(struct main_context *main_ctx,
return ret;
}
- sbus_reconnect_init(rctx->conn_ctx, max_retries,
+ sbus_reconnect_init(rctx->conn, max_retries,
pam_dp_reconnect_init, rctx);
return EOK;
diff --git a/server/responder/pam/pamsrv_dp.c b/server/responder/pam/pamsrv_dp.c
index 9703fdbbb..c7a536e80 100644
--- a/server/responder/pam/pamsrv_dp.c
+++ b/server/responder/pam/pamsrv_dp.c
@@ -85,19 +85,19 @@ int pam_dp_send_req(struct pam_auth_req *preq, int timeout)
struct pam_data *pd = preq->pd;
DBusMessage *msg;
DBusPendingCall *pending_reply;
- DBusConnection *conn;
+ DBusConnection *dbus_conn;
dbus_bool_t ret;
/* double check dp_ctx has actually been initialized.
* in some pathological cases it may happen that nss starts up before
* dp connection code is actually able to establish a connection.
*/
- if (!preq->cctx->rctx->conn_ctx) {
+ if (!preq->cctx->rctx->conn) {
DEBUG(1, ("The Data Provider connection is not available yet!"
" This maybe a bug, it shouldn't happen!\n"));
return EIO;
}
- conn = sbus_get_connection(preq->cctx->rctx->conn_ctx);
+ dbus_conn = sbus_get_connection(preq->cctx->rctx->conn);
msg = dbus_message_new_method_call(NULL,
DP_CLI_PATH,
@@ -118,7 +118,7 @@ int pam_dp_send_req(struct pam_auth_req *preq, int timeout)
return EIO;
}
- ret = dbus_connection_send_with_reply(conn, msg, &pending_reply, timeout);
+ ret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply, timeout);
if (!ret || pending_reply == NULL) {
/*
* Critical Failure
@@ -137,7 +137,7 @@ int pam_dp_send_req(struct pam_auth_req *preq, int timeout)
return EOK;
}
-static int pam_dp_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
+static int pam_dp_identity(DBusMessage *message, struct sbus_connection *conn)
{
dbus_uint16_t version = DATA_PROVIDER_VERSION;
dbus_uint16_t clitype = DP_CLI_FRONTEND;
@@ -163,7 +163,7 @@ static int pam_dp_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
/* send reply back */
- sbus_conn_send_reply(sconn, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return EOK;
diff --git a/server/sbus/sbus_client.c b/server/sbus/sbus_client.c
index 971aa1616..990f21b02 100644
--- a/server/sbus/sbus_client.c
+++ b/server/sbus/sbus_client.c
@@ -27,11 +27,11 @@ int sbus_client_init(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct sbus_method_ctx *sm_ctx,
const char *server_address,
- struct sbus_conn_ctx **_conn_ctx,
+ struct sbus_connection **_conn,
sbus_conn_destructor_fn destructor,
void *conn_pvt_data)
{
- struct sbus_conn_ctx *conn_ctx = NULL;
+ struct sbus_connection *conn = NULL;
int ret;
/* Validate input */
@@ -39,24 +39,24 @@ int sbus_client_init(TALLOC_CTX *mem_ctx,
return EINVAL;
}
- ret = sbus_new_connection(mem_ctx, ev, server_address, &conn_ctx);
+ ret = sbus_new_connection(mem_ctx, ev, server_address, &conn);
if (ret != EOK) {
goto fail;
}
- ret = sbus_conn_add_method_ctx(conn_ctx, sm_ctx);
+ ret = sbus_conn_add_method_ctx(conn, sm_ctx);
if (ret != EOK) {
goto fail;
}
/* Set connection destructor and private data */
- sbus_conn_set_destructor(conn_ctx, destructor);
- sbus_conn_set_private_data(conn_ctx, conn_pvt_data);
+ sbus_conn_set_destructor(conn, destructor);
+ sbus_conn_set_private_data(conn, conn_pvt_data);
- *_conn_ctx = conn_ctx;
+ *_conn = conn;
return EOK;
fail:
- talloc_free(conn_ctx);
+ talloc_free(conn);
return ret;
}
diff --git a/server/sbus/sbus_client.h b/server/sbus/sbus_client.h
index 98b5309ce..b49dd66ed 100644
--- a/server/sbus/sbus_client.h
+++ b/server/sbus/sbus_client.h
@@ -29,7 +29,7 @@ int sbus_client_init(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct sbus_method_ctx *sm_ctx,
const char *server_address,
- struct sbus_conn_ctx **_conn_ctx,
+ struct sbus_connection **_conn,
sbus_conn_destructor_fn destructor,
void *conn_pvt_data);
diff --git a/server/sbus/sssd_dbus.h b/server/sbus/sssd_dbus.h
index ddb1cb89e..412820387 100644
--- a/server/sbus/sssd_dbus.h
+++ b/server/sbus/sssd_dbus.h
@@ -22,12 +22,12 @@
#ifndef _SSSD_DBUS_H_
#define _SSSD_DBUS_H_
-struct sbus_conn_ctx;
+struct sbus_connection;
struct sbus_srv_ctx;
#include "dbus/dbus.h"
-typedef int (*sbus_msg_handler_fn)(DBusMessage *, struct sbus_conn_ctx *);
+typedef int (*sbus_msg_handler_fn)(DBusMessage *, struct sbus_connection *);
/*
* sbus_conn_destructor_fn
@@ -35,7 +35,7 @@ typedef int (*sbus_msg_handler_fn)(DBusMessage *, struct sbus_conn_ctx *);
*/
typedef int (*sbus_conn_destructor_fn)(void *);
-typedef void (*sbus_conn_reconn_callback_fn)(struct sbus_conn_ctx *, int, void *);
+typedef void (*sbus_conn_reconn_callback_fn)(struct sbus_connection *, int, void *);
/*
* sbus_server_conn_init_fn
@@ -43,7 +43,7 @@ typedef void (*sbus_conn_reconn_callback_fn)(struct sbus_conn_ctx *, int, void *
* This function should define the sbus_conn_destructor_fn
* for this connection at a minimum
*/
-typedef int (*sbus_server_conn_init_fn)(struct sbus_conn_ctx *, void *);
+typedef int (*sbus_server_conn_init_fn)(struct sbus_connection *, void *);
enum {
SBUS_CONN_TYPE_PRIVATE = 1,
@@ -91,7 +91,7 @@ int sbus_new_server(TALLOC_CTX *mem_ctx,
*/
int sbus_new_connection(TALLOC_CTX *ctx, struct tevent_context *ev,
const char *address,
- struct sbus_conn_ctx **conn_ctx);
+ struct sbus_connection **conn);
/* sbus_add_connection
* Integrates a D-BUS connection with the TEvent main
@@ -108,27 +108,27 @@ int sbus_new_connection(TALLOC_CTX *ctx, struct tevent_context *ev,
int sbus_add_connection(TALLOC_CTX *ctx,
struct tevent_context *ev,
DBusConnection *dbus_conn,
- struct sbus_conn_ctx **dct_ctx,
+ struct sbus_connection **conn,
int connection_type);
-void sbus_conn_set_destructor(struct sbus_conn_ctx *conn_ctx,
+void sbus_conn_set_destructor(struct sbus_connection *conn,
sbus_conn_destructor_fn destructor);
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,
+DBusConnection *sbus_get_connection(struct sbus_connection *conn);
+void sbus_disconnect(struct sbus_connection *conn);
+void sbus_conn_set_private_data(struct sbus_connection *conn, void *pvt_data);
+void *sbus_conn_get_private_data(struct sbus_connection *conn);
+int sbus_conn_add_method_ctx(struct sbus_connection *conn,
struct sbus_method_ctx *method_ctx);
-bool sbus_conn_disconnecting(struct sbus_conn_ctx *conn_ctx);
+bool sbus_conn_disconnecting(struct sbus_connection *conn);
/* max_retries < 0: retry forever
* max_retries = 0: never retry (why are you calling this function?)
* max_retries > 0: obvious
*/
-void sbus_reconnect_init(struct sbus_conn_ctx *conn_ctx,
+void sbus_reconnect_init(struct sbus_connection *conn,
int max_retries,
sbus_conn_reconn_callback_fn callback,
void *pvt);
@@ -139,7 +139,7 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn,
DBusMessage *message,
void *user_data);
-void sbus_conn_send_reply(struct sbus_conn_ctx *conn_ctx,
+void sbus_conn_send_reply(struct sbus_connection *conn,
DBusMessage *reply);
int sbus_is_dbus_fixed_type(int dbus_type);
diff --git a/server/sbus/sssd_dbus_connection.c b/server/sbus/sssd_dbus_connection.c
index 70ddefd9f..8e4c3048b 100644
--- a/server/sbus/sssd_dbus_connection.c
+++ b/server/sbus/sssd_dbus_connection.c
@@ -7,7 +7,7 @@
/* Types */
struct dbus_ctx_list;
-struct sbus_conn_ctx {
+struct sbus_connection {
struct tevent_context *ev;
DBusConnection *dbus_conn;
char *address;
@@ -25,36 +25,36 @@ struct sbus_conn_ctx {
};
struct sbus_message_handler_ctx {
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
struct sbus_method_ctx *method_ctx;
};
static int _method_list_contains_path(struct sbus_method_ctx *list,
struct sbus_method_ctx *method);
-static void sbus_unreg_object_paths(struct sbus_conn_ctx *conn_ctx);
+static void sbus_unreg_object_paths(struct sbus_connection *conn);
-static int sbus_auto_reconnect(struct sbus_conn_ctx *conn_ctx);
+static int sbus_auto_reconnect(struct sbus_connection *conn);
static void sbus_dispatch(struct tevent_context *ev,
struct tevent_timer *te,
struct timeval tv, void *data)
{
struct tevent_timer *new_event;
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
DBusConnection *dbus_conn;
int ret;
if (data == NULL) return;
- conn_ctx = talloc_get_type(data, struct sbus_conn_ctx);
+ conn = talloc_get_type(data, struct sbus_connection);
- dbus_conn = conn_ctx->dbus_conn;
+ dbus_conn = conn->dbus_conn;
DEBUG(6, ("dbus conn: %lX\n", dbus_conn));
- if (conn_ctx->retries > 0) {
+ if (conn->retries > 0) {
DEBUG(6, ("SBUS is reconnecting. Deferring.\n"));
/* Currently trying to reconnect, defer dispatch */
- new_event = tevent_add_timer(ev, conn_ctx, tv, sbus_dispatch, conn_ctx);
+ new_event = tevent_add_timer(ev, conn, tv, sbus_dispatch, conn);
if (new_event == NULL) {
DEBUG(0,("Could not defer dispatch!\n"));
}
@@ -62,30 +62,30 @@ static void sbus_dispatch(struct tevent_context *ev,
}
if ((!dbus_connection_get_is_connected(dbus_conn)) &&
- (conn_ctx->max_retries != 0)) {
+ (conn->max_retries != 0)) {
/* Attempt to reconnect automatically */
- ret = sbus_auto_reconnect(conn_ctx);
+ ret = sbus_auto_reconnect(conn);
if (ret == EOK) {
DEBUG(1, ("Performing auto-reconnect\n"));
return;
}
DEBUG(0, ("Cannot start auto-reconnection.\n"));
- conn_ctx->reconnect_callback(conn_ctx,
+ conn->reconnect_callback(conn,
SBUS_RECONNECT_ERROR,
- conn_ctx->reconnect_pvt);
+ conn->reconnect_pvt);
return;
}
- if ((conn_ctx->disconnect) ||
+ if ((conn->disconnect) ||
(!dbus_connection_get_is_connected(dbus_conn))) {
DEBUG(3,("Connection is not open for dispatching.\n"));
/*
* Free the connection object.
* This will invoke the destructor for the connection
*/
- talloc_free(conn_ctx);
- conn_ctx = NULL;
+ talloc_free(conn);
+ conn = NULL;
return;
}
@@ -103,7 +103,7 @@ static void sbus_dispatch(struct tevent_context *ev,
*/
ret = dbus_connection_get_dispatch_status(dbus_conn);
if (ret != DBUS_DISPATCH_COMPLETE) {
- new_event = tevent_add_timer(ev, conn_ctx, tv, sbus_dispatch, conn_ctx);
+ new_event = tevent_add_timer(ev, conn, tv, sbus_dispatch, conn);
if (new_event == NULL) {
DEBUG(2,("Could not add dispatch event!\n"));
@@ -122,15 +122,15 @@ static void sbus_dispatch(struct tevent_context *ev,
*/
static void sbus_conn_wakeup_main(void *data)
{
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
struct timeval tv;
struct tevent_timer *te;
- conn_ctx = talloc_get_type(data, struct sbus_conn_ctx);
+ conn = talloc_get_type(data, struct sbus_connection);
gettimeofday(&tv, NULL);
/* D-BUS calls this function when it is time to do a dispatch */
- te = tevent_add_timer(conn_ctx->ev, conn_ctx, tv, sbus_dispatch, conn_ctx);
+ te = tevent_add_timer(conn->ev, conn, tv, sbus_dispatch, conn);
if (te == NULL) {
DEBUG(2,("Could not add dispatch event!\n"));
/* TODO: Calling exit here is bad */
@@ -138,7 +138,7 @@ static void sbus_conn_wakeup_main(void *data)
}
}
-static int sbus_add_connection_int(struct sbus_conn_ctx **conn_ctx);
+static int sbus_add_connection_int(struct sbus_connection **conn);
/*
* integrate_connection_with_event_loop
@@ -148,40 +148,40 @@ static int sbus_add_connection_int(struct sbus_conn_ctx **conn_ctx);
int sbus_add_connection(TALLOC_CTX *ctx,
struct tevent_context *ev,
DBusConnection *dbus_conn,
- struct sbus_conn_ctx **_conn_ctx,
+ struct sbus_connection **_conn,
int connection_type)
{
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
int ret;
DEBUG(5,("Adding connection %lX\n", dbus_conn));
- conn_ctx = talloc_zero(ctx, struct sbus_conn_ctx);
+ conn = talloc_zero(ctx, struct sbus_connection);
- conn_ctx->ev = ev;
- conn_ctx->dbus_conn = dbus_conn;
- conn_ctx->connection_type = connection_type;
- conn_ctx->disconnect = 0;
+ conn->ev = ev;
+ conn->dbus_conn = dbus_conn;
+ conn->connection_type = connection_type;
+ conn->disconnect = 0;
/* This will be replaced on the first call to sbus_conn_add_method_ctx() */
- conn_ctx->method_ctx_list = NULL;
+ conn->method_ctx_list = NULL;
/* This can be overridden by a call to sbus_reconnect_init() */
- conn_ctx->retries = 0;
- conn_ctx->max_retries = 0;
- conn_ctx->reconnect_callback = NULL;
+ conn->retries = 0;
+ conn->max_retries = 0;
+ conn->reconnect_callback = NULL;
- *_conn_ctx = conn_ctx;
+ *_conn = conn;
- ret = sbus_add_connection_int(_conn_ctx);
+ ret = sbus_add_connection_int(_conn);
if (ret != EOK) {
- talloc_free(conn_ctx);
+ talloc_free(conn);
}
return ret;
}
-static int sbus_add_connection_int(struct sbus_conn_ctx **_conn_ctx)
+static int sbus_add_connection_int(struct sbus_connection **_conn)
{
- struct sbus_conn_ctx *conn_ctx = *_conn_ctx;
+ struct sbus_connection *conn = *_conn;
struct sbus_generic_dbus_ctx *gen_ctx;
dbus_bool_t dbret;
@@ -190,19 +190,19 @@ static int sbus_add_connection_int(struct sbus_conn_ctx **_conn_ctx)
* Connections can override this with
* sbus_conn_set_destructor
*/
- sbus_conn_set_destructor(conn_ctx, NULL);
+ sbus_conn_set_destructor(conn, NULL);
- gen_ctx = talloc_zero(conn_ctx, struct sbus_generic_dbus_ctx);
+ gen_ctx = talloc_zero(conn, struct sbus_generic_dbus_ctx);
if (!gen_ctx) {
DEBUG(0, ("Out of memory!\n"));
return ENOMEM;
}
- gen_ctx->ev = conn_ctx->ev;
+ gen_ctx->ev = conn->ev;
gen_ctx->type = SBUS_CONNECTION;
- gen_ctx->dbus.conn = conn_ctx->dbus_conn;
+ gen_ctx->dbus.conn = conn->dbus_conn;
/* Set up DBusWatch functions */
- dbret = dbus_connection_set_watch_functions(conn_ctx->dbus_conn,
+ dbret = dbus_connection_set_watch_functions(conn->dbus_conn,
sbus_add_watch,
sbus_remove_watch,
sbus_toggle_watch,
@@ -213,7 +213,7 @@ static int sbus_add_connection_int(struct sbus_conn_ctx **_conn_ctx)
}
/* Set up DBusTimeout functions */
- dbret = dbus_connection_set_timeout_functions(conn_ctx->dbus_conn,
+ dbret = dbus_connection_set_timeout_functions(conn->dbus_conn,
sbus_add_timeout,
sbus_remove_timeout,
sbus_toggle_timeout,
@@ -225,9 +225,9 @@ static int sbus_add_connection_int(struct sbus_conn_ctx **_conn_ctx)
}
/* Set up dispatch handler */
- dbus_connection_set_wakeup_main_function(conn_ctx->dbus_conn,
+ dbus_connection_set_wakeup_main_function(conn->dbus_conn,
sbus_conn_wakeup_main,
- conn_ctx, NULL);
+ conn, NULL);
/* Set up any method_contexts passed in */
@@ -236,17 +236,17 @@ static int sbus_add_connection_int(struct sbus_conn_ctx **_conn_ctx)
* If there are no messages to be dispatched, this will do
* nothing.
*/
- sbus_conn_wakeup_main(conn_ctx);
+ sbus_conn_wakeup_main(conn);
/* Return the new toplevel object */
- *_conn_ctx = conn_ctx;
+ *_conn = conn;
return EOK;
}
int sbus_new_connection(TALLOC_CTX *ctx, struct tevent_context *ev,
const char *address,
- struct sbus_conn_ctx **conn_ctx)
+ struct sbus_connection **conn)
{
DBusConnection *dbus_conn;
DBusError dbus_error;
@@ -264,15 +264,15 @@ int sbus_new_connection(TALLOC_CTX *ctx, struct tevent_context *ev,
}
ret = sbus_add_connection(ctx, ev, dbus_conn,
- conn_ctx, SBUS_CONN_TYPE_SHARED);
+ conn, SBUS_CONN_TYPE_SHARED);
if (ret != EOK) {
/* FIXME: release resources */
}
/* Store the address for later reconnection */
- (*conn_ctx)->address = talloc_strdup((*conn_ctx), address);
+ (*conn)->address = talloc_strdup((*conn), address);
- dbus_connection_set_exit_on_disconnect((*conn_ctx)->dbus_conn, FALSE);
+ dbus_connection_set_exit_on_disconnect((*conn)->dbus_conn, FALSE);
return ret;
}
@@ -281,33 +281,33 @@ int sbus_new_connection(TALLOC_CTX *ctx, struct tevent_context *ev,
* sbus_conn_set_destructor
* Configures a callback to clean up this connection when it
* is finalized.
- * @param conn_ctx The sbus_conn_ctx created
+ * @param conn The sbus_connection created
* when this connection was established
* @param destructor The destructor function that should be
* called when the connection is finalized. If passed NULL,
* this will reset the connection to the default destructor.
*/
-void sbus_conn_set_destructor(struct sbus_conn_ctx *conn_ctx,
+void sbus_conn_set_destructor(struct sbus_connection *conn,
sbus_conn_destructor_fn destructor)
{
- if (!conn_ctx) return;
+ if (!conn) return;
- conn_ctx->destructor = destructor;
+ conn->destructor = destructor;
/* TODO: Should we try to handle the talloc_destructor too? */
}
int sbus_default_connection_destructor(void *ctx)
{
- struct sbus_conn_ctx *conn_ctx;
- conn_ctx = talloc_get_type(ctx, struct sbus_conn_ctx);
+ struct sbus_connection *conn;
+ conn = talloc_get_type(ctx, struct sbus_connection);
DEBUG(5, ("Invoking default destructor on connection %lX\n",
- conn_ctx->dbus_conn));
- if (conn_ctx->connection_type == SBUS_CONN_TYPE_PRIVATE) {
+ conn->dbus_conn));
+ if (conn->connection_type == SBUS_CONN_TYPE_PRIVATE) {
/* Private connections must be closed explicitly */
- dbus_connection_close(conn_ctx->dbus_conn);
+ dbus_connection_close(conn->dbus_conn);
}
- else if (conn_ctx->connection_type == SBUS_CONN_TYPE_SHARED) {
+ else if (conn->connection_type == SBUS_CONN_TYPE_SHARED) {
/* Shared connections are destroyed when their last reference is removed */
}
else {
@@ -319,75 +319,75 @@ int sbus_default_connection_destructor(void *ctx)
/* Remove object path */
/* TODO: Remove object paths */
- dbus_connection_unref(conn_ctx->dbus_conn);
+ dbus_connection_unref(conn->dbus_conn);
return 0;
}
/*
* sbus_get_connection
* Utility function to retreive the DBusConnection object
- * from a sbus_conn_ctx
+ * from a sbus_connection
*/
-DBusConnection *sbus_get_connection(struct sbus_conn_ctx *conn_ctx)
+DBusConnection *sbus_get_connection(struct sbus_connection *conn)
{
- return conn_ctx->dbus_conn;
+ return conn->dbus_conn;
}
-void sbus_disconnect (struct sbus_conn_ctx *conn_ctx)
+void sbus_disconnect (struct sbus_connection *conn)
{
- if (conn_ctx == NULL) {
+ if (conn == NULL) {
return;
}
- DEBUG(5,("Disconnecting %lX\n", conn_ctx->dbus_conn));
+ DEBUG(5,("Disconnecting %lX\n", conn->dbus_conn));
/*******************************
- * Referencing conn_ctx->dbus_conn */
- dbus_connection_ref(conn_ctx->dbus_conn);
+ * Referencing conn->dbus_conn */
+ dbus_connection_ref(conn->dbus_conn);
- conn_ctx->disconnect = 1;
+ conn->disconnect = 1;
/* Invoke the custom destructor, if it exists */
- if (conn_ctx->destructor) {
- conn_ctx->destructor(conn_ctx);
+ if (conn->destructor) {
+ conn->destructor(conn);
}
/* Unregister object paths */
- sbus_unreg_object_paths(conn_ctx);
+ sbus_unreg_object_paths(conn);
/* Disable watch functions */
- dbus_connection_set_watch_functions(conn_ctx->dbus_conn,
+ dbus_connection_set_watch_functions(conn->dbus_conn,
NULL, NULL, NULL,
NULL, NULL);
/* Disable timeout functions */
- dbus_connection_set_timeout_functions(conn_ctx->dbus_conn,
+ dbus_connection_set_timeout_functions(conn->dbus_conn,
NULL, NULL, NULL,
NULL, NULL);
/* Disable dispatch status function */
- dbus_connection_set_dispatch_status_function(conn_ctx->dbus_conn,
+ dbus_connection_set_dispatch_status_function(conn->dbus_conn,
NULL, NULL, NULL);
/* Disable wakeup main function */
- dbus_connection_set_wakeup_main_function(conn_ctx->dbus_conn,
+ dbus_connection_set_wakeup_main_function(conn->dbus_conn,
NULL, NULL, NULL);
/* Finalize the connection */
- sbus_default_connection_destructor(conn_ctx);
+ sbus_default_connection_destructor(conn);
- dbus_connection_unref(conn_ctx->dbus_conn);
- /* Unreferenced conn_ctx->dbus_conn *
+ dbus_connection_unref(conn->dbus_conn);
+ /* Unreferenced conn->dbus_conn *
******************************/
- DEBUG(5,("Disconnected %lX\n", conn_ctx->dbus_conn));
+ DEBUG(5,("Disconnected %lX\n", conn->dbus_conn));
}
static int sbus_reply_internal_error(DBusMessage *message,
- struct sbus_conn_ctx *conn_ctx) {
+ struct sbus_connection *conn) {
DBusMessage *reply = dbus_message_new_error(message, DBUS_ERROR_IO_ERROR,
"Internal Error");
if (reply) {
- sbus_conn_send_reply(conn_ctx, reply);
+ sbus_conn_send_reply(conn, reply);
dbus_message_unref(reply);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -397,7 +397,7 @@ static int sbus_reply_internal_error(DBusMessage *message,
/* messsage_handler
* Receive messages and process them
*/
-DBusHandlerResult sbus_message_handler(DBusConnection *conn,
+DBusHandlerResult sbus_message_handler(DBusConnection *dbus_conn,
DBusMessage *message,
void *user_data)
{
@@ -432,9 +432,9 @@ 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->conn_ctx);
+ ret = ctx->method_ctx->methods[i].fn(message, ctx->conn);
if (ret != EOK) return sbus_reply_internal_error(message,
- ctx->conn_ctx);
+ ctx->conn);
break;
}
}
@@ -443,7 +443,7 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn,
/* Reply DBUS_ERROR_UNKNOWN_METHOD */
DEBUG(1, ("No matching method found for %s.\n", method));
reply = dbus_message_new_error(message, DBUS_ERROR_UNKNOWN_METHOD, NULL);
- sbus_conn_send_reply(ctx->conn_ctx, reply);
+ sbus_conn_send_reply(ctx->conn, reply);
dbus_message_unref(reply);
}
}
@@ -458,9 +458,9 @@ 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->conn_ctx);
+ ret = ctx->method_ctx->introspect_fn(message, ctx->conn);
if (ret != EOK) return sbus_reply_internal_error(message,
- ctx->conn_ctx);
+ ctx->conn);
}
}
else
@@ -473,7 +473,7 @@ DBusHandlerResult sbus_message_handler(DBusConnection *conn,
/* Adds a new D-BUS path message handler to the connection
* Note: this must be a unique path.
*/
-int sbus_conn_add_method_ctx(struct sbus_conn_ctx *conn_ctx,
+int sbus_conn_add_method_ctx(struct sbus_connection *conn,
struct sbus_method_ctx *method_ctx)
{
DBusObjectPathVTable *connection_vtable;
@@ -481,11 +481,11 @@ int sbus_conn_add_method_ctx(struct sbus_conn_ctx *conn_ctx,
TALLOC_CTX *tmp_ctx;
dbus_bool_t dbret;
- if (!conn_ctx || !method_ctx) {
+ if (!conn || !method_ctx) {
return EINVAL;
}
- if (_method_list_contains_path(conn_ctx->method_ctx_list, method_ctx)) {
+ if (_method_list_contains_path(conn->method_ctx_list, method_ctx)) {
DEBUG(0, ("Cannot add method context with identical path.\n"));
return EINVAL;
}
@@ -494,29 +494,29 @@ int sbus_conn_add_method_ctx(struct sbus_conn_ctx *conn_ctx,
return EINVAL;
}
- DLIST_ADD(conn_ctx->method_ctx_list, method_ctx);
- tmp_ctx = talloc_reference(conn_ctx, method_ctx);
+ DLIST_ADD(conn->method_ctx_list, method_ctx);
+ tmp_ctx = talloc_reference(conn, method_ctx);
if (tmp_ctx != method_ctx) {
/* talloc_reference only fails on insufficient memory */
return ENOMEM;
}
/* Set up the vtable for the object path */
- connection_vtable = talloc_zero(conn_ctx, DBusObjectPathVTable);
+ connection_vtable = talloc_zero(conn, DBusObjectPathVTable);
if (!connection_vtable) {
return ENOMEM;
}
connection_vtable->message_function = method_ctx->message_handler;
- msg_handler_ctx = talloc_zero(conn_ctx, struct sbus_message_handler_ctx);
+ msg_handler_ctx = talloc_zero(conn, struct sbus_message_handler_ctx);
if (!msg_handler_ctx) {
talloc_free(connection_vtable);
return ENOMEM;
}
- msg_handler_ctx->conn_ctx = conn_ctx;
+ msg_handler_ctx->conn = conn;
msg_handler_ctx->method_ctx = method_ctx;
- dbret = dbus_connection_register_object_path(conn_ctx->dbus_conn,
+ dbret = dbus_connection_register_object_path(conn->dbus_conn,
method_ctx->path,
connection_vtable,
msg_handler_ctx);
@@ -548,36 +548,36 @@ static int _method_list_contains_path(struct sbus_method_ctx *list,
return 0; /* FALSE */
}
-static void sbus_unreg_object_paths(struct sbus_conn_ctx *conn_ctx)
+static void sbus_unreg_object_paths(struct sbus_connection *conn)
{
- struct sbus_method_ctx *iter = conn_ctx->method_ctx_list;
+ struct sbus_method_ctx *iter = conn->method_ctx_list;
struct sbus_method_ctx *purge;
while (iter != NULL) {
- dbus_connection_unregister_object_path(conn_ctx->dbus_conn,
+ dbus_connection_unregister_object_path(conn->dbus_conn,
iter->path);
- DLIST_REMOVE(conn_ctx->method_ctx_list, iter);
+ DLIST_REMOVE(conn->method_ctx_list, iter);
purge = iter;
iter = iter->next;
- talloc_unlink(conn_ctx, purge);
+ talloc_unlink(conn, purge);
}
}
-void sbus_conn_set_private_data(struct sbus_conn_ctx *conn_ctx, void *pvt_data)
+void sbus_conn_set_private_data(struct sbus_connection *conn, void *pvt_data)
{
- conn_ctx->pvt_data = pvt_data;
+ conn->pvt_data = pvt_data;
}
-void *sbus_conn_get_private_data(struct sbus_conn_ctx *conn_ctx)
+void *sbus_conn_get_private_data(struct sbus_connection *conn)
{
- return conn_ctx->pvt_data;
+ return conn->pvt_data;
}
static void sbus_reconnect(struct tevent_context *ev,
struct tevent_timer *te,
struct timeval tv, void *data)
{
- struct sbus_conn_ctx *conn_ctx = talloc_get_type(data, struct sbus_conn_ctx);
+ struct sbus_connection *conn = talloc_get_type(data, struct sbus_connection);
DBusConnection *dbus_conn;
DBusError dbus_error;
struct tevent_timer *event;
@@ -586,40 +586,40 @@ static void sbus_reconnect(struct tevent_context *ev,
int ret;
DEBUG(3, ("Making reconnection attempt %d to [%s]\n",
- conn_ctx->retries, conn_ctx->address));
+ conn->retries, conn->address));
/* Make a new connection to the D-BUS address */
dbus_error_init(&dbus_error);
- dbus_conn = dbus_connection_open(conn_ctx->address, &dbus_error);
+ dbus_conn = dbus_connection_open(conn->address, &dbus_error);
if (dbus_conn) {
/* We successfully reconnected. Set up mainloop
* integration.
*/
- DEBUG(3, ("Reconnected to [%s]\n", conn_ctx->address));
- conn_ctx->dbus_conn = dbus_conn;
- ret = sbus_add_connection_int(&conn_ctx);
+ DEBUG(3, ("Reconnected to [%s]\n", conn->address));
+ conn->dbus_conn = dbus_conn;
+ ret = sbus_add_connection_int(&conn);
if (ret != EOK) {
dbus_connection_unref(dbus_conn);
goto failed;
}
/* Remove object paths (the reconnection callback must re-add these */
- iter = conn_ctx->method_ctx_list;
+ iter = conn->method_ctx_list;
while (iter != NULL) {
- DLIST_REMOVE(conn_ctx->method_ctx_list, iter);
+ DLIST_REMOVE(conn->method_ctx_list, iter);
purge = iter;
iter = iter->next;
- talloc_unlink(conn_ctx, purge);
+ talloc_unlink(conn, purge);
}
/* Reset retries to 0 to resume dispatch processing */
- conn_ctx->retries = 0;
+ conn->retries = 0;
/* Notify the owner of this connection that the
* reconnection was successful
*/
- conn_ctx->reconnect_callback(conn_ctx,
+ conn->reconnect_callback(conn,
SBUS_RECONNECT_SUCCESS,
- conn_ctx->reconnect_pvt);
+ conn->reconnect_pvt);
return;
}
@@ -629,49 +629,49 @@ failed:
dbus_error.name, dbus_error.message));
if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error);
- conn_ctx->retries++;
+ conn->retries++;
/* Check if we've passed our last chance or if we've lost track of
* our retry count somehow
*/
- if (((conn_ctx->max_retries > 0) &&
- (conn_ctx->retries > conn_ctx->max_retries)) ||
- conn_ctx->retries <= 0) {
- conn_ctx->reconnect_callback(conn_ctx,
+ if (((conn->max_retries > 0) &&
+ (conn->retries > conn->max_retries)) ||
+ conn->retries <= 0) {
+ conn->reconnect_callback(conn,
SBUS_RECONNECT_EXCEEDED_RETRIES,
- conn_ctx->reconnect_pvt);
+ conn->reconnect_pvt);
}
- if (conn_ctx->retries == 2) {
+ if (conn->retries == 2) {
tv.tv_sec += 3; /* Wait 3 seconds before the second reconnect attempt */
}
- else if (conn_ctx->retries == 3) {
+ else if (conn->retries == 3) {
tv.tv_sec += 10; /* Wait 10 seconds before the third reconnect attempt */
}
else {
tv.tv_sec += 30; /* Wait 30 seconds before all subsequent reconnect attempts */
}
- event = tevent_add_timer(conn_ctx->ev, conn_ctx, tv, sbus_reconnect, conn_ctx);
+ event = tevent_add_timer(conn->ev, conn, tv, sbus_reconnect, conn);
if (event == NULL) {
- conn_ctx->reconnect_callback(conn_ctx,
+ conn->reconnect_callback(conn,
SBUS_RECONNECT_ERROR,
- conn_ctx->reconnect_pvt);
+ conn->reconnect_pvt);
}
}
-/* This function will free and recreate the sbus_conn_ctx,
+/* This function will free and recreate the sbus_connection,
* calling functions need to be aware of this (and whether
* they have attached a talloc destructor to the
- * sbus_conn_ctx.
+ * sbus_connection.
*/
-static int sbus_auto_reconnect(struct sbus_conn_ctx *conn_ctx)
+static int sbus_auto_reconnect(struct sbus_connection *conn)
{
struct tevent_timer *te = NULL;
struct timeval tv;
- conn_ctx->retries++;
- if ((conn_ctx->max_retries > 0) &&
- (conn_ctx->retries >= conn_ctx->max_retries)) {
+ conn->retries++;
+ if ((conn->max_retries > 0) &&
+ (conn->retries >= conn->max_retries)) {
/* Return EAGAIN (to tell the calling process it
* needs to create a new connection from scratch
*/
@@ -680,34 +680,34 @@ static int sbus_auto_reconnect(struct sbus_conn_ctx *conn_ctx)
gettimeofday(&tv, NULL);
tv.tv_sec += 1; /* Wait 1 second before the first reconnect attempt */
- te = tevent_add_timer(conn_ctx->ev, conn_ctx, tv, sbus_reconnect, conn_ctx);
+ te = tevent_add_timer(conn->ev, conn, tv, sbus_reconnect, conn);
if (te == NULL) return EAGAIN;
return EOK;
}
/* Max retries */
-void sbus_reconnect_init(struct sbus_conn_ctx *conn_ctx,
+void sbus_reconnect_init(struct sbus_connection *conn,
int max_retries,
sbus_conn_reconn_callback_fn callback,
void *pvt)
{
if(max_retries == 0 || callback == NULL) return;
- conn_ctx->retries = 0;
- conn_ctx->max_retries = max_retries;
- conn_ctx->reconnect_callback = callback;
- conn_ctx->reconnect_pvt = pvt;
+ conn->retries = 0;
+ conn->max_retries = max_retries;
+ conn->reconnect_callback = callback;
+ conn->reconnect_pvt = pvt;
}
-bool sbus_conn_disconnecting(struct sbus_conn_ctx *conn_ctx)
+bool sbus_conn_disconnecting(struct sbus_connection *conn)
{
- if (conn_ctx->disconnect == 1) return true;
+ if (conn->disconnect == 1) return true;
return false;
}
-void sbus_conn_send_reply(struct sbus_conn_ctx *conn_ctx, DBusMessage *reply)
+void sbus_conn_send_reply(struct sbus_connection *conn, DBusMessage *reply)
{
- dbus_connection_send(conn_ctx->dbus_conn, reply, NULL);
+ dbus_connection_send(conn->dbus_conn, reply, NULL);
}
diff --git a/server/sbus/sssd_dbus_server.c b/server/sbus/sssd_dbus_server.c
index 6df004d31..5c247fcc3 100644
--- a/server/sbus/sssd_dbus_server.c
+++ b/server/sbus/sssd_dbus_server.c
@@ -53,11 +53,11 @@ static int sbus_server_destructor(void *ctx);
* dbus_connection_close()
*/
static void sbus_server_init_new_connection(DBusServer *dbus_server,
- DBusConnection *conn,
+ DBusConnection *dbus_conn,
void *data)
{
struct sbus_srv_ctx *srv_ctx;
- struct sbus_conn_ctx *conn_ctx;
+ struct sbus_connection *conn;
struct sbus_method_ctx *iter;
int ret;
@@ -68,22 +68,22 @@ static void sbus_server_init_new_connection(DBusServer *dbus_server,
}
DEBUG(5,("Adding connection %lX.\n", conn));
- ret = sbus_add_connection(srv_ctx, srv_ctx->ev, conn,
- &conn_ctx, SBUS_CONN_TYPE_PRIVATE);
+ ret = sbus_add_connection(srv_ctx, srv_ctx->ev, dbus_conn,
+ &conn, SBUS_CONN_TYPE_PRIVATE);
if (ret != 0) {
- dbus_connection_close(conn);
+ dbus_connection_close(dbus_conn);
DEBUG(5,("Closing connection (failed setup)"));
return;
}
- dbus_connection_ref(conn);
+ dbus_connection_ref(dbus_conn);
DEBUG(5,("Got a connection\n"));
/* Set up global methods */
iter = srv_ctx->sd_ctx;
while (iter != NULL) {
- sbus_conn_add_method_ctx(conn_ctx, iter);
+ sbus_conn_add_method_ctx(conn, iter);
iter = iter->next;
}
@@ -95,7 +95,7 @@ static void sbus_server_init_new_connection(DBusServer *dbus_server,
* This function (or its callbacks) should also
* set up connection-specific methods.
*/
- ret = srv_ctx->init_fn(conn_ctx, srv_ctx->init_pvt_data);
+ ret = srv_ctx->init_fn(conn, srv_ctx->init_pvt_data);
if (ret != EOK) {
DEBUG(1,("Initialization failed!\n"));
}