--On Tuesday, August 29, 2006 3:29 PM -0700 Quanah Gibson-Mount <[EMAIL PROTECTED]> wrote:



--On Tuesday, August 29, 2006 3:18 PM -0700 Quanah Gibson-Mount
<[EMAIL PROTECTED]> wrote:



--On Tuesday, August 29, 2006 3:16 PM -0700 Quanah Gibson-Mount
<[EMAIL PROTECTED]> wrote:

Hi,

I'm trying to make Net::LDAP use a specific control while executing a
search.  However, if I add the control part to the search parameter, it
actually executes a search on the server.

Err, if I add the control part to the search, it *doesn't* execute on the
server.

This code works somewhat better.  I think the documentation in "man
Net::LDAP" is a bit misleading since it doesn't note you need to use
Net::LDAP::Control.

# !/usr/pubsw/bin/perl
use Net::LDAP;
use Net::LDAP::Control;
use MIME::Base64;
use Authen::SASL;

my $ValSortControl=Net::LDAP::Control->new(
  type=>"1.3.6.1.4.1.4203.666.5.14",
  value=>1
);

$ldap = Net::LDAP->new( 'ldap-dev1.stanford.edu' ) or die "$@";
$sasl = Authen::SASL->new(GSSAPI);
$status = $ldap->bind("", sasl=>$sasl);
$status = $ldap->search(base=>"cn=people,dc=stanford,dc=edu",
scope=>"sub", filter=>"uid=torg",attrs=>"ou",control=>[ $ValSortControl
]);
$status = $ldap->unbind();


Now of course, I'm getting decoding error messages from the server.  sigh.

This seems to be because the Net::LDAP::Control is not storing the value for "value" correctly. It should be an integer 1, or at least a boolean. TRUE doesn't work any better.

--Quanah


--
Quanah Gibson-Mount
Principal Software Developer
ITS/Shared Application Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html

Reply via email to