*/
#define _GNU_SOURCE
+#define NO_PLUGIN_VERBOSE_MACRO
#include <stdlib.h>
#include <string.h>
#include <systemd/sd-bus.h>
#include <json-c/json.h>
-#include "afb-plugin.h"
-#include "afb-req-itf.h"
+#include <afb/afb-plugin.h>
+#include <afb/afb-req-itf.h>
#include "afb-common.h"
goto error2;
}
api->api++;
+ if (!afb_apis_is_valid_api_name(api->api)) {
+ errno = EINVAL;
+ goto error2;
+ }
/* the name/interface is copied after the path */
api->name = &api->path[pathlen + 1];
static void dbus_req_success(struct dbus_req *dreq, struct json_object *obj, const char *info)
{
- dbus_req_reply(dreq, RETOK, json_object_to_json_string(obj), info);
+ dbus_req_reply(dreq, RETOK, json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN), info);
}
static void dbus_req_fail(struct dbus_req *dreq, const char *status, const char *info)
int rc;
rc = sd_bus_emit_signal(api->sdbus, api->path, api->name,
- "event", "ss", event, json_object_to_json_string(object));
+ "event", "ss", event, json_object_to_json_string_ext(object, JSON_C_TO_STRING_PLAIN));
if (rc < 0)
ERROR("error while emiting event %s", event);
json_object_put(object);