Listing 3. Lines Example bind() method which authenticates against another LDAP Server


114. sub init {
115.     my $this = shift;
116.     my $retValue;
117.     my $mesg;
118.     $this->{Ldap} = new Net::LDAP ( $this->{Host},
119.                               port => $this->{Port} ) ||
120.                     return(50) ;
121.     return(0);
122. }
123. 
124. sub bind {
125.     my $this = shift;
126.     my $retValue;
127.     my $mesg;

128.     my ($UserDN,$UserCredentials) = @_ ;
129.     $mesg = $this->{Ldap}->bind(($UserDN,
130.                   password => $UserCredentials) ;
131.     $retValue = $mesg->code();   

           
132.     #  retValue encoded following LDAP standard
133.     # 0 means success
134.     return( $retValue );
}


