Permalink
Browse files

*** empty log message ***

  • Loading branch information...
1 parent 753fef2 commit 87bb9d3e90614bb5ad16447d65d7e0f5b8f43641 @gbarr gbarr committed Jan 29, 2001
Showing with 152 additions and 23 deletions.
  1. +30 −3 ChangeLog
  2. +0 −1 MANIFEST
  3. +1 −1 README
  4. +1 −1 RELEASE_NOTES
  5. +1 −1 TODO
  6. +15 −5 lib/Net/LDAP.pm
  7. +6 −6 lib/Net/LDAP/Entry.pm
  8. +29 −3 lib/Net/LDAP/Entry.pod
  9. +62 −0 lib/Net/LDAP/Extra.pm
  10. +7 −2 lib/Net/LDAP/LDIF.pm
View
@@ -1,3 +1,30 @@
+Change 611 on 2001/01/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Documentation updates
+
+Change 610 on 2000/12/20 by <gbarr@pobox.com> (Graham Barr)
+
+ Add new ::Extra module for user loaded extensions
+
+Change 609 on 2000/12/18 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::LDAP
+ - Ignore unexpected PDUs
+
+Change 608 on 2000/12/18 by <gbarr@pobox.com> (Graham Barr)
+
+ Deleted schema script at Clif's request. It's functionality is in the
+ tklkup script
+
+Change 605 on 2000/10/12 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::LDAP::LDIF, Net::LDAP::Entry
+ - Fix for attempting to write_cmd on an entry with no changes
+
+Change 604 on 2000/10/12 by <gbarr@pobox.com> (Graham Barr)
+
+ Fix spelling typos
+
Change 599 on 2000/09/14 by <gbarr@pobox.com> (Graham Barr)
Release 0.22
@@ -75,7 +102,7 @@ Change 567 on 2000/08/16 by <gbarr@pobox.com> (Graham Barr)
Change 566 on 2000/08/16 by <gbarr@pobox.com> (Graham Barr)
Net::LDAP::Entry
- - added ->get_value() and depricated ->get()
+ - added ->get_value() and deprecated ->get()
Change 565 on 2000/08/16 by <gbarr@pobox.com> (Graham Barr)
@@ -736,7 +763,7 @@ Change 223 on 1998/10/31 by <gbarr@pobox.com> (Graham Barr)
Net::LDAP::Entry
- decode sets changetype to modify
- - depricated ->ldif & ->ldif_read
+ - deprecated ->ldif & ->ldif_read
Net::LDAP::LDIF
- added ->done
@@ -865,7 +892,7 @@ Change 200 on 1998/10/17 by <gbarr@pobox.com> (Graham Barr)
- Fixed decode problem for references
- Renamed all_entries as entries
- Renamed all_references as references
- - first_entry and next_entry depricated
+ - first_entry and next_entry deprecated
- entry now only waits until the requested entry has arrived, not
until the whole search has completed.
View
@@ -13,7 +13,6 @@ contrib/README
contrib/dot.tklkup
contrib/isMember.pl
contrib/printMembers.pl
-contrib/schema
contrib/tklkup
data/00-cmp2.ldif
data/00-in.ldif
View
@@ -44,7 +44,7 @@ QUICK START GUIDE:
*******************************************************************************
-NOTE: Everything that has been depricated will be removed when V1.00 is
+NOTE: Everything that has been deprecated will be removed when V1.00 is
released, but who knows when that will be.
*******************************************************************************
View
@@ -7,7 +7,7 @@ perl-ldap 0.21 September 12 2000
================================
* Change ->get back to return what 0.19 returned
-* Depricate ->get in favor of ->get_value
+* Deprecate ->get in favor of ->get_value
* Net::LDAP::Schema now supports matchingRules
* Added experimental onerror option to ->new
* New FAQ by Clif Harden
View
@@ -56,7 +56,7 @@ Controls
General
Move the TCP connect out of new() and into a connect() method
- Add a configure/cget methods for options, async and version methods become depricated
+ Add a configure/cget methods for options, async and version methods become deprecated
rename _recvresp and document to make avaliable for async users
if bind() is passed options then require an auth option, stop accidental anon binds.
make bind(password => '') illegal, force then to use noauth => ''
View
@@ -7,7 +7,7 @@ package Net::LDAP;
use strict;
use IO::Socket;
use IO::Select;
-use vars qw($VERSION $LDAP_VERSION);
+use vars qw($VERSION $LDAP_VERSION @ISA);
use Convert::ASN1 qw(asn_read);
use Net::LDAP::Message;
use Net::LDAP::ASN qw(LDAPResponse);
@@ -22,9 +22,16 @@ use Net::LDAP::Constant qw(LDAP_SUCCESS
LDAP_INAPPROPRIATE_AUTH
);
-$VERSION = 0.22;
+$VERSION = 0.22_02;
+@ISA = qw(Net::LDAP::Extra);
+$LDAP_VERSION = 2; # default LDAP protocol version
-$LDAP_VERSION = 2; # default LDAP protocol version
+# Net::LDAP::Extra will only exist is someone use's the module. But we need
+# to ensure the package stash exists or perl will complain that we inherit
+# from a non-existant package. I could just use the module, but I did not
+# want to.
+
+$Net::LDAP::Extra::create = $Net::LDAP::Extra::create = 0;
sub import {
shift;
@@ -38,7 +45,7 @@ sub _options {
my $once = 0;
for my $v (grep { /^-/ } keys %ret) {
require Carp;
- $once++ or Carp::carp("depricated use of leading - for options");
+ $once++ or Carp::carp("deprecated use of leading - for options");
$ret{substr($v,1)} = $ret{$v};
}
@@ -619,7 +626,10 @@ sub _recvresp {
my $mid = $result->{messageID};
my $mesg = $ldap->{net_ldap_mesg}->{$mid} or
- return LDAP_PROTOCOL_ERROR;
+ do {
+ print STDERR "Unexpected PDU, ignored\n" if $debug & 10;
+ next;
+ };
$mesg->decode($result) or
return $mesg->code;
View
@@ -9,13 +9,13 @@ use Net::LDAP::ASN qw(LDAPEntry);
use Net::LDAP::Constant qw(LDAP_LOCAL_ERROR);
use vars qw($VERSION);
-$VERSION = "0.12";
+$VERSION = "0.13";
sub new {
my $self = shift;
my $type = ref($self) || $self;
- my $entry = bless { 'changetype' => 'add' }, $type;
+ my $entry = bless { 'changetype' => 'add', changes => [] }, $type;
$entry;
}
@@ -33,7 +33,7 @@ sub decode {
my $result = ref($_[0]) ? shift : $LDAPEntry->decode(shift)
or return;
- %{$self} = ( asn => $result, changetype => 'modify');
+ %{$self} = ( asn => $result, changetype => 'modify', changes => []);
$self;
}
@@ -52,13 +52,13 @@ sub dn {
sub get_attribute {
require Carp;
- Carp::carp("->get_attribute depricated, use ->get_value") if $^W;
+ Carp::carp("->get_attribute deprecated, use ->get_value") if $^W;
shift->get_value(@_, asref => !wantarray);
}
sub get {
require Carp;
- Carp::carp("->get depricated, use ->get_value") if $^W;
+ Carp::carp("->get deprecated, use ->get_value") if $^W;
shift->get_value(@_, asref => !wantarray);
}
@@ -210,7 +210,7 @@ sub update {
elsif ($self->{'changetype'} eq 'delete') {
$mesg = $ldap->delete($self, 'callback' => $cb);
}
- elsif (defined $self->{'changes'}) {
+ elsif (@{$self->{'changes'}}) {
$mesg = $ldap->modify($self, 'changes' => $self->{'changes'}, 'callback' => $cb);
}
else {
@@ -100,7 +100,18 @@ If TRUE, return a list of the attribute names excluding any options. For example
name;en-us: Bob
jpeg;binary: **binary data**
-the return list would be C<( 'name', 'jpeg' )>.
+then
+
+ @values = $entry->attributes()
+ print "default: @values\n";
+
+ @values = $entry->attributes( nooptions => 1);
+ print "nooptions: @values\n";
+
+will output
+
+ default: name name;en-us jpeg;binary
+ nooptions: name jpeg
=back
@@ -187,7 +198,11 @@ For example if an entry had
name: Graham Barr
name;en-us: Bob
-Then a get for attribute "name" with alloptions set would return
+Then a get for attribute "name" with alloptions set to a true value
+
+ $ref = $entry->get_value( 'name', alloptions => 1);
+
+will return a hash reference that would be like
{
'' => [ 'Graham Barr' ],
@@ -199,6 +214,17 @@ Then a get for attribute "name" with alloptions set would return
If TRUE then the result will be a reference to an array containing all the
values for the attribute, or undef if the attribute does not exist.
+ $scalar = $entry->get_value('name');
+
+$scalar will be the first value for the C<name> attribute, or C<undef> if the
+entry does not contain a C<name> attribute.
+
+ $ref = $entry->get_value('name', asref => 1);
+
+$ref will be a reference to an array, which will have all the values for
+the C<name> attribute. If the entry does not have an attribute called C<name>
+then $ref will be C<undef>
+
=back
B<NOTE>: In the interest of performance the array references returned by C<get_value>
@@ -256,6 +282,6 @@ terms as Perl itself.
=for html <hr>
-I<$Id: Entry.pod,v 1.5 2000/09/12 09:17:09 gbarr Exp $>
+I<$Id: Entry.pod,v 1.6 2001/01/29 21:09:37 gbarr Exp $>
=cut
View
@@ -0,0 +1,62 @@
+# Copyright (c) 2000 Graham Barr <gbarr@pobox.com>. All rights reserved.
+# This program is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+
+package Net::LDAP::Extra;
+
+use strict;
+use vars qw($VERSION);
+
+require Net::LDAP;
+require Carp;
+
+$VERSION = "0.01";
+
+sub import {
+ shift;
+ local $SIG{__DIE__} = \&Carp::croak;
+ foreach (@_) {
+ my $file = "Net/LDAP/Extra/$_.pm";
+ next if exists $INC{$file};
+ require $file;
+ "Net::LDAP::Extra::$_"->import;
+ }
+}
+
+1;
+
+__END__
+
+
+=head1 NAME
+
+Net::LDAP::Extra -- Load extra Net::LDAP methods
+
+=head1 SYNOPSIS
+
+ use Net::LDAP::Extra qw(my_extn);
+
+ $ldap = Net::LDAP->new( ... );
+
+ $ldap->my_extn( ... );
+
+=head1 DESCRIPTION
+
+C<Net::LDAP::Extra> allows extra methods to be added to Net::LDAP.
+Normally such methods would be added by sub-classing Net::LDAP, but this
+proves to get messy as different people write different additions and
+others want to use multiple of these sub-classes. Users end up having
+to create sub-classes of their own which inherit from all the extension
+sub-classes just so they can get all the features.
+
+C<Net::LDAP::Extra> allows methods to be added directly to
+all Net::LDAP objects. This can be done by creating a class
+C<Net::LDAP::Extra::name> which exports functions. A
+C<use Net::LDAP::Extra qw(name)> will then make these functions avaliable
+as a methods on all C<Net::LDAP> objects.
+
+Care should be taken when choosing names for the functions to export
+to ensure that they do not clash with others.
+
+=cut
+
@@ -9,7 +9,7 @@ use SelectSaver;
require Net::LDAP::Entry;
use vars qw($VERSION);
-$VERSION = "0.05";
+$VERSION = "0.06";
my %mode = qw(w > r < a >>);
@@ -288,7 +288,12 @@ sub write_cmd {
my $saver = SelectSaver->new($self->{'fh'});
foreach $entry (grep { defined } @_) {
+ my @changes = $entry->changes or next;
my $type = $entry->changetype;
+
+ # Skip entry if there is nothing to write
+ next if $type eq 'modify' and !@changes;
+
my $dn = "dn: " . $entry->dn;
print "\n" if tell($self->{'fh'});
@@ -304,7 +309,7 @@ sub write_cmd {
my $change;
my $first = 0;
- foreach $change ($entry->changes) {
+ foreach $change (@changes) {
unless (ref($change)) {
$type = $change;
next;

0 comments on commit 87bb9d3

Please sign in to comment.