OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Subject: RE: Unpostmapping?
From: Nate (natenetimages.com)
Date: Mon Sep 11 2000 - 15:20:28 CDT


On Mon, 11 Sep 2000, Chris Rovers wrote:

>
> > Den 11-Sep-00 17:18:33 skrev Chris Rovers følgende om
> > "Unpostmapping?":
> > >I have a .db file (my recipients_canonical) to which the
> > original text file
> > >has gone walk-about. Other then re-inforcing the necessity
> > of backing up
> > >the /etc/postfix directory (ooops), does any one have any
> > suggestions on how
> > >I can get the original comments back?
> >
> > Hmm. If you could, then they wouldn't have been comments,
> > would they?
>
> Errr. That really should have been "contents" not comments. I blame it on
> the morning I've had.....
>
> Yes, I understand that contents don't go in the db.... I just was incoherent
> when I wrote the message.
>

This perl script will print the contents of your postfix access file:

#!/usr/bin/perl

use DB_File;

$db = '/etc/postfix/access.db';

if (not(dbmopen %accessfile, $db, 0644)){
        die "Couldn't open $db: $!";
}

print "Contents of access file \n";

while (($key, $val) = each %accessfile) {
        write;
}
dbmclose (%accessfile);

## spit out some whitespace for good measure
print "\n\n";

format top =
 
Postfix Access File
 
Host/Domain Action
-----------------------------------------------------------------
.
 
format STDOUT =
<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$key, $val
.

# exit nicely ;-)
exit 0;

You could modify it to accept an argument and then print out your
postmap'ed files at will.

DISCLAIMER: tested with 5.005_03 built for i386-linux

--
Nate Campi	                    natenetimages.com
For all support email please CC: supportnetimages.com