From da79de232037cb62d9f0d9fa2c0465f1dc088c73 Mon Sep 17 00:00:00 2001 From: "docelic@crystallabs.io" Date: Sun, 28 Apr 2019 19:40:06 +0000 Subject: [PATCH] Allow default attributes to be set via config and cmdline This commit changes the default attribute list from a fixed '*' to a configurable list, defaulting to ['*']. It allows one to use config file or command line to set default attributes to retrieve and display - i.e. to set default attributes to '+' or to a list of multiple specific attributes. Printing or changing this value through env/setenv is currently not supported because env/setenv only work properly with string values while attributes is a list. FossilOrigin-Name: 8c312e181611c61d43a588d2aa2c6e3d231db490c29f40aee861a0e1832039fc --- shelldap | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/shelldap b/shelldap index 296c9ac..545d071 100755 --- a/shelldap +++ b/shelldap @@ -1437,7 +1437,7 @@ sub run_cat { my $self = shift; my $dn = shift; - my @attrs = (@_) ? @_ : ('*'); + my @attrs = (@_) ? @_ : @{$conf->{'attributes'}}; $self->display( $dn, \@attrs, 0 ); } @@ -2381,6 +2381,7 @@ Getopt::Long::GetOptions( 'binddn|D=s', 'basedn|b=s', 'cacheage=i', + 'attributes=s@', 'paginate=i', 'promptpass|W', 'timeout=i', @@ -2413,8 +2414,9 @@ if ( $conf->{'configfile'} ) { # defaults $conf->{'configfile'} ||= "$ENV{'HOME'}/.shelldap.rc"; -$conf->{'cacheage'} ||= 300; -$conf->{'timeout'} ||= 10; +$conf->{'cacheage'} ||= 300; +$conf->{'timeout'} ||= 10; +$conf->{'attributes'} ||= ['*']; # create and enter shell loop my $shell = LDAP::Shell->new();