diff options
Diffstat (limited to 'src/microhttpd/gen_auth.c')
-rw-r--r-- | src/microhttpd/gen_auth.c | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/src/microhttpd/gen_auth.c b/src/microhttpd/gen_auth.c index e13d5578..2cdfb3d3 100644 --- a/src/microhttpd/gen_auth.c +++ b/src/microhttpd/gen_auth.c | |||
@@ -295,35 +295,19 @@ parse_dauth_params (const char *str, | |||
295 | } | 295 | } |
296 | 296 | ||
297 | /* Postprocess values */ | 297 | /* Postprocess values */ |
298 | if ((NULL != userhash.value.str) && (0 != userhash.value.len)) | 298 | if (NULL != userhash.value.str) |
299 | { | 299 | { |
300 | const char *param_str; | 300 | if (userhash.quoted) |
301 | size_t param_len; | 301 | pdauth->userhash = |
302 | char buf[5 * 2]; /* 5 is the length of "false" (longer then "true") */ | 302 | MHD_str_equal_caseless_quoted_bin_n (userhash.value.str, |
303 | if (! userhash.quoted) | 303 | userhash.value.len, |
304 | { | 304 | "true", |
305 | param_str = userhash.value.str; | 305 | MHD_STATICSTR_LEN_ ("true")); |
306 | param_len = userhash.value.len; | ||
307 | } | ||
308 | else | ||
309 | { | ||
310 | if (sizeof(buf) / sizeof(buf[0]) >= userhash.value.len) | ||
311 | { | ||
312 | param_len = MHD_str_unquote (userhash.value.str, userhash.value.len, | ||
313 | buf); | ||
314 | param_str = buf; | ||
315 | } | ||
316 | else | ||
317 | { | ||
318 | param_len = 0; | ||
319 | param_str = NULL; /* Actually not used */ | ||
320 | } | ||
321 | } | ||
322 | if ((param_len == 4) && MHD_str_equal_caseless_bin_n_ (param_str, "true", | ||
323 | 4)) | ||
324 | pdauth->userhash = true; | ||
325 | else | 306 | else |
326 | pdauth->userhash = false; | 307 | pdauth->userhash = |
308 | (MHD_STATICSTR_LEN_ ("true") == userhash.value.len) && | ||
309 | (0 == memcmp (str, userhash.value.str, userhash.value.len)); | ||
310 | |||
327 | } | 311 | } |
328 | else | 312 | else |
329 | pdauth->userhash = false; | 313 | pdauth->userhash = false; |