# HG changeset patch # User Mahlon E. Smith # Date 1496872122 25200 # Node ID 4c7843b9a0473b0a938ce6a9055cdf75fc7f2864 # Parent a1aa55019077ba9d717311020625291fbfd02714 Make password extension usage consistent with pager control. diff -r a1aa55019077 -r 4c7843b9a047 shelldap --- a/shelldap Wed Jun 07 14:38:08 2017 -0700 +++ b/shelldap Wed Jun 07 14:48:42 2017 -0700 @@ -461,6 +461,7 @@ LDAP_OTHER LDAP_TIMEOUT LDAP_NO_MEMORY + LDAP_EXTENSION_PASSWORD_MODIFY LDAP_CONNECT_ERROR LDAP_CONTROL_PAGED /; use Net::LDAP::Util qw/ canonical_dn ldap_explode_dn /; @@ -473,6 +474,7 @@ use Carp 'confess'; use base 'Term::Shell'; + my $conf = $main::conf; # make 'die' backtrace in debug mode @@ -526,8 +528,9 @@ # check for the pagination extension on the server early, and bail # if necessary. if ( $conf->{'paginate'} && $conf->{'paginate'} =~ /^\d+$/ && $conf->{'paginate'} > 0 ) { - my $has_pagination = ( grep $_ eq LDAP_CONTROL_PAGED, $self->{'root_dse'}->get_value('supportedControl') ); - die "Server pagination is enabled, but the server doesn't seem to support it.\n" unless $has_pagination; + unless ( $self->{'root_dse'}->supported_control(LDAP_CONTROL_PAGED) ) { + die "Server pagination is enabled, but the server doesn't seem to support it.\n"; + } } else { $conf->{'paginate'} = undef; @@ -2171,8 +2174,7 @@ $self->{'root_dse'} ||= $self->ldap->root_dse(); - my $pw_extension = '1.3.6.1.4.1.4203.1.11.1'; - unless ( $self->{'root_dse'}->supported_extension( $pw_extension ) ) { + unless ( $self->{'root_dse'}->supported_extension(LDAP_EXTENSION_PASSWORD_MODIFY) ) { print "Sorry, password changes not supported by LDAP server.\n"; return; }