Article View: news.software.nntp
Article #38037nnrpd_auth.pl
From: tomjnsn
Date: Tue, 15 Jun 1999 00:00
Date: Tue, 15 Jun 1999 00:00
62 lines
2338 bytes
2338 bytes
I am trying to get an intranet news server to authenticate against
user's network passwords using PAM, and a perl module Authen_PAM. I've
gotten it setup correctly so that it requests for a login and password
when trying to access the newsgroups, specifically in Netscape, but it
will accept anything for a login and password, and allow the user access
to the groups. I don't think it is a problem with the Authen_PAM
module, because I can run the same lines of code I put in nnrpd_auth.pl
as an independent process, successfully refusing an incorrect login or
password. Any suggestions?
Tom
The following is the code I changed in nnrpd_auth.pl:
sub authenticate {
my $key;
foreach $key (keys %attributes) {
}
if ($attributes{type} eq "connect") {
my (@results) = checkhost();
return @results;
} elsif ($attributes{type} eq "authenticate") {
return checkuser();
} elsif ($attributes{type} eq "disconnect") {
}
return 502;
}
sub checkuser {
my $user = $attributes{'username'};
pam_start("passwd", $user, \&pam_conv_func, $pamh);
$retval = pam_set_item($pamh,PAM_TTY,$DISPLAY);
$retval = pam_authenticate($pamh, 0);
if ($retval) {
pam_end($pamh);
return ($authcodes{'allowed'}, 1, 1, $defaultgroups);
} else {
pam_end($pamh);
return ($authcodes{'denied'}, undef, undef, undef);
}
}
sub pam_conv_func {
my @res;
while (@_ ) {
my $msg_type = shift;
my $msg = shift;
push @res, 0;
push @res, $attributes{'password'};
}
push @res, PAM_SUCCESS;
return @res;
}
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Technical Details
Message-ID:
<7k5pjb$o5q$1@nnrp1.deja.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <7k5pjb$o5q$1@nnrp1.deja.com> Subject: nnrpd_auth.pl Date: Tue, 15 Jun 1999 00:00:00 +0000 From: tomjnsn@my-deja.com Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 489853569 X-Http-Proxy: 1.0 x31.deja.com:80 (Squid/1.1.22) for client 206.67.74.111 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Tue Jun 15 14:56:50 1999 GMT Newsgroups: news.software.nntp X-Http-User-Agent: Mozilla/4.6 [en] (WinNT; I)