Make password extension usage consistent with pager control.
authorMahlon E. Smith <mahlon@martini.nu>
Wed, 07 Jun 2017 14:48:42 -0700
changeset 93 4c7843b9a047
parent 92 a1aa55019077
child 94 4464f9984530
Make password extension usage consistent with pager control.
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;
 	}