Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
http: return correct error code to obtain authorization, fix http_acc…
…ess_verify_channel - mask check
  • Loading branch information
perexg committed Oct 24, 2014
1 parent 38f73e1 commit 596b4e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/http.c
Expand Up @@ -464,6 +464,9 @@ http_access_verify_channel(http_connection_t *hc, int mask,
return -1;
}

if (access_verify2(hc->hc_access, mask))
return -1;

if (channel_access(ch, hc->hc_access, hc->hc_username))
res = 0;
return res;
Expand Down
12 changes: 6 additions & 6 deletions src/webui/webui.c
Expand Up @@ -414,7 +414,7 @@ http_tag_playlist(http_connection_t *hc, channel_tag_t *tag)

if(hc->hc_access == NULL ||
access_verify2(hc->hc_access, ACCESS_STREAMING))
return HTTP_STATUS_NOT_ALLOWED;
return HTTP_STATUS_UNAUTHORIZED;

hq = &hc->hc_reply;
host = http_arg_get(&hc->hc_args, "Host");
Expand Down Expand Up @@ -453,7 +453,7 @@ http_tag_list_playlist(http_connection_t *hc)

if(hc->hc_access == NULL ||
access_verify2(hc->hc_access, ACCESS_STREAMING))
return HTTP_STATUS_NOT_ALLOWED;
return HTTP_STATUS_UNAUTHORIZED;

hq = &hc->hc_reply;
host = http_arg_get(&hc->hc_args, "Host");
Expand Down Expand Up @@ -505,7 +505,7 @@ http_channel_list_playlist(http_connection_t *hc)

if(hc->hc_access == NULL ||
access_verify2(hc->hc_access, ACCESS_STREAMING))
return HTTP_STATUS_NOT_ALLOWED;
return HTTP_STATUS_UNAUTHORIZED;

hq = &hc->hc_reply;
host = http_arg_get(&hc->hc_args, "Host");
Expand Down Expand Up @@ -1061,7 +1061,7 @@ page_play(http_connection_t *hc, const char *remain, void *opaque)
(access_verify2(hc->hc_access, ACCESS_STREAMING) &&
access_verify2(hc->hc_access, ACCESS_ADVANCED_STREAMING) &&
access_verify2(hc->hc_access, ACCESS_RECORDER)))
return HTTP_STATUS_NOT_ALLOWED;
return HTTP_STATUS_UNAUTHORIZED;

playlist = http_arg_get(&hc->hc_req_args, "playlist");
if (playlist) {
Expand Down Expand Up @@ -1104,7 +1104,7 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque)
(access_verify2(hc->hc_access, ACCESS_STREAMING) &&
access_verify2(hc->hc_access, ACCESS_ADVANCED_STREAMING) &&
access_verify2(hc->hc_access, ACCESS_RECORDER)))
return HTTP_STATUS_NOT_ALLOWED;
return HTTP_STATUS_UNAUTHORIZED;

pthread_mutex_lock(&global_lock);

Expand Down Expand Up @@ -1228,7 +1228,7 @@ page_imagecache(http_connection_t *hc, const char *remain, void *opaque)
access_verify2(hc->hc_access, ACCESS_STREAMING) &&
access_verify2(hc->hc_access, ACCESS_ADVANCED_STREAMING) &&
access_verify2(hc->hc_access, ACCESS_RECORDER)))
return HTTP_STATUS_NOT_ALLOWED;
return HTTP_STATUS_UNAUTHORIZED;

if(sscanf(remain, "%d", &id) != 1)
return HTTP_STATUS_BAD_REQUEST;
Expand Down

0 comments on commit 596b4e0

Please sign in to comment.