Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
htsp server: review channel access verification, fixes #2505
  • Loading branch information
perexg committed Nov 24, 2014
1 parent d6bfd1f commit fe24184
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/htsp_server.c
Expand Up @@ -1096,7 +1096,7 @@ htsp_method_getEvents(htsp_connection_t *htsp, htsmsg_t *in)
return htsp_error("Event does not exist");

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

numFollowing = htsmsg_get_u32_or_default(in, "numFollowing", 0);
Expand Down Expand Up @@ -1192,7 +1192,7 @@ htsp_method_epgQuery(htsp_connection_t *htsp, htsmsg_t *in)
tvhtrace("htsp", "min_duration %d and max_duration %d", min_duration, max_duration);

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

/* Query */
Expand Down Expand Up @@ -1345,8 +1345,10 @@ htsp_method_addDvrEntry(htsp_connection_t *htsp, htsmsg_t *in)
stop_extra = 0;
if(!htsmsg_get_u32(in, "channelId", &u32))
ch = channel_find_by_id(u32);
if(!htsmsg_get_u32(in, "eventId", &eventid))
if(!htsmsg_get_u32(in, "eventId", &eventid)) {
e = epg_broadcast_find_by_id(eventid);
ch = e->channel;
}
if(htsmsg_get_u32(in, "priority", &priority))
priority = DVR_PRIO_NORMAL;
if(htsmsg_get_u32(in, "retention", &retention))
Expand All @@ -1357,7 +1359,7 @@ htsp_method_addDvrEntry(htsp_connection_t *htsp, htsmsg_t *in)
lang = htsp->htsp_language;

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

/* Manual timer */
Expand Down Expand Up @@ -1553,7 +1555,7 @@ htsp_method_addAutorecEntry(htsp_connection_t *htsp, htsmsg_t *in)
comment = "";

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

dae = dvr_autorec_create_htsp(dvr_config_name, title, ch, approx_time, days_of_week,
Expand Down

0 comments on commit fe24184

Please sign in to comment.