diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-05-05 23:23:39 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-05-05 23:29:39 +0900 |
commit | e04418bb16cd99b4a4402e7457d3bdc967284f98 (patch) | |
tree | 82fdefad7ef68c398800a45e9a8a3e625fb907b7 | |
parent | f0b5629c8cc485753ad0af2ed414bc6ae70c629f (diff) | |
download | ruby-e04418bb16cd99b4a4402e7457d3bdc967284f98.tar.gz |
[ruby/uri] Check if DN exists
https://bugs.ruby-lang.org/issues/16830
https://github.com/ruby/uri/commit/b4bf8c1217
-rw-r--r-- | lib/uri/ldap.rb | 1 | ||||
-rw-r--r-- | test/uri/test_ldap.rb | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/uri/ldap.rb b/lib/uri/ldap.rb index a2043ccdf5..14e6163292 100644 --- a/lib/uri/ldap.rb +++ b/lib/uri/ldap.rb @@ -118,6 +118,7 @@ module URI # Private method to cleanup +dn+ from using the +path+ component attribute. def parse_dn + raise InvalidURIError, 'bad LDAP URL' unless @path @dn = @path[1..-1] end private :parse_dn diff --git a/test/uri/test_ldap.rb b/test/uri/test_ldap.rb index adad4454b5..64845e487a 100644 --- a/test/uri/test_ldap.rb +++ b/test/uri/test_ldap.rb @@ -95,6 +95,10 @@ class TestLDAP < Test::Unit::TestCase u.select(:scheme, :host, :not_exist, :port) end end + + def test_parse_invalid_uri + assert_raise(URI::InvalidURIError) {URI.parse("ldap:https://example.com")} + end end |