ruby-ldap 0.9.16 → 0.9.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/ChangeLog +7 -0
- data/NOTES +9 -0
- data/README +1 -0
- data/conn.c +2 -0
- data/entry.c +94 -72
- data/rbldap.h +5 -8
- metadata +39 -41
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
Njg3ZDQ0MzkzNWJiNTM0ZTZiYmE1NzkwZDEzZTgzMDg5YWZmNTI1ZTVmOGU1
|
10
|
-
Mjk1M2FhMjc1MmMzYzk5YjRiNWM3MGU1YzdkOWM1YzVmNTg1MGY3N2ExYTgy
|
11
|
-
MzFlMTQwZTY3MzgyMWQzMzdlMjFkOGYwYTNjN2M3ZjYzYTE0ODE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MTJlYjc0MzhjMjU3NWIwMTU2NTM3MzYyMjk5ZGM0YTMzNGExMGM1OTM2ODQ0
|
14
|
-
ZmZhM2NjNmE4ZjNiM2FiNDI2YzllZDU0OWRkNjJhZDgxNDQyNDcwYjljNjNk
|
15
|
-
N2VjNWY5NDg0ZjcwYTQ0YTQwNmJiYzlhNWZmOTc0ZWYzMzI2MzY=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c3a89e98ee493dd192900110043609702f6acab9
|
4
|
+
data.tar.gz: 4988a7cd01236d6c918f9d3dd3780a7325f12232
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 013aa48ccd94301e1660376edd04230cf548de15e6d5f5a2b11f04d388304bb45cfb53fb824a649e844e2c9ba1769ae981aa0a041719b280ca75168f96a86865
|
7
|
+
data.tar.gz: 2d45dfb14d1913b0ecf26af6365397ebc3c1a1deb8187fed75b802f25a278a719b0582404c55ae2c34cc0c099b797f4e56bce3704c795a3e733b7e65bb7e527a
|
data/ChangeLog
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
Fri Feb 6 08:51:09 UTC 2015 Alexey Chebotar <alexey.chebotar@gmail.com>
|
2
|
+
* Version 0.9.17
|
3
|
+
* Use ruby object to keep LDAP search result instead of libldap's data structure.
|
4
|
+
* Use macro Check_LDAPENTRY for assertion inside native extension codes.
|
5
|
+
* Remove assertion code from macro GET_LDAPENTRY_DATA.
|
6
|
+
Thanks to SUENAGA Hiroki.
|
7
|
+
|
1
8
|
Fri Sep 6 07:04:07 UTC 2013 Alexey Chebotar <alexey.chebotar@gmail.com>
|
2
9
|
* Version 0.9.16
|
3
10
|
* Fixed undefined method 'each' in LDAP::LDIF.mods_to_ldif (GH-26).
|
data/NOTES
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
0.9.17
|
2
|
+
-----
|
3
|
+
|
4
|
+
* Use ruby object to keep LDAP search result instead of libldap's data structure.
|
5
|
+
* Use macro Check_LDAPENTRY for assertion inside native extension codes.
|
6
|
+
* Remove assertion code from macro GET_LDAPENTRY_DATA (GH-31).
|
7
|
+
Thanks to SUENAGA Hiroki.
|
8
|
+
|
9
|
+
|
1
10
|
0.9.16
|
2
11
|
-----
|
3
12
|
|
data/README
CHANGED
data/conn.c
CHANGED
@@ -756,6 +756,7 @@ rb_ldap_conn_result2error (VALUE self, VALUE msg)
|
|
756
756
|
|
757
757
|
GET_LDAP_DATA (self, ldapdata);
|
758
758
|
Check_Kind (msg, rb_cLDAP_Entry);
|
759
|
+
Check_LDAPENTRY(msg);
|
759
760
|
GET_LDAPENTRY_DATA (msg, edata);
|
760
761
|
|
761
762
|
ldapdata->err = ldap_result2error (ldapdata->ldap, edata->msg, cdofree);
|
@@ -807,6 +808,7 @@ static VALUE
|
|
807
808
|
rb_ldap_conn_invalidate_entry (VALUE msg)
|
808
809
|
{
|
809
810
|
RB_LDAPENTRY_DATA *edata;
|
811
|
+
Check_LDAPENTRY(msg);
|
810
812
|
GET_LDAPENTRY_DATA (msg, edata);
|
811
813
|
edata->ldap = NULL;
|
812
814
|
edata->msg = NULL;
|
data/entry.c
CHANGED
@@ -8,6 +8,70 @@
|
|
8
8
|
|
9
9
|
VALUE rb_cLDAP_Entry;
|
10
10
|
|
11
|
+
static void
|
12
|
+
rb_ldap_entry_mark(RB_LDAPENTRY_DATA *edata)
|
13
|
+
{
|
14
|
+
rb_gc_mark(edata->dn);
|
15
|
+
rb_gc_mark(edata->attr);
|
16
|
+
/*
|
17
|
+
* edata->ldap and edata->msg are managed in a block given by each search
|
18
|
+
* operation. ldap_msgfree should be called after ldap_search.
|
19
|
+
* they are just for C language interfaces, don't touch these members
|
20
|
+
* in ruby method implementation.
|
21
|
+
*/
|
22
|
+
}
|
23
|
+
|
24
|
+
/*
|
25
|
+
* load libldap's value data structure into ruby array of string
|
26
|
+
*/
|
27
|
+
static VALUE
|
28
|
+
rb_ldap_entry_load_val(LDAP *ldap, LDAPMessage *msg, char *c_attr)
|
29
|
+
{
|
30
|
+
struct berval **bv;
|
31
|
+
VALUE vals;
|
32
|
+
int nvals;
|
33
|
+
int i;
|
34
|
+
|
35
|
+
bv = ldap_get_values_len(ldap, msg, c_attr);
|
36
|
+
if (bv == NULL)
|
37
|
+
return Qnil;
|
38
|
+
|
39
|
+
nvals = ldap_count_values_len(bv);
|
40
|
+
vals = rb_ary_new2(nvals);
|
41
|
+
for (i = 0; i < nvals; i++) {
|
42
|
+
rb_ary_push(vals, rb_tainted_str_new(bv[i]->bv_val, bv[i]->bv_len));
|
43
|
+
}
|
44
|
+
ldap_value_free_len(bv);
|
45
|
+
|
46
|
+
return vals;
|
47
|
+
}
|
48
|
+
|
49
|
+
/*
|
50
|
+
* load libldap's attributes data structure into ruby hash
|
51
|
+
*/
|
52
|
+
static VALUE
|
53
|
+
rb_ldap_entry_load_attr(LDAP *ldap, LDAPMessage *msg)
|
54
|
+
{
|
55
|
+
VALUE hash = rb_hash_new();
|
56
|
+
BerElement *ber = NULL;
|
57
|
+
char *c_attr;
|
58
|
+
|
59
|
+
for (c_attr = ldap_first_attribute(ldap, msg, &ber);
|
60
|
+
c_attr != NULL;
|
61
|
+
c_attr = ldap_next_attribute(ldap, msg, ber)) {
|
62
|
+
VALUE attr = rb_tainted_str_new2(c_attr);
|
63
|
+
VALUE vals = rb_ldap_entry_load_val(ldap, msg, c_attr);
|
64
|
+
|
65
|
+
rb_hash_aset(hash, attr, vals);
|
66
|
+
ldap_memfree(c_attr);
|
67
|
+
}
|
68
|
+
|
69
|
+
#if !defined(USE_OPENLDAP1)
|
70
|
+
ber_free(ber, 0);
|
71
|
+
#endif
|
72
|
+
|
73
|
+
return hash;
|
74
|
+
}
|
11
75
|
|
12
76
|
void
|
13
77
|
rb_ldap_entry_free (RB_LDAPENTRY_DATA * edata)
|
@@ -22,10 +86,25 @@ rb_ldap_entry_new (LDAP * ldap, LDAPMessage * msg)
|
|
22
86
|
{
|
23
87
|
VALUE val;
|
24
88
|
RB_LDAPENTRY_DATA *edata;
|
89
|
+
char *c_dn;
|
90
|
+
|
25
91
|
val = Data_Make_Struct (rb_cLDAP_Entry, RB_LDAPENTRY_DATA,
|
26
|
-
|
92
|
+
rb_ldap_entry_mark, rb_ldap_entry_free, edata);
|
27
93
|
edata->ldap = ldap;
|
28
94
|
edata->msg = msg;
|
95
|
+
|
96
|
+
/* get dn */
|
97
|
+
c_dn = ldap_get_dn(ldap, msg);
|
98
|
+
if (c_dn) {
|
99
|
+
edata->dn = rb_tainted_str_new2(c_dn);
|
100
|
+
ldap_memfree(c_dn);
|
101
|
+
}
|
102
|
+
else {
|
103
|
+
edata->dn = Qnil;
|
104
|
+
}
|
105
|
+
|
106
|
+
/* get attributes */
|
107
|
+
edata->attr = rb_ldap_entry_load_attr(ldap, msg);
|
29
108
|
return val;
|
30
109
|
}
|
31
110
|
|
@@ -38,23 +117,10 @@ VALUE
|
|
38
117
|
rb_ldap_entry_get_dn (VALUE self)
|
39
118
|
{
|
40
119
|
RB_LDAPENTRY_DATA *edata;
|
41
|
-
char *cdn;
|
42
|
-
VALUE dn;
|
43
120
|
|
44
121
|
GET_LDAPENTRY_DATA (self, edata);
|
45
122
|
|
46
|
-
|
47
|
-
if (cdn)
|
48
|
-
{
|
49
|
-
dn = rb_tainted_str_new2 (cdn);
|
50
|
-
ldap_memfree (cdn);
|
51
|
-
}
|
52
|
-
else
|
53
|
-
{
|
54
|
-
dn = Qnil;
|
55
|
-
}
|
56
|
-
|
57
|
-
return dn;
|
123
|
+
return edata->dn;
|
58
124
|
}
|
59
125
|
|
60
126
|
/*
|
@@ -70,34 +136,10 @@ VALUE
|
|
70
136
|
rb_ldap_entry_get_values (VALUE self, VALUE attr)
|
71
137
|
{
|
72
138
|
RB_LDAPENTRY_DATA *edata;
|
73
|
-
char *c_attr;
|
74
|
-
struct berval **c_vals;
|
75
|
-
int i;
|
76
|
-
int count;
|
77
|
-
VALUE vals;
|
78
139
|
|
79
140
|
GET_LDAPENTRY_DATA (self, edata);
|
80
|
-
c_attr = StringValueCStr (attr);
|
81
|
-
|
82
|
-
c_vals = ldap_get_values_len (edata->ldap, edata->msg, c_attr);
|
83
|
-
if (c_vals)
|
84
|
-
{
|
85
|
-
vals = rb_ary_new ();
|
86
|
-
count = ldap_count_values_len (c_vals);
|
87
|
-
for (i = 0; i < count; i++)
|
88
|
-
{
|
89
|
-
VALUE str;
|
90
|
-
str = rb_tainted_str_new (c_vals[i]->bv_val, c_vals[i]->bv_len);
|
91
|
-
rb_ary_push (vals, str);
|
92
|
-
}
|
93
|
-
ldap_value_free_len (c_vals);
|
94
|
-
}
|
95
|
-
else
|
96
|
-
{
|
97
|
-
vals = Qnil;
|
98
|
-
}
|
99
141
|
|
100
|
-
return
|
142
|
+
return rb_hash_aref(edata->attr, attr);
|
101
143
|
}
|
102
144
|
|
103
145
|
/*
|
@@ -111,28 +153,16 @@ VALUE
|
|
111
153
|
rb_ldap_entry_get_attributes (VALUE self)
|
112
154
|
{
|
113
155
|
RB_LDAPENTRY_DATA *edata;
|
114
|
-
VALUE
|
115
|
-
char *attr;
|
116
|
-
BerElement *ber = NULL;
|
156
|
+
VALUE attrs;
|
117
157
|
|
118
158
|
GET_LDAPENTRY_DATA (self, edata);
|
119
159
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
{
|
125
|
-
rb_ary_push (vals, rb_tainted_str_new2 (attr));
|
126
|
-
ldap_memfree(attr);
|
127
|
-
}
|
128
|
-
|
129
|
-
#if !defined(USE_OPENLDAP1)
|
130
|
-
if( ber != NULL ){
|
131
|
-
ber_free(ber, 0);
|
132
|
-
}
|
133
|
-
#endif
|
160
|
+
attrs = rb_funcall(edata->attr, rb_intern("keys"), 0);
|
161
|
+
if (TYPE(attrs) != T_ARRAY) {
|
162
|
+
return Qnil;
|
163
|
+
}
|
134
164
|
|
135
|
-
return
|
165
|
+
return attrs;
|
136
166
|
}
|
137
167
|
|
138
168
|
/*
|
@@ -144,21 +174,13 @@ rb_ldap_entry_get_attributes (VALUE self)
|
|
144
174
|
VALUE
|
145
175
|
rb_ldap_entry_to_hash (VALUE self)
|
146
176
|
{
|
147
|
-
|
148
|
-
VALUE hash
|
149
|
-
VALUE attr, vals;
|
150
|
-
int i;
|
151
|
-
|
152
|
-
Check_Type (attrs, T_ARRAY);
|
153
|
-
rb_hash_aset (hash, rb_tainted_str_new2 ("dn"),
|
154
|
-
rb_ary_new3 (1, rb_ldap_entry_get_dn (self)));
|
155
|
-
for (i = 0; i < RARRAY_LEN (attrs); i++)
|
156
|
-
{
|
157
|
-
attr = rb_ary_entry (attrs, i);
|
158
|
-
vals = rb_ldap_entry_get_values (self, attr);
|
159
|
-
rb_hash_aset (hash, attr, vals);
|
160
|
-
}
|
177
|
+
RB_LDAPENTRY_DATA *edata;
|
178
|
+
VALUE hash, dn_ary;
|
161
179
|
|
180
|
+
GET_LDAPENTRY_DATA (self, edata);
|
181
|
+
hash = rb_hash_dup(edata->attr);
|
182
|
+
dn_ary = rb_ary_new3(1, edata->dn);
|
183
|
+
rb_hash_aset(hash, rb_tainted_str_new2("dn"), dn_ary);
|
162
184
|
return hash;
|
163
185
|
}
|
164
186
|
|
data/rbldap.h
CHANGED
@@ -27,8 +27,8 @@
|
|
27
27
|
|
28
28
|
#define RB_LDAP_MAJOR_VERSION 0
|
29
29
|
#define RB_LDAP_MINOR_VERSION 9
|
30
|
-
#define RB_LDAP_PATCH_VERSION
|
31
|
-
#define RB_LDAP_VERSION "0.9.
|
30
|
+
#define RB_LDAP_PATCH_VERSION 17
|
31
|
+
#define RB_LDAP_VERSION "0.9.17"
|
32
32
|
|
33
33
|
#define LDAP_GET_OPT_MAX_BUFFER_SIZE (1024) /* >= sizeof(LDAPAPIInfo) */
|
34
34
|
|
@@ -55,6 +55,8 @@ typedef struct rb_ldapentry_data
|
|
55
55
|
{
|
56
56
|
LDAP *ldap;
|
57
57
|
LDAPMessage *msg;
|
58
|
+
VALUE dn;
|
59
|
+
VALUE attr;
|
58
60
|
} RB_LDAPENTRY_DATA;
|
59
61
|
|
60
62
|
typedef struct rb_ldapmod_data
|
@@ -161,7 +163,7 @@ VALUE rb_ldap_mod_vals (VALUE);
|
|
161
163
|
|
162
164
|
#define Check_LDAPENTRY(obj) {\
|
163
165
|
RB_LDAPENTRY_DATA *ptr; \
|
164
|
-
Data_Get_Struct(obj, struct
|
166
|
+
Data_Get_Struct(obj, struct rb_ldapentry_data, ptr); \
|
165
167
|
if( ! ptr->msg ){ \
|
166
168
|
VALUE value = rb_inspect(obj); \
|
167
169
|
rb_raise(rb_eLDAP_InvalidEntryError, "%s is not a valid entry", \
|
@@ -171,11 +173,6 @@ VALUE rb_ldap_mod_vals (VALUE);
|
|
171
173
|
|
172
174
|
#define GET_LDAPENTRY_DATA(obj,ptr) { \
|
173
175
|
Data_Get_Struct(obj, struct rb_ldapentry_data, ptr); \
|
174
|
-
if( ! ptr->msg ){ \
|
175
|
-
VALUE value = rb_inspect(obj); \
|
176
|
-
rb_raise(rb_eLDAP_InvalidEntryError, "%s is not a valid entry", \
|
177
|
-
StringValuePtr(value)); \
|
178
|
-
}; \
|
179
176
|
}
|
180
177
|
|
181
178
|
#define GET_LDAPMOD_DATA(obj,ptr) {\
|
metadata
CHANGED
@@ -1,72 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-ldap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Chebotar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
SDK and Active Directory). The common API for application development is described
|
15
|
-
in RFC1823 and is supported by Ruby/LDAP.
|
16
|
-
|
17
|
-
'
|
13
|
+
description: |
|
14
|
+
It provides the interface to some LDAP libraries (e.g. OpenLDAP, Netscape SDK and Active Directory). The common API for application development is described in RFC1823 and is supported by Ruby/LDAP.
|
18
15
|
email: alexey.chebotar@gmail.com
|
19
16
|
executables: []
|
20
17
|
extensions:
|
21
18
|
- extconf.rb
|
22
19
|
extra_rdoc_files: []
|
23
20
|
files:
|
24
|
-
- ChangeLog
|
25
21
|
- COPYING
|
22
|
+
- ChangeLog
|
26
23
|
- FAQ
|
27
24
|
- NOTES
|
28
25
|
- README
|
29
26
|
- TODO
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
27
|
+
- clientauth.c
|
28
|
+
- conn.c
|
29
|
+
- entry.c
|
30
|
+
- extconf.rb
|
31
|
+
- ldap.c
|
32
|
+
- lib/ldap/control.rb
|
33
|
+
- lib/ldap/ldif.rb
|
34
|
+
- lib/ldap/schema.rb
|
35
|
+
- misc.c
|
36
|
+
- mod.c
|
37
|
+
- rbldap.h
|
38
|
+
- saslconn.c
|
39
|
+
- sslconn.c
|
34
40
|
- test/add.rb
|
35
|
-
- test/tc_schema.rb
|
36
41
|
- test/add2.rb
|
37
|
-
- test/search.rb
|
38
42
|
- test/add3.rb
|
39
|
-
- test/
|
43
|
+
- test/bind-ldaps.rb
|
44
|
+
- test/bind-sasl.rb
|
40
45
|
- test/bind-ssl.rb
|
41
|
-
- test/
|
42
|
-
- test/
|
46
|
+
- test/bind.rb
|
47
|
+
- test/compare.rb
|
48
|
+
- test/conf.rb
|
43
49
|
- test/delete.rb
|
50
|
+
- test/ext.rb
|
51
|
+
- test/misc1.rb
|
52
|
+
- test/misc2.rb
|
53
|
+
- test/modrdn.rb
|
54
|
+
- test/moz_cert.rb
|
55
|
+
- test/search.rb
|
44
56
|
- test/search2.rb
|
57
|
+
- test/search3.rb
|
58
|
+
- test/setup.rb
|
59
|
+
- test/subschema.rb
|
45
60
|
- test/tc_conn.rb
|
46
|
-
- test/ts_ldap.rb
|
47
|
-
- test/conf.rb
|
48
|
-
- test/misc2.rb
|
49
|
-
- test/bind-ldaps.rb
|
50
|
-
- test/tc_search.rb
|
51
|
-
- test/bind.rb
|
52
61
|
- test/tc_ldif.rb
|
53
|
-
- test/
|
54
|
-
- test/
|
55
|
-
-
|
56
|
-
- lib/ldap/control.rb
|
57
|
-
- lib/ldap/ldif.rb
|
58
|
-
- extconf.rb
|
59
|
-
- rbldap.h
|
62
|
+
- test/tc_schema.rb
|
63
|
+
- test/tc_search.rb
|
64
|
+
- test/ts_ldap.rb
|
60
65
|
- win/winlber.h
|
61
66
|
- win/winldap.h
|
62
|
-
- conn.c
|
63
|
-
- sslconn.c
|
64
|
-
- entry.c
|
65
|
-
- clientauth.c
|
66
|
-
- ldap.c
|
67
|
-
- mod.c
|
68
|
-
- saslconn.c
|
69
|
-
- misc.c
|
70
67
|
- win/wldap32.def
|
71
68
|
homepage: http://ruby-ldap.sourceforge.net/
|
72
69
|
licenses: []
|
@@ -77,18 +74,19 @@ require_paths:
|
|
77
74
|
- lib
|
78
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
79
76
|
requirements:
|
80
|
-
- -
|
77
|
+
- - ">="
|
81
78
|
- !ruby/object:Gem::Version
|
82
79
|
version: '0'
|
83
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
81
|
requirements:
|
85
|
-
- -
|
82
|
+
- - ">="
|
86
83
|
- !ruby/object:Gem::Version
|
87
84
|
version: '0'
|
88
85
|
requirements: []
|
89
86
|
rubyforge_project: ruby-ldap
|
90
|
-
rubygems_version: 2.
|
87
|
+
rubygems_version: 2.4.5
|
91
88
|
signing_key:
|
92
89
|
specification_version: 4
|
93
90
|
summary: Ruby/LDAP is an extension module for Ruby
|
94
91
|
test_files: []
|
92
|
+
has_rdoc: true
|