mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 07:38:49 -05:00
return CURLDIGEST_NOMEM when a memory function fails to deliver
This commit is contained in:
parent
ccdcdb2a46
commit
78aba6e4cd
@ -105,6 +105,8 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
|
||||
value, content)) ) {
|
||||
if(strequal(value, "nonce")) {
|
||||
d->nonce = strdup(content);
|
||||
if(!d->nonce)
|
||||
return CURLDIGEST_NOMEM;
|
||||
}
|
||||
else if(strequal(value, "stale")) {
|
||||
if(strequal(content, "true")) {
|
||||
@ -114,15 +116,21 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
|
||||
}
|
||||
else if(strequal(value, "realm")) {
|
||||
d->realm = strdup(content);
|
||||
if(!d->realm)
|
||||
return CURLDIGEST_NOMEM;
|
||||
}
|
||||
else if(strequal(value, "opaque")) {
|
||||
d->opaque = strdup(content);
|
||||
if(!d->opaque)
|
||||
return CURLDIGEST_NOMEM;
|
||||
}
|
||||
else if(strequal(value, "qop")) {
|
||||
char *tok_buf;
|
||||
/* tokenize the list and choose auth if possible, use a temporary
|
||||
clone of the buffer since strtok_r() ruins it */
|
||||
tmp = strdup(content);
|
||||
if(!tmp)
|
||||
return CURLDIGEST_NOMEM;
|
||||
token = strtok_r(tmp, ",", &tok_buf);
|
||||
while (token != NULL) {
|
||||
if (strequal(token, "auth")) {
|
||||
@ -137,13 +145,19 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
|
||||
/*select only auth o auth-int. Otherwise, ignore*/
|
||||
if (foundAuth) {
|
||||
d->qop = strdup("auth");
|
||||
if(!d->qop)
|
||||
return CURLDIGEST_NOMEM;
|
||||
}
|
||||
else if (foundAuthInt) {
|
||||
d->qop = strdup("auth-int");
|
||||
if(!d->qop)
|
||||
return CURLDIGEST_NOMEM;
|
||||
}
|
||||
}
|
||||
else if(strequal(value, "algorithm")) {
|
||||
d->algorithm = strdup(content);
|
||||
if(!d->algorithm)
|
||||
return CURLDIGEST_NOMEM;
|
||||
if(strequal(content, "MD5-sess"))
|
||||
d->algo = CURLDIGESTALGO_MD5SESS;
|
||||
else if(strequal(content, "MD5"))
|
||||
|
@ -27,6 +27,7 @@ typedef enum {
|
||||
CURLDIGEST_NONE, /* not a digest */
|
||||
CURLDIGEST_BAD, /* a digest, but one we don't like */
|
||||
CURLDIGEST_BADALGO, /* unsupported algorithm requested */
|
||||
CURLDIGEST_NOMEM,
|
||||
CURLDIGEST_FINE, /* a digest we act on */
|
||||
|
||||
CURLDIGEST_LAST /* last entry in this enum, don't use */
|
||||
|
Loading…
Reference in New Issue
Block a user