redmine: Fix openid

For some reason, redmine:3.4 ships with ancient (2014) ruby-openid,
which is no longer compatible with the way how ruby handles HMAC.

Change-Id: I60f6f1ede059accf6b29891abcfe3b2529744e8a
This commit is contained in:
Harald Welte 2018-10-07 11:10:42 +02:00
parent 9b6bfccdd7
commit a02280fa77
2 changed files with 24 additions and 0 deletions

View File

@ -7,3 +7,6 @@ RUN apt-get update && \
mscgen \
patch && \
apt-get clean
ADD hmac.diff /tmp/hmac.diff
RUN cd / && patch -p0 < /tmp/hmac.diff

21
redmine/hmac.diff Normal file
View File

@ -0,0 +1,21 @@
--- usr/local/bundle/gems/ruby-openid-2.3.0/lib/openid/cryptutil.rb.old 2018-10-07 08:53:33.612724431 +0000
+++ usr/local/bundle/gems/ruby-openid-2.3.0/lib/openid/cryptutil.rb 2018-10-07 08:54:03.016525355 +0000
@@ -39,6 +39,6 @@
def CryptUtil.hmac_sha1(key, text)
- if Digest.const_defined? :HMAC
- Digest::HMAC.new(key,Digest::SHA1).update(text).digest
+ if defined? OpenSSL
+ OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new, key, text)
else
return HMAC::SHA1.digest(key, text)
end
@@ -50,7 +50,7 @@
def CryptUtil.hmac_sha256(key, text)
- if Digest.const_defined? :HMAC
- Digest::HMAC.new(key,Digest::SHA256).update(text).digest
+ if defined? OpenSSL
+ OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, text)
else
return HMAC::SHA256.digest(key, text)
end