[PATCH V3 uhttpd] ubus: add new RESTful API
Rafał Miłecki
zajec5 at gmail.com
Tue Sep 15 02:45:12 EDT 2020
On 14.09.2020 17:15, Rafał Miłecki wrote:
> +static void uh_ubus_handle_post(struct client *cl)
> +{
> + static const struct blobmsg_policy hdr_policy[__HDR_UBUS_MAX] = {
> + [HDR_AUTHORIZATION] = { "authorization", BLOBMSG_TYPE_STRING },
> + };
> + struct dispatch_ubus *du = &cl->dispatch.ubus;
> + struct blob_attr *tb[__HDR_UBUS_MAX];
> + const char *url = du->url_path;
> + const char *auth;
> +
> + if (!strcmp(url, conf.ubus_prefix) ||
> + (url[strlen(url) - 1] == '/' && !strncmp(url, conf.ubus_prefix, strlen(url) - 1))) {
I think above may result in false positives for
ubus_prefix: /ubus/
url: /ub/
That should be:
if (ops->path_match(conf.ubus_prefix, url) && strlen(url) - strlen(conf.ubus_prefix) <= 1) {
More information about the openwrt-devel
mailing list