From: Jaroslav Kysela Date: Tue, 23 Jun 2015 13:12:32 +0000 (+0200) Subject: api: fixed the permission check issue for DVR (and maybe other) X-Git-Tag: v4.2.1~2249 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4c9e009ce8b4e074d6f244ddc4f05ebaa3302dab;p=thirdparty%2Ftvheadend.git api: fixed the permission check issue for DVR (and maybe other) --- diff --git a/src/api/api_idnode.c b/src/api/api_idnode.c index bc2a25499..58abcc1ca 100644 --- a/src/api/api_idnode.c +++ b/src/api/api_idnode.c @@ -144,7 +144,8 @@ api_idnode_grid e = htsmsg_create_map(); htsmsg_add_str(e, "uuid", idnode_uuid_as_str(ins.is_array[i])); in = ins.is_array[i]; - idnode_perm_set(in, perm); + if (idnode_perm(in, perm, NULL)) + continue; idnode_read0(in, e, flist, 0, perm->aa_lang); idnode_perm_unset(in); htsmsg_add_msg(list, NULL, e); @@ -411,7 +412,10 @@ api_idnode_tree /* Root node */ if (isroot && node) { htsmsg_t *m; - idnode_perm_set(node, perm); + if (idnode_perm(node, perm, NULL)) { + pthread_mutex_unlock(&global_lock); + return EINVAL; + } m = idnode_serialize(node, perm->aa_lang); idnode_perm_unset(node); htsmsg_add_u32(m, "leaf", idnode_is_leaf(node)); @@ -426,7 +430,8 @@ api_idnode_tree for(i = 0; i < v->is_count; i++) { idnode_t *in = v->is_array[i]; htsmsg_t *m; - idnode_perm_set(in, perm); + if (idnode_perm(in, perm, NULL)) + continue; m = idnode_serialize(v->is_array[i], perm->aa_lang); idnode_perm_unset(in); htsmsg_add_u32(m, "leaf", idnode_is_leaf(v->is_array[i])); diff --git a/src/idnode.h b/src/idnode.h index 908169840..59c6d4d02 100644 --- a/src/idnode.h +++ b/src/idnode.h @@ -203,7 +203,6 @@ int idnode_write0 (idnode_t *self, htsmsg_t *m, int optmask, int dosave); #define idnode_update(in, m) idnode_write0(in, m, PO_RDONLY | PO_WRONCE, 1) int idnode_perm(idnode_t *self, struct access *a, htsmsg_t *msg_to_write); -static inline void idnode_perm_set(idnode_t *self, struct access *a) { self->in_access = a; } static inline void idnode_perm_unset(idnode_t *self) { self->in_access = NULL; } idnode_list_mapping_t * idnode_list_link