----- Original Message -----
From: "Lu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 19, 2002 6:50 PM
Subject: [vchkpw] HELP! - corrupted /var/qmail/users/assign file


> System is still accepting mail so it seems that the cdb counterpart is
> still intact.
>
> Anyone know how to convert cdb file back to assign file please ?
>
> Thanks.
>
> Lu
>
>

hi,
some time ago i had the same problem,
here is the script that i used to rebuld the assign file from the cdb
it is not very good example of perl programming, but it does the job :))

you will need the perl CDB_File module.

--------------------------------------

#!/usr/bin/perl

use CDB_File;

$cdb_domain_list = '/var/qmail/users/cdb';

tie %cdb, 'CDB_File', $cdb_domain_list or die 'error opening domain list cdb
file';

foreach $key ( keys %cdb ) {

    if (!$key) {
    print ".\n";
    last;
    }

    $kliuch = $key;
    $kliuch =~s/!/\+/;
    print "$kliuch";

    @domain = split(\x0, $cdb{$key});

        foreach $value (@domain) {

            $value =~ s/\x0/:/g;
            print ":$value";

        }
    print ":\n";
}

untie %cdb;



Reply via email to