diff options
Diffstat (limited to 'server/nss/nsssrv.c')
-rw-r--r-- | server/nss/nsssrv.c | 31 |
1 files changed, 22 insertions, 9 deletions
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) |