浏览代码

I should read RFC 2831 more carefully: DIGEST-MD5 with authzid needs one more tweak.

Alexandros Vellis 19 年之前
父节点
当前提交
4a20048513
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      functions/auth.php

+ 3 - 0
functions/auth.php

@@ -152,6 +152,9 @@ function digest_md5_response ($username,$password,$challenge,$service,$host,$aut
     $string_a1 .= utf8_encode($password);
     $string_a1 .= utf8_encode($password);
     $string_a1 = hmac_md5($string_a1);
     $string_a1 = hmac_md5($string_a1);
     $A1 = $string_a1 . ":" . $result['nonce'] . ":" . $cnonce;
     $A1 = $string_a1 . ":" . $result['nonce'] . ":" . $cnonce;
+    if(!empty($authz)) {
+        $A1 .= ":" . utf8_encode($authz);
+    }
     $A1 = bin2hex(hmac_md5($A1));
     $A1 = bin2hex(hmac_md5($A1));
     $A2 = "AUTHENTICATE:$digest_uri_value";
     $A2 = "AUTHENTICATE:$digest_uri_value";
     // If qop is auth-int or auth-conf, A2 gets a little extra
     // If qop is auth-int or auth-conf, A2 gets a little extra