Re: self written auth_programme

From: Gert-Jan Looy <gj@dont-contact.us>
Date: Thu, 14 Oct 1999 11:11:00 +0200

Could this have something to do with $|=1 ; (buffer size) ?

Thomas Peruzzi wrote:
>
> hi squid-users!
>
> I have a problem with a self-written auth_programme. As far as I know, the
> most important thing is that the programme runs in an endless loop and
> returns OK if the pair username/password is correct and otherwise ERR. In
> command-line the script works like ncs_auth, but if I integrate it, it
> doesn't work. The prompt for loging in is coming, you type in the correct
> password, and username and then nothing happens. Netscape tries to find and
> find and find and squid doesn't log anything. So, maybe you could help me.
> Please don't look in detail, the perl-script is a pre-alpha, which we need
> for a project of our university, for enabling squid to do accounting based
> on bandwidth. Maybe someone of you had an idea, what's wrong.
>
> Thanx
>
> tp
> ps: the ncsa_auth works. I have tested it to ensure that it's a problem of
> the script and no config-error.
>
> SCRIPT:
>
> #!/usr/bin/perl -w
> # ncsa_auth in perl
> # version 0.1
> # tperuzzi, okt 1999
> #
>
> ##########################################################################
> # first get all the usernames and passwords and limits
> ##########################################################################
> open(PASSWD, "$ARGV[0]");
> while ( <PASSWD> )
> {
> ($p_user, $p_pass) = (split(/:/))[0,1];
> $usr{$p_user}=$p_pass;
>
> ##########################################################################
> # main
> # run in loop, get username and password in pairs, decrypt and compare
> ##########################################################################
> }
> # now run a loop and extract the input
> chop($pass= <STDIN>);
> while( $pass )
> {
> ($user,$pass) = (split(/ /,$pass))[0,1];
> # does the user exists?
> if( $usr{$user} )
> {
> # decrypt password (see man perlfunc)
> $crypt = crypt($pass,$usr{$user});
> # does the password match?
> if ($crypt eq $usr{$user}
> {
> print "OK\n";
> }
> else
> {
> print "ERR\n";
> }
> }
> else
> {
> print "ERR\n";
> }
> chop($pass= <STDIN>);
> }
> # if programme terminates perl_auth should also terminate :)
> exit 0;
>
> --
> -----------------------------
> ICS
> Dipl.-Ing.(FH) Thomas Peruzzi
> thomas.peruzzi@fh-sbg.ac.at
> http://www.fh-sbg.ac.at/ics
> 0043 662 4665 653
> -----------------------------
Received on Thu Oct 14 1999 - 03:28:41 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:48:49 MST