여러분! 다음과 같은 오류 메시지가 나타나고 무엇을해야할지 전혀 모릅니다. 이것은 이미 알려진 net-ldap 버그입니까? 나는 보석을 업데이 트하려고하고 이미 인터넷에서 추가 정보를 찾았다. 첫 번째 부분은 괜찮아요, 내 LDAP 데이터베이스에서 아군 내 데이터를 얻을 수 있지만이 오류가 결국 발생합니다.net ldap - 인코딩 :: UndefinedConversionError
/usr/local/lib/ruby/gems/1.9.1/gems/net-ldap-0.3.1/lib/net/ber/core_ext/string.rb:23:in
,363,210encode': "\x8E" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError) from /usr/local/lib/ruby/gems/1.9.1/gems/net-ldap-0.3.1/lib/net/ber/core_ext/string.rb:23:in
raw_utf8_encoded ' /usr/local/lib/ruby/gems/1.9.1/gems/net-ldap-0.3.1/lib/net/ber/core_ext/string.rb:15:into_ber' from /usr/local/lib/ruby/gems/1.9.1/gems/net-ldap-0.3.1/lib/net/ldap.rb:1396:in
검색의 블록' /usr/local/lib/ruby/gems/1.9.1/gems/net-ldap-0.3.1/lib/net/ldap.rb:1367:inloop' from /usr/local/lib/ruby/gems/1.9.1/gems/net-ldap-0.3.1/lib/net/ldap.rb:1367:in
검색에서 ' /usr/local/lib /ruby/gems/1.9.1/gems/net-ldap-0.3.1/lib/net/ldap.rb:637:in `search '
여기에 내 코드 :
require 'rubygems'
require 'net/ldap'
ldap = Net::LDAP.new
ldap.host = 'xxxxxx'
ldap.authenticate "cn=admin, dc=xxxx, dc=xxxxx, dc=de", "xxxxx!"
#puts ldap.bind
if ldap.bind
# authentication succeeded
else
# authentication failed
# p ldap.get_operation_result
end
filter = Net::LDAP::Filter.eq("uid", "*")
treebase = "xxxxx, dc=xxxxxx, dc=de"
ldap.search(:base => treebase, :filter => filter) do |entry|
puts "DN: #{entry.dn}"
entry.each do |attribute, values|
puts " #{attribute}:"
values.each do |value|
puts " --->#{value}"
end
end
end
안녕 켄! 고마워요! Google 그룹의 코드가 도움이되지 않았지만 루비 -ldap을 사용하도록 확신했습니다. 처음에는이 모듈이 마음에 들지 않았지만 지금은 더 잘 작동합니다. ... 변환 오류가 없습니다. 수정 기능이 있지만 어떻게 작동하는지 모르겠습니다. 잘못된 부분을 대체하는 것이 가능할 수도 있습니다. 연결에 어떤 문제가 있습니까? – gadreel
@ user1458773 다행이 당신을 위해 일하는 것 같습니다! 내 문제는 내가 인증하는 동안 루비 -ldap이 간단한 TLS를 사용하도록 만드는 방법을 볼 수 없다는 것이다. net-ldap에서 다음과 같이 할 수 있습니다 : Net :: LDAP.new (: host => server, : port => 636, : auth => {: method => : simple, : username => username, password = > password}, : encryption => : simple_tls)'그러나 단순한 TLS를 사용하는 루비 -ldap을 얻는 방법을 알 수는 없습니다. LDAP :: Conn.bind "method"매개 변수의 기본값은 LDAP :: LDAP_AUTH_SIMPLE이지만 다른 옵션은 무엇인지 찾을 수 없습니다. 이 문제를 해결했다면 알려주세요! –