#!/usr/local/bin/perl
# edit_alias.cgi
# Edit an existing sendmail alias

require './sendmail-lib.pl';
require './aliases-lib.pl';
&ReadParse();
$conf = &get_sendmailcf();
@aliases = &list_aliases(&aliases_file($conf));
$a = $aliases[$in{'num'}];
$access{'amode'} == 1 ||
$access{'amode'} == 2 && $a->{'name'} =~ /$access{'aliases'}/ ||
$access{'amode'} == 3 && $a->{'name'} eq $remote_user ||
	&error($text{'aform_ecannot'});
foreach $v (@{$a->{'values'}}) {
	$access{"aedit_".&alias_type($v)} ||
		&error($text{'aform_ecannot'});
	}

&header($text{'aform_edit'}, "", "edit_alias");
print "<hr>\n";
&alias_form($a);
print "<hr>\n";
&footer("list_aliases.cgi", $text{'aliases_return'},
	"", $text{'index_return'});

