base(): make more secure, allow '' as DN
Only accept DNs as arguments to base that are legal DNs. Convert DN given into canonical form. FossilOrigin-Name: a0488120c18e20d452ec6ebe8b44e009fca7839c39b0af5524254ea6bd4294e3
This commit is contained in:
parent
dcbcabb056
commit
22128dac8b
1 changed files with 4 additions and 2 deletions
6
shelldap
6
shelldap
|
|
@ -368,6 +368,7 @@ use Term::ReadKey;
|
||||||
use Term::Shell;
|
use Term::Shell;
|
||||||
use Digest::MD5;
|
use Digest::MD5;
|
||||||
use Net::LDAP qw(LDAP_SUCCESS LDAP_SERVER_DOWN);
|
use Net::LDAP qw(LDAP_SUCCESS LDAP_SERVER_DOWN);
|
||||||
|
use Net::LDAP::Util qw(canonical_dn);
|
||||||
use Net::LDAP::LDIF;
|
use Net::LDAP::LDIF;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use File::Temp;
|
use File::Temp;
|
||||||
|
|
@ -623,8 +624,9 @@ sub base
|
||||||
$conf->{'basedn'} = $namingContexts[0];
|
$conf->{'basedn'} = $namingContexts[0];
|
||||||
$self->{'base'} = $namingContexts[0];
|
$self->{'base'} = $namingContexts[0];
|
||||||
}
|
}
|
||||||
if ( $_[0] ) {
|
if ( @_ ) {
|
||||||
$self->{'base'} = $_[0];
|
my $base = canonical_dn($_[0], casefold => 'none');
|
||||||
|
$self->{'base'} = $base if ($base);
|
||||||
}
|
}
|
||||||
return $self->{'base'};
|
return $self->{'base'};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue