distinguished_name 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,11 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', 'distinguished_name')
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'distinguished_name'))
|
2
2
|
|
3
3
|
class DistinguishedName::Canonicalize
|
4
4
|
|
5
5
|
class << self
|
6
6
|
|
7
7
|
def reverse(dn, order=['CN','OU','O','C'])
|
8
|
+
STDERR.puts "Warning! DistinguishedName::Canonicalize is deprecated. Use DistinguishedName::Transform instead."
|
8
9
|
@dn = dn
|
9
10
|
@order = []
|
10
11
|
order.each {|o| @order << o + '='}
|
@@ -52,11 +52,18 @@ private
|
|
52
52
|
def parse_dn(dn_string)
|
53
53
|
begin
|
54
54
|
OpenSSL::X509::Name.parse(dn_string)
|
55
|
-
rescue
|
55
|
+
rescue parse_exception
|
56
56
|
raise OpenSSL::X509::NameError
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
|
60
|
+
def parse_exception
|
61
|
+
if defined?(JRUBY_VERSION)
|
62
|
+
JRUBY_VERSION >= "1.7.1" ? TypeError : Java::JavaLang::NullPointerException
|
63
|
+
else
|
64
|
+
TypeError
|
65
|
+
end
|
66
|
+
end
|
61
67
|
|
68
|
+
end
|
62
69
|
end
|
data/test/test_helper.rb
CHANGED
@@ -3,5 +3,5 @@ require 'test/unit'
|
|
3
3
|
if Kernel.respond_to?(:require_relative)
|
4
4
|
require_relative "../lib/distinguished_name"
|
5
5
|
else
|
6
|
-
require File.join(File.dirname(
|
6
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "distinguished_name"))
|
7
7
|
end
|