#!/usr/bin/eperl -w 
###
#
# Copyright (c) Ensim Corporation 2000, 2001   All Rights Reserved.
#
# This software is furnished under a license and may be used and copied
# only  in  accordance  with  the  terms  of such  license and with the
# inclusion of the above copyright notice. This software or any other
# copies thereof may not be provided or otherwise made available to any
# other person. No title to and ownership of the software is hereby
# transferred.
#
# The information in this software is subject to change without notice
# and  should  not be  construed  as  a commitment by Ensim Corporation.
# Ensim assumes no responsibility for the use or  reliability  of its
# software on equipment which is not supplied by Ensim.
#
# ----------------------------------------------------------------------
# Usage: list_aliases
# ----------------------------------------------------------------------

push @INC, ($ENV{'OCW_SVCPATH'} || "/usr/lib/opcenter")."/sendmail";

use strict;
require sendmail;

use lib ($ENV{OCW_SVCPATH} or "/usr/lib/opcenter") . "/sendmail";
use lib ($ENV{OCW_SVCPATH} or "/usr/lib/opcenter") . "/cmdline_common";

use ERRORS;
use Carper;

my( $usage, $sendmailcf, $afile, $adbm, $adbmtype, @accs, %option);
$usage = "Usage: list_aliases\n";

die $usage if ($#ARGV > -1);

$sendmailcf = &sendmail::get_sendmailcf();
$afile = &sendmail::access_file($sendmailcf);
($adbm, $adbmtype) = &sendmail::access_dbm($sendmailcf);
if (!$adbm) {
  # No Kaccess directive in sendmail.cf
  $cerr += $E_UNSUPPORTEDSPAM ;
  print STDERR "Spam filter not supported by sendmail.\n";
  exit 1;
}
if (!-r $afile) {
  # Text file not found, create one
#   print STDERR "Spam filter data file not readable.\n";
#   exit 1;
  open(ACCESSFILE, ">$afile");
  close(ACCESSFILE);
}
@accs = &sendmail::list_access($afile);

map {if ($_->{action} eq "REJECT") {print"$_->{from}\n"}} @accs;



