Closed hsuenaga closed 9 years ago
Hello @hsuenaga, unfortunately I do not have enough knowledge to answer your questions, but I can merge patch if you prepare it as a Pull request.
Hello @bearded, I sent Pull request. I changed usage of macros, use Check_LDAPENTRY for assertion inside native extension, use GET_LDAPENTRY_DATA just for a type cast.
Please check it, thank you!
Hello @hsuenaga, thank you for pull request!
I just released version 0.9.17, please check it out :)
Hello @bearded, I tested the version 0.9.17 from gem repository. It seems working fine.
Thank you!!
Found in gem ruby-ldap-0.9.16, ruby-2.1.5.
Because
LDAPEntry
instance is invalidated inLDAPConn#search
block, assertionif( ! ptr->msg )
in macroGET_LDAPENTRY_DATA
will fail if the macro used outside of the block.If the assertion is failed, the macro
GET_LDAP_ENTRY_DATA
tries to callrb_ldap_entry_inspect()
to report errors.rb_ldap_entry_inspect()
callsrb_ldap_entry_to_hash()
, andrb_ldap_entry_to_hash()
usesGET_LDAPENTRY_DATA
, and .... call stack will be overflowed.Here is a sample code.
when executing
p found
, ruby reportsstack level too deep (SystemStackError)
.Here is my fix. This patch adds
VALUE dn
andVALUE attr
toLDAPEntry
, and changes all of public methods to use theVALUE
members instead of raw data structures come from libldap.edata->ldap
andedata->msg
still exist because LDAPConn may access those data.The assertion is changed to
if( TYPE(ptr->dn) != T_STRING )
. I think this assertion is broken, but I have no idea. UsingCheck_LDAPENTRY()
when we really access to raw data structures, and remove the assertion fromGET_LDAPENTRY_DATA()
???Thank you,