Skip to content

Commit

Permalink
Change over to using Authen::SASL v2.00, which is now distributed
Browse files Browse the repository at this point in the history
in a separate distribution
  • Loading branch information
gbarr committed Feb 18, 2002
1 parent 8a9aefa commit 559989d
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 202 deletions.
5 changes: 0 additions & 5 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ data/slapd-conf.in
data/slapd.at.conf
data/slapd.oc.conf
data/slapd2-conf.in
htdocs/Authen/SASL.html
htdocs/Bundle/Net/LDAP.html
htdocs/Net/LDAP.html
htdocs/Net/LDAP/Constant.html
Expand Down Expand Up @@ -71,10 +70,6 @@ htdocs/Net/LDAPS.html
htdocs/index.html
htdocs/index.xml
install-nomake
lib/Authen/SASL.pm
lib/Authen/SASL.pod
lib/Authen/SASL/CRAM_MD5.pm
lib/Authen/SASL/EXTERNAL.pm
lib/Bundle/Net/LDAP.pm
lib/LWP/Protocol/ldap.pm
lib/Net/LDAP.pm
Expand Down
6 changes: 5 additions & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The -*- perl -*- script writes the Makefile for perl-ldap
# $Id: Makefile.PL,v 1.7 2001/12/03 16:20:26 gbarr Exp $
# $Id: Makefile.PL,v 1.8 2002/02/18 16:51:41 gbarr Exp $

use 5.004;
use ExtUtils::MakeMaker;
Expand Down Expand Up @@ -71,6 +71,10 @@ check_module('MIME::Base64') or print <<"EDQ","\n";
The MIME::Base64 module is needed ONLY IF you intend to read/write LDIF files
EDQ

check_module('Authen::SASL', 2.00) or print <<"EDQ","\n";
If you intend to use SASL authentication you need at least version 2.00
EDQ

print "\n",<<"EDQ","\n" if $missing;
****************************************************************************
You are missing some modules that MAY be needed for some of the features
Expand Down
1 change: 0 additions & 1 deletion htdocs/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
<section>
<title>Other</title>
<group>
<module>Authen::SASL</module>
<module>Bundle::Net::LDAP</module>
</group>
</section>
Expand Down
57 changes: 0 additions & 57 deletions lib/Authen/SASL.pm

This file was deleted.

57 changes: 0 additions & 57 deletions lib/Authen/SASL.pod

This file was deleted.

39 changes: 0 additions & 39 deletions lib/Authen/SASL/CRAM_MD5.pm

This file was deleted.

32 changes: 0 additions & 32 deletions lib/Authen/SASL/EXTERNAL.pm

This file was deleted.

19 changes: 15 additions & 4 deletions lib/Net/LDAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,26 @@ sub bind {

my $sasl = $passwd;
# Tell the SASL object our user identifier
$sasl->user("dn: $dn") unless $sasl->user;
$sasl->callback( user => "dn: $stash{name}")
unless $sasl->callback('user');

my $sasl_conn = $sasl->client_new("ldap",$ldap->{net_ldap_host});

# Tell SASL the local and server IP addresses
$sasl_conn->property(
sockname => $ldap->{net_ldap_socket}->sockname,
peername => $ldap->{net_ldap_socket}->peername,
);

my $initial = $sasl_conn->client_start;

$passwd = {
mechanism => $sasl->name,
credentials => $sasl->initial
mechanism => $sasl_conn->mechanism,
credentials => $initial
};

# Save data, we will need it later
$mesg->_sasl_info($stash{name},$control,$sasl);
$mesg->_sasl_info($stash{name},$control,$sasl_conn);
}

$stash{authentication} = { $auth_type => $passwd };
Expand Down
16 changes: 10 additions & 6 deletions lib/Net/LDAP/Bind.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package Net::LDAP::Bind;

use strict;
use Net::LDAP qw(LDAP_SASL_BIND_IN_PROGRESS LDAP_DECODING_ERROR);
use Net::LDAP qw(LDAP_SASL_BIND_IN_PROGRESS LDAP_DECODING_ERROR LDAP_SUCCESS);
use Net::LDAP::Message;
use vars qw(@ISA);

Expand All @@ -23,26 +23,30 @@ sub decode {
or $self->set_error(LDAP_DECODING_ERROR,"LDAP decode error")
and return;

my $sasl = $self->{sasl};
my $ldap = $self->parent;

$ldap->{net_ldap_socket} = $sasl->securesocket($ldap->{net_ldap_socket})
if $sasl and $bind->{resultCode} == LDAP_SUCCESS;

return $self->SUPER::decode($result)
unless $bind->{resultCode} == LDAP_SASL_BIND_IN_PROGRESS;

# tell our LDAP client to forget us as this message has now completed
# all communications with the server
$self->parent->_forgetmesg($self);
$ldap->_forgetmesg($self);

$self->{mesgid} = Net::LDAP::Message->NewMesgID(); # Get a new message ID

my $sasl = $self->{sasl};
my $ldap = $self->parent;
my $resp = $sasl->challenge($bind->{serverSaslCreds});
my $resp = $sasl->client_step($bind->{serverSaslCreds});

$self->encode(
bindRequest => {
version => $ldap->version,
name => $self->{dn},
authentication => {
sasl => {
mechanism => $sasl->name,
mechanism => $sasl->mechanism,
credentials => $resp
}
},
Expand Down

0 comments on commit 559989d

Please sign in to comment.