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

I am looking to implement a perl script that gathers the login information (specifically, the username) before that information logs into the system. My current setting is the following

PerlRequire /etc/httpd/conf/perl/startup.pl
PerlModule MyApache2::Authm
<Location "/git">
 AuthType Basic
 SetHandler perl-script
 PerlAuthenHandler MyApache2::Authm::authn_handler
 AuthName "My Git Repository"
 AuthBasicProvider ldap-ny ldap-mia
 AuthzLDAPAuthoritative off
 AuthGroupFile /git/htgroups
 Require valid-user

Sometimes, some users login as darly.senecal but others login as DOMAIN\darly.senecal.

I'm writing a perl module in which gathers the information that users enters at the login screen and review the username format before really login into the system; if the user logs in as DOMAIN\username, then the script has to strip the DOMAIN\ and makes the username as login. Otherwise, the script the skips the changes and logs in normally.

package MyApache2::Authm;
use warnings;
use Apache2::Access ();
use Apache2::RequestRec ();
use Apache2::Const -compile => qw(OK DECLINED HTTP_UNAUTHORIZED);
sub authn_handler
   my $r = shift;
   #Get Authentication Credentials
   my ($res, $sent_pw) = $r->get_basic_auth_pw;
   if ($r->user =~ m/^(\QDOMAIN\\\E)/)
     my @user = split(/\\/,$r->user);
     print "User: ", $r->user;
     return Apache2::OK;

I tested the following code and I get this error

Tested the code but provide the following:

[Wed Jun 11 11:30:24 2014] [notice] child pid 32468 exit signal Segmentation fault (11)

share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.