ruby-ldap3 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (10) hide show
  1. checksums.yaml +4 -4
  2. data/NOTES +5 -1
  3. data/conn.c +8 -2
  4. data/entry.c +13 -13
  5. data/extconf.rb +6 -0
  6. data/ldap.c +2 -1
  7. data/misc.c +3 -3
  8. data/mod.c +3 -3
  9. data/rbldap.h +14 -3
  10. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4904684569075e822679cfd8af4b0e1d6e284370b18c3aa31a977e4a31da9fbd
4
- data.tar.gz: ccf467f897301b6e80b22e0e9789d88e31d57c20e259701da404b19559e41913
3
+ metadata.gz: 7e95b5803604a211b957f2c4b47cf5ec11438e5ed88ffd8fdda03a51da94df71
4
+ data.tar.gz: 4629ddac3d4a5d9ff75c52a43e7f5b978ff9a608ec0404740944a42468b2a08d
5
5
  SHA512:
6
- metadata.gz: 83167cc6cb5a02c09267762d02cd2bca641c8344c3be05ec52ba99f79ef76a6769909c34b0053553ac1bd68265e24c4c984821d32d10439cb87dbe4a06335f49
7
- data.tar.gz: 1e8678db6143d04169ed46089ae4fbbb600bc5b9a63a3bdcec3c88b4c247c3b365cee343cce6699f7948d5d6109827f8f4caeb3bd6569108029e2e0b96962589
6
+ metadata.gz: 99f1c50af3132f1dd69c5e693f654cb92b513e1085d3c668e8bef88e084294c9e0ab6d3f02e715f250cb575087196e725f124cc545109fdbdb4ed8c941ca8766
7
+ data.tar.gz: b3c7f244a2762aa37460cd0fa50f61e219642ab2888a0fb1a55458c4c844bd322f1d7fc7fbe7fbb2589da841b2a5aec6da0b692e583cf07e251ab08c93c069f2
data/NOTES CHANGED
@@ -1,6 +1,10 @@
1
+ 0.10.1
2
+ -----
3
+ * bearded/ruby-ldap PRs 44, 45, 46 pulled up
4
+
1
5
  0.10.0
2
6
  -----
3
- * Project forked, renamed to ruby-ldap3, porting to Ruby 3.x with previous PRs
7
+ * Project forked, renamed to ruby-ldap3
4
8
 
5
9
  0.9.20
6
10
  -----
data/conn.c CHANGED
@@ -1855,14 +1855,20 @@ Init_ldap_conn ()
1855
1855
  {
1856
1856
  rb_ldap_sort_obj = Qnil;
1857
1857
 
1858
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 30000
1858
1859
  rb_cLDAP_Conn = rb_define_class_under (rb_mLDAP, "Conn", rb_cData);
1860
+ #endif
1861
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 30000
1862
+ rb_cLDAP_Conn = rb_define_class_under (rb_mLDAP, "Conn", rb_cObject);
1863
+ rb_undef_alloc_func(rb_cLDAP_Conn);
1864
+ #endif
1859
1865
  rb_define_attr (rb_cLDAP_Conn, "referrals", 1, 0);
1860
1866
  rb_define_attr (rb_cLDAP_Conn, "controls", 1, 0);
1861
1867
  rb_define_attr (rb_cLDAP_Conn, "sasl_quiet", 1, 1);
1862
- #if RUBY_VERSION_CODE < 170
1868
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10700
1863
1869
  rb_define_singleton_method (rb_cLDAP_Conn, "new", rb_ldap_class_new, -1);
1864
1870
  #endif
1865
- #if RUBY_VERSION_CODE >= 173
1871
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10703
1866
1872
  rb_define_alloc_func (rb_cLDAP_Conn, rb_ldap_conn_s_allocate);
1867
1873
  #else
1868
1874
  rb_define_singleton_method (rb_cLDAP_Conn, "allocate",
data/entry.c CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  VALUE rb_cLDAP_Entry;
10
10
 
11
- #if RUBY_VERSION_CODE >= 190
11
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10900
12
12
  static void
13
13
  rb_ldap_entry_mark(RB_LDAPENTRY_DATA *edata)
14
14
  {
@@ -88,11 +88,11 @@ rb_ldap_entry_new (LDAP * ldap, LDAPMessage * msg)
88
88
  {
89
89
  VALUE val;
90
90
  RB_LDAPENTRY_DATA *edata;
91
- #if RUBY_VERSION_CODE >= 190
91
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10900
92
92
  char *c_dn;
93
93
  #endif
94
94
 
95
- #if RUBY_VERSION_CODE >= 190
95
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10900
96
96
  val = Data_Make_Struct (rb_cLDAP_Entry, RB_LDAPENTRY_DATA,
97
97
  rb_ldap_entry_mark, rb_ldap_entry_free, edata);
98
98
  #else
@@ -102,7 +102,7 @@ rb_ldap_entry_new (LDAP * ldap, LDAPMessage * msg)
102
102
  edata->ldap = ldap;
103
103
  edata->msg = msg;
104
104
 
105
- #if RUBY_VERSION_CODE >= 190
105
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10900
106
106
  /* get dn */
107
107
  c_dn = ldap_get_dn(ldap, msg);
108
108
  if (c_dn) {
@@ -128,14 +128,14 @@ VALUE
128
128
  rb_ldap_entry_get_dn (VALUE self)
129
129
  {
130
130
  RB_LDAPENTRY_DATA *edata;
131
- #if RUBY_VERSION_CODE < 190
131
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900
132
132
  char *cdn;
133
133
  VALUE dn;
134
134
  #endif
135
135
 
136
136
  GET_LDAPENTRY_DATA (self, edata);
137
137
 
138
- #if RUBY_VERSION_CODE < 190
138
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900
139
139
  cdn = ldap_get_dn (edata->ldap, edata->msg);
140
140
  if (cdn)
141
141
  {
@@ -166,7 +166,7 @@ VALUE
166
166
  rb_ldap_entry_get_values (VALUE self, VALUE attr)
167
167
  {
168
168
  RB_LDAPENTRY_DATA *edata;
169
- #if RUBY_VERSION_CODE < 190
169
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900
170
170
  char *c_attr;
171
171
  struct berval **c_vals;
172
172
  int i;
@@ -175,7 +175,7 @@ rb_ldap_entry_get_values (VALUE self, VALUE attr)
175
175
  #endif
176
176
 
177
177
  GET_LDAPENTRY_DATA (self, edata);
178
- #if RUBY_VERSION_CODE < 190
178
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900
179
179
  c_attr = StringValueCStr (attr);
180
180
 
181
181
  c_vals = ldap_get_values_len (edata->ldap, edata->msg, c_attr);
@@ -213,7 +213,7 @@ VALUE
213
213
  rb_ldap_entry_get_attributes (VALUE self)
214
214
  {
215
215
  RB_LDAPENTRY_DATA *edata;
216
- #if RUBY_VERSION_CODE < 190
216
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900
217
217
  VALUE vals;
218
218
  char *attr;
219
219
  BerElement *ber = NULL;
@@ -223,7 +223,7 @@ rb_ldap_entry_get_attributes (VALUE self)
223
223
 
224
224
  GET_LDAPENTRY_DATA (self, edata);
225
225
 
226
- #if RUBY_VERSION_CODE < 190
226
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900
227
227
  vals = rb_ary_new ();
228
228
  for (attr = ldap_first_attribute (edata->ldap, edata->msg, &ber);
229
229
  attr != NULL;
@@ -259,7 +259,7 @@ rb_ldap_entry_get_attributes (VALUE self)
259
259
  VALUE
260
260
  rb_ldap_entry_to_hash (VALUE self)
261
261
  {
262
- #if RUBY_VERSION_CODE < 190
262
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900
263
263
  VALUE attrs = rb_ldap_entry_get_attributes (self);
264
264
  VALUE hash = rb_hash_new ();
265
265
  VALUE attr, vals;
@@ -269,7 +269,7 @@ rb_ldap_entry_to_hash (VALUE self)
269
269
  VALUE hash, dn_ary;
270
270
  #endif
271
271
 
272
- #if RUBY_VERSION_CODE < 190
272
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900
273
273
  Check_Type (attrs, T_ARRAY);
274
274
  rb_hash_aset (hash, rb_tainted_str_new2 ("dn"),
275
275
  rb_ary_new3 (1, rb_ldap_entry_get_dn (self)));
@@ -305,7 +305,7 @@ rb_ldap_entry_inspect (VALUE self)
305
305
  str = rb_str_new (0, strlen (c) + 10 + 16 + 1); /* 10:tags 16:addr 1:nul */
306
306
  sprintf (RSTRING_PTR (str), "#<%s:0x%lx\n", c, self);
307
307
 
308
- #if RUBY_VERSION_CODE < 190
308
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900
309
309
  RSTRING(str)->len = strlen (RSTRING_PTR (str));
310
310
  #else
311
311
  rb_str_set_len(str, strlen (RSTRING_PTR (str)));
data/extconf.rb CHANGED
@@ -257,6 +257,12 @@ have_func("ldap_sasl_interactive_bind_s")
257
257
 
258
258
  $defs << "-DRUBY_VERSION_CODE=#{RUBY_VERSION.gsub(/\D/, '')}"
259
259
 
260
+ def rb_ldap_rb_ver_code
261
+ ( _major, _minor, _teeny ) = RUBY_VERSION.split(/\D/)
262
+ _rvc = _major.to_i * 10000 + _minor.to_i * 100 + _teeny.to_i
263
+ end
264
+ $defs << "-DRB_LDAP_RVC=#{rb_ldap_rb_ver_code}"
265
+
260
266
  create_makefile("ldap")
261
267
 
262
268
 
data/ldap.c CHANGED
@@ -201,7 +201,8 @@ rb_ldap_hash2mods (VALUE self, VALUE op, VALUE hash)
201
201
  VALUE tmp;
202
202
 
203
203
  tmp = rb_assoc_new (op, rb_ary_new ());
204
- rb_iterate (rb_each, hash, rb_ldap_hash2mods_i, tmp);
204
+ /* Explicitly cast value per: https://github.com/bearded/ruby-ldap/issues/47#issuecomment-1645066553 */
205
+ rb_iterate (rb_each, hash, (rb_block_call_func_t) rb_ldap_hash2mods_i, tmp);
205
206
 
206
207
  return rb_ary_entry (tmp, 1);
207
208
  }
data/misc.c CHANGED
@@ -131,7 +131,7 @@ rb_ldap_control_s_allocate (VALUE klass)
131
131
  return Data_Wrap_Struct (klass, 0, rb_ldap_control_free, ctl);
132
132
  }
133
133
 
134
- #if RUBY_VERSION_CODE < 170
134
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10700
135
135
  static VALUE
136
136
  rb_ldap_control_s_new (int argc, VALUE argv[], VALUE klass)
137
137
  {
@@ -479,11 +479,11 @@ Init_ldap_misc ()
479
479
 
480
480
  #ifdef HAVE_LDAPCONTROL
481
481
  rb_cLDAP_Control = rb_define_class_under (rb_mLDAP, "Control", rb_cObject);
482
- #if RUBY_VERSION_CODE < 170
482
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10700
483
483
  rb_define_singleton_method (rb_cLDAP_Control, "new",
484
484
  rb_ldap_control_s_new, -1);
485
485
  #endif
486
- #if RUBY_VERSION_CODE >= 173
486
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10703
487
487
  rb_define_alloc_func (rb_cLDAP_Control, rb_ldap_control_s_allocate);
488
488
  #else
489
489
  rb_define_singleton_method (rb_cLDAP_Control, "allocate",
data/mod.c CHANGED
@@ -283,7 +283,7 @@ rb_ldap_mod_inspect (VALUE self)
283
283
  str = rb_str_new (0, strlen (c) + 10 + 16 + 1); /* 10:tags 16:addr 1:nul */
284
284
  sprintf (RSTRING_PTR (str), "#<%s:0x%lx ", c, self);
285
285
 
286
- #if RUBY_VERSION_CODE < 190
286
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900
287
287
  RSTRING(str)->len = strlen (RSTRING_PTR (str));
288
288
  #else
289
289
  rb_str_set_len(str, strlen (RSTRING_PTR (str)));
@@ -336,10 +336,10 @@ void
336
336
  Init_ldap_mod ()
337
337
  {
338
338
  rb_cLDAP_Mod = rb_define_class_under (rb_mLDAP, "Mod", rb_cObject);
339
- #if RUBY_VERSION_CODE < 170
339
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10700
340
340
  rb_define_singleton_method (rb_cLDAP_Mod, "new", rb_ldap_class_new, -1);
341
341
  #endif
342
- #if RUBY_VERSION_CODE >= 173
342
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10703
343
343
  rb_define_alloc_func (rb_cLDAP_Mod, rb_ldap_mod_s_allocate);
344
344
  #else
345
345
  rb_define_singleton_method (rb_cLDAP_Mod, "allocate",
data/rbldap.h CHANGED
@@ -28,7 +28,7 @@
28
28
  #define RB_LDAP_MAJOR_VERSION 0
29
29
  #define RB_LDAP_MINOR_VERSION 9
30
30
  #define RB_LDAP_PATCH_VERSION 20
31
- #define RB_LDAP_VERSION "0.10.0"
31
+ #define RB_LDAP_VERSION "0.10.1"
32
32
 
33
33
  #define LDAP_GET_OPT_MAX_BUFFER_SIZE (1024) /* >= sizeof(LDAPAPIInfo) */
34
34
 
@@ -55,7 +55,7 @@ typedef struct rb_ldapentry_data
55
55
  {
56
56
  LDAP *ldap;
57
57
  LDAPMessage *msg;
58
- #if RUBY_VERSION_CODE >= 190
58
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 10900
59
59
  VALUE dn;
60
60
  VALUE attr;
61
61
  #endif
@@ -173,7 +173,7 @@ VALUE rb_ldap_mod_vals (VALUE);
173
173
  }; \
174
174
  }
175
175
 
176
- #if RUBY_VERSION_CODE < 190
176
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC < 10900
177
177
  #define GET_LDAPENTRY_DATA(obj,ptr) { \
178
178
  Data_Get_Struct(obj, struct rb_ldapentry_data, ptr); \
179
179
  if( ! ptr->msg ){ \
@@ -205,3 +205,14 @@ VALUE rb_ldap_mod_vals (VALUE);
205
205
  rb_define_method(rb_cLDAP_Mod,method,cfunc,argc)
206
206
 
207
207
  #endif
208
+
209
+ #if defined(RB_LDAP_RVC) && RB_LDAP_RVC >= 20700
210
+ # if defined rb_tainted_str_new
211
+ # undef rb_tainted_str_new
212
+ # endif
213
+ # if defined rb_tainted_str_new2
214
+ # undef rb_tainted_str_new2
215
+ # endif
216
+ # define rb_tainted_str_new(p,l) rb_str_new((p),(l))
217
+ # define rb_tainted_str_new2(p) rb_str_new_cstr((p))
218
+ #endif
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-ldap3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Curcuru
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-01-25 00:00:00.000000000 Z
12
+ date: 2025-01-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: 'It provides the interface to some LDAP libraries (e.g. OpenLDAP, Netscape
15
15
  SDK and Active Directory). The common API for application development is described