#include <krb5/krb5.h>
+#include <systemd/sd-bus.h>
#include <systemd/sd-daemon.h>
#include <systemd/sd-event.h>
// Event Loop
sd_event* loop;
+ // dbus
+ sd_bus* bus;
+
// Kerberos Authentication
struct {
// Context
return r;
}
+static int pakfire_daemon_setup_bus(struct pakfire_daemon* daemon) {
+ int r;
+
+ // Connect to the system bus
+ r = sd_bus_open_system(&daemon->bus);
+ if (r < 0) {
+ ERROR(daemon->ctx, "Could not connect to system bus: %s\n", strerror(-r));
+ return r;
+ }
+
+ return 0;
+}
+
static int pakfire_daemon_setup_loop(struct pakfire_daemon* daemon) {
int r;
pakfire_xfer_unref(daemon->control);
if (daemon->loop)
sd_event_unref(daemon->loop);
+ if (daemon->bus)
+ sd_bus_unref(daemon->bus);
if (daemon->ctx)
pakfire_ctx_unref(daemon->ctx);
free(daemon);
if (r)
goto ERROR;
+ // Setup dbus
+ r = pakfire_daemon_setup_bus(d);
+ if (r < 0)
+ goto ERROR;
+
// Setup Kerberos Authentication
r = pakfire_daemon_setup_krb5(d);
if (r)