Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to complete Redmine's feature request #2693: Use Redmine.pm to authenticate for any directory (1). I have not much knowledge on all these things and need help. Redmine uses mod_perl module Redmine.pm for authentication & authorization. This module defines several custom configuration directives. I've successfully modified patch from (1) and it works when all config is in <Location>:

<Location /digischrank/test>
        AuthType basic
        AuthName "Digischrank Test" 
        Require valid-user
        PerlAccessHandler Apache::Authn::Redmine::access_handler
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler
        RedmineDSN "DBI:mysql:database=SomedaTaBAse;host=localhost" 
        RedmineDbUser "SoMeuSer" 
        RedmineDbPass "SomePaSS" 
        RedmineProject "digischrank" 
</Location>

But when I move one of these directives (RedmineProject, see (1)) in .htaccess file, Redmine.pm doesn't see it! I've tried to change <Location> to <Directory> and add AllowOverride All. Directives from .htaccess is visible, but remaining ones from <Directory> - not. I don't want to move all directives to each .htaccess. When I add <Location> in addition to <Directory>, again - only directives from <Location> are visible.

As far as I know, directives should be merged. I miss something?

share|improve this question

1 Answer 1

I've found that Redmine.pm doesn't provide DIR_MERGE function to merge configuration objects. See details in Creating and Merging Configuration Objects section of mod_perl manual. I've simplified given example because I need only override mode:

sub DIR_MERGE    { merge(@_) }

sub merge {
      my ($base, $add) = @_;
      my %mrg = ();
      for my $key (keys %$base, keys %$add) {
          next if exists $mrg{$key};
          # override mode
          $mrg{$key} = $base->{$key} if exists $base->{$key};
          $mrg{$key} = $add->{$key}  if exists $add->{$key};
      }
      return bless \%mrg, ref($base);
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.