Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
api: fixed the permission check issue for DVR (and maybe other)
  • Loading branch information
perexg committed Jun 23, 2015
1 parent 1e7eca9 commit 4c9e009
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/api/api_idnode.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand All @@ -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]));
Expand Down
1 change: 0 additions & 1 deletion src/idnode.h
Expand Up @@ -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
Expand Down

0 comments on commit 4c9e009

Please sign in to comment.