Fix: WebServer: Digest authentication failed for some clients
Ports: 4d3850e87e
This commit is contained in:
parent
a299ddc99e
commit
2d3c57635d
@ -33,7 +33,8 @@
|
|||||||
|
|
||||||
|
|
||||||
static const char AUTHORIZATION_HEADER[] = "Authorization";
|
static const char AUTHORIZATION_HEADER[] = "Authorization";
|
||||||
static const char qop_auth[] = "qop=\"auth\"";
|
static const char qop_auth[] PROGMEM = "qop=auth";
|
||||||
|
static const char qop_auth_quoted[] PROGMEM = "qop=\"auth\"";
|
||||||
static const char WWW_Authenticate[] = "WWW-Authenticate";
|
static const char WWW_Authenticate[] = "WWW-Authenticate";
|
||||||
static const char Content_Length[] = "Content-Length";
|
static const char Content_Length[] = "Content-Length";
|
||||||
|
|
||||||
@ -185,7 +186,7 @@ bool WebServer::authenticate(const char * username, const char * password){
|
|||||||
}
|
}
|
||||||
// parameters for the RFC 2617 newer Digest
|
// parameters for the RFC 2617 newer Digest
|
||||||
String _nc,_cnonce;
|
String _nc,_cnonce;
|
||||||
if(authReq.indexOf(FPSTR(qop_auth)) != -1) {
|
if(authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) {
|
||||||
_nc = _extractParam(authReq, F("nc="), ',');
|
_nc = _extractParam(authReq, F("nc="), ',');
|
||||||
_cnonce = _extractParam(authReq, F("cnonce=\""),'\"');
|
_cnonce = _extractParam(authReq, F("cnonce=\""),'\"');
|
||||||
}
|
}
|
||||||
@ -205,7 +206,7 @@ bool WebServer::authenticate(const char * username, const char * password){
|
|||||||
}
|
}
|
||||||
log_v("Hash of GET:uri=%s", _H2.c_str());
|
log_v("Hash of GET:uri=%s", _H2.c_str());
|
||||||
String _responsecheck = "";
|
String _responsecheck = "";
|
||||||
if(authReq.indexOf(FPSTR(qop_auth)) != -1) {
|
if(authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) {
|
||||||
_responsecheck = md5str(_H1 + ':' + _nonce + ':' + _nc + ':' + _cnonce + F(":auth:") + _H2);
|
_responsecheck = md5str(_H1 + ':' + _nonce + ':' + _nc + ':' + _cnonce + F(":auth:") + _H2);
|
||||||
} else {
|
} else {
|
||||||
_responsecheck = md5str(_H1 + ':' + _nonce + ':' + _H2);
|
_responsecheck = md5str(_H1 + ':' + _nonce + ':' + _H2);
|
||||||
|
Loading…
Reference in New Issue
Block a user