ruby-ldap3 0.10.0

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.
data/mod.c ADDED
@@ -0,0 +1,359 @@
1
+ /*
2
+ * mod.c
3
+ * $Id: mod.c,v 1.14 2005/03/07 22:57:34 ianmacd Exp $
4
+ */
5
+
6
+ #include "ruby.h"
7
+ #include "rbldap.h"
8
+
9
+ VALUE rb_cLDAP_Mod;
10
+
11
+
12
+ void
13
+ rb_ldap_mod_free (RB_LDAPMOD_DATA * data)
14
+ {
15
+ if (data->mod)
16
+ {
17
+ struct berval **bvals;
18
+ char **svals;
19
+ int i;
20
+
21
+ xfree(data->mod->mod_type);
22
+ if (data->mod->mod_op & LDAP_MOD_BVALUES)
23
+ {
24
+ bvals = data->mod->mod_vals.modv_bvals;
25
+ for (i = 0; bvals[i] != NULL; i++)
26
+ {
27
+ xfree (bvals[i]);
28
+ }
29
+ xfree (bvals);
30
+ }
31
+ else
32
+ {
33
+ svals = data->mod->mod_vals.modv_strvals;
34
+ for (i = 0; svals[i] != NULL; i++)
35
+ {
36
+ xfree (svals[i]);
37
+ }
38
+ xfree (svals);
39
+ }
40
+ xfree (data->mod);
41
+ }
42
+ xfree (data);
43
+ }
44
+
45
+ static LDAPMod *
46
+ rb_ldap_new_mod (int mod_op, char *mod_type, char **modv_strvals)
47
+ {
48
+ LDAPMod *mod;
49
+
50
+ if (mod_op & LDAP_MOD_BVALUES)
51
+ {
52
+ rb_bug ("rb_ldap_mod_new: illegal mod_op");
53
+ }
54
+
55
+ mod = ALLOC_N (LDAPMod, 1);
56
+ mod->mod_op = mod_op;
57
+ mod->mod_type = ALLOC_N(char,strlen(mod_type) + 1);
58
+ strcpy(mod->mod_type, mod_type);
59
+ mod->mod_vals.modv_strvals = modv_strvals;
60
+
61
+ return mod;
62
+ }
63
+
64
+ VALUE
65
+ rb_ldap_mod_new (int mod_op, char *mod_type, char **modv_strvals)
66
+ {
67
+ VALUE obj;
68
+ RB_LDAPMOD_DATA *moddata;
69
+
70
+ obj = Data_Make_Struct (rb_cLDAP_Mod, RB_LDAPMOD_DATA,
71
+ 0, rb_ldap_mod_free, moddata);
72
+ moddata->mod = rb_ldap_new_mod (mod_op, mod_type, modv_strvals);
73
+
74
+ return obj;
75
+ }
76
+
77
+ static LDAPMod *
78
+ rb_ldap_new_mod2 (int mod_op, char *mod_type, struct berval **modv_bvals)
79
+ {
80
+ LDAPMod *mod;
81
+
82
+ if (!(mod_op & LDAP_MOD_BVALUES))
83
+ {
84
+ rb_bug ("rb_ldap_mod_new: illegal mod_op");
85
+ }
86
+
87
+ mod = ALLOC_N (LDAPMod, 1);
88
+ mod->mod_op = mod_op;
89
+ mod->mod_type = ALLOC_N(char,strlen(mod_type) + 1);
90
+ strcpy(mod->mod_type, mod_type);
91
+ mod->mod_vals.modv_bvals = modv_bvals;
92
+
93
+ return mod;
94
+ }
95
+
96
+ VALUE
97
+ rb_ldap_mod_new2 (int mod_op, char *mod_type, struct berval ** modv_bvals)
98
+ {
99
+ VALUE obj;
100
+ RB_LDAPMOD_DATA *moddata;
101
+
102
+ obj = Data_Make_Struct (rb_cLDAP_Mod, RB_LDAPMOD_DATA,
103
+ 0, rb_ldap_mod_free, moddata);
104
+ moddata->mod = rb_ldap_new_mod2 (mod_op, mod_type, modv_bvals);
105
+
106
+ return obj;
107
+ }
108
+
109
+ static VALUE
110
+ rb_ldap_mod_s_allocate (VALUE klass)
111
+ {
112
+ RB_LDAPMOD_DATA *moddata;
113
+ VALUE obj;
114
+
115
+ obj =
116
+ Data_Make_Struct (klass, RB_LDAPMOD_DATA, 0, rb_ldap_mod_free, moddata);
117
+ moddata->mod = NULL;
118
+
119
+ return obj;
120
+ }
121
+
122
+ /*
123
+ * call-seq:
124
+ * Mod.new(mod_type, attr, vals) => LDAP::Mod
125
+ *
126
+ * Create a new LDAP::Mod object of type +mod_type+. This is most commonly
127
+ * *LDAP_MOD_ADD*, *LDAP_MOD_REPLACE* or *LDAP_MOD_DELETE*, although some LDAP
128
+ * servers may offer extension types.
129
+ *
130
+ * +attr+ should be the name of the attribute on which to operate, whilst
131
+ * +vals+ is an array of values pertaining to +attr+. If +vals+ contains
132
+ * binary data, +mod_type+ should be logically OR'ed (|) with
133
+ * *LDAP_MOD_BVALUES*.
134
+ *
135
+ * LDAP::Mod objects can be passed to methods in the LDAP::Conn class, such as
136
+ * Conn#add, Conn#add_ext, Conn#modify and Conn#modify_ext.
137
+ */
138
+ static VALUE
139
+ rb_ldap_mod_initialize (int argc, VALUE argv[], VALUE self)
140
+ {
141
+ struct berval **bvals;
142
+ char **strvals;
143
+ int mod_op;
144
+ char *mod_type;
145
+ int i;
146
+ VALUE op, type, vals;
147
+ RB_LDAPMOD_DATA *moddata;
148
+
149
+ rb_scan_args (argc, argv, "3", &op, &type, &vals);
150
+ Data_Get_Struct (self, RB_LDAPMOD_DATA, moddata);
151
+ if (moddata->mod)
152
+ return Qnil;
153
+
154
+ mod_op = NUM2INT (op);
155
+ mod_type = RSTRING_PTR(type);
156
+ Check_Type (vals, T_ARRAY);
157
+
158
+ if (mod_op & LDAP_MOD_BVALUES)
159
+ {
160
+ bvals = ALLOC_N (struct berval *, RARRAY_LEN (vals) + 1);
161
+ for (i = 0; i < RARRAY_LEN (vals); i++)
162
+ {
163
+ VALUE str;
164
+ struct berval *bval;
165
+ str = RARRAY_PTR (vals)[i];
166
+ Check_Type (str, T_STRING);
167
+ bval = ALLOC_N (struct berval, 1);
168
+ bval->bv_len = RSTRING_LEN (str);
169
+ RB_LDAP_SET_STR (bval->bv_val, str);
170
+ bvals[i] = bval;
171
+ }
172
+ bvals[i] = NULL;
173
+ moddata->mod = rb_ldap_new_mod2 (mod_op, mod_type, bvals);
174
+ }
175
+ else
176
+ {
177
+ strvals = ALLOC_N (char *, RARRAY_LEN (vals) + 1);
178
+ for (i = 0; i < RARRAY_LEN (vals); i++)
179
+ {
180
+ VALUE str;
181
+ char *sval;
182
+ str = RARRAY_PTR (vals)[i];
183
+ RB_LDAP_SET_STR (sval, str);
184
+ strvals[i] = sval;
185
+ }
186
+ strvals[i] = NULL;
187
+ moddata->mod = rb_ldap_new_mod (mod_op, mod_type, strvals);
188
+ }
189
+
190
+ return Qnil;
191
+ }
192
+
193
+ /*
194
+ * call-seq:
195
+ * mod.mod_op => Fixnum
196
+ *
197
+ * Return the type of modification associated with the LDAP::Mod object.
198
+ * Standard types are *LDAP_MOD_ADD*, *LDAP_MOD_REPLACE* and
199
+ * *LDAP_MOD_DELETE*, although any of these may be logically OR'ed with
200
+ * *LDAP_MOD_BVALUES* to indicate that the values of the Mod object contain
201
+ * binary data.
202
+ */
203
+ VALUE
204
+ rb_ldap_mod_op (VALUE self)
205
+ {
206
+ RB_LDAPMOD_DATA *moddata;
207
+
208
+ GET_LDAPMOD_DATA (self, moddata);
209
+ return INT2NUM (moddata->mod->mod_op);
210
+ }
211
+
212
+ /*
213
+ * call-seq:
214
+ * mod.mod_type => String
215
+ *
216
+ * Return the name of the attribute associated with the LDAP::Mod object.
217
+ */
218
+ VALUE
219
+ rb_ldap_mod_type (VALUE self)
220
+ {
221
+ RB_LDAPMOD_DATA *moddata;
222
+
223
+ GET_LDAPMOD_DATA (self, moddata);
224
+ return rb_tainted_str_new2 (moddata->mod->mod_type);
225
+ }
226
+
227
+ /*
228
+ * call-seq:
229
+ * mod.mod_vals => Array of String
230
+ *
231
+ * Return the values associated with the Mod object.
232
+ */
233
+ VALUE
234
+ rb_ldap_mod_vals (VALUE self)
235
+ {
236
+ RB_LDAPMOD_DATA *moddata;
237
+ struct berval **bvals;
238
+ char **svals;
239
+ int i;
240
+ VALUE val;
241
+
242
+ GET_LDAPMOD_DATA (self, moddata);
243
+
244
+ if (moddata->mod->mod_op & LDAP_MOD_BVALUES)
245
+ {
246
+ bvals = moddata->mod->mod_vals.modv_bvals;
247
+ val = rb_ary_new ();
248
+ for (i = 0; bvals[i] != NULL; i++)
249
+ {
250
+ VALUE str;
251
+ str = rb_tainted_str_new (bvals[i]->bv_val, bvals[i]->bv_len);
252
+ rb_ary_push (val, str);
253
+ }
254
+ }
255
+ else
256
+ {
257
+ svals = moddata->mod->mod_vals.modv_strvals;
258
+ val = rb_ary_new ();
259
+ for (i = 0; svals[i] != NULL; i++)
260
+ {
261
+ VALUE str;
262
+ str = rb_tainted_str_new2 (svals[i]);
263
+ rb_ary_push (val, str);
264
+ }
265
+ }
266
+
267
+ return val;
268
+ }
269
+
270
+ /* call-seq:
271
+ * mod.inspect => String
272
+ *
273
+ * Produce a concise representation of the Mod object.
274
+ */
275
+ VALUE
276
+ rb_ldap_mod_inspect (VALUE self)
277
+ {
278
+ VALUE str;
279
+ VALUE hash = rb_hash_new ();
280
+ const char *c;
281
+
282
+ c = rb_obj_classname (self);
283
+ str = rb_str_new (0, strlen (c) + 10 + 16 + 1); /* 10:tags 16:addr 1:nul */
284
+ sprintf (RSTRING_PTR (str), "#<%s:0x%lx ", c, self);
285
+
286
+ #if RUBY_VERSION_CODE < 190
287
+ RSTRING(str)->len = strlen (RSTRING_PTR (str));
288
+ #else
289
+ rb_str_set_len(str, strlen (RSTRING_PTR (str)));
290
+ #endif
291
+
292
+ switch (FIX2INT (rb_ldap_mod_op (self)) & ~LDAP_MOD_BVALUES)
293
+ {
294
+ case LDAP_MOD_ADD:
295
+ rb_str_cat2 (str, "LDAP_MOD_ADD");
296
+ break;
297
+ case LDAP_MOD_DELETE:
298
+ rb_str_cat2 (str, "LDAP_MOD_DELETE");
299
+ break;
300
+ case LDAP_MOD_REPLACE:
301
+ rb_str_cat2 (str, "LDAP_MOD_REPLACE");
302
+ break;
303
+ #ifdef LDAP_MOD_INCREMENT
304
+ case LDAP_MOD_INCREMENT:
305
+ rb_str_cat2 (str, "LDAP_MOD_INCREMENT");
306
+ break;
307
+ #endif
308
+ #ifdef LDAP_MOD_OP
309
+ case LDAP_MOD_OP:
310
+ rb_str_cat2 (str, "LDAP_MOD_OP");
311
+ break;
312
+ #endif
313
+ default:
314
+ /* We shouldn't end up here. */
315
+ rb_str_cat2 (str, "unknown");
316
+ break;
317
+ }
318
+ if (FIX2INT (rb_ldap_mod_op (self)) & LDAP_MOD_BVALUES)
319
+ rb_str_cat2 (str, "|LDAP_MOD_BVALUES");
320
+ rb_str_cat2 (str, "\n");
321
+
322
+ rb_hash_aset (hash, rb_ldap_mod_type (self), rb_ldap_mod_vals (self));
323
+ rb_str_concat (str, rb_inspect (hash));
324
+ rb_str_cat2 (str, ">");
325
+
326
+ return str;
327
+ }
328
+
329
+ /* Document-class: LDAP::Mod
330
+ *
331
+ * Create and manipulate LDAP::Mod objects, which can then be passed to methods
332
+ * in the LDAP::Conn class, such as Conn#add, Conn#add_ext, Conn#modify and
333
+ * Conn#modify_ext.
334
+ */
335
+ void
336
+ Init_ldap_mod ()
337
+ {
338
+ rb_cLDAP_Mod = rb_define_class_under (rb_mLDAP, "Mod", rb_cObject);
339
+ #if RUBY_VERSION_CODE < 170
340
+ rb_define_singleton_method (rb_cLDAP_Mod, "new", rb_ldap_class_new, -1);
341
+ #endif
342
+ #if RUBY_VERSION_CODE >= 173
343
+ rb_define_alloc_func (rb_cLDAP_Mod, rb_ldap_mod_s_allocate);
344
+ #else
345
+ rb_define_singleton_method (rb_cLDAP_Mod, "allocate",
346
+ rb_ldap_mod_s_allocate, 0);
347
+ #endif
348
+ rb_ldap_mod_define_method ("initialize", rb_ldap_mod_initialize, -1);
349
+ rb_ldap_mod_define_method ("mod_op", rb_ldap_mod_op, 0);
350
+ rb_ldap_mod_define_method ("mod_type", rb_ldap_mod_type, 0);
351
+ rb_ldap_mod_define_method ("mod_vals", rb_ldap_mod_vals, 0);
352
+ rb_ldap_mod_define_method ("inspect", rb_ldap_mod_inspect, 0);
353
+
354
+ /*
355
+ rb_ldap_mod_define_method("mod_op=", rb_ldap_mod_set_op, 1);
356
+ rb_ldap_mod_define_method("mod_type=", rb_ldap_mod_set_type, 1);
357
+ rb_ldap_mod_define_method("mod_vals=", rb_ldap_mod_set_vals, 1);
358
+ */
359
+ }
data/rbldap.h ADDED
@@ -0,0 +1,207 @@
1
+ /*
2
+ * rbldap.h
3
+ * $Id: rbldap.h,v 1.17 2006/08/09 11:23:04 ianmacd Exp $
4
+ */
5
+
6
+ #ifndef RB_LDAP_H
7
+ #define RB_LDAP_H 1
8
+
9
+ #ifdef USE_WLDAP32
10
+ # ifdef HAVE_WINLBER_H
11
+ # include "winlber.h"
12
+ # endif
13
+ # include "winldap.h"
14
+ #else
15
+ # include <lber.h>
16
+ # include <ldap.h>
17
+ #endif
18
+
19
+ #ifdef HAVE_LDAP_SSL_H
20
+ #include <ldap_ssl.h>
21
+ #endif
22
+
23
+ #ifndef LDAP_OPT_SUCCESS
24
+ # define LDAP_OPT_SUCCESS (0)
25
+ # define LDAP_OPT_ERROR (-1)
26
+ #endif
27
+
28
+ #define RB_LDAP_MAJOR_VERSION 0
29
+ #define RB_LDAP_MINOR_VERSION 9
30
+ #define RB_LDAP_PATCH_VERSION 20
31
+ #define RB_LDAP_VERSION "0.10.0"
32
+
33
+ #define LDAP_GET_OPT_MAX_BUFFER_SIZE (1024) /* >= sizeof(LDAPAPIInfo) */
34
+
35
+ #define RB_LDAP_SET_STR(var,val) {\
36
+ Check_Type(val, T_STRING); \
37
+ var = ALLOC_N(char, RSTRING_LEN(val) + 1); \
38
+ memcpy(var, RSTRING_PTR(val), RSTRING_LEN(val) + 1); \
39
+ }
40
+
41
+ #if defined(HAVE_LDAP_SEARCH_EXT_S)
42
+ # define HAVE_LDAPCONTROL
43
+ #endif
44
+
45
+ typedef struct rb_ldap_data
46
+ {
47
+ LDAP *ldap;
48
+ int bind;
49
+ int err;
50
+ } RB_LDAP_DATA;
51
+
52
+ #define RLDAP_DATA_PTR(obj) ((RB_LDAP_DATA*)DATA_PTR(obj))
53
+
54
+ typedef struct rb_ldapentry_data
55
+ {
56
+ LDAP *ldap;
57
+ LDAPMessage *msg;
58
+ #if RUBY_VERSION_CODE >= 190
59
+ VALUE dn;
60
+ VALUE attr;
61
+ #endif
62
+ } RB_LDAPENTRY_DATA;
63
+
64
+ typedef struct rb_ldapmod_data
65
+ {
66
+ LDAPMod *mod;
67
+ } RB_LDAPMOD_DATA;
68
+
69
+ struct timeval rb_time_interval(VALUE num);
70
+
71
+ #ifndef HAVE_LDAP_MEMFREE
72
+ # define ldap_memfree(ptr) free(ptr)
73
+ #endif
74
+
75
+ extern VALUE rb_mLDAP;
76
+
77
+ extern VALUE rb_sLDAP_APIInfo;
78
+ extern VALUE rb_cLDAP_Controls;
79
+
80
+ extern VALUE rb_cLDAP_Conn;
81
+ extern VALUE rb_cLDAP_SSLConn;
82
+ extern VALUE rb_cLDAP_Entry;
83
+ extern VALUE rb_cLDAP_Mod;
84
+ extern VALUE rb_eLDAP_Error;
85
+ extern VALUE rb_eLDAP_ResultError;
86
+ extern VALUE rb_eLDAP_InvalidDataError;
87
+ extern VALUE rb_eLDAP_InvalidEntryError;
88
+
89
+ #ifdef LDAP_OPT_API_INFO
90
+ VALUE rb_ldap_apiinfo_new (LDAPAPIInfo *);
91
+ LDAPAPIInfo *rb_ldap_get_apiinfo (VALUE);
92
+ #endif /* LDAP_OPT_API_INFO */
93
+
94
+ #ifdef HAVE_LDAPCONTROL
95
+ VALUE rb_ldap_control_new (LDAPControl *);
96
+ LDAPControl *rb_ldap_get_control (VALUE);
97
+ LDAPControl **rb_ldap_get_controls (VALUE);
98
+ void rb_ldap_free_controls (LDAPControl ** ctrls);
99
+ #endif
100
+
101
+ VALUE rb_ldap_class_new (int, VALUE[], VALUE);
102
+ VALUE rb_ldap_dummy_method (int, VALUE[], VALUE);
103
+ VALUE rb_ldap_err2string (VALUE, VALUE);
104
+ VALUE rb_ldap_dn2ufn (VALUE, VALUE);
105
+ VALUE rb_ldap_hash2mods (VALUE, VALUE, VALUE);
106
+ VALUE rb_ldap_entry2hash (VALUE, VALUE);
107
+
108
+ VALUE rb_ldap_conn_new (VALUE, LDAP *);
109
+ VALUE rb_ldap_conn_simple_bind_s (int, VALUE[], VALUE);
110
+ VALUE rb_ldap_conn_bind_s (int, VALUE[], VALUE);
111
+ VALUE rb_ldap_conn_start_tls_s (int, VALUE[], VALUE);
112
+ VALUE rb_ldap_conn_unbind (VALUE);
113
+ VALUE rb_ldap_conn_set_option (VALUE, VALUE, VALUE);
114
+ VALUE rb_ldap_conn_get_option (VALUE, VALUE);
115
+ VALUE rb_ldap_conn_perror (VALUE, VALUE);
116
+ VALUE rb_ldap_conn_result2error (VALUE, VALUE);
117
+ VALUE rb_ldap_conn_err2string (VALUE, VALUE);
118
+ VALUE rb_ldap_conn_search_s (int, VALUE[], VALUE);
119
+ VALUE rb_ldap_conn_search2_s (int, VALUE[], VALUE);
120
+ VALUE rb_ldap_conn_add_s (VALUE, VALUE, VALUE);
121
+ VALUE rb_ldap_conn_modify_s (VALUE, VALUE, VALUE);
122
+ VALUE rb_ldap_conn_modrdn_s (VALUE, VALUE, VALUE, VALUE);
123
+ VALUE rb_ldap_conn_delete_s (VALUE, VALUE);
124
+ VALUE rb_ldap_conn_err (VALUE);
125
+ VALUE rb_ldap_conn_set_sort (VALUE, VALUE, VALUE);
126
+ VALUE rb_ldap_conn_get_sort (VALUE);
127
+
128
+ VALUE rb_ldap_saslconn_bind (int, VALUE[], VALUE);
129
+
130
+ VALUE rb_ldap_entry_new (LDAP *, LDAPMessage *);
131
+ VALUE rb_ldap_entry_get_dn (VALUE self);
132
+ VALUE rb_ldap_entry_get_values (VALUE, VALUE);
133
+ VALUE rb_ldap_entry_get_attributes (VALUE);
134
+ VALUE rb_ldap_entry_to_hash (VALUE);
135
+
136
+ VALUE rb_ldap_mod_new (int, char *, char **);
137
+ VALUE rb_ldap_mod_new2 (int, char *, struct berval **);
138
+ VALUE rb_ldap_mod_op (VALUE);
139
+ VALUE rb_ldap_mod_type (VALUE);
140
+ VALUE rb_ldap_mod_vals (VALUE);
141
+
142
+ #define Check_Kind(obj,klass) {\
143
+ if(!rb_obj_is_kind_of(obj,klass))\
144
+ rb_raise(rb_eTypeError,"type mismatch");\
145
+ };
146
+
147
+ #define Check_LDAP_Result(err) { \
148
+ if( (err) != LDAP_SUCCESS && (err) != LDAP_SIZELIMIT_EXCEEDED ){ \
149
+ rb_raise(rb_eLDAP_ResultError, "%s", ldap_err2string(err)); \
150
+ } \
151
+ }
152
+
153
+ #define Check_LDAP_OPT_Result(err) { \
154
+ if( (err) != LDAP_OPT_SUCCESS ){ \
155
+ rb_raise(rb_eLDAP_ResultError, "%s", ldap_err2string(err)); \
156
+ } \
157
+ }
158
+
159
+ #define GET_LDAP_DATA(obj,ptr) {\
160
+ Data_Get_Struct(obj, struct rb_ldap_data, ptr); \
161
+ if( ! ptr->ldap ){ \
162
+ rb_raise(rb_eLDAP_InvalidDataError, "The LDAP handler has already unbound.");\
163
+ } \
164
+ }
165
+
166
+ #define Check_LDAPENTRY(obj) {\
167
+ RB_LDAPENTRY_DATA *ptr; \
168
+ Data_Get_Struct(obj, struct rb_ldapentry_data, ptr); \
169
+ if( ! ptr->msg ){ \
170
+ VALUE value = rb_inspect(obj); \
171
+ rb_raise(rb_eLDAP_InvalidEntryError, "%s is not a valid entry", \
172
+ StringValuePtr(value)); \
173
+ }; \
174
+ }
175
+
176
+ #if RUBY_VERSION_CODE < 190
177
+ #define GET_LDAPENTRY_DATA(obj,ptr) { \
178
+ Data_Get_Struct(obj, struct rb_ldapentry_data, ptr); \
179
+ if( ! ptr->msg ){ \
180
+ VALUE value = rb_inspect(obj); \
181
+ rb_raise(rb_eLDAP_InvalidEntryError, "%s is not a valid entry", \
182
+ StringValuePtr(value)); \
183
+ }; \
184
+ }
185
+ #else
186
+ #define GET_LDAPENTRY_DATA(obj,ptr) { \
187
+ Data_Get_Struct(obj, struct rb_ldapentry_data, ptr); \
188
+ }
189
+ #endif
190
+
191
+ #define GET_LDAPMOD_DATA(obj,ptr) {\
192
+ Data_Get_Struct(obj, struct rb_ldapmod_data, ptr); \
193
+ if( ! ptr->mod ) \
194
+ rb_raise(rb_eLDAP_InvalidDataError, "The Mod data is not ready for use."); \
195
+ }
196
+
197
+ #define rb_ldap_define_class(cname,parent) \
198
+ rb_define_class_under(rb_mLDAP,cname,parent)
199
+
200
+ #define rb_ldap_conn_define_method(method,cfunc,argc) \
201
+ rb_define_method(rb_cLDAP_Conn,method,cfunc,argc)
202
+ #define rb_ldap_entry_define_method(method,cfunc,argc) \
203
+ rb_define_method(rb_cLDAP_Entry,method,cfunc,argc)
204
+ #define rb_ldap_mod_define_method(method,cfunc,argc) \
205
+ rb_define_method(rb_cLDAP_Mod,method,cfunc,argc)
206
+
207
+ #endif