Hi

This way, I do not get any failure messages, but the authenication does not
work at all. Say, it does not matter wat password your typing in, you get
always authenticated. Even when one auf the handlers logs a violation and
return AUTH_REQUIRED / DECLINED.

package Apache::AuthenIntra;

use strict;
use     Apache::AuthenSmb;
use     Apache::AuthSybase;
use     Apache::Constants;

sub handler {
        my $r = shift;
        my($res, $sent_pw) = $r->get_basic_auth_pw;
        return $res if $res != OK;

        if (  Apache::AuthenSmb::handler($r) == Apache::Constants::OK ) {
                return Apache::Constants::OK;
        } elsif ( Apache::AuthSybase::handler($r) == Apache::Constants::OK )
{
                return Apache::Constants::OK;
        }
        $r->note_basic_auth_failure;
        return Apache::Constant::AUTH_REQUIRED;
}

Marcel


-----Ursprüngliche Nachricht-----
Von: Stathy G. Touloumis [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 12. Februar 2002 18:32
An: Marcel Weber; [EMAIL PROTECTED]
Betreff: RE: Multiple authentication methods


> The get_handlers code is out of AuthenSmb as I do not have the slightest
> idea of how to get the results of the called function.
Hmmm, It would seem that it would be better to call the function directly
from your handler.  I am not sure how the AuthenSmb handlers should be
called but you should get the idea.

sub handler {
  my $r = shift;
  my($res, $sent_pw) = $r->get_basic_auth_pw;
  return $res if $res != OK;

  if ( Apache::AuthSybase->handler($r) == Apache::Constants::OK ) {
    return Apache::Constants::OK;

  } elsif ( Apache::AuthenSmb->handler($r) == Apache::Constants::OK ) {
    return Apache::Constants::OK;

  } else {
    return Apache::Constant::DECLINED;

  }


}

> I get just as far, as I can authenticate via AuthSybase, but the second
> method is never executed. Well, probably some expirienced perl coder would
> laugh at me...

He he, we all had to start from the beginning ; )


> Hmm, I fiddled a bit around whith this code but, it does not
> really work the
> way I want it to.
>
> This is what I coded:
>
> sub handler {
>         my $r = shift;
>         my($res, $sent_pw) = $r->get_basic_auth_pw;
>         return $res if $res != OK;
>
>         $r->push_handlers( PerlAuthenHandler=> Apache::AuthSybase );
>         if (@{ $r->get_handlers("PerlAuthenHandler") || []}) {
>         return OK;
>         }
>         $r->push_handlers( PerlAuthenHandler=> Apache::AuthenSmb );
>         if (@{ $r->get_handlers("PerlAuthenHandler") || []}) {
>         return OK;
>         }
>         return DECLINED;
> }
>
> The get_handlers code is out of AuthenSmb as I do not have the slightest
> idea of how to get the results of the called function.
>
> What the code should do is: Call AuthSybase, check return value, if OK
> return OK, else call AuthenSMB, return return value.
>


Reply via email to