mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-29 00:23:23 -05:00
Rework WWW-Authenticate header parsing
Make it work for both WWW-Authenticate: Digest realm="raop", nonce="518C974C3847DEAE59B1FE0609C437C702C4BEFE" and WWW-Authenticate: Digest realm="raop" nonce="3328882a152ab0b51bc16b15a038b3bb" 802.11g and 802.11n AirPort Express, respectively.
This commit is contained in:
parent
f7c2bf756a
commit
6f642f487b
12
src/raop.c
12
src/raop.c
@ -836,6 +836,8 @@ raop_parse_auth(struct raop_session *rs, struct evrtsp_request *req)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DPRINTF(E_DBG, L_RAOP, "WWW-Authenticate: %s\n", param);
|
||||||
|
|
||||||
if (strncmp(param, "Digest ", strlen("Digest ")) != 0)
|
if (strncmp(param, "Digest ", strlen("Digest ")) != 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_RAOP, "Unsupported authentication method: %s\n", param);
|
DPRINTF(E_LOG, L_RAOP, "Unsupported authentication method: %s\n", param);
|
||||||
@ -859,19 +861,19 @@ raop_parse_auth(struct raop_session *rs, struct evrtsp_request *req)
|
|||||||
{
|
{
|
||||||
if (strcmp(token, "realm") == 0)
|
if (strcmp(token, "realm") == 0)
|
||||||
{
|
{
|
||||||
token = strtok_r(NULL, " =", &ptr);
|
token = strtok_r(NULL, "=\"", &ptr);
|
||||||
if (!token)
|
if (!token)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
rs->realm = strndup(token + 1, strlen(token) - 2);
|
rs->realm = strdup(token);
|
||||||
}
|
}
|
||||||
else if (strcmp(token, "nonce") == 0)
|
else if (strcmp(token, "nonce") == 0)
|
||||||
{
|
{
|
||||||
token = strtok_r(NULL, " =", &ptr);
|
token = strtok_r(NULL, "=\"", &ptr);
|
||||||
if (!token)
|
if (!token)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
rs->nonce = strndup(token + 1, strlen(token) - 2);
|
rs->nonce = strdup(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
token = strtok_r(NULL, " =", &ptr);
|
token = strtok_r(NULL, " =", &ptr);
|
||||||
@ -898,6 +900,8 @@ raop_parse_auth(struct raop_session *rs, struct evrtsp_request *req)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DPRINTF(E_DBG, L_RAOP, "Found realm: [%s], nonce: [%s]\n", rs->realm, rs->nonce);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user