From c3c23bbd9464863af34757297c5132fa1e8c56c4 Mon Sep 17 00:00:00 2001 From: Roman Maksimov Date: Thu, 16 May 2019 12:19:40 +0300 Subject: [PATCH] fix typo and the offset value of miscptr --- hydra-http-form.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/hydra-http-form.c b/hydra-http-form.c index f322fe6..77559df 100644 --- a/hydra-http-form.c +++ b/hydra-http-form.c @@ -402,14 +402,25 @@ int32_t parse_options(char *miscptr, ptr_header_node *ptr_head) { case 'a': // fall through case 'A': // only for http, not http-form! ptr = miscptr + 2; - if (strncasecmp(miscptr, "NTML", 4) == 0) + + if (strncasecmp(ptr, "NTLM", 4) == 0) http_auth_mechanism = AUTH_NTLM; - else if (strncasecmp(miscptr, "MD5", 3) == 0 || strncasecmp(miscptr, "DIGEST", 6) == 0) + else if (strncasecmp(ptr, "MD5", 3) == 0 || strncasecmp(ptr, "DIGEST", 6) == 0) http_auth_mechanism = AUTH_DIGESTMD5; - else if (strncasecmp(miscptr, "BASIC", 4) == 0) + else if (strncasecmp(ptr, "BASIC", 4) == 0) http_auth_mechanism = AUTH_BASIC; else - fprintf(stderr, "[WARNING] unknown http auth type: %s\n", miscptr); + fprintf(stderr, "[WARNING] unknown http auth type: %s\n", ptr); + + while (*ptr != 0 && *ptr != ':') + ptr++; + + if (*ptr != 0) { + *ptr = 0; + ptr += 1; + } + + miscptr = ptr; break; case 'c': // fall through case 'C':