summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-10-25 10:47:54 +0000
committerPeter Palfrader <peter@palfrader.org>2002-10-25 10:47:54 +0000
commit2cf545f50a2008c2550d9d631105de7d93929525 (patch)
treec15935fb8d76d085dd180a546185028ce7b756be
parent7a9b25a7a1202a3da71c22f34cd2f1efce64a586 (diff)
Also support setups without user defined mailboxes (recipient_delimiter set to '')
-rw-r--r--Echolot/Tools.pm47
-rw-r--r--NEWS2
-rw-r--r--README6
-rw-r--r--doc/pingd.conf.pod16
4 files changed, 55 insertions, 16 deletions
diff --git a/Echolot/Tools.pm b/Echolot/Tools.pm
index ff57c3e..7a83049 100644
--- a/Echolot/Tools.pm
+++ b/Echolot/Tools.pm
@@ -1,7 +1,7 @@
package Echolot::Tools;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Tools.pm,v 1.10 2002/09/12 15:41:49 weasel Exp $
+# $Id: Tools.pm,v 1.11 2002/10/25 10:47:54 weasel Exp $
#
=pod
@@ -78,11 +78,19 @@ sub make_address($) {
my $hash = hash($token . Echolot::Globals::get()->{'storage'}->get_secret() );
my $cut_hash = substr($hash, 0, Echolot::Config::get()->{'hash_len'});
my $complete_token = $token.'='.$cut_hash;
- my $address = Echolot::Config::get()->{'my_localpart'}.
- Echolot::Config::get()->{'recipient_delimiter'}.
- $complete_token.
- '@'.
- Echolot::Config::get()->{'my_domain'};
+ my $address = Echolot::Config::get()->{'recipient_delimiter'} ne ''?
+ Echolot::Config::get()->{'my_localpart'}.
+ Echolot::Config::get()->{'recipient_delimiter'}.
+ $complete_token.
+ '@'.
+ Echolot::Config::get()->{'my_domain'}
+ :
+ Echolot::Config::get()->{'my_localpart'}.
+ '@'.
+ Echolot::Config::get()->{'my_domain'}.
+ '('.
+ $complete_token.
+ ')';
return $address;
};
@@ -90,10 +98,18 @@ sub make_address($) {
sub verify_address_tokens($) {
my ($address) = @_;
- my $delimiter = quotemeta( Echolot::Config::get()->{'recipient_delimiter'});
- my ($type, $timestamp, $received_hash) = $address =~ /$delimiter (.*) = (\d+) = ([0-9a-f]+) @/x or
- cluck("Could not parse to header '$address'"),
- return undef;
+ my ($type, $timestamp, $received_hash);
+ if (Echolot::Config::get()->{'recipient_delimiter'} ne '') {
+ my $delimiter = quotemeta( Echolot::Config::get()->{'recipient_delimiter'});
+ ($type, $timestamp, $received_hash) = $address =~ /$delimiter (.*) = (\d+) = ([0-9a-f]+) @/x or
+ ($type, $timestamp, $received_hash) = $address =~ /\( (.*) = (\d+) = ([0-9a-f]+) \)/x or
+ cluck("Could not parse to header '$address'"),
+ return undef;
+ } else {
+ ($type, $timestamp, $received_hash) = $address =~ /\( (.*) = (\d+) = ([0-9a-f]+) \)/x or
+ cluck("Could not parse to header '$address'"),
+ return undef;
+ };
my $token = $type.'='.$timestamp;
my $hash = Echolot::Tools::hash($token . Echolot::Globals::get()->{'storage'}->get_secret() );
@@ -116,19 +132,20 @@ sub send_message(%) {
return 0;
$args{'Subject'} = '' unless (defined $args{'Subject'});
$args{'Body'} = '' unless (defined $args{'Body'});
+ $args{'From_'} =
+ Echolot::Config::get()->{'my_localpart'}.
+ '@'.
+ Echolot::Config::get()->{'my_domain'};
if (defined $args{'Token'}) {
$args{'From'} = make_address( $args{'Token'} );
} else {
- $args{'From'} =
- Echolot::Config::get()->{'my_localpart'}.
- '@'.
- Echolot::Config::get()->{'my_domain'};
+ $args{'From'} = $args{'From_'};
};
$args{'Subject'} = 'none' unless (defined $args{'Subject'});
my @lines = map { $_."\n" } split (/\r?\n/, $args{'Body'});
- open(SENDMAIL, '|'.Echolot::Config::get()->{'sendmail'}.' -f '.$args{'From'}.' -t')
+ open(SENDMAIL, '|'.Echolot::Config::get()->{'sendmail'}.' -f '.$args{'From_'}.' -t')
or cluck("Cannot run sendmail: $!"),
return 0;
printf SENDMAIL "From: %s\n", $args{'From'};
diff --git a/NEWS b/NEWS
index c820ba1..8512684 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
Changes in version 2.0.5
* Only take default parameters if they are not set in
pingd.conf (as opposed to set to undef).
+ * Also support setups without user defined mailboxes
+ (recipient_delimiter set to '').
Changes in version 2.0.4 - 2002-10-16
* Fix pingd.conf(5) manpage a bit (indention levels).
diff --git a/README b/README
index bc5682b..7340500 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-$Id: README,v 1.34 2002/09/12 17:47:26 weasel Exp $
+$Id: README,v 1.35 2002/10/25 10:47:54 weasel Exp $
#####################################################################
## R E A D M E F O R E C H O L O T ###########################
#####################################################################
@@ -111,6 +111,10 @@ o Make sure your MTA supports user defined mailboxes to ensure that
If you are using an MTA other than postfix, consult your MTA's
documentation to determine how to enable user defined mailboxes.
+ If it is not possible for you to have user defined mailboxes set
+ recipient_delimiter to the empty string "" in pingd.conf. Echolot
+ will then work around it (This is _not_ recommended).
+
o Echolot can read its incoming mail either from an mbox format mailbox
or from a Maildir. The latter is preferred for technical reasons since
a Maildir does not require file locking.
diff --git a/doc/pingd.conf.pod b/doc/pingd.conf.pod
index a3da324..479ca7b 100644
--- a/doc/pingd.conf.pod
+++ b/doc/pingd.conf.pod
@@ -65,8 +65,24 @@ It is used in several templates.
The B<recipient_delimiter> parameter specifies the separator between user names
and address extensions (user+foo).
+If it is an empty string Echolot does not make use of user defined mailboxes
+but rather encodes the message type et al in a Comment/Realname part of an
+address.
+
+The use of recipient_delimiter is strongly recommended if your MTA setup
+supports it.
+
Default: 'recipient_delimiter' => '+',
Example: 'recipient_delimiter' => '-',
+ 'recipient_delimiter' => '',
+
+Example addresses:
+
+with + as a recipient delimiter:
+ pinger+conf.1=1035540778=1dd23d97@example.org
+
+without recipient delimiter:
+ pinger@example.org (conf.2=1035541597=3baa2ae5)
=item B<dev_random>