diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2013-01-26 15:14:55 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2013-01-26 15:14:55 +0100 |
commit | d241c560bf2cd84a4cb497eaa3fe131a7c193293 (patch) | |
tree | c53abf7bba9deccd96b396ee019f504bfdabc80c /ubus.c | |
parent | ac7670faba12e23b8ec7e866dcfe1d98d3921b40 (diff) |
ubus: use a default sid if authentication is disabled
Diffstat (limited to 'ubus.c')
-rw-r--r-- | ubus.c | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -35,6 +35,7 @@ static struct ubus_context *ctx; static struct blob_buf buf; #define UH_UBUS_MAX_POST_SIZE 4096 +#define UH_UBUS_DEFAULT_SID "00000000000000000000000000000000" enum { RPC_JSONRPC, @@ -449,15 +450,21 @@ static void uh_ubus_handle_request(struct client *cl, char *url, struct path_inf blob_buf_init(&buf, 0); - url += strlen(conf.ubus_prefix); - while (*url == '/') - url++; + if (conf.ubus_noauth) { + sid = UH_UBUS_DEFAULT_SID; + } + else { + url += strlen(conf.ubus_prefix); + while (*url == '/') + url++; - sep = strchr(url, '/'); - if (sep) - *sep = 0; + sep = strchr(url, '/'); + if (sep) + *sep = 0; + + sid = url; + } - sid = url; if (strlen(sid) != 32 || cl->request.method != UH_HTTP_MSG_POST) return ops->client_error(cl, 400, "Bad Request", "Invalid Request"); |