[httpd] Better logging of unauthorized requests

This commit is contained in:
ejurgensen 2018-09-07 17:01:32 +02:00
parent f5721b7a18
commit 3ba92aa860
3 changed files with 5 additions and 3 deletions

View File

@ -723,7 +723,7 @@ daap_request_authorize(struct httpd_request *hreq)
{
if (!session)
{
DPRINTF(E_LOG, L_DAAP, "DAAP session not found: '%s'\n", hreq->uri_parsed->uri);
DPRINTF(E_LOG, L_DAAP, "Unauthorized request from '%s', DAAP session not found: '%s'\n", hreq->peer_address, hreq->uri_parsed->uri);
return -1;
}
@ -749,7 +749,7 @@ daap_request_authorize(struct httpd_request *hreq)
ret = httpd_basic_auth(hreq->req, NULL, passwd, cfg_getstr(cfg_getsec(cfg, "library"), "name"));
if (ret != 0)
{
DPRINTF(E_LOG, L_DAAP, "Unsuccessful library authentication\n");
DPRINTF(E_LOG, L_DAAP, "Unsuccessful library authorization attempt from '%s'\n", hreq->peer_address);
return -1;
}

View File

@ -595,6 +595,8 @@ dacp_request_authorize(struct httpd_request *hreq)
return 0;
invalid:
DPRINTF(E_LOG, L_DACP, "Unauthorized request '%s' from '%s' (is peer trusted in your config?)\n", hreq->uri_parsed->uri, hreq->peer_address);
httpd_send_error(hreq->req, 403, "Forbidden");
return -1;
}

View File

@ -297,7 +297,7 @@ rsp_request_authorize(struct httpd_request *hreq)
ret = httpd_basic_auth(hreq->req, NULL, passwd, cfg_getstr(cfg_getsec(cfg, "library"), "name"));
if (ret != 0)
{
DPRINTF(E_LOG, L_RSP, "Unsuccessful library authentication\n");
DPRINTF(E_LOG, L_RSP, "Unsuccessful library authorization attempt from '%s'\n", hreq->peer_address);
return -1;
}