diff --git a/config.c b/config.c index 2a64cdf..e5eac48 100644 --- a/config.c +++ b/config.c @@ -678,6 +678,14 @@ int get_global_config(struct config *conf) conf->cpe_userid = value; value = NULL; } + else + { + if (conf->cpe_userid!=NULL) + { + free(conf->cpe_userid); + } + conf->cpe_userid = strdup(""); + } } else { @@ -694,6 +702,14 @@ int get_global_config(struct config *conf) conf->cpe_passwd = value; value = NULL; } + else + { + if (conf->cpe_passwd!=NULL) + { + free(conf->cpe_passwd); + } + conf->cpe_passwd = strdup(""); + } } else { diff --git a/digestauth.c b/digestauth.c index d808691..b0a44ae 100644 --- a/digestauth.c +++ b/digestauth.c @@ -371,7 +371,7 @@ int http_digest_auth_check(const char *http_method, const char *url, char un[MAX_USERNAME_LENGTH]; len = lookup_sub_value(un, sizeof(un), header, "username"); - if ((0 == len) || (0 != strcmp(username, un))) + if (0 != strcmp(username, un)) return MHD_NO; left -= strlen("username") + len; }