[Mimedefang] Tie to aliases.db doesn't work

Jan Pieter Cornet johnpc at xs4all.nl
Tue May 24 03:40:33 EDT 2005


On Mon, May 23, 2005 at 06:37:05PM -0800, Matthew Schumacher wrote:
> However if I try to pull out a specific value with:
> 
> require DB_File;
> use Fcntl;
> tie %aliases, "DB_File", "/etc/mail/aliases.db", O_RDONLY;
> 
> print $aliases{root};
> 
> It doesn't work.  If I use `makemap hash aliases < aliases` to make the
> database all is well, but when I make it with newaliases I can't find a
> value in the hash by key name.
> 
> Any ideas?

newaliases stores the keys (and values) with a trailing \0 character. Try:

    print $aliases{"root\0"}, "\n";

Also make sure to strip the \0 from the value if you're using it for
anything other than just printing, so the code above could also be
written as:

my $alias = "root";
my $dest = $aliases{"$alias\0"};
$dest =~ s/\0$//;
print $dest, "\n";

-- 
#!perl -wpl # mmfppfmpmmpp mmpffm <pmmppfmfpppppfmmmf at fpffmm4mmmpmfpmf.ppppmf>
$p=3-2*/[^\W\dmpf_]/i;s.[a-z]{$p}.vec($f=join('',$p-1?chr(sub{$_[0]*9+$_[1]*3+
$_[2]}->(map{/p|f/i+/f/i}split//,$&)+97):qw(m p f)[map{((ord$&)%32-1)/$_%3}(9,
3,1)]),5,1)='`'lt$&;$f.eig;                                # Jan-Pieter Cornet



More information about the MIMEDefang mailing list