line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::LDAP::AutoDNs; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
21564
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
780
|
use Sys::Hostname; |
|
1
|
|
|
|
|
1164
|
|
|
1
|
|
|
|
|
1301
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Net::LDAP::AutoDNs - Automatically make some default decisions some LDAP DNs and scopes. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.2.2 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.2.2'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use Net::LDAP::AutoDNs; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $obj = Net::LDAP::AutoDNs->new(); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
print $obj->{users}."\n"; |
27
|
|
|
|
|
|
|
print $obj->{usersScope}."\n"; |
28
|
|
|
|
|
|
|
print $obj->{dns}."\n"; |
29
|
|
|
|
|
|
|
print $obj->{groups}."\n"; |
30
|
|
|
|
|
|
|
print $obj->{groupsScope}."\n"; |
31
|
|
|
|
|
|
|
print $obj->{home}."\n"; |
32
|
|
|
|
|
|
|
print $obj->{base}."\n"; |
33
|
|
|
|
|
|
|
print $obj->{bind}."\n"; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 new |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Creates a new Net::LDAP::AutoDNs object. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head3 hash args |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head4 methods |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This is a comma seperated list of methods to use. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
The currently supported ones are listed below and checked |
48
|
|
|
|
|
|
|
in the listed order. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
hostname |
51
|
|
|
|
|
|
|
env |
52
|
|
|
|
|
|
|
devldap |
53
|
|
|
|
|
|
|
EESDPenv |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
The naming of those wraps around to the similarly named |
56
|
|
|
|
|
|
|
methodes. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
#Only the hostname methode will be tried. |
59
|
|
|
|
|
|
|
my $obj=Net::LDAP::AutoDNs->({methodes=>"hostname"}); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
#First the env methdoe will be tried and then the hostname methode. |
62
|
|
|
|
|
|
|
my $obj=Net::LDAP::AutoDNs->({methodes=>"env,hostname"}) |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub new { |
67
|
0
|
|
|
0
|
1
|
|
my %args; |
68
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
69
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
0
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
}; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
#gets the methodes to use |
73
|
|
|
|
|
|
|
#This to make input from things other than perl easier. |
74
|
0
|
0
|
|
|
|
|
if (!defined($args{methods})){ |
75
|
0
|
|
|
|
|
|
$args{methods}='hostname,env,EESDPenv,devldap'; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
my $self={error=>undef, methode=>$args{methods}}; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
bless $self; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my $unmatched=1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
#runs through the methodes and finds one to use |
85
|
0
|
|
|
|
|
|
my @split=split(/,/, $args{methods}); #splits them apart at every ',' |
86
|
0
|
|
|
|
|
|
my $splitInt=0; |
87
|
0
|
|
|
|
|
|
while (defined($split[$splitInt])){ |
88
|
|
|
|
|
|
|
#handles it via the env method |
89
|
0
|
0
|
|
|
|
|
if ($split[$splitInt] eq "devldap") { |
90
|
0
|
0
|
|
|
|
|
if ($self->byDevLDAP()) { |
91
|
0
|
|
|
|
|
|
$unmatched=undef;#as it as been matched, set $unmatched to false |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
#handles it via the env method |
96
|
0
|
0
|
|
|
|
|
if ($split[$splitInt] eq "env") { |
97
|
0
|
0
|
|
|
|
|
if ($self->byEnv()) { |
98
|
0
|
|
|
|
|
|
$unmatched=undef;#as it as been matched, set $unmatched to false |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
#handles it via the EESDPenv method |
103
|
0
|
0
|
|
|
|
|
if ($split[$splitInt] eq "EESDPenv") { |
104
|
0
|
0
|
|
|
|
|
if ($self->byEESDPenv()) { |
105
|
0
|
|
|
|
|
|
$unmatched=undef;#as it as been matched, set $unmatched to false |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
#handles it if it if using the hostname method |
110
|
0
|
0
|
|
|
|
|
if ($split[$splitInt] eq "hostname") { |
111
|
0
|
0
|
|
|
|
|
if ($self->byHostname()) { |
112
|
0
|
|
|
|
|
|
$unmatched=undef;#as it as been matched, set $unmatched to false |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
$splitInt++; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
0
|
0
|
|
|
|
|
if ($unmatched){ |
120
|
0
|
|
|
|
|
|
$self->{error}=2; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
return $self; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 newEESDP |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Creates a new Net::LDAP::AutoDNs object in a |
129
|
|
|
|
|
|
|
EESDP LDAP Standard method. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub newEESDP { |
134
|
0
|
|
|
0
|
1
|
|
my %args; |
135
|
0
|
|
|
|
|
|
$args{methodes}='hostname,devldap,EESDPenv'; |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
my $self={error=>undef, methodes=>$args{methodes}}; |
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
bless $self; |
140
|
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
|
my $unmatched=1; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
#runs through the methodes and finds one to use |
144
|
0
|
|
|
|
|
|
my @split=split(/,/, $args{methodes}); #splits them apart at every ',' |
145
|
0
|
|
|
|
|
|
my $splitInt=0; |
146
|
0
|
|
|
|
|
|
while (defined($split[$splitInt])){ |
147
|
|
|
|
|
|
|
#handles it via the env method |
148
|
0
|
0
|
|
|
|
|
if ($split[$splitInt] eq "devldap") { |
149
|
0
|
0
|
|
|
|
|
if ($self->byDevLDAP()) { |
150
|
0
|
|
|
|
|
|
$unmatched=undef;#as it as been matched, set $unmatched to false |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
#handles it via the EESDPenv method |
155
|
0
|
0
|
|
|
|
|
if ($split[$splitInt] eq "EESDPenv") { |
156
|
0
|
0
|
|
|
|
|
if ($self->byEESDPenv()) { |
157
|
0
|
|
|
|
|
|
$unmatched=undef;#as it as been matched, set $unmatched to false |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
#handles it if it if using the hostname method |
162
|
0
|
0
|
|
|
|
|
if ($split[$splitInt] eq "hostname") { |
163
|
0
|
0
|
|
|
|
|
if ($self->byHostname()) { |
164
|
0
|
|
|
|
|
|
$unmatched=undef;#as it as been matched, set $unmatched to false |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
|
$splitInt++; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
|
return $self; |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head2 byDevLDAP |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This sets it up using the information found under '/dev/ldap/'. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
More information on this can be found at |
179
|
|
|
|
|
|
|
http://eesdp.org/eesdp/ldap-kmod.html . |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub byDevLDAP{ |
184
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
185
|
|
|
|
|
|
|
|
186
|
0
|
|
|
|
|
|
$self->{error}=undef; |
187
|
|
|
|
|
|
|
|
188
|
0
|
0
|
|
|
|
|
if (! -d '/dev/ldap/') { |
189
|
0
|
|
|
|
|
|
$self->{error}=3; |
190
|
0
|
|
|
|
|
|
return undef; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
0
|
0
|
|
|
|
|
if (open(USERS, '<', '/dev/ldap/userBase')){ |
194
|
0
|
|
|
|
|
|
my $temp=join('', ); |
195
|
0
|
0
|
|
|
|
|
if ($temp ne '') { |
196
|
0
|
|
|
|
|
|
$self->{users}=join('', ); |
197
|
|
|
|
|
|
|
} |
198
|
0
|
|
|
|
|
|
close(USERS); |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
0
|
0
|
|
|
|
|
if (open(USERSSCOPE, '<', '/dev/ldap/userScope')){ |
202
|
0
|
|
|
|
|
|
my $temp=join('', ); |
203
|
0
|
0
|
|
|
|
|
if ($temp ne '') { |
204
|
0
|
|
|
|
|
|
$self->{usersScope}=join('', ); |
205
|
|
|
|
|
|
|
} |
206
|
0
|
|
|
|
|
|
close(USERSSCOPE); |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
0
|
0
|
|
|
|
|
if (open(GROUP, '<', '/dev/ldap/groupBase')){ |
210
|
0
|
|
|
|
|
|
my $temp=join('', ); |
211
|
0
|
0
|
|
|
|
|
if ($temp ne '') { |
212
|
0
|
|
|
|
|
|
$self->{groups}=join('', ); |
213
|
|
|
|
|
|
|
} |
214
|
0
|
|
|
|
|
|
close(GROUP); |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
0
|
0
|
|
|
|
|
if (open(GROUPSCOPE, '<', '/dev/ldap/groupScope')){ |
218
|
0
|
|
|
|
|
|
my $temp=join('', ); |
219
|
0
|
0
|
|
|
|
|
if ($temp ne '') { |
220
|
0
|
|
|
|
|
|
$self->{groupsScope}=join('', ); |
221
|
|
|
|
|
|
|
} |
222
|
0
|
|
|
|
|
|
close(GROUPSCOPE); |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
0
|
0
|
|
|
|
|
if (open(HOME, '<', '/dev/ldap/homeBase')){ |
226
|
0
|
|
|
|
|
|
my $temp=join('', ); |
227
|
0
|
0
|
|
|
|
|
if ($temp ne '') { |
228
|
0
|
|
|
|
|
|
$self->{home}=join('', ); |
229
|
|
|
|
|
|
|
} |
230
|
0
|
|
|
|
|
|
close(HOME); |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
0
|
0
|
|
|
|
|
if (open(BASE, '<', '/dev/ldap/base')){ |
234
|
0
|
|
|
|
|
|
my $temp=join('', ); |
235
|
0
|
0
|
|
|
|
|
if ($temp ne '') { |
236
|
0
|
|
|
|
|
|
$self->{base}=join('', ); |
237
|
|
|
|
|
|
|
} |
238
|
0
|
|
|
|
|
|
close(BASE); |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
0
|
0
|
|
|
|
|
if (defined( $self->{base} )){ |
242
|
0
|
|
|
|
|
|
$self->{dns}='ou=dns,'.$self->{base} |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
|
245
|
0
|
0
|
|
|
|
|
if (defined( $self->{base} )){ |
246
|
0
|
|
|
|
|
|
$self->{dhcp}='ou=dhcp,'.$self->{base}; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
0
|
|
|
|
|
|
return 1; |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head2 byEnv |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
This sets it up using $ENV{AutoDNbase} for the base. |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=cut |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub byEnv{ |
259
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
260
|
0
|
|
|
|
|
|
my %args; |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
#blanks any previous errors |
263
|
0
|
|
|
|
|
|
$self->{error}=undef; |
264
|
|
|
|
|
|
|
|
265
|
0
|
0
|
|
|
|
|
if (!defined($ENV{AutoDNbase})){ |
266
|
0
|
|
|
|
|
|
return undef; |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
0
|
|
|
|
|
|
$self->{users}='ou=users,'.$ENV{AutoDNbase}; |
270
|
0
|
|
|
|
|
|
$self->{usersScope}='sub'; |
271
|
|
|
|
|
|
|
|
272
|
0
|
|
|
|
|
|
$self->{groups}='ou=groups,'.$ENV{AutoDNbase}; |
273
|
0
|
|
|
|
|
|
$self->{groupsScope}='sub'; |
274
|
|
|
|
|
|
|
|
275
|
0
|
|
|
|
|
|
$self->{home}='ou=home,'.$ENV{AutoDNbase}; |
276
|
|
|
|
|
|
|
|
277
|
0
|
|
|
|
|
|
$self->{base}=$ENV{AutoDNbase}; |
278
|
|
|
|
|
|
|
|
279
|
0
|
|
|
|
|
|
$self->{dhcp}='ou=dhcp,'.$ENV{AutoDNbase}; |
280
|
|
|
|
|
|
|
|
281
|
0
|
|
|
|
|
|
$self->{dns}='ou=dns,'.$ENV{AutoDNbase}; |
282
|
|
|
|
|
|
|
|
283
|
0
|
|
|
|
|
|
return 1; |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=head2 byEESDPenv |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
Populates all DNs using the EESDP LDAP Standard in regards |
289
|
|
|
|
|
|
|
to environmental values. |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=cut |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
sub byEESDPenv{ |
294
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
295
|
0
|
|
|
|
|
|
my %args; |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
#blanks any previous errors |
298
|
0
|
|
|
|
|
|
$self->{error}=undef; |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
#gets the base DN |
301
|
0
|
0
|
|
|
|
|
if (defined($ENV{'EESDP-BaseDN'})) { |
302
|
0
|
|
|
|
|
|
$self->{base}=$ENV{'EESDP-BaseDN'}; |
303
|
|
|
|
|
|
|
} |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
#gets the user OU |
306
|
0
|
0
|
|
|
|
|
if (defined($ENV{'EESDP-UserOU'})) { |
307
|
0
|
|
|
|
|
|
$self->{users}=$ENV{'EESDP-UserOU'}; |
308
|
|
|
|
|
|
|
} |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
#gets the user OU scope |
311
|
0
|
0
|
|
|
|
|
if (defined($ENV{'EESDP-UserScope'})) { |
312
|
0
|
|
|
|
|
|
$self->{usersScope}=$ENV{'EESDP-UserScope'}; |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
#gets the group OU |
316
|
0
|
0
|
|
|
|
|
if (defined($ENV{'EESDP-GroupOU'})) { |
317
|
0
|
|
|
|
|
|
$self->{groups}=$ENV{'EESDP-GroupOU'}; |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
#gets the group OU scope |
321
|
0
|
0
|
|
|
|
|
if (defined($ENV{'EESDP-GroupScope'})) { |
322
|
0
|
|
|
|
|
|
$self->{groupsScope}=$ENV{'EESDP-GroupScope'}; |
323
|
|
|
|
|
|
|
} |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
#gets the DNS OU |
326
|
0
|
0
|
|
|
|
|
if (defined($ENV{'EESDP-DNSOU'})) { |
327
|
0
|
|
|
|
|
|
$self->{dns}=$ENV{'EESDP-DNSOU'}; |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
#gets the home OU |
331
|
0
|
0
|
|
|
|
|
if (defined($ENV{'EESDP-HomeOU'})) { |
332
|
0
|
|
|
|
|
|
$self->{home}=$ENV{'EESDP-HomeOU'}; |
333
|
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
#gets the bind DN |
336
|
0
|
0
|
|
|
|
|
if (defined($ENV{'EESDP-BindDN'})) { |
337
|
0
|
|
|
|
|
|
$self->{bind}=$ENV{'EESDP-BindDN'}; |
338
|
|
|
|
|
|
|
} |
339
|
|
|
|
|
|
|
|
340
|
0
|
|
|
|
|
|
return 1; |
341
|
|
|
|
|
|
|
} |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=head2 byHostname |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
Sets the DNs based on the hostname. The last subdomain is |
346
|
|
|
|
|
|
|
chopped off and each '.' is replaced with a ',dc='. This |
347
|
|
|
|
|
|
|
means 'host.foo.bar' becomes 'dc=foo,dc=bar'. |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
Returns true if it succeeds. |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=cut |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
sub byHostname{ |
354
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
355
|
0
|
|
|
|
|
|
my %args; |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
#blanks any previous errors |
359
|
0
|
|
|
|
|
|
$self->{error}=undef; |
360
|
|
|
|
|
|
|
|
361
|
0
|
|
|
|
|
|
my $base=hostname;#gets the hostname |
362
|
0
|
0
|
|
|
|
|
if ($?) { |
363
|
0
|
|
|
|
|
|
$self->{error}=1; |
364
|
0
|
|
|
|
|
|
return undef; |
365
|
|
|
|
|
|
|
} |
366
|
0
|
|
|
|
|
|
chomp($base);#removes the trailing '\n' |
367
|
0
|
|
|
|
|
|
$base=~s/^[a-z0-9A-Z-]*\.//; #removes everything up to the first '.' |
368
|
0
|
|
|
|
|
|
$base=~s/\./,dc=/g;#replaces every '.' with a ',dc=' |
369
|
0
|
|
|
|
|
|
$base='dc='.$base;#creates fine base dn |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
|
372
|
0
|
|
|
|
|
|
$self->{users}='ou=users,'.$base; |
373
|
0
|
|
|
|
|
|
$self->{usersScope}='sub'; |
374
|
|
|
|
|
|
|
|
375
|
0
|
|
|
|
|
|
$self->{groups}='ou=groups,'.$base; |
376
|
0
|
|
|
|
|
|
$self->{groupsScope}='sub'; |
377
|
|
|
|
|
|
|
|
378
|
0
|
|
|
|
|
|
$self->{home}='ou=home,'.$base; |
379
|
|
|
|
|
|
|
|
380
|
0
|
|
|
|
|
|
$self->{base}=$base; |
381
|
|
|
|
|
|
|
|
382
|
0
|
|
|
|
|
|
$self->{dhcp}='ou=dhcp,'.$base; |
383
|
|
|
|
|
|
|
|
384
|
0
|
|
|
|
|
|
$self->{dns}='ou=dns,'.$base; |
385
|
|
|
|
|
|
|
|
386
|
0
|
|
|
|
|
|
return 1; |
387
|
|
|
|
|
|
|
} |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
=head1 Error Codes |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
$obj->{error} is defined, there is an error. |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=head2 0 |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
Methode not implemented yet. |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
=head2 1 |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
Retrieving hostname failed. Most likely caused by 'hostname' not being in the path. |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
=head2 2 |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
None of the methodes returned matched or returned true. |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=head2 3 |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
Either the system does not support /dev/ldap/. |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
=head1 AUTHOR |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
Zane C. Bowers, C<< >> |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
=head1 BUGS |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
416
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
417
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
=head1 SUPPORT |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
perldoc Net::LDAP::AutoDNs |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
You can also look for information at: |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
=over 4 |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
L |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
L |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=item * CPAN Ratings |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
L |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
=item * Search CPAN |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
L |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
=back |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
Copyright 2008 Zane C. Bowers, all rights reserved. |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
458
|
|
|
|
|
|
|
under the same terms as Perl itself. |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=cut |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
1; # End of Net::LDAP::AutoDNs |