diff options
Diffstat (limited to 'server/providers/data_provider.c')
-rw-r--r-- | server/providers/data_provider.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c index 677f677f..4dc9dfaa 100644 --- a/server/providers/data_provider.c +++ b/server/providers/data_provider.c @@ -31,6 +31,11 @@ #include <errno.h> #include <security/pam_modules.h> +/* Needed for res_init() */ +#include <netinet/in.h> +#include <arpa/nameser.h> +#include <resolv.h> + #include "popt.h" #include "util/util.h" #include "confdb/confdb.h" @@ -83,11 +88,13 @@ 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); struct sbus_method mon_sbus_methods[] = { { SERVICE_METHOD_IDENTITY, service_identity }, { SERVICE_METHOD_PING, service_pong }, { SERVICE_METHOD_RELOAD, service_reload }, + { SERVICE_METHOD_RES_INIT, service_res_init }, { NULL, NULL } }; @@ -174,6 +181,18 @@ static int service_reload(DBusMessage *message, struct sbus_conn_ctx *sconn) return service_pong(message, sconn); } +static int service_res_init(DBusMessage *message, struct sbus_conn_ctx *sconn) +{ + int ret; + + ret = res_init(); + if(ret != 0) { + return EIO; + } + + return service_pong(message, sconn); +} + static int dp_monitor_init(struct dp_ctx *dpctx) { int ret; |