shelldap
changeset 4 5a65bc849363
parent 3 0f815f3daaf7
child 5 78b2a48e07db
--- a/shelldap	Mon May 17 08:18:39 2010 -0700
+++ b/shelldap	Thu Jul 15 09:01:05 2010 -0700
@@ -1402,8 +1402,12 @@
 		$long	= $flags =~ /l/;
 	}
 
-	my $s = $self->search({ scope => $recurse ? 'sub' : 'one',
-							vals  => $long, filter => $filter });
+	my $s = $self->search({
+		scope  => $recurse ? 'sub' : 'one',
+		vals   => 1,
+		filter => $filter,
+		attrs  => [ '*', 'hasSubordinates' ]
+	});
 	if ( $s->{'code'} ) {
 		print "$s->{'message'}\n";
 		return;
@@ -1419,7 +1423,7 @@
 		  || {
 			posixAccount => 'gecos',
 			posixGroup   => 'gidNumber',
-			ipHost	   => 'ipHostNumber',
+			ipHost	     => 'ipHostNumber',
 		  }
 	  };
 
@@ -1429,6 +1433,13 @@
 	my $dn;
 	foreach my $e ( sort { $a->dn() cmp $b->dn() } @{ $s->{'entries'} } ) {
 		$dn = $e->dn();
+
+		# if this entry is a container for other entries, append a
+		# trailing slash.
+		if ( $e->get_value('hasSubordinates') eq 'TRUE' ) {
+			$dn .= '/';
+		}
+
 		my $rdn = $dn;
 		$rdn =~ s/,$base//i;