Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:languages:ruby:extensions
rubygem-ruby-ldap
ruby-ldap-rb_cObject.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ruby-ldap-rb_cObject.patch of Package rubygem-ruby-ldap
From 31c999b9024157cde61e06cc629a54fe8372ec96 Mon Sep 17 00:00:00 2001 From: minamino <minamino@iij.ad.jp> Date: Wed, 28 Dec 2022 18:14:14 +0900 Subject: [PATCH 1/2] Update conn.c ruby >= 3.0: use rb_cObject instead of rb_cData ruby < 3.0: use rb_cData ruby 2.7 will be outdated soon. --- conn.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conn.c b/conn.c index e628695..54c91a1 100644 --- a/conn.c +++ b/conn.c @@ -1855,7 +1855,13 @@ Init_ldap_conn () { rb_ldap_sort_obj = Qnil; +#if RUBY_VERSION_CODE >= 300 + rb_cLDAP_Conn = rb_define_class_under (rb_mLDAP, "Conn", rb_cObject); + rb_undef_alloc_func (rb_cLDAP_Conn); +#endif +#if RUBY_VERSION_CODE < 300 rb_cLDAP_Conn = rb_define_class_under (rb_mLDAP, "Conn", rb_cData); +#endif rb_define_attr (rb_cLDAP_Conn, "referrals", 1, 0); rb_define_attr (rb_cLDAP_Conn, "controls", 1, 0); rb_define_attr (rb_cLDAP_Conn, "sasl_quiet", 1, 1); From 9a488dc19c185df3629d0093f65aa73a2370bd6c Mon Sep 17 00:00:00 2001 From: minamino <minamino@iij.ad.jp> Date: Fri, 19 May 2023 16:18:39 +0900 Subject: [PATCH 2/2] replace RUBY_VERSION_CODE with RB_LDAP_RVC --- conn.c | 14 +++++++------- entry.c | 26 +++++++++++++------------- extconf.rb | 6 ++++++ misc.c | 6 +++--- mod.c | 6 +++--- rbldap.h | 15 +++++++++++++-- 6 files changed, 45 insertions(+), 28 deletions(-) diff --git a/conn.c b/conn.c index 54c91a1..fb5ee7d 100644 --- a/conn.c +++ b/conn.c @@ -1855,20 +1855,20 @@ Init_ldap_conn () { rb_ldap_sort_obj = Qnil; -#if RUBY_VERSION_CODE >= 300 - rb_cLDAP_Conn = rb_define_class_under (rb_mLDAP, "Conn", rb_cObject); - rb_undef_alloc_func (rb_cLDAP_Conn); -#endif -#if RUBY_VERSION_CODE < 300 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 30000 rb_cLDAP_Conn = rb_define_class_under (rb_mLDAP, "Conn", rb_cData); +#endif +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 30000 + rb_cLDAP_Conn = rb_define_class_under (rb_mLDAP, "Conn", rb_cObject); + rb_undef_alloc_func(rb_cLDAP_Conn); #endif rb_define_attr (rb_cLDAP_Conn, "referrals", 1, 0); rb_define_attr (rb_cLDAP_Conn, "controls", 1, 0); rb_define_attr (rb_cLDAP_Conn, "sasl_quiet", 1, 1); -#if RUBY_VERSION_CODE < 170 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10700 rb_define_singleton_method (rb_cLDAP_Conn, "new", rb_ldap_class_new, -1); #endif -#if RUBY_VERSION_CODE >= 173 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10703 rb_define_alloc_func (rb_cLDAP_Conn, rb_ldap_conn_s_allocate); #else rb_define_singleton_method (rb_cLDAP_Conn, "allocate", diff --git a/entry.c b/entry.c index 2cddcf9..c630ee8 100644 --- a/entry.c +++ b/entry.c @@ -8,7 +8,7 @@ VALUE rb_cLDAP_Entry; -#if RUBY_VERSION_CODE >= 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10900 static void rb_ldap_entry_mark(RB_LDAPENTRY_DATA *edata) { @@ -88,11 +88,11 @@ rb_ldap_entry_new (LDAP * ldap, LDAPMessage * msg) { VALUE val; RB_LDAPENTRY_DATA *edata; -#if RUBY_VERSION_CODE >= 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10900 char *c_dn; #endif -#if RUBY_VERSION_CODE >= 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10900 val = Data_Make_Struct (rb_cLDAP_Entry, RB_LDAPENTRY_DATA, rb_ldap_entry_mark, rb_ldap_entry_free, edata); #else @@ -102,7 +102,7 @@ rb_ldap_entry_new (LDAP * ldap, LDAPMessage * msg) edata->ldap = ldap; edata->msg = msg; -#if RUBY_VERSION_CODE >= 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10900 /* get dn */ c_dn = ldap_get_dn(ldap, msg); if (c_dn) { @@ -128,14 +128,14 @@ VALUE rb_ldap_entry_get_dn (VALUE self) { RB_LDAPENTRY_DATA *edata; -#if RUBY_VERSION_CODE < 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900 char *cdn; VALUE dn; #endif GET_LDAPENTRY_DATA (self, edata); -#if RUBY_VERSION_CODE < 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900 cdn = ldap_get_dn (edata->ldap, edata->msg); if (cdn) { @@ -166,7 +166,7 @@ VALUE rb_ldap_entry_get_values (VALUE self, VALUE attr) { RB_LDAPENTRY_DATA *edata; -#if RUBY_VERSION_CODE < 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900 char *c_attr; struct berval **c_vals; int i; @@ -175,7 +175,7 @@ rb_ldap_entry_get_values (VALUE self, VALUE attr) #endif GET_LDAPENTRY_DATA (self, edata); -#if RUBY_VERSION_CODE < 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900 c_attr = StringValueCStr (attr); c_vals = ldap_get_values_len (edata->ldap, edata->msg, c_attr); @@ -213,7 +213,7 @@ VALUE rb_ldap_entry_get_attributes (VALUE self) { RB_LDAPENTRY_DATA *edata; -#if RUBY_VERSION_CODE < 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900 VALUE vals; char *attr; BerElement *ber = NULL; @@ -223,7 +223,7 @@ rb_ldap_entry_get_attributes (VALUE self) GET_LDAPENTRY_DATA (self, edata); -#if RUBY_VERSION_CODE < 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900 vals = rb_ary_new (); for (attr = ldap_first_attribute (edata->ldap, edata->msg, &ber); attr != NULL; @@ -259,7 +259,7 @@ rb_ldap_entry_get_attributes (VALUE self) VALUE rb_ldap_entry_to_hash (VALUE self) { -#if RUBY_VERSION_CODE < 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900 VALUE attrs = rb_ldap_entry_get_attributes (self); VALUE hash = rb_hash_new (); VALUE attr, vals; @@ -269,7 +269,7 @@ rb_ldap_entry_to_hash (VALUE self) VALUE hash, dn_ary; #endif -#if RUBY_VERSION_CODE < 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900 Check_Type (attrs, T_ARRAY); rb_hash_aset (hash, rb_tainted_str_new2 ("dn"), rb_ary_new3 (1, rb_ldap_entry_get_dn (self))); @@ -305,7 +305,7 @@ rb_ldap_entry_inspect (VALUE self) str = rb_str_new (0, strlen (c) + 10 + 16 + 1); /* 10:tags 16:addr 1:nul */ sprintf (RSTRING_PTR (str), "#<%s:0x%lx\n", c, self); -#if RUBY_VERSION_CODE < 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900 RSTRING(str)->len = strlen (RSTRING_PTR (str)); #else rb_str_set_len(str, strlen (RSTRING_PTR (str))); diff --git a/extconf.rb b/extconf.rb index 9df2349..3fae4f5 100755 --- a/extconf.rb +++ b/extconf.rb @@ -257,6 +257,12 @@ def ldap_with_config(arg, default = nil) $defs << "-DRUBY_VERSION_CODE=#{RUBY_VERSION.gsub(/\D/, '')}" +def rb_ldap_rb_ver_code + ( _major, _minor, _teeny ) = RUBY_VERSION.split(/\D/) + _rvc = _major.to_i * 10000 + _minor.to_i * 100 + _teeny.to_i +end +$defs << "-DRB_LDAP_RVC=#{rb_ldap_rb_ver_code}" + create_makefile("ldap") diff --git a/misc.c b/misc.c index 7b7b056..ac1061c 100644 --- a/misc.c +++ b/misc.c @@ -131,7 +131,7 @@ rb_ldap_control_s_allocate (VALUE klass) return Data_Wrap_Struct (klass, 0, rb_ldap_control_free, ctl); } -#if RUBY_VERSION_CODE < 170 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10700 static VALUE rb_ldap_control_s_new (int argc, VALUE argv[], VALUE klass) { @@ -479,11 +479,11 @@ Init_ldap_misc () #ifdef HAVE_LDAPCONTROL rb_cLDAP_Control = rb_define_class_under (rb_mLDAP, "Control", rb_cObject); -#if RUBY_VERSION_CODE < 170 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10700 rb_define_singleton_method (rb_cLDAP_Control, "new", rb_ldap_control_s_new, -1); #endif -#if RUBY_VERSION_CODE >= 173 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10703 rb_define_alloc_func (rb_cLDAP_Control, rb_ldap_control_s_allocate); #else rb_define_singleton_method (rb_cLDAP_Control, "allocate", diff --git a/mod.c b/mod.c index 0d8e7f2..7732261 100644 --- a/mod.c +++ b/mod.c @@ -283,7 +283,7 @@ rb_ldap_mod_inspect (VALUE self) str = rb_str_new (0, strlen (c) + 10 + 16 + 1); /* 10:tags 16:addr 1:nul */ sprintf (RSTRING_PTR (str), "#<%s:0x%lx ", c, self); -#if RUBY_VERSION_CODE < 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900 RSTRING(str)->len = strlen (RSTRING_PTR (str)); #else rb_str_set_len(str, strlen (RSTRING_PTR (str))); @@ -336,10 +336,10 @@ void Init_ldap_mod () { rb_cLDAP_Mod = rb_define_class_under (rb_mLDAP, "Mod", rb_cObject); -#if RUBY_VERSION_CODE < 170 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10700 rb_define_singleton_method (rb_cLDAP_Mod, "new", rb_ldap_class_new, -1); #endif -#if RUBY_VERSION_CODE >= 173 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10703 rb_define_alloc_func (rb_cLDAP_Mod, rb_ldap_mod_s_allocate); #else rb_define_singleton_method (rb_cLDAP_Mod, "allocate", diff --git a/rbldap.h b/rbldap.h index 1fa04e1..2cf53f0 100644 --- a/rbldap.h +++ b/rbldap.h @@ -55,7 +55,7 @@ typedef struct rb_ldapentry_data { LDAP *ldap; LDAPMessage *msg; -#if RUBY_VERSION_CODE >= 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10900 VALUE dn; VALUE attr; #endif @@ -173,7 +173,7 @@ VALUE rb_ldap_mod_vals (VALUE); }; \ } -#if RUBY_VERSION_CODE < 190 +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900 #define GET_LDAPENTRY_DATA(obj,ptr) { \ Data_Get_Struct(obj, struct rb_ldapentry_data, ptr); \ if( ! ptr->msg ){ \ @@ -205,3 +205,14 @@ VALUE rb_ldap_mod_vals (VALUE); rb_define_method(rb_cLDAP_Mod,method,cfunc,argc) #endif + +#if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 20700 +# if defined rb_tainted_str_new +# undef rb_tainted_str_new +# endif +# if defined rb_tainted_str_new2 +# undef rb_tainted_str_new2 +# endif +# define rb_tainted_str_new(p,l) rb_str_new((p),(l)) +# define rb_tainted_str_new2(p) rb_str_new_cstr((p)) +#endif
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor