Re: Authenticate against multiple password files

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Wed, 26 Apr 2000 21:35:42 +0200

Cliff Green wrote:

> That's the one that uses IPC::Open2, right?

Yes.

Hmm.. locking back in the message I sent I am not sure the posted code
exacly matches what I tried. There are a quite obvious error in the
posted script. I probably first wrote the message and then tried it out.
The error is the traditional one of not disabling output buffering. Try
adding a $|=1 at the top of the script:

#!/usr/bin/perl
$|=1;
use IPC::Open2;
open2(*read1,*write1,"/foo/bar/ncsa_auth /etc/passwd");
open2(*read2,*write2,"/bar/baz/squid_ldap_auth ldap.server.edu");
while(<>) {
  print write1 $_; $ans = <read1>;
  if ($ans =~ /^OK/) { print $ans; next; }
  print write2 $_; $ans = <read2>;
  if ($ans =~ /^OK/) { print $ans; next; }
  print $ans;
}

--
Henrik Nordstrom
Squid hacker
Received on Wed Apr 26 2000 - 14:06:10 MDT

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