a
This commit is contained in:
20
update/scripts/packages/majordomo-1.94.5/md-sub/catdb
vendored
Normal file
20
update/scripts/packages/majordomo-1.94.5/md-sub/catdb
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/local/gnu/bin/perl
|
||||
#
|
||||
# catdb
|
||||
#
|
||||
# Author: John Orthoefer <jco@direwolf.com>
|
||||
# Date: 7 Jan 1996
|
||||
#
|
||||
# Introduction
|
||||
# This program dumps out a dbm file so you can see what the keys are and
|
||||
# what the values are.
|
||||
|
||||
dbmopen( %DB, "$ARGV[0]", 0666);
|
||||
|
||||
foreach $i (keys %DB) {
|
||||
print "$i = \"$DB{$i}\"\n";
|
||||
}
|
||||
|
||||
dbmclose( DB);
|
||||
|
||||
exit 0;
|
||||
170
update/scripts/packages/majordomo-1.94.5/md-sub/cgi-lib.pl
vendored
Normal file
170
update/scripts/packages/majordomo-1.94.5/md-sub/cgi-lib.pl
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
#!/usr/local/bin/perl -- -*- C -*-
|
||||
|
||||
# Perl Routines to Manipulate CGI input
|
||||
# S.E.Brenner@bioc.cam.ac.uk
|
||||
# $Header: /sources/cvsrepos/majordomo/md-sub/cgi-lib.pl,v 1.1 1996/02/01 15:17:43 cwilson Exp $
|
||||
#
|
||||
# Copyright 1994 Steven E. Brenner
|
||||
# Unpublished work.
|
||||
# Permission granted to use and modify this library so long as the
|
||||
# copyright above is maintained, modifications are documented, and
|
||||
# credit is given for any use of the library.
|
||||
#
|
||||
# Thanks are due to many people for reporting bugs and suggestions
|
||||
# especially Meng Weng Wong, Maki Watanabe, Bo Frese Rasmussen,
|
||||
# Andrew Dalke, Mark-Jason Dominus and Dave Dittrich.
|
||||
|
||||
# For more information, see:
|
||||
# http://www.bio.cam.ac.uk/web/form.html
|
||||
# http://www.seas.upenn.edu/~mengwong/forms/
|
||||
|
||||
# Minimalist http form and script (http://www.bio.cam.ac.uk/web/minimal.cgi):
|
||||
#
|
||||
# require "cgi-lib.pl";
|
||||
# if (&ReadParse(*input)) {
|
||||
# print &PrintHeader, &PrintVariables(%input);
|
||||
# } else {
|
||||
# print &PrintHeader,'<form><input type="submit">Data: <input name="myfield">';
|
||||
#}
|
||||
|
||||
# ReadParse
|
||||
# Reads in GET or POST data, converts it to unescaped text, and puts
|
||||
# one key=value in each member of the list "@in"
|
||||
# Also creates key/value pairs in %in, using '\0' to separate multiple
|
||||
# selections
|
||||
|
||||
# Returns TRUE if there was input, FALSE if there was no input
|
||||
# UNDEF may be used in the future to indicate some failure.
|
||||
|
||||
# Now that cgi scripts can be put in the normal file space, it is useful
|
||||
# to combine both the form and the script in one place. If no parameters
|
||||
# are given (i.e., ReadParse returns FALSE), then a form could be output.
|
||||
|
||||
# If a variable-glob parameter (e.g., *cgi_input) is passed to ReadParse,
|
||||
# information is stored there, rather than in $in, @in, and %in.
|
||||
|
||||
sub ReadParse {
|
||||
local (*in) = @_ if @_;
|
||||
local ($i, $key, $val);
|
||||
|
||||
# Read in text
|
||||
if (&MethGet) {
|
||||
$in = $ENV{'QUERY_STRING'};
|
||||
} elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
|
||||
read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
|
||||
}
|
||||
|
||||
@in = split(/&/,$in);
|
||||
|
||||
foreach $i (0 .. $#in) {
|
||||
# Convert plus's to spaces
|
||||
$in[$i] =~ s/\+/ /g;
|
||||
|
||||
# Split into key and value.
|
||||
($key, $val) = split(/=/,$in[$i],2); # splits on the first =.
|
||||
|
||||
# Convert %XX from hex numbers to alphanumeric
|
||||
$key =~ s/%(..)/pack("c",hex($1))/ge;
|
||||
$val =~ s/%(..)/pack("c",hex($1))/ge;
|
||||
|
||||
# Associate key and value
|
||||
$in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple separator
|
||||
$in{$key} .= $val;
|
||||
|
||||
}
|
||||
|
||||
return length($in);
|
||||
}
|
||||
|
||||
|
||||
# PrintHeader
|
||||
# Returns the magic line which tells WWW that we're an HTML document
|
||||
|
||||
sub PrintHeader {
|
||||
return "Content-type: text/html\n\n";
|
||||
}
|
||||
|
||||
|
||||
# MethGet
|
||||
# Return true if this cgi call was using the GET request, false otherwise
|
||||
|
||||
sub MethGet {
|
||||
return ($ENV{'REQUEST_METHOD'} eq "GET");
|
||||
}
|
||||
|
||||
# MyURL
|
||||
# Returns a URL to the script
|
||||
sub MyURL {
|
||||
return 'http://' . $ENV{'SERVER_NAME'} . $ENV{'SCRIPT_NAME'};
|
||||
}
|
||||
|
||||
# CgiError
|
||||
# Prints out an error message which which containes appropriate headers,
|
||||
# markup, etcetera.
|
||||
# Parameters:
|
||||
# If no parameters, gives a generic error message
|
||||
# Otherwise, the first parameter will be the title and the rest will
|
||||
# be given as different paragraphs of the body
|
||||
|
||||
sub CgiError {
|
||||
local (@msg) = @_;
|
||||
local ($i,$name);
|
||||
|
||||
if (!@msg) {
|
||||
$name = &MyURL;
|
||||
@msg = ("Error: script $name encountered fatal error");
|
||||
};
|
||||
|
||||
print &PrintHeader;
|
||||
print "<html><head><title>$msg[0]</title></head>\n";
|
||||
print "<body><h1>$msg[0]</h1>\n";
|
||||
foreach $i (1 .. $#msg) {
|
||||
print "<p>$msg[$i]</p>\n";
|
||||
}
|
||||
print "</body></html>\n";
|
||||
}
|
||||
|
||||
# PrintVariables
|
||||
# Nicely formats variables in an associative array passed as a parameter
|
||||
# And returns the HTML string.
|
||||
|
||||
sub PrintVariables {
|
||||
local (%in) = @_;
|
||||
local ($old, $out, $output);
|
||||
$old = $*; $* =1;
|
||||
$output .= "<DL COMPACT>";
|
||||
foreach $key (sort keys(%in)) {
|
||||
foreach (split("\0", $in{$key})) {
|
||||
($out = $_) =~ s/\n/<BR>/g;
|
||||
$output .= "<DT><B>$key</B><DD><I>$out</I><BR>";
|
||||
}
|
||||
}
|
||||
$output .= "</DL>";
|
||||
$* = $old;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
# PrintVariablesShort
|
||||
# Nicely formats variables in an associative array passed as a parameter
|
||||
# Using one line per pair (unless value is multiline)
|
||||
# And returns the HTML string.
|
||||
|
||||
|
||||
sub PrintVariablesShort {
|
||||
local (%in) = @_;
|
||||
local ($old, $out, $output);
|
||||
$old = $*; $* =1;
|
||||
foreach $key (sort keys(%in)) {
|
||||
foreach (split("\0", $in{$key})) {
|
||||
($out = $_) =~ s/\n/<BR>/g;
|
||||
$output .= "<B>$key</B> is <I>$out</I><BR>";
|
||||
}
|
||||
}
|
||||
$* = $old;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
1; #return true
|
||||
|
||||
413
update/scripts/packages/majordomo-1.94.5/md-sub/md-sub.cgi
vendored
Normal file
413
update/scripts/packages/majordomo-1.94.5/md-sub/md-sub.cgi
vendored
Normal file
@@ -0,0 +1,413 @@
|
||||
#!/usr/local/gnu/bin/perl
|
||||
#
|
||||
# md-sub.cgi
|
||||
#
|
||||
# Author: John Orthoefer <jco@direwolf.com>
|
||||
# Date: 17 Jan 1996
|
||||
#
|
||||
# Introduction
|
||||
# This cgi allows people web surfing to subscribe to mailing list.
|
||||
# It presents the person with a form when called with out options.
|
||||
# when called with options it will send a mail message to the
|
||||
# mailing list.
|
||||
#
|
||||
# Installing
|
||||
# To install this software:
|
||||
# o put the script in the cgi-bin directory
|
||||
# o set the following varables up for your site
|
||||
# cgiloc - url of this script as refered to via the web
|
||||
# listsdb - where the database of lists is going to live
|
||||
# logfile - where the log for script activity should go
|
||||
# sendmail - the sending e-mail program, it should have the
|
||||
# option to read the incoming stream for the To
|
||||
# address set, '-t' on sendmail.
|
||||
# o initialize the database
|
||||
# + list all your mailing lists and contact addresses in a file
|
||||
# one per line as in
|
||||
# firewalls majordomo@greatcircle.com
|
||||
# warhammerfb majordomo@direwolf.com
|
||||
# majordomo-workers majordomo@greatcircle.com
|
||||
# default warhammerfb
|
||||
# help webmaster@here.org
|
||||
#
|
||||
# note: there are 3 special names
|
||||
# default -- This is the mailing list that will be
|
||||
# selected when the form is first
|
||||
# presented to the user.
|
||||
# help -- This is the address for people to send
|
||||
# help to.
|
||||
# info -- This is used to specify a URL for information about
|
||||
# a mailing list.
|
||||
# the format is:
|
||||
# info listname url
|
||||
# where: listname matches a list that is specifed
|
||||
# elsewhere in the file.
|
||||
# url is some url on the web.
|
||||
# + then run the the script with the '-C filename' option
|
||||
# to construct the database. The create option will only
|
||||
# add to the database. If you want to clear the database,
|
||||
# you need to 'rm $listsdb*' (there will be two file a
|
||||
# .dir and .pag file.)
|
||||
# o add a link to the scripts URL in your web pages.
|
||||
# + if you want to make different default mailing lists based on
|
||||
# which pages you came from you can do this by passing the param
|
||||
# default=listname
|
||||
# as part of the URL.
|
||||
# ie: <href url="http://mypage.domain.org/md-sub.cgi?default=mylist">
|
||||
# This will cause mylist to be the default selected one instead of
|
||||
# the database default.
|
||||
#
|
||||
# Misc
|
||||
# This script needs two perl libs cgi-lib.pl (included in this
|
||||
# distrubution.) and getopts.pl (which should be included with
|
||||
# your perl distrubution.)
|
||||
#
|
||||
# Scalars that need to be changed
|
||||
#
|
||||
$cgiloc = "http://stout/~jco/md-sub.cgi";
|
||||
$listsdb = "/usr/jco/.md-subrc";
|
||||
$logfile = "/usr/jco/md-sub.log";
|
||||
#$sendmail = "|/usr/lib/sendmail -t";
|
||||
$sendmail = "|/usr/bin/cat - > /tmp/test.out"; # This one is for
|
||||
# testing...
|
||||
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
# NOTHING BELOW HERE SHOULD NEED TO BE CHANGED
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
#
|
||||
# Required file
|
||||
require 'cgi-lib.pl';
|
||||
use Getopt::Std;
|
||||
|
||||
#
|
||||
# Version number
|
||||
$version = "1.0";
|
||||
|
||||
#
|
||||
# Info
|
||||
$info = "jco\@direwolf.com";
|
||||
|
||||
#
|
||||
# Call Getopts
|
||||
getopts( 'C:v');
|
||||
|
||||
#
|
||||
# Check to see if we are creating a DB
|
||||
if ($opt_C) {
|
||||
&create_lists( $opt_C);
|
||||
exit 0;
|
||||
}
|
||||
|
||||
#
|
||||
# Check to see if the version is being intergated.
|
||||
if ($opt_v) {
|
||||
print "Version: $version\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
#
|
||||
# Read the list DB
|
||||
&load_lists;
|
||||
|
||||
#
|
||||
# Figure out if we have a filled in form or we need to send a form
|
||||
if (&ReadParse && !defined( $in{ 'default'})) {
|
||||
if (defined $in{ 'infopage'} ) {
|
||||
&infopage;
|
||||
} else {
|
||||
$in{ 'mailing_list'} =~ s/\*$//; # drop the * at the end of the name.
|
||||
&sendmessage;
|
||||
}
|
||||
} else {
|
||||
&form;
|
||||
}
|
||||
|
||||
#
|
||||
# Birthday party, cheesecake, jelly bean, boom!
|
||||
# R.E.M.
|
||||
exit 0;
|
||||
|
||||
#
|
||||
# create_lists
|
||||
# Create the DBM file.
|
||||
sub create_lists {
|
||||
local( $file) = @_;
|
||||
|
||||
open( LISTS, $file);
|
||||
dbmopen( %MLRC, $listsdb, 0644);
|
||||
|
||||
while( <LISTS>) {
|
||||
chop;
|
||||
($name, $address) = /(\S*)\s*(.*)/;
|
||||
if ($name =~ /info/i) {
|
||||
($name, $address) = $address =~/(\S*)\s*(.*)/;
|
||||
$MLRC{ "LISTINFO-$name"} = $address;
|
||||
@info = (@info, $name);
|
||||
} else {
|
||||
@ml = (@ml, $name);
|
||||
$MLRC{ "LISTNAME-$name"} = $address;
|
||||
}
|
||||
}
|
||||
|
||||
$MLRC{ 'mailing-lists'} = join( ";", @ml);
|
||||
$MLRC{ 'mailing-info'} = join( ";", @info);
|
||||
dbmclose( MLRC);
|
||||
}
|
||||
|
||||
#
|
||||
# load_lists
|
||||
# read in the DBM file.
|
||||
sub load_lists {
|
||||
if (!dbmopen( %MLRC, $listsdb, undef)) {
|
||||
&log( "Can't open $listsdb");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
foreach $i (split(/;/, $MLRC{'mailing-lists'})) {
|
||||
$ml{$i} = $MLRC{ "LISTNAME-$i"};
|
||||
}
|
||||
|
||||
foreach $i (split(/;/, $MLRC{'mailing-info'})) {
|
||||
$mi{$i} = $MLRC{ "LISTINFO-$i"};
|
||||
}
|
||||
|
||||
dbmclose( MLRC);
|
||||
}
|
||||
|
||||
#
|
||||
# form
|
||||
# Present the form to the user to fill out
|
||||
sub form {
|
||||
|
||||
# Form header
|
||||
print <<EOF;
|
||||
Content-type: text/html
|
||||
|
||||
<html>
|
||||
<title>Mailing List Subscription</title>
|
||||
<body>
|
||||
<font size=5>
|
||||
<center><b>Mailing List Subscription Form</b></center>
|
||||
</font>
|
||||
<br>
|
||||
|
||||
To subscribe to any of these mailing lists all you need to do is fill
|
||||
out the form compeletly. And submit it. The form will then be
|
||||
processed and you should be added to the mailing list shortly.<p>
|
||||
|
||||
EOF
|
||||
|
||||
if (defined %mi) {
|
||||
print <<EOF;
|
||||
|
||||
If a mailing list has a star (*) after it. That means there is online info
|
||||
about that list. To access the descriptions for those lists click
|
||||
<a href=\"$cgiloc?infopage\">here</a>.<p>
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
<hr>
|
||||
<form action="$cgiloc" method="post">
|
||||
Mailing List:
|
||||
EOF
|
||||
|
||||
# Generate the list of mailing lists
|
||||
print "<select name=\"mailing_list\">\n";
|
||||
foreach $i (keys %ml) {
|
||||
next if ($i eq 'default');
|
||||
next if ($i eq 'help');
|
||||
if ( $i eq $in{ 'default'}) {
|
||||
print "<option selected>$i";
|
||||
} elsif ( $i eq $ml{ 'default'} && !defined( $in{ 'default'})) {
|
||||
print "<option selected>$i";
|
||||
} else {
|
||||
print "<option>$i";
|
||||
}
|
||||
print "*" if (defined $mi{ $i});
|
||||
print "\n";
|
||||
}
|
||||
print "</select>\n";
|
||||
|
||||
# form trailer
|
||||
print <<EOF
|
||||
<br>
|
||||
Real name: <input type="text" name="rname" size=30> <br>
|
||||
E-mail Address: <input type="text" name="email" size=30> <br>
|
||||
<br>
|
||||
What action would you like to take?
|
||||
<blockquote>
|
||||
<input checked type=radio name="function" value="subscribe">Subscribe
|
||||
to the list<br>
|
||||
<input type=radio name="function" value="unsubscribe">Unsubscribe from
|
||||
the list<br>
|
||||
<input type=radio name="function" value="who">Have a list of who is on the list
|
||||
mailed to you<br>
|
||||
<input type=radio name="function" value="info">Get a detailed description
|
||||
of the list mailed to you<br>
|
||||
</blockquote>
|
||||
<input type="submit" value="Send request">
|
||||
<input type="reset" value="Reset">
|
||||
|
||||
</form>
|
||||
<hr>
|
||||
<address>
|
||||
<a href="mailto:$ml{ 'help'}">Webmaster</a> /
|
||||
<a href="mailto:$info>md-sub.cgi</a> /
|
||||
$version
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
}
|
||||
|
||||
#
|
||||
# infopage
|
||||
# This sends the page with all the info lists on it.
|
||||
|
||||
sub infopage {
|
||||
|
||||
print <<EOF;
|
||||
Content-type: text/html
|
||||
|
||||
<html>
|
||||
<title>Mailing List Information</title>
|
||||
<body>
|
||||
<font size=5>
|
||||
<center><b>Mailing List Information</b></center>
|
||||
</font>
|
||||
<br>
|
||||
<hr>
|
||||
EOF
|
||||
print "<ul>\n";
|
||||
foreach $i (keys %mi) {
|
||||
print "<li><a href=\"$mi{ $i}\">$i</a>\n";
|
||||
}
|
||||
print "</ul>\n";
|
||||
|
||||
print <<EOF;
|
||||
<hr>
|
||||
<address>
|
||||
<a href="mailto:$ml{ 'help'}">Webmaster</a> /
|
||||
<a href="mailto:$info>md-sub.cgi</a> /
|
||||
$version
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
}
|
||||
|
||||
#
|
||||
# log
|
||||
# This routine is called to print data out to the log file it should
|
||||
# be trival to make it use syslog if you are so inclined.
|
||||
sub log {
|
||||
local( $msg) = @_;
|
||||
|
||||
|
||||
open( LOG, ">>$logfile");
|
||||
|
||||
print LOG &DTG;
|
||||
print LOG " - $msg\n";
|
||||
|
||||
close( LOG);
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# DTG
|
||||
# Date Time Group, This is a military thing. Express time in GMT (aka
|
||||
# Zulu) it this kinda funky format (ddhhmmZ MON YY). I used it because
|
||||
# it's a canned routine I have.
|
||||
sub DTG {
|
||||
local( $time) = @_;
|
||||
local( @months) = ( 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN',
|
||||
'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC');
|
||||
|
||||
$time = time if ($time);
|
||||
sprintf( "%2.2d%2.2d%2.2dZ %s %2.2d",
|
||||
(gmtime( $time))[3],
|
||||
(gmtime( $time))[2],
|
||||
(gmtime( $time))[1],
|
||||
@months[(gmtime( $time))[4]],
|
||||
(gmtime( $time))[5]);
|
||||
}
|
||||
|
||||
#
|
||||
# sendmessage
|
||||
# This is the worker routine. Sends a nice HTML message to the user and
|
||||
# sends a nice e-mail to the mailing list admin.
|
||||
#
|
||||
sub sendmessage {
|
||||
local( $i);
|
||||
|
||||
if ($in{ 'email'} eq "") {
|
||||
print <<EOF;
|
||||
Content-type: text/html
|
||||
|
||||
<html>
|
||||
<font size=6>
|
||||
<center><b>SORRY</b></center><br>
|
||||
</font>
|
||||
I'm sorry but you must fill in your e-mail address.
|
||||
Press "back" and try again.
|
||||
</html>
|
||||
EOF
|
||||
|
||||
exit 0;
|
||||
}
|
||||
$in{ 'email'} = "$in{ 'email'}@$ENV{'REMOTE_HOST'}"
|
||||
if ( !( $in{ 'email'} =~ /\S*@\S*/));
|
||||
|
||||
&log( "<$in{ 'email'}> \"$in{ 'rname'}\" ".
|
||||
"$in{ 'function'} $in{ 'mailing_list'}");
|
||||
|
||||
open( SM, "$sendmail");
|
||||
print SM <<EOF;
|
||||
To: $ml{$in {'mailing_list'}}
|
||||
From: "$in{ 'rname'}" <$in{'email'}>
|
||||
Reply-To: "$in{ 'rname'}" <$in{'email'}>
|
||||
|
||||
$in{ 'function'} $in{'mailing_list'}
|
||||
EOF
|
||||
close( SM);
|
||||
|
||||
print <<EOF;
|
||||
Content-type: text/html
|
||||
|
||||
|
||||
<HTML>
|
||||
<TITLE>Thank You</TITLE>
|
||||
<BODY>
|
||||
<FONT SIZE=5>
|
||||
<CENTER><B>THANK YOU</B></CENTER>
|
||||
</FONT><br>
|
||||
Your request has been forwarded to the list owner for processing.
|
||||
You should be added soon.
|
||||
<br>
|
||||
|
||||
If the list owner has any questions about adding you they should be in
|
||||
touch with you shortly.
|
||||
<br>
|
||||
<br>
|
||||
The following information will be sent for you:
|
||||
<br>
|
||||
<br>
|
||||
<TT>
|
||||
EOF
|
||||
|
||||
print "To: $ml{$in {'mailing_list'}}<br>\n";
|
||||
print "From: \"$in{ 'rname'}\" <$in{'email'}><br><br>\n";
|
||||
|
||||
print "$in{ 'function'} $in{'mailing_list'} <br>\n";
|
||||
|
||||
print <<EOF;
|
||||
|
||||
</TT>
|
||||
</BODY>
|
||||
</HTML>
|
||||
EOF
|
||||
|
||||
}
|
||||
9
update/scripts/packages/majordomo-1.94.5/md-sub/ml-init.sample
vendored
Normal file
9
update/scripts/packages/majordomo-1.94.5/md-sub/ml-init.sample
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
warhammerfb majordomo@direwolf.com
|
||||
warhammerfb-digest majordomo@direwolf.com
|
||||
test jco@bbn.com
|
||||
Firewalls majordomo@greatcircle.com
|
||||
info Firewalls http://www.greatcircle.com/firewalls/
|
||||
info Firewalls-digest http://www.greatcircle.com/firewalls/
|
||||
Firewalls-digest majordomo@greatcircle.com
|
||||
help webmaster@www.noname.org
|
||||
default warhammerfb
|
||||
Reference in New Issue
Block a user