66 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			66 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
								 | 
							
								#!/usr/bin/perl -w
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#----------------------------------------------------------------------
							 | 
						||
| 
								 | 
							
								# copyright (C) 2006 Gordon Rowell <gordonr@gormand.com.au>
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# This program is free software; you can redistribute it and/or modify
							 | 
						||
| 
								 | 
							
								# it under the terms of the GNU General Public License as published by
							 | 
						||
| 
								 | 
							
								# the Free Software Foundation; either version 2 of the License, or
							 | 
						||
| 
								 | 
							
								# (at your option) any later version.
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# This program is distributed in the hope that it will be useful,
							 | 
						||
| 
								 | 
							
								# but WITHOUT ANY WARRANTY; without even the implied warranty of
							 | 
						||
| 
								 | 
							
								# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
							 | 
						||
| 
								 | 
							
								# GNU General Public License for more details.
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# You should have received a copy of the GNU General Public License
							 | 
						||
| 
								 | 
							
								# along with this program; if not, write to the Free Software
							 | 
						||
| 
								 | 
							
								# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
							 | 
						||
| 
								 | 
							
								#----------------------------------------------------------------------
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use strict;
							 | 
						||
| 
								 | 
							
								use warnings;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use esmith::AccountsDB;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								my $adb = esmith::AccountsDB->open or die "Couldn't open AccountsDB\n";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use constant ALIAS_DIR => "/var/qmail/alias";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								chdir ALIAS_DIR or die "Couldn't chdir alias directory\n";
							 | 
						||
| 
								 | 
							
								opendir DIR, '.' or die "Couldn't readdir .\n";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								for my $file ( readdir(DIR) )
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    next unless ($file =~ /^.qmail-/);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    my $name = $file;
							 | 
						||
| 
								 | 
							
								    $name =~ s/.qmail-//;
							 | 
						||
| 
								 | 
							
								    $name =~ s/-default$//;
							 | 
						||
| 
								 | 
							
								    $name =~ s/:/./g;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    my $account = $adb->get($name);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    if ($account)
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
									print "$file: ACCOUNT: $name - " . $account->prop('type') . "\n";
							 | 
						||
| 
								 | 
							
									next;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    my $template = "/etc/e-smith/templates" . ALIAS_DIR . "/$file";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    my $custom_template = "/etc/e-smith/templates-custom" . ALIAS_DIR . "/$file";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    if (-e $template or -e $custom_template)
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
									print "$file: TEMPLATE exists\n";
							 | 
						||
| 
								 | 
							
									next;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    print "$file: MANUAL - contents:\n";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    open FILE, $file;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    print <FILE>, "\n";
							 | 
						||
| 
								 | 
							
								}
							 |