Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
http: drop ticket param from http_access_verify_channel()
With 85e1bbb we now accept ticket or credentials, so we don't need to
hint whether tickets should be honored or not. If there is a ticket and
it satisfies our security check, accept it.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
  • Loading branch information
swegener authored and perexg committed Nov 14, 2015
1 parent d1ce213 commit fb9044c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
6 changes: 2 additions & 4 deletions src/http.c
Expand Up @@ -567,15 +567,13 @@ http_access_verify(http_connection_t *hc, int mask)
*/
int
http_access_verify_channel(http_connection_t *hc, int mask,
struct channel *ch, int ticket)
struct channel *ch)
{
int res = -1;

assert(ch);

if (ticket)
http_access_verify_ticket(hc);

http_access_verify_ticket(hc);
if (hc->hc_access) {
res = access_verify2(hc->hc_access, mask);

Expand Down
2 changes: 1 addition & 1 deletion src/http.h
Expand Up @@ -237,7 +237,7 @@ void http_server_done(void);

int http_access_verify(http_connection_t *hc, int mask);
int http_access_verify_channel(http_connection_t *hc, int mask,
struct channel *ch, int ticket);
struct channel *ch);

void http_deescape(char *s);

Expand Down
10 changes: 5 additions & 5 deletions src/webui/webui.c
Expand Up @@ -543,7 +543,7 @@ http_channel_playlist(http_connection_t *hc, int pltype, channel_t *channel)
char *profile, *hostpath;
const char *name;

if (http_access_verify_channel(hc, ACCESS_STREAMING, channel, 1))
if (http_access_verify_channel(hc, ACCESS_STREAMING, channel))
return HTTP_STATUS_UNAUTHORIZED;

profile = profile_validate_name(http_arg_get(&hc->hc_req_args, "profile"));
Expand Down Expand Up @@ -626,7 +626,7 @@ http_tag_playlist(http_connection_t *hc, int pltype, channel_tag_t *tag)
htsbuf_qprintf(hq, "#NAME %s\n", tag->ct_name);
for (idx = 0; idx < count; idx++) {
ch = chlist[idx];
if (http_access_verify_channel(hc, ACCESS_STREAMING, ch, 0))
if (http_access_verify_channel(hc, ACCESS_STREAMING, ch))
continue;
snprintf(buf, sizeof(buf), "/stream/channelid/%d", channel_get_id(ch));
name = channel_get_name(ch);
Expand Down Expand Up @@ -788,7 +788,7 @@ http_channel_list_playlist(http_connection_t *hc, int pltype)
for (idx = 0; idx < count; idx++) {
ch = chlist[idx];

if (http_access_verify_channel(hc, ACCESS_STREAMING, ch, 0))
if (http_access_verify_channel(hc, ACCESS_STREAMING, ch))
continue;

name = channel_get_name(ch);
Expand Down Expand Up @@ -842,7 +842,7 @@ http_dvr_list_playlist(http_connection_t *hc, int pltype)
continue;

if (de->de_channel &&
http_access_verify_channel(hc, ACCESS_RECORDER, de->de_channel, 0))
http_access_verify_channel(hc, ACCESS_RECORDER, de->de_channel))
continue;

durration = dvr_entry_get_stop_time(de) - dvr_entry_get_start_time(de);
Expand Down Expand Up @@ -1194,7 +1194,7 @@ http_stream_channel(http_connection_t *hc, channel_t *ch, int weight)
void *tcp_id;
int res = HTTP_STATUS_SERVICE;

if (http_access_verify_channel(hc, ACCESS_STREAMING, ch, 1))
if (http_access_verify_channel(hc, ACCESS_STREAMING, ch))
return HTTP_STATUS_UNAUTHORIZED;

if(!(pro = profile_find_by_list(hc->hc_access->aa_profiles,
Expand Down
10 changes: 5 additions & 5 deletions src/webui/xmltv.c
Expand Up @@ -122,7 +122,7 @@ http_xmltv_channel(http_connection_t *hc, channel_t *channel)
{
char *hostpath;

if (http_access_verify_channel(hc, ACCESS_STREAMING, channel, 1))
if (http_access_verify_channel(hc, ACCESS_STREAMING, channel))
return HTTP_STATUS_UNAUTHORIZED;

hostpath = http_get_hostpath(hc);
Expand Down Expand Up @@ -154,13 +154,13 @@ http_xmltv_tag(http_connection_t *hc, channel_tag_t *tag)
http_xmltv_begin(&hc->hc_reply);
LIST_FOREACH(ilm, &tag->ct_ctms, ilm_in1_link) {
ch = (channel_t *)ilm->ilm_in2;
if (http_access_verify_channel(hc, ACCESS_STREAMING, ch, 0))
if (http_access_verify_channel(hc, ACCESS_STREAMING, ch))
continue;
http_xmltv_channel_add(&hc->hc_reply, hostpath, ch);
}
LIST_FOREACH(ilm, &tag->ct_ctms, ilm_in1_link) {
ch = (channel_t *)ilm->ilm_in2;
if (http_access_verify_channel(hc, ACCESS_STREAMING, ch, 0))
if (http_access_verify_channel(hc, ACCESS_STREAMING, ch))
continue;
http_xmltv_programme_add(&hc->hc_reply, hostpath, ch);
}
Expand All @@ -187,12 +187,12 @@ http_xmltv_channel_list(http_connection_t *hc)

http_xmltv_begin(&hc->hc_reply);
CHANNEL_FOREACH(ch) {
if (http_access_verify_channel(hc, ACCESS_STREAMING, ch, 0))
if (http_access_verify_channel(hc, ACCESS_STREAMING, ch))
continue;
http_xmltv_channel_add(&hc->hc_reply, hostpath, ch);
}
CHANNEL_FOREACH(ch) {
if (http_access_verify_channel(hc, ACCESS_STREAMING, ch, 0))
if (http_access_verify_channel(hc, ACCESS_STREAMING, ch))
continue;
http_xmltv_programme_add(&hc->hc_reply, hostpath, ch);
}
Expand Down

0 comments on commit fb9044c

Please sign in to comment.