Skip to content

Commit

Permalink
parser_authenticate: fix re-entrance of parse_authenticate_header
Browse files Browse the repository at this point in the history
properly populate the picked_auth body when calling
parse_authenticate_header twice.
  • Loading branch information
razvancrainea committed Jan 28, 2025
1 parent ef64542 commit 5f8376d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion parser/parse_authenticate.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,10 @@ int parse_authenticate_header(struct hdr_field *authenticate,
{
void **parsed;
struct authenticate_body *auth_body, *ret_auth;
int rc;
int rc, prev_parsed;

parsed = &(authenticate->parsed);
prev_parsed = (*parsed != NULL);
ret_auth = NULL;

while(*parsed == NULL)
Expand Down Expand Up @@ -389,6 +390,14 @@ int parse_authenticate_header(struct hdr_field *authenticate,
else
break;
}
if (prev_parsed) {
while (!ret_auth && authenticate) {
if (authenticate->parsed &&
(md == NULL || md->matchf(authenticate->parsed, md)))
ret_auth = authenticate->parsed;
authenticate = authenticate->sibling;
}
}
*picked_auth = ret_auth;

return ret_auth ? 0 : -1;
Expand Down

0 comments on commit 5f8376d

Please sign in to comment.