From: Graham B. <gb...@us...> - 2003-05-09 12:05:13
|
Update of /cvsroot/perl-ldap/ldap/lib/Net In directory sc8-pr-cvs1:/tmp/cvs-serv13723/lib/Net Modified Files: LDAP.pm LDAP.pod Log Message: Change root_dse to return a RootDSE object instead of an Entry Remove supported_* methods from Net::LDAP as they are now methods in the RootDSE class Index: LDAP.pm =================================================================== RCS file: /cvsroot/perl-ldap/ldap/lib/Net/LDAP.pm,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- LDAP.pm 8 May 2003 19:46:22 -0000 1.48 +++ LDAP.pm 9 May 2003 12:05:10 -0000 1.49 @@ -874,33 +874,6 @@ : Net::LDAP::Schema->new($mesg->entry); } -sub supported_extension { - return _supported_feature( 'supportedExtension', @_ ); -} - -sub supported_version { - return _supported_feature( 'supportedLDAPVersion', @_ ); -} - -sub supported_control { - return _supported_feature( 'supportedControl', @_ ); -} - -sub supported_sasl_mechanism { - return _supported_feature( 'supportedSASLMechanisms', @_ ); -} - -sub _supported_feature { - my $attr = shift; - my $root = shift->root_dse( attrs => [$attr] ) - or return undef; - my %ext; - map { $ext{$_} = 1 } $root->get_value( $attr ); - foreach (@_) { - return 0 unless exists $ext{$_}; - } - return 1; -} sub root_dse { my $ldap = shift; @@ -914,6 +887,9 @@ supportedSASLMechanisms supportedLDAPVersion )]; + my $root = $arg{attrs} && $ldap->{net_ldap_root_dse}; + + return $root if $root; my $mesg = $ldap->search( base => '', @@ -922,7 +898,13 @@ attrs => $attrs, ); - $mesg->entry; + require Net::LDAP::RootDSE; + $root = $mesg->entry; + bless $root, 'Net::LDAP::RootDSE' if $root; # Naughty, but there you go :-) + + $ldap->{net_ldap_root_dse} = $root unless $arg{attrs}; + + return $root; } sub start_tls { @@ -951,6 +933,8 @@ return $mesg if $mesg->code; + + delete $ldap->{net_ldap_root_dse}; $arg->{sslversion} = 'tlsv1' unless defined $arg->{sslversion}; IO::Socket::SSL::context_init( { _SSL_context_init_args($arg) } ); Index: LDAP.pod =================================================================== RCS file: /cvsroot/perl-ldap/ldap/lib/Net/LDAP.pod,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- LDAP.pod 7 May 2003 10:54:57 -0000 1.25 +++ LDAP.pod 9 May 2003 12:05:10 -0000 1.26 @@ -492,7 +492,7 @@ =back -The result is an object of class L<Net::LDAP::Search>. +The result is an object of class L<Net::LDAP::RootDSE>. B<Example> |