#!/usr/bin/perl use warnings; use strict; #user-defined variables my $domain = "defora.org"; my $maildir = 'Mail/'; my $passwd_file = '/etc/passwd-webmail'; my $map_file = '/etc/postfix/webmail-maildir'; my $uid_file = '/etc/postfix/webmail-uid'; my $gid_file = '/etc/postfix/webmail-gid'; open(FP, "<$passwd_file") or die "Couldn't open \"$passwd_file\""; open(MAPFP, ">$map_file") or die "Couldn't open \"$map_file\""; open(UIDFP, ">$uid_file") or die "Couldn't open \"$uid_file\""; open(GIDFP, ">$gid_file") or die "Couldn't open \"$gid_file\""; my $line; while($line = ) { my $login = ''; my $uid = ''; my $gid = ''; my $home = ''; if($line =~ /(.*):.*:(.*):(.*):.*:(.*):/) { $login = $1; $uid = $2; $gid = $3; $home = $4; print(MAPFP "$login\@$domain $home/$maildir\n"); print(UIDFP "$login\@$domain $uid\n"); print(GIDFP "$login\@$domain $gid\n"); } } system("/usr/sbin/postmap $map_file"); system("/usr/sbin/postmap $uid_file"); system("/usr/sbin/postmap $gid_file");