Added CGI args parser
authorJamie Cameron <jcameron@webmin.com>
Wed, 10 Jun 2009 05:09:30 +0000 (05:09 +0000)
committerJamie Cameron <jcameron@webmin.com>
Wed, 10 Jun 2009 05:09:30 +0000 (05:09 +0000)
sendmail/cgi_args.pl [new file with mode: 0644]
sendmail/lang/en

diff --git a/sendmail/cgi_args.pl b/sendmail/cgi_args.pl
new file mode 100644 (file)
index 0000000..3e2a6c8
--- /dev/null
@@ -0,0 +1,64 @@
+
+do 'sendmail-lib.pl';
+do 'virtusers-lib.pl';
+do 'generics-lib.pl';
+do 'domain-lib.pl';
+do 'access-lib.pl';
+
+sub cgi_args
+{
+my ($cgi) = @_;
+if ($cgi =~ /^list_/) {
+       # All these are OK with no args
+       return '';
+       }
+elsif ($cgi eq 'edit_alias.cgi') {
+       # Assume first one
+       return 'num=0';
+       }
+elsif ($cgi eq 'edit_virtuser.cgi') {
+       # First virtuser, if any
+       my $conf = &get_sendmailcf();
+       my $vfile = &virtusers_file($conf);
+       my ($vdbm, $vdbmtype) = &virtusers_dbm($conf);
+       if ($vdbm) {
+               my @virts = &list_virtusers($vfile);
+               return @virts ? 'num=0' : 'none';
+               }
+       return 'none';
+       }
+elsif ($cgi eq 'edit_generic.cgi') {
+       # First outgoing address mapping
+       my $conf = &get_sendmailcf();
+       my $gfile = &generics_file($conf);
+       my ($gdbm, $gdbmtype) = &generics_dbm($conf);
+       if ($gdbm) {
+               my @gens = &list_generics($gfile);
+               return @gens ? 'num=0' : 'none';
+               }
+       return 'none';
+       }
+elsif ($cgi eq 'edit_domain.cgi') {
+       # First domain table entry
+       my $conf = &get_sendmailcf();
+       my $dfile = &domains_file($conf);
+       my ($ddbm, $ddbmtype) = &domains_dbm($conf);
+       if ($ddbm) {
+               my @doms = &list_domains($dfile);
+               return @doms ? 'num=0' : 'none';
+               }
+       return 'none';
+       }
+elsif ($cgi eq 'edit_access.cgi') {
+       # First spam control rule
+       my $conf = &get_sendmailcf();
+       my $afile = &access_file($conf);
+       my ($adbm, $adbmtype) = &access_dbm($conf);
+       if ($adbm) {
+               my @accs = &list_access($afile);
+               return @accs ? 'num=0' : 'none';
+               }
+       return 'none';
+       }
+return undef;
+}
index 4b70dc2..b5328da 100644 (file)
@@ -202,8 +202,8 @@ virtusers_toomany=There are too many address mappings on your system to display
 virtusers_go=Find address mappings matching:
 virtusers_delete=Delete Selected Address Mappings
 
-vform_edit=Edit Mapping
-vform_create=Create Mapping
+vform_edit=Edit Address Mapping
+vform_create=Create Address Mapping
 vform_for=Mail for
 vform_address=Address
 vform_domain=Domain