From: Jaroslav Kysela Date: Thu, 14 Feb 2019 12:43:26 +0000 (+0100) Subject: http server: fix the new digest hashes (appearently firefox nor chrome do support... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a08a525bd754d57555ed8f5a9ac1bb0ad4e11d84;p=thirdparty%2Ftvheadend.git http server: fix the new digest hashes (appearently firefox nor chrome do support them) --- diff --git a/src/config.c b/src/config.c index 351a1aa47..2293d278b 100644 --- a/src/config.c +++ b/src/config.c @@ -1691,7 +1691,7 @@ config_boot config.idnode.in_class = &config_class; config.ui_quicktips = 1; config.http_auth = HTTP_AUTH_DIGEST; - config.http_auth_algo = HTTP_AUTH_ALGO_SHA512_256; + config.http_auth_algo = HTTP_AUTH_ALGO_MD5; config.proxy = 0; config.realm = strdup("tvheadend"); config.info_area = strdup("login,storage,time"); diff --git a/src/http.c b/src/http.c index 8daa84017..0b3c68529 100644 --- a/src/http.c +++ b/src/http.c @@ -390,12 +390,12 @@ http_send_header(http_connection_t *hc, int rc, const char *content, if (hc->hc_nonce == NULL) http_get_nonce(hc); char *opaque = http_get_opaque(hc, realm); - htsbuf_qprintf(&hdrs, "WWW-Authenticate: Digest realm=\"%s\"", realm); + htsbuf_qprintf(&hdrs, "WWW-Authenticate: Digest realm=\"%s\", qop=auth", realm); if (config.http_auth_algo != HTTP_AUTH_ALGO_MD5) htsbuf_qprintf(&hdrs, ", algorithm=%s", config.http_auth_algo == HTTP_AUTH_ALGO_SHA256 ? "SHA-256" : "SHA-512-256"); - htsbuf_qprintf(&hdrs, ", qop=\"auth\", nonce=\"%s\"", hc->hc_nonce); + htsbuf_qprintf(&hdrs, ", nonce=\"%s\"", hc->hc_nonce); htsbuf_qprintf(&hdrs, ", opaque=\"%s\"\r\n", opaque); free(opaque); } else { diff --git a/src/utils.c b/src/utils.c index 8fc5da8b7..1cdc30f3c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -568,11 +568,11 @@ openssl_hash ( const char *str, int lowercase, const EVP_MD *md, int len ) if ((mdctx = EVP_MD_CTX_create()) == NULL) return NULL; - if (EVP_DigestInit_ex(mdctx, md, NULL) != 0) + if (EVP_DigestInit_ex(mdctx, md, NULL) != 1) goto __error; - if (EVP_DigestUpdate(mdctx, str, strlen(str)) != 0) + if (EVP_DigestUpdate(mdctx, str, strlen(str)) != 1) goto __error; - if (EVP_DigestFinal_ex(mdctx, hash, NULL)) + if (EVP_DigestFinal_ex(mdctx, hash, NULL) != 1) goto __error; for (i = 0; i < len; i++) sprintf(ret + i*2, fmt, hash[i]);