OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Unable to write a very simple access policy server

From: Martin Schmitt (masscsy.de)
Date: Wed Aug 01 2007 - 08:18:25 CDT


Jeremie Le Hen schrieb:

> % #!/usr/bin/perl

$| = 1; # to disable Perl's buffering of output.

> % open LOG, '>> /tmp/policystub.log';
> % while (<STDIN>) {
> % print LOG $_;
> % print LOG "HEX: ".(unpack "H*", $_)."\n";
> % chomp;
> % print "action=DUNNO\n\n" if ($_ eq '');
> % }
> % close LOG;
>
> Testing it manually, it seems to work as expected:
> % postfix1# printf 'attribute=value\n\n' | /root/policystub.pl
> % action=DUNNO

This works because policystub.pl terminates after EOF. Under master's
control, the smtpd remains connected to the policy service, which
buffers output and therefore doesn't answer immediately.

-martin

--
Martin Schmitt - Schmitt Systemberatung - http://www.scsy.de
DE 35415 Pohlheim, Gießener Str. 18
DE 65307 Bad Schwalbach, Am Bräunchesberg 9
Linux/UNIX - Internet - E-Mail Infrastructure - Antispam/Antivirus
- "What goes up, must come down. Ask any system administrator." -