Fixed some errors. Here comes the working version:
--------- package Apache::AuthMulti; # Stathy G. Touloumis # Marcel M. Weber # Darren Chamberlain # # Version 0.1.0 / 2002.02.13 / Marcel M. Weber use strict; use Apache::Constants qw(:common); sub handler { my $r = shift; my($res, $sent_pw) = $r->get_basic_auth_pw; return $res if $res != OK; my @auth_modules=$r->dir_config->get("AuthModules"); for my $am (@auth_modules) { load($am); if ($@){ $r->log_reason("Error loading module '$am':$@"); next; } my $handler = \&{"$am\::handler"}; if ($handler->($r) == OK) { $r->warn("$am return OK"); return OK; } $r->log_reason("$am not OK"); } $r->note_basic_auth_failure; $r->log_reason("none of the handlers could authenticate this user"); return AUTH_REQUIRED; } sub load { my $module=@_[0]; $module =~ s[::][/]g; $module .= '.pm'; eval { require $module; }; return $@ ? 1 : 0; } 1; __END__ ------------------- In the httpd.conf you have to put something like this: <Location /test> AuthName Test AuthType Basic # These are AuthenSmb specific PerlSetVar myPDC SAMBA PerlSetVar myDOMAIN ARBEITSGRUPPE # With PerlAddVar you pass an array PerlAddVar AuthModules Apache::AuthSybase PerlAddVar AuthModules Apache::AuthenSmb PerlAuthenHandler Apache::AuthMulti require valid-user </Location> ----------------------- Works perfect... Why not submitting this somewhere? I think this could be usefull for quite a lot of people. I think this is cool, as you do not have to worry wether the module returns DECLINED or AUTH_REQUIRED. Marcel Am Mittwoch den, 13. Februar 2002, um 15:02, schrieb darren chamberlain: > Quoting Marcel Weber <[EMAIL PROTECTED]> [12 Feb-02 16:15]: >> I don't get the point why it did not work the other way round, >> but now everything is just fine now : > > Make it a little more generic: > > package Apache::MultiAuthen; > > use strict; > use Apache::Constants qw(:common); > > sub handler { > my $r = shift; > my($res, $sent_pw) = $r->get_basic_auth_pw; > return $res if $res != OK; > > # Tweak this; unsure about dir_config returning an array > my @auth_modules = $r->dir_config("AuthModules"); > > for my $am (@auth_modules) { > load($am); > > if ($@) { > $r->log("Error loading module '$am': $@"); > next; > } > > my $handler = \&{"$am\::handler"}; > if ($handler->($r) == OK) { > $r->log_reason("$am return OK"); > return OK > } > > $r->log_reason("$am not OK"); > } > > $r->note_basic_auth_failure; > return AUTH_REQUIRED; > } > > sub load { > my $module = @_; > $module =~ s[::][/]g; > $module .= '.pm'; > > eval { require $module; }; > > return $@ ? 1 : 0; > } > > 1; > > __END__ > > (darren) > > -- > Never attribute to malice that which is adequately explained by > incompetence. > -- Napolean Bonaparte > > ------------------- PGP / GPG Key: http://www.ncpro.com/GPG/mmweber-at-ncpro-com.asc