Browse files

Merge pull request #4 from aboltart/ruby-2.0

Fix for Ruby 2.0 version
  • Loading branch information...
2 parents cccd89a + 3a37ba8 commit 3fa21549907e515a2cce2d2c0eb0faaeaaa44597 @ebeigarts committed Jan 7, 2013
Showing with 10 additions and 10 deletions.
  1. +9 −9 lib/oracle_ebs_authentication/security.rb
  2. +1 −1 oracle_ebs_authentication.gemspec
View
18 lib/oracle_ebs_authentication/security.rb
@@ -3,12 +3,12 @@
module OracleEbsAuthentication
# The Java original source code was taken form
# http://code.google.com/p/jebusinessauth/source/browse/trunk/src/com/milci/ebusinesssuite/eBusinessSuiteSecurity.java
- #
+ #
# As original Java source is not documented then Ruby source code was done
# as similar as possible to Java code to avoid differences in functionality.
- #
+ #
class Security
- if RUBY_VERSION =~ /^1.9/
+ if RUBY_VERSION =~ /^(1.9|2.0)/
class Bytes < String
def initialize(string)
super(string.force_encoding('ASCII-8BIT'))
@@ -341,7 +341,7 @@ def old_control(s1, s2, i1)
abyte0 = a_(s1.dup)
#j1 = s2.mb_chars.length
j1 = s2.length
-
+
if (j1 > i1 - 1)
j1 = i1 - 1
end
@@ -428,15 +428,15 @@ def m(abyte0)
def n(i1, j1, k1)
return i1 ^ j1 ^ k1
end
-
+
def o(i1, j1, k1)
return i1 ^ j1 ^ k1
end
def control(s1, s2, i1)
return new_control(s1, s2, 0, i1)
end
-
+
def p(s1)
s1 = bytes s1
flag = false
@@ -723,7 +723,7 @@ def x(ai, abyte0)
i1 += 1
abyte0[i1] = (ai[1] & 0xff)
end
-
+
def old_check(s1, s2, flag)
abyte0 = a_(s1.dup)
abyte1 = p(s2)
@@ -766,7 +766,7 @@ def y(abyte0, abyte1)
# puts "<br/>DEBUG y: abyte2=#{abyte2.unpack("H*")[0]}"
return abyte2
end
-
+
def z(abyte0)
abyte0.unpack("H*")[0].upcase
end
@@ -850,7 +850,7 @@ def check(s1, s2, flag)
return true if decrypt(s1, s2, flag)
false
end
-
+
def decrypt(s1, s2, flag)
if (s2 != nil && s2.length() > 0)
if (s2[0, 2] == "ZG")
View
2 oracle_ebs_authentication.gemspec
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "rake"
s.add_development_dependency "rspec", ["~> 2.5.0"]
- s.add_development_dependency "ruby-oci8", ["~> 2.0.4"]
+ s.add_development_dependency "ruby-oci8", ["~> 2.1.4"]
s.files = Dir.glob("{lib,spec}/**/*") + %w(README.md LICENSE)
s.require_paths = ["lib"]

0 comments on commit 3fa2154

Please sign in to comment.