Skip to content

Commit 5f8376d

Browse files
committed
parser_authenticate: fix re-entrance of parse_authenticate_header
properly populate the picked_auth body when calling parse_authenticate_header twice.
1 parent ef64542 commit 5f8376d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

parser/parse_authenticate.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,10 @@ int parse_authenticate_header(struct hdr_field *authenticate,
355355
{
356356
void **parsed;
357357
struct authenticate_body *auth_body, *ret_auth;
358-
int rc;
358+
int rc, prev_parsed;
359359

360360
parsed = &(authenticate->parsed);
361+
prev_parsed = (*parsed != NULL);
361362
ret_auth = NULL;
362363

363364
while(*parsed == NULL)
@@ -389,6 +390,14 @@ int parse_authenticate_header(struct hdr_field *authenticate,
389390
else
390391
break;
391392
}
393+
if (prev_parsed) {
394+
while (!ret_auth && authenticate) {
395+
if (authenticate->parsed &&
396+
(md == NULL || md->matchf(authenticate->parsed, md)))
397+
ret_auth = authenticate->parsed;
398+
authenticate = authenticate->sibling;
399+
}
400+
}
392401
*picked_auth = ret_auth;
393402

394403
return ret_auth ? 0 : -1;

0 commit comments

Comments
 (0)