Subject: | Re: An enhancement request for Apache2::AuthenNIS |
Date: | Sun, 13 Jul 2008 18:02:55 +0300 |
To: | bug-apache2-authennis [...] rt.cpan.org |
From: | Sagi Ben-Akiva <sagi [...] graphtech.co.il> |
Hi again,
I added the following lines to the perl module in order to enable
shadowed passwords :
============================= Start of diff =============================
--- /usr/lib/perl5/site_perl/5.8.8/Apache2/AuthenNIS.pm.orig
2008-04-10 22:10:58.000000000 +0300
+++ /usr/lib/perl5/site_perl/5.8.8/Apache2/AuthenNIS.pm 2008-07-13
17:57:45.539733902 +0300
@@ -134,6 +134,17 @@
}
my( $user, $hash, $uid, $gid, $gecos, $dir, $shell ) = split( /:/,
$entry );
+ if ( $hash eq 'x' ){
+ my( $shadow_status, $shadow_entry ) = Net::NIS::yp_match(
$domain, "shadow.byname", $name );
+ if ( $shadow_status ) {
+ my $error_msg = Net::NIS::yperr_string( $shadow_status );
+ $r->note_basic_auth_failure;
+ $r->log_error( __PACKAGE__, " - user $name: yp_match: status ",
+ "$shadow_status, $error_msg", $r->uri );
+ return Apache2::Const::HTTP_UNAUTHORIZED;
+ }
+ ($user, $hash) = split( /:/, $shadow_entry );
+ }
if ( crypt( $sent_pwd, $hash ) eq $hash ) {
return Apache2::Const::OK;
============================= End of diff =============================
It probably needs some more debugging and tweaking, but it works for me.
Thanks,
Sagi.
Sagi Ben-Akiva wrote:
Show quoted text
> Hello,
>
> I'm willing to use this perl module to enable Apache NIS authentication
> at my webserver.
>
> But the problem is that when the user logs in, he get
> a "bad password" error message.
> Looking at Apache2::AuthenNIS I found that
> the module compares the result of 'crypt' with the typed password
> with the second field of the entry returned
> by Net::NIS::yp_match( $domain, "passwd.byname", $name );
> The problem is that I use shadowed passwords
> and the second field returned by the above line
> is always 'x'.
>
> Thank you,
> Sagi.
>
--
Sagi Ben-Akiva - sagi@graphtech.co.il
GraphTech Computer Systems,
www.graphtech.co.il
Tel: +972-9-9703334
Mob: +972-54-4970634