* plugins/auth/auth_ldap_bind

Correct DECLINE to DECLINED


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@405 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
John Peacock 2005-04-12 20:48:53 +00:00
parent 58ded6369d
commit 270f9c9a70

View File

@ -60,7 +60,7 @@ sub authldap {
# find dn of user matching supplied username # find dn of user matching supplied username
$ldh = Net::LDAP->new($ldhost, port=>$ldport, timeout=>$ldwait ) or $ldh = Net::LDAP->new($ldhost, port=>$ldport, timeout=>$ldwait ) or
$self->log(LOGALERT, "authldap/$method - error in initial conn" ) && $self->log(LOGALERT, "authldap/$method - error in initial conn" ) &&
return ( DECLINE, "authldap/$method - temporary auth error" ); return ( DECLINED, "authldap/$method - temporary auth error" );
# find the user's DN # find the user's DN
$mesg = $ldh->search( $mesg = $ldh->search(
@ -71,12 +71,12 @@ sub authldap {
timeout=>$ldwait, timeout=>$ldwait,
sizelimit=>'1') or sizelimit=>'1') or
$self->log(LOGALERT, "authldap/$method - err in search for user" ) && $self->log(LOGALERT, "authldap/$method - err in search for user" ) &&
return ( DECLINE, "authldap/$method - temporary auth error" ); return ( DECLINED, "authldap/$method - temporary auth error" );
# deal with errors if they exist # deal with errors if they exist
if ( $mesg->code ) { if ( $mesg->code ) {
$self->log(LOGALERT, "authldap/$method - err " . $mesg->code . " in search for user" ); $self->log(LOGALERT, "authldap/$method - err " . $mesg->code . " in search for user" );
return ( DECLINE, "authldap/$method - temporary auth error" ); return ( DECLINED, "authldap/$method - temporary auth error" );
} }
# unbind, so as to allow a rebind below # unbind, so as to allow a rebind below
@ -86,7 +86,7 @@ sub authldap {
if (($mesg->count) && ($lduserdn = $mesg->entry->dn)) { if (($mesg->count) && ($lduserdn = $mesg->entry->dn)) {
$ldh = Net::LDAP->new($ldhost, port=>$ldport, timeout=>$ldwait ) or $ldh = Net::LDAP->new($ldhost, port=>$ldport, timeout=>$ldwait ) or
$self->log(LOGALERT, "authldap/$method - err in user conn" ) && $self->log(LOGALERT, "authldap/$method - err in user conn" ) &&
return ( DECLINE, "authldap/$method - temporary auth error" ); return ( DECLINED, "authldap/$method - temporary auth error" );
# here's the whole reason for the script # here's the whole reason for the script
$mesg = $ldh->bind($lduserdn, password=>$passClear, timeout=>$ldwait); $mesg = $ldh->bind($lduserdn, password=>$passClear, timeout=>$ldwait);
@ -95,7 +95,7 @@ sub authldap {
# deal with errors if they exist, or allow success # deal with errors if they exist, or allow success
if ( $mesg->code ) { if ( $mesg->code ) {
$self->log(LOGALERT, "authldap/$method - error in user bind" ); $self->log(LOGALERT, "authldap/$method - error in user bind" );
return ( DENY, "authldap/$method - wrong username or password" ); return ( DECLINED, "authldap/$method - wrong username or password" );
} else { } else {
$self->log( LOGINFO, "authldap/$method - $user auth success" ); $self->log( LOGINFO, "authldap/$method - $user auth success" );
$self->log( LOGDEBUG, "authldap/$method - user: $user, pass: $passClear" ); $self->log( LOGDEBUG, "authldap/$method - user: $user, pass: $passClear" );
@ -105,7 +105,7 @@ sub authldap {
# if the plugin couldn't find user's entry # if the plugin couldn't find user's entry
} else { } else {
$self->log(LOGALERT, "authldap/$method - user not found" ) && $self->log(LOGALERT, "authldap/$method - user not found" ) &&
return ( DECLINE, "authldap/$method - wrong username or password" ); return ( DECLINED, "authldap/$method - wrong username or password" );
} }
$ldh->disconnect; $ldh->disconnect;