mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-29 12:16:48 +03:00
Fix: some clients were not able to authenticate using DIGEST_AUTH (#5506)
This commit is contained in:
parent
34e90f3c56
commit
3a36501d6d
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
static const char AUTHORIZATION_HEADER[] PROGMEM = "Authorization";
|
static const char AUTHORIZATION_HEADER[] PROGMEM = "Authorization";
|
||||||
static const char qop_auth[] PROGMEM = "qop=auth";
|
static const char qop_auth[] PROGMEM = "qop=auth";
|
||||||
|
static const char qop_auth_quoted[] PROGMEM = "qop=\"auth\"";
|
||||||
static const char WWW_Authenticate[] PROGMEM = "WWW-Authenticate";
|
static const char WWW_Authenticate[] PROGMEM = "WWW-Authenticate";
|
||||||
static const char Content_Length[] PROGMEM = "Content-Length";
|
static const char Content_Length[] PROGMEM = "Content-Length";
|
||||||
|
|
||||||
@ -165,7 +166,7 @@ bool ESP8266WebServer::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=\""));
|
||||||
}
|
}
|
||||||
@ -195,7 +196,7 @@ bool ESP8266WebServer::authenticate(const char * username, const char * password
|
|||||||
DEBUG_OUTPUT.println("Hash of GET:uri=" + _H2);
|
DEBUG_OUTPUT.println("Hash of GET:uri=" + _H2);
|
||||||
#endif
|
#endif
|
||||||
md5.begin();
|
md5.begin();
|
||||||
if(authReq.indexOf(FPSTR(qop_auth)) != -1) {
|
if(authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) {
|
||||||
md5.add(_H1 + ':' + _nonce + ':' + _nc + ':' + _cnonce + F(":auth:") + _H2);
|
md5.add(_H1 + ':' + _nonce + ':' + _nc + ':' + _cnonce + F(":auth:") + _H2);
|
||||||
} else {
|
} else {
|
||||||
md5.add(_H1 + ':' + _nonce + ':' + _H2);
|
md5.add(_H1 + ':' + _nonce + ':' + _H2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user