# HG changeset patch # User Mahlon E. Smith # Date 1279209665 25200 # Node ID 5a65bc849363c056b65dc8170e4dc1195bfec6d5 # Parent 0f815f3daaf74a568c9c9fd52d854d50827d9f89 Append a trailing slash to entries that contain other entries. Thanks to Jonathan Rozes for the idea, and Michael Granger for telling me about the hasSubordinates attribute (that he was already using to do exactly this in the Treequel-based ruby shell, heh!) diff -r 0f815f3daaf7 -r 5a65bc849363 shelldap --- 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;