[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 # Copyright (c) 1998-2008 Graham Barr <gbarr@pobox.com>. All rights reserved. 2 # This program is free software; you can redistribute it and/or 3 # modify it under the same terms as Perl itself. 4 5 package Net::LDAP::Constant; 6 7 $VERSION = "0.07"; 8 9 use Carp; 10 11 my %const; 12 13 sub import { 14 shift; 15 my $callpkg = caller(0); 16 _find(@_); 17 my $oops; 18 my $all = grep /:all/, @_; 19 foreach my $sym ($all ? keys %const : @_) { 20 if (my $sub = $const{$sym}) { 21 *{$callpkg . "::$sym"} = $sub; 22 } 23 else { 24 ++$oops; 25 carp(qq["$sym" is not exported by the Net::LDAP::Constant module]); 26 } 27 } 28 croak("Can't continue after import errors") if $oops; 29 } 30 31 sub _find { 32 if (my @need = grep { ! $const{$_} } @_) { 33 my %need; @need{@need} = (); 34 my $all = exists $need{':all'}; 35 seek(DATA,0,0); 36 local $/=''; # paragraph mode 37 local $_; 38 while(<DATA>) { 39 next unless /^=item\s+(LDAP_\S+)\s+\((.*)\)/ and ($all or exists $need{$1}); 40 my ($name, $value) = ($1,$2); 41 delete $need{$name}; 42 $const{$name} = sub () { $value }; 43 last unless keys %need; 44 } 45 } 46 @const{@_}; 47 } 48 49 sub AUTOLOAD { 50 (my $name = $AUTOLOAD) =~ s/^.*:://; 51 my $sub = _find($name) or croak("Undefined subroutine &$AUTOLOAD"); 52 my $val = &$sub; # Avoid prototype error caused by *$AUTOLOAD = $sub 53 *$AUTOLOAD = sub { $val }; 54 goto &$AUTOLOAD; 55 } 56 57 # These subs are really in Net::LDAP::Util, but need to access <DATA> 58 # so its easier for them to be here. 59 60 my @err2name; 61 62 sub Net::LDAP::Util::ldap_error_name { 63 my $code = 0 + (ref($_[0]) ? $_[0]->code : $_[0]); 64 65 unless (@err2name) { 66 seek(DATA,0,0); 67 local $/=''; # paragraph mode 68 local $_; 69 my $n = -1; 70 while(<DATA>) { 71 last if /^=head2/ and ++$n; 72 next if $n; 73 $err2name[$2] = $1 if /^=item\s+(LDAP_\S+)\s+\((\d+)\)/; 74 } 75 } 76 $err2name[$code] || sprintf("LDAP error code %d(0x%02X)",$code,$code); 77 } 78 79 80 sub Net::LDAP::Util::ldap_error_text { 81 my $code = 0 + (ref($_[0]) ? $_[0]->code : $_[0]); 82 my $text; 83 84 seek(DATA,0,0); 85 local $/=''; # paragraph mode 86 local $_; 87 my $n = -1; 88 while(<DATA>) { 89 last if /^=head2/ and ++$n; 90 next if $n; 91 if (/^=item\s+(LDAP_\S+)\s+\((\d+)\)/) { 92 last if defined $text; 93 $text = '' if $2 == $code; 94 } 95 elsif (defined $text) { 96 $text .= $_; 97 } 98 } 99 100 if (defined $text) { 101 # Do some cleanup. Really should use a proper pod parser here. 102 103 $text =~ s/^=item\s+\*\s+/ * /msg; 104 $text =~ s/^=(over\s*\d*|back)//msg; 105 $text =~ s/ +\n//g; 106 $text =~ s/\n\n+/\n\n/g; 107 $text =~ s/\n+\Z/\n/ if defined $text; 108 } 109 110 return $text; 111 } 112 113 1; 114 115 __DATA__ 116 117 =head1 NAME 118 119 Net::LDAP::Constant - Constants for use with Net::LDAP 120 121 =head1 SYNOPSIS 122 123 use Net::LDAP qw(LDAP_SUCCESS LDAP_PROTOCOL_ERROR); 124 125 =head1 DESCRIPTION 126 127 B<Net::LDAP::Constant> exports constant subroutines for the following LDAP 128 error codes. 129 130 =head2 Protocol Constants 131 132 =over 4 133 134 =item LDAP_SUCCESS (0) 135 136 Operation completed without error 137 138 =item LDAP_OPERATIONS_ERROR (1) 139 140 Server encountered an internal error 141 142 =item LDAP_PROTOCOL_ERROR (2) 143 144 Unrecognized version number or incorrect PDU structure 145 146 =item LDAP_TIMELIMIT_EXCEEDED (3) 147 148 The time limit on a search operation has been exceeded 149 150 =item LDAP_SIZELIMIT_EXCEEDED (4) 151 152 The maximum number of search results to return has been exceeded. 153 154 =item LDAP_COMPARE_FALSE (5) 155 156 This code is returned when a compare request completes and the attribute value 157 given is not in the entry specified 158 159 =item LDAP_COMPARE_TRUE (6) 160 161 This code is returned when a compare request completes and the attribute value 162 given is in the entry specified 163 164 =item LDAP_AUTH_METHOD_NOT_SUPPORTED (7) 165 166 Unrecognized SASL mechanism name 167 168 =item LDAP_STRONG_AUTH_NOT_SUPPORTED (7) 169 170 Unrecognized SASL mechanism name 171 172 =item LDAP_STRONG_AUTH_REQUIRED (8) 173 174 The server requires authentication be performed with a SASL mechanism 175 176 =item LDAP_PARTIAL_RESULTS (9) 177 178 Returned to version 2 clients when a referral is returned. The response 179 will contain a list of URL's for other servers. 180 181 =item LDAP_REFERRAL (10) 182 183 The server is referring the client to another server. The response will 184 contain a list of URL's 185 186 =item LDAP_ADMIN_LIMIT_EXCEEDED (11) 187 188 The server has exceed the maximum number of entries to search while gathering 189 a list of search result candidates 190 191 =item LDAP_UNAVAILABLE_CRITICAL_EXT (12) 192 193 A control or matching rule specified in the request is not supported by 194 the server 195 196 =item LDAP_CONFIDENTIALITY_REQUIRED (13) 197 198 This result code is returned when confidentiality is required to perform 199 a given operation 200 201 =item LDAP_SASL_BIND_IN_PROGRESS (14) 202 203 The server requires the client to send a new bind request, with the same SASL 204 mechanism, to continue the authentication process 205 206 =item LDAP_NO_SUCH_ATTRIBUTE (16) 207 208 The request referenced an attribute that does not exist 209 210 =item LDAP_UNDEFINED_TYPE (17) 211 212 The request contains an undefined attribute type 213 214 =item LDAP_INAPPROPRIATE_MATCHING (18) 215 216 An extensible matching rule in the given filter does not apply to the specified 217 attribute 218 219 =item LDAP_CONSTRAINT_VIOLATION (19) 220 221 The request contains a value which does not meet with certain constraints. 222 This result can be returned as a consequence of 223 224 =over 4 225 226 =item * 227 228 The request was to add or modify a user password, and the password fails to 229 meet the criteria the server is configured to check. This could be that the 230 password is too short, or a recognizable word (e.g. it matches one of the 231 attributes in the users entry) or it matches a previous password used by 232 the same user. 233 234 =item * 235 236 The request is a bind request to a user account that has been locked 237 238 =back 239 240 =item LDAP_TYPE_OR_VALUE_EXISTS (20) 241 242 The request attempted to add an attribute type or value that already exists 243 244 =item LDAP_INVALID_SYNTAX (21) 245 246 Some part of the request contained an invalid syntax. It could be a search 247 with an invalid filter or a request to modify the schema and the given 248 schema has a bad syntax. 249 250 =item LDAP_NO_SUCH_OBJECT (32) 251 252 The server cannot find an object specified in the request 253 254 =item LDAP_ALIAS_PROBLEM (33) 255 256 Server encountered a problem while attempting to dereference an alias 257 258 =item LDAP_INVALID_DN_SYNTAX (34) 259 260 The request contained an invalid DN 261 262 =item LDAP_IS_LEAF (35) 263 264 The specified entry is a leaf entry 265 266 =item LDAP_ALIAS_DEREF_PROBLEM (36) 267 268 Server encountered a problem while attempting to dereference an alias 269 270 =item LDAP_INAPPROPRIATE_AUTH (48) 271 272 The server requires the client which had attempted to bind anonymously or 273 without supplying credentials to provide some form of credentials 274 275 =item LDAP_INVALID_CREDENTIALS (49) 276 277 The wrong password was supplied or the SASL credentials could not be processed 278 279 =item LDAP_INSUFFICIENT_ACCESS (50) 280 281 The client does not have sufficient access to perform the requested 282 operation 283 284 =item LDAP_BUSY (51) 285 286 The server is too busy to perform requested operation 287 288 =item LDAP_UNAVAILABLE (52) 289 290 The server in unavailable to perform the request, or the server is 291 shutting down 292 293 =item LDAP_UNWILLING_TO_PERFORM (53) 294 295 The server is unwilling to perform the requested operation 296 297 =item LDAP_LOOP_DETECT (54) 298 299 The server was unable to perform the request due to an internal loop detected 300 301 =item LDAP_SORT_CONTROL_MISSING (60) 302 303 The search contained a "virtual list view" control, but not a server-side 304 sorting control, which is required when a "virtual list view" is given. 305 306 =item LDAP_INDEX_RANGE_ERROR (61) 307 308 The search contained a control for a "virtual list view" and the results 309 exceeded the range specified by the requested offsets. 310 311 =item LDAP_NAMING_VIOLATION (64) 312 313 The request violates the structure of the DIT 314 315 =item LDAP_OBJECT_CLASS_VIOLATION (65) 316 317 The request specifies a change to an existing entry or the addition of a new 318 entry that does not comply with the servers schema 319 320 =item LDAP_NOT_ALLOWED_ON_NONLEAF (66) 321 322 The requested operation is not allowed on an entry that has child entries 323 324 =item LDAP_NOT_ALLOWED_ON_RDN (67) 325 326 The requested operation ill affect the RDN of the entry 327 328 =item LDAP_ALREADY_EXISTS (68) 329 330 The client attempted to add an entry that already exists. This can occur as 331 a result of 332 333 =over 4 334 335 =item * 336 337 An add request was submitted with a DN that already exists 338 339 =item * 340 341 A modify DN requested was submitted, where the requested new DN already exists 342 343 =item * 344 345 The request is adding an attribute to the schema and an attribute with the 346 given OID or name already exists 347 348 =back 349 350 =item LDAP_NO_OBJECT_CLASS_MODS (69) 351 352 Request attempt to modify the object class of an entry that should not be 353 modified 354 355 =item LDAP_RESULTS_TOO_LARGE (70) 356 357 The results of the request are to large 358 359 =item LDAP_AFFECTS_MULTIPLE_DSAS (71) 360 361 The requested operation needs to be performed on multiple servers where 362 the requested operation is not permitted 363 364 =item LDAP_OTHER (80) 365 366 An unknown error has occurred 367 368 =item LDAP_SERVER_DOWN (81) 369 370 C<Net::LDAP> cannot establish a connection or the connection has been lost 371 372 =item LDAP_LOCAL_ERROR (82) 373 374 An error occurred in C<Net::LDAP> 375 376 =item LDAP_ENCODING_ERROR (83) 377 378 C<Net::LDAP> encountered an error while encoding the request packet that would 379 have been sent to the server 380 381 =item LDAP_DECODING_ERROR (84) 382 383 C<Net::LDAP> encountered an error while decoding a response packet from 384 the server. 385 386 =item LDAP_TIMEOUT (85) 387 388 C<Net::LDAP> timeout while waiting for a response from the server 389 390 =item LDAP_AUTH_UNKNOWN (86) 391 392 The method of authentication requested in a bind request is unknown to 393 the server 394 395 =item LDAP_FILTER_ERROR (87) 396 397 An error occurred while encoding the given search filter. 398 399 =item LDAP_USER_CANCELED (88) 400 401 The user canceled the operation 402 403 =item LDAP_PARAM_ERROR (89) 404 405 An invalid parameter was specified 406 407 =item LDAP_NO_MEMORY (90) 408 409 Out of memory error 410 411 =item LDAP_CONNECT_ERROR (91) 412 413 A connection to the server could not be established 414 415 =item LDAP_NOT_SUPPORTED (92) 416 417 An attempt has been made to use a feature not supported by Net::LDAP 418 419 =item LDAP_CONTROL_NOT_FOUND (93) 420 421 The controls required to perform the requested operation were not 422 found. 423 424 =item LDAP_NO_RESULTS_RETURNED (94) 425 426 No results were returned from the server. 427 428 =item LDAP_MORE_RESULTS_TO_RETURN (95) 429 430 There are more results in the chain of results. 431 432 =item LDAP_CLIENT_LOOP (96) 433 434 A loop has been detected. For example when following referals. 435 436 =item LDAP_REFERRAL_LIMIT_EXCEEDED (97) 437 438 The referral hop limit has been exceeded. 439 440 =back 441 442 =head2 Control OIDs 443 444 =over 4 445 446 =item LDAP_CONTROL_SORTREQUEST (1.2.840.113556.1.4.473) 447 448 =item LDAP_CONTROL_SORTRESULT (1.2.840.113556.1.4.474) 449 450 =item LDAP_CONTROL_VLVREQUEST (2.16.840.1.113730.3.4.9) 451 452 =item LDAP_CONTROL_VLVRESPONSE (2.16.840.1.113730.3.4.10) 453 454 =item LDAP_CONTROL_PROXYAUTHENTICATION (2.16.840.1.113730.3.4.18) 455 456 =item LDAP_CONTROL_PAGED (1.2.840.113556.1.4.319) 457 458 =item LDAP_CONTROL_TREE_DELETE (1.2.840.113556.1.4.805) 459 460 =item LDAP_CONTROL_MATCHEDVALS (1.2.826.0.1.3344810.2.2) 461 462 =item LDAP_CONTROL_MATCHEDVALUES (1.2.826.0.1.3344810.2.3) 463 464 =item LDAP_CONTROL_MANAGEDSAIT (2.16.840.1.113730.3.4.2) 465 466 =item LDAP_CONTROL_PERSISTENTSEARCH (2.16.840.1.113730.3.4.3) 467 468 =item LDAP_CONTROL_ENTRYCHANGE (2.16.840.1.113730.3.4.7) 469 470 =item LDAP_CONTROL_PWEXPIRED (2.16.840.1.113730.3.4.4) 471 472 =item LDAP_CONTROL_PWEXPIRING (2.16.840.1.113730.3.4.5) 473 474 =item LDAP_CONTROL_REFERRALS (1.2.840.113556.1.4.616) 475 476 =item LDAP_CONTROL_PASSWORDPOLICY (1.3.6.1.4.1.42.2.27.8.5.1) 477 478 =item LDAP_CONTROL_PREREAD (1.3.6.1.1.13.1) 479 480 =item LDAP_CONTROL_POSTREAD (1.3.6.1.1.13.2) 481 482 =item LDAP_CONTROL_ASSERTION (1.3.6.1.1.12) 483 484 =item LDAP_CONTROL_SYNC (1.3.6.1.4.1.4203.1.9.1.1) 485 486 =item LDAP_CONTROL_SYNC_STATE (1.3.6.1.4.1.4203.1.9.1.2) 487 488 =item LDAP_CONTROL_SYNC_DONE (1.3.6.1.4.1.4203.1.9.1.3) 489 490 =item LDAP_SYNC_INFO (1.3.6.1.4.1.4203.1.9.1.4) 491 492 =back 493 494 =head2 Control constants 495 496 =over 4 497 498 =item LDAP_PP_PASSWORD_EXPIRED (0) [LDAP_CONTROL_PASSWORDPOLICY] 499 500 The account's password has expired. 501 502 =item LDAP_PP_ACCOUNT_LOCKED (1) [LDAP_CONTROL_PASSWORDPOLICY] 503 504 The account is locked. 505 506 =item LDAP_PP_CHANGE_AFTER_RESET (2) [LDAP_CONTROL_PASSWORDPOLICY] 507 508 The account's password has been reset and now must be changed. 509 510 =item LDAP_PP_PASSWORD_MOD_NOT_ALLOWED (3) [LDAP_CONTROL_PASSWORDPOLICY] 511 512 The account's password may not be modified. 513 514 =item LDAP_PP_MUST_SUPPLY_OLD_PASSWORD (4) [LDAP_CONTROL_PASSWORDPOLICY] 515 516 The old password must also be supplied when setting a new password. 517 518 =item LDAP_PP_INSUFFICIENT_PASSWORD_QUALITY (5) [LDAP_CONTROL_PASSWORDPOLICY] 519 520 The new password was not of sufficient quality. 521 522 =item LDAP_PP_PASSWORD_TOO_SHORT (6) [LDAP_CONTROL_PASSWORDPOLICY] 523 524 The new password was too short. 525 526 =item LDAP_PP_PASSWORD_TOO_YOUNG (7) [LDAP_CONTROL_PASSWORDPOLICY] 527 528 The previous password was changed too recently. 529 530 =item LDAP_PP_PASSWORD_IN_HISTORY (8) [LDAP_CONTROL_PASSWORDPOLICY] 531 532 The new password was used too recently. 533 534 =item LDAP_SYNC_NONE (0) [LDAP_CONTROL_SYNC] 535 536 =item LDAP_SYNC_REFRESH_ONLY (1) [LDAP_CONTROL_SYNC] 537 538 =item LDAP_SYNC_RESERVED (2) [LDAP_CONTROL_SYNC] 539 540 =item LDAP_SYNC_REFRESH_AND_PERSIST (3) [LDAP_CONTROL_SYNC] 541 542 =item LDAP_SYNC_REFRESH_PRESENTS (0) [LDAP_SYNC_INFO] 543 544 =item LDAP_SYNC_REFRESH_DELETES (1) [LDAP_SYNC_INFO] 545 546 =item LDAP_TAG_SYNC_NEW_COOKIE (0x80) [LDAP_SYNC_INFO] 547 548 =item LDAP_TAG_SYNC_REFRESH_DELETE (0xa1) [LDAP_SYNC_INFO] 549 550 =item LDAP_TAG_SYNC_REFRESH_PRESENT (0xa2) [LDAP_SYNC_INFO] 551 552 =item LDAP_TAG_SYNC_ID_SET (0xa3) [LDAP_SYNC_INFO] 553 554 =item LDAP_TAG_SYNC_COOKIE (0x04) [LDAP_SYNC_INFO] 555 556 =item LDAP_TAG_REFRESHDELETES (0x01) [LDAP_SYNC_INFO] 557 558 =item LDAP_TAG_REFRESHDONE (0x01) [LDAP_SYNC_INFO] 559 560 =item LDAP_TAG_RELOAD_HINT (0x01) [LDAP_CONTROL_SYNC] 561 562 =item LDAP_SYNC_PRESENT (0) [LDAP_CONTROL_SYNC_STATE] 563 564 =item LDAP_SYNC_ADD (1) [LDAP_CONTROL_SYNC_STATE] 565 566 =item LDAP_SYNC_MODIFY (2) [LDAP_CONTROL_SYNC_STATE] 567 568 =item LDAP_SYNC_DELETE (3) [LDAP_CONTROL_SYNC_STATE] 569 570 =back 571 572 =head2 Extension OIDs 573 574 B<Net::LDAP::Constant> exports constant subroutines for the following LDAP 575 extension OIDs. 576 577 =over 4 578 579 =item LDAP_EXTENSION_START_TLS (1.3.6.1.4.1.1466.20037) 580 581 Indicates if the server supports the Start TLS extension (RFC 2830) 582 583 =item LDAP_EXTENSION_PASSWORD_MODIFY (1.3.6.1.4.1.4203.1.11.1) 584 585 Indicates that the server supports the Password Modify extension (RFC 3062) 586 587 =item LDAP_EXTENSION_WHO_AM_I (1.3.6.1.4.1.4203.1.11.3) 588 589 Indicates that the server supports the "Who am I?" extension (draft-zeilenga-ldap-authzid-09) 590 591 =back 592 593 =head2 Feature OIDs 594 595 B<Net::LDAP::Constant> exports constant subroutines for the following LDAP 596 feature OIDs. 597 598 =over 4 599 600 =item LDAP_FEATURE_ALL_OPATTS (1.3.6.1.4.1.4203.1.5.1) 601 602 Indicates if the server allows "+" for returning all operational attributes 603 (RFC 3673) 604 605 =item LDAP_FEATURE_MODIFY_INCREMENT (1.3.6.1.1.14) 606 607 Indicates if the server supports the Modify Increment extension (RFC 4525) 608 609 =back 610 611 =head1 SEE ALSO 612 613 L<Net::LDAP>, 614 L<Net::LDAP::Message> 615 616 =head1 AUTHOR 617 618 Graham Barr E<lt>gbarr@pobox.comE<gt> 619 620 Please report any bugs, or post any suggestions, to the perl-ldap mailing list 621 E<lt>perl-ldap@perl.orgE<gt> 622 623 =head1 COPYRIGHT 624 625 Copyright (c) 1998-2008 Graham Barr. All rights reserved. This program is 626 free software; you can redistribute it and/or modify it under the same 627 terms as Perl itself. 628 629 =cut
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |