big-r81 commented on code in PR #4140:
URL: https://github.com/apache/couchdb/pull/4140#discussion_r942236748
##########
src/couch/src/couch_httpd_auth.erl:
##########
@@ -695,3 +700,33 @@ authentication_warning(#httpd{mochi_req = Req}, User) ->
"~p: Authentication failed for user ~s from ~s",
[?MODULE, User, Peer]
).
+
+verify_hash_names(HashAlgorithms, SupportedHashFun) ->
+ verify_hash_names(HashAlgorithms, SupportedHashFun, []).
+verify_hash_names([], _, HashNames) ->
+ HashNames;
+verify_hash_names([H | T], SupportedHashFun, HashNames) ->
+ try
+ HashAtom = binary_to_existing_atom(H),
+ Result =
+ case lists:member(HashAtom, SupportedHashFun) of
+ true -> HashNames ++ [HashAtom];
Review Comment:
Okay, but the order of the hash algos is important. Assume we have
```ini
hash_algorithms = sha256, sha
```
then we get as result
```erlang
[sha, sha256]
```
and the cookie is generated with the first algorithm.
Maybe your solution
```erlang
true -> [HashAtom | HashNames]
```
in combination with
```
verify_hash_names([], _, HashNames) ->
lists:reverse(HashNames);
```
Is this better?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]