use sane way to get a default basedn: RootDSe's namingContexts
authorPeter Marschall <peter@adpm.de>
Sat, 05 Mar 2011 19:08:50 +0100
changeset 20 d956658803b8
parent 19 18e71da965ff
child 21 cf8013cbfb58
use sane way to get a default basedn: RootDSe's namingContexts
shelldap
--- a/shelldap	Tue Sep 06 15:59:07 2011 -0700
+++ b/shelldap	Sat Mar 05 19:08:50 2011 +0100
@@ -619,12 +619,9 @@
 	# try and determine base automatically from rootDSE
 	#
 	unless ( $self->{'base'} ) {
-		my $base = $self->{'root_dse'}->{'asn'} || {};
-		$base = $base->{'attributes'}			|| [];
-		$base = $base->[0]						|| {};
-		$base = $base->{'vals'}					|| [];
-		$conf->{'basedn'} = $base->[0];
-		$self->{'base'}   = $base->[0];
+		my @namingContexts = $self->{'root_dse'}->get_value('namingContexts');
+		$conf->{'basedn'} = $namingContexts[0];
+		$self->{'base'}   = $namingContexts[0];
 	}
 	if ( $_[0] ) {
 		$self->{'base'} = $_[0];