Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
htsp server: fix channel authorisation for EPG getEvents method
  • Loading branch information
perexg committed Apr 11, 2016
1 parent c9a1e0b commit 679ed1c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/htsp_server.c
Expand Up @@ -1549,15 +1549,17 @@ htsp_method_getEvents(htsp_connection_t *htsp, htsmsg_t *in)
return htsp_error(htsp, N_("Event does not exist"));

/* Check access */
if (ch && !htsp_user_access_channel(htsp, ch))
return htsp_error(htsp, N_("User does not have access"));

numFollowing = htsmsg_get_u32_or_default(in, "numFollowing", 0);
maxTime = htsmsg_get_s64_or_default(in, "maxTime", 0);
lang = htsmsg_get_str(in, "language") ?: htsp->htsp_language;

/* Use event as starting point */
if (e || ch) {

if (!htsp_user_access_channel(htsp, ch))
return htsp_error(htsp, N_("User does not have access"));

if (!e) e = ch->ch_epg_now ?: ch->ch_epg_next;

/* Output */
Expand All @@ -1572,16 +1574,20 @@ htsp_method_getEvents(htsp_connection_t *htsp, htsmsg_t *in)

/* All channels */
} else {

events = htsmsg_create_list();
CHANNEL_FOREACH(ch) {
int num = numFollowing;
if (!htsp_user_access_channel(htsp, ch))
return htsp_error(htsp, N_("User does not have access"));

This comment has been minimized.

Copy link
@Glenn-1990

Glenn-1990 Apr 11, 2016

Contributor

Continue; ?

This comment has been minimized.

Copy link
@perexg

perexg Apr 11, 2016

Author Contributor

Yes, fixed in 37ed360 . Thanks for review.

RB_FOREACH(e, &ch->ch_epg_schedule, sched_link) {
if (maxTime && e->start > maxTime) break;
htsmsg_add_msg(events, NULL, htsp_build_event(e, NULL, lang, 0, htsp));
if (num == 1) break;
if (num) num--;
}
}

}

/* Send */
Expand Down

0 comments on commit 679ed1c

Please sign in to comment.