Re: problem with proxy_auth

From: Julio <julio@dont-contact.us>
Date: Sun, 02 May 1999 00:16:15 -0300

Yes, I forgot that STDOUT is buffered (STDERR isn't).
Also, I've had to setuid the script (owner root) to make it work well under
regular users and have everything work fine with NIS and shadow passwords.
Thanks for the help.

Julio

ps. here goes the final script, that authenticate an user using the system
passwords database:

#!/usr/bin/perl
#this script must be set +s

$|=1; #flush STDOUT for every write

LINE: while (<STDIN>) {
    chomp;
    @parameters = split;
    $givenUser = @parameters[0];
    $givenPasswd = @parameters[1];

    if ($givenUser eq "") {
        print "ERR\n";
        next LINE;
    }

    unless ($systemPasswd = (getpwnam $givenUser)[1]) {
        print "ERR\n";
        next LINE;
    }

    $salt = substr $systemPasswd, 0, 2;

    if (crypt($givenPasswd,$salt) eq $systemPasswd) { print "OK\n"; }
    else { print "ERR\n"; }
}
Received on Sat May 01 1999 - 20:58:08 MDT

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