From 29f2cdb50c196c8171627efddd52221c6eb3492a Mon Sep 17 00:00:00 2001 From: "mahlon@martini.nu" Date: Thu, 15 Jul 2010 16:01:04 +0000 Subject: [PATCH] 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!) FossilOrigin-Name: 0ba6d54560597cf729b319c54229a6331218cd31d18e7e0edddfa5f132480c3d --- shelldap | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/shelldap b/shelldap index 0bd0ad5..ef784cb 100755 --- a/shelldap +++ b/shelldap @@ -1402,8 +1402,12 @@ sub run_list $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 @@ sub run_list || { posixAccount => 'gecos', posixGroup => 'gidNumber', - ipHost => 'ipHostNumber', + ipHost => 'ipHostNumber', } }; @@ -1429,6 +1433,13 @@ sub run_list 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;