Great Circle Associates Majordomo-Workers
(February 1998)
 

Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: Some more minor fixes
From: Norbert Bollow <nb @ thinkcoach . com>
Date: Thu, 26 Feb 1998 18:45:39 +0100
To: majordomo-workers @ greatcircle . com

This patch adds some documentation of parameters to Addr.pm, corrects an
error in a comment (037 plus one is _not_ 038) and also fixes two minor
bugs, namely

- A confusion of left and right in the text which is printed when complaining
  about comments after a route.

- In the old regexp for recognizing bang paths, a bang path which has
  only one hostname would not be recognized as such if the hostname ends
  with a digit, which is not uncommon.

-- Norbert.


--- Addr.pm.orig	Thu Feb 26 09:25:47 1998
+++ Addr.pm	Thu Feb 26 09:25:36 1998
@@ -31,6 +31,44 @@
 certain configuration values can be assigned to it without using package
 globals.
 
+The following parameters can be set to either 0 or 1:
+
+  allow_at_in_phrase         - Allow '@' in the 'phrase' part of addresses
+                               like this:   phrase <user@example.com>
+  allow_bang_paths           - Allow old-style UUCP electronic-mail 
+                               addresses like this:  abcvax!defvax!user
+  allow_comments_after_route - Allow (illegal) e-mail addresses like this:
+                                 <user@example.com> comment
+                               (the address is illegal because the comment
+                               should be before the <user@example.com> 
+                               part and not after it.)
+  allow_ending_dot           - Allow a dot at the end of an e-mail address
+                               e.g. like this:  user@example.com.
+  limit_length               - Limit the length of 'user' and 'host' parts
+                               of user@host e-mail addresses to 64 
+                               characters each, as required by section 
+                               4.5.3 of RFC821.
+  require_fqdn               - Require fully qualified domain names.
+  strict_domain_check        - Check for valid top-level domain and for 
+                               correct syntax of domain-literals. 
+
+  NOTE: Checking for a valid top-level domain is currently done by means of
+        a table which is hard-coded at the end of this file, and which might
+        possibly be outdated by the time you're reading this.
+
+Example:
+
+  $av = new Mj::Addr
+    (
+     allow_at_in_phrase          => 0,
+     allow_bang_paths            => 0,
+     allow_comments_after_route  => 0,
+     allow_ending_dot            => 0,
+     limit_length                => 1,
+     require_fqdn                => 1,
+     strict_domain_check         => 1,
+    );
+
 =cut
 sub new {
   my $type  = shift;
@@ -71,20 +109,12 @@
 
 =cut
 
-#$Mj::Addr::require_fqdn        = 1;
-#$Mj::Addr::strict_domain_check = 1;
-#$Mj::Addr::allow_ending_dot    = 0;
-#$Mj::Addr::allow_at_in_phrase  = 0;
-#$Mj::Addr::allow_bang_paths    = 1;
-#$Mj::Addr::allow_comments_after_route = 0;
-#$Mj::Addr::limit_length        = 1;
-
 sub validate {
   my $self  = shift;
   local($_) = shift;
   my $log = new Log::In 150, $_;
   my (@comment, @phrase, @route, @words, $angle, $bang_path, $comment,
-      $domain_literal, $i, $left_of_route, $lhs_length, $nest, $rhs_length,
+      $domain_literal, $i, $right_of_route, $lhs_length, $nest, $rhs_length,
       $on_rhs, $subdomain, $word);
 
   my $specials = q|()<>@,;:\".[]|;
@@ -283,18 +313,18 @@
       }
       if ($words[$i] =~ /^\>/) {
 	$angle--;
-	$left_of_route = 1;
+	$right_of_route = 1;
 	next;
       }
 
       # If in a bracketed section, specials are OK.
       next if $angle;
       
-      # If we're left of the route address, nothing is allowed to appear.
+      # If we're right of the route address, nothing is allowed to appear.
       # This is common, however, and is overrideable.
-      if (!$self->{'allow_comments_after_route'} && $left_of_route) {
+      if (!$self->{'allow_comments_after_route'} && $right_of_route) {
 	$::log->out("failed");
-	return (0, "Nothing is allowed to the left of an address in angle brackets.\n");
+	return (0, "Nothing is allowed to the right of an address in angle brackets.\n");
       }
 
       # We might be lenient and allow '@' in the phrase
@@ -336,7 +366,7 @@
   # We can bail out early if we have just a bang path
   if ($#words == 0 &&
       $self->{'allow_bang_paths'} &&
-      $words[0] =~ /[a-z]+\![a-z]+/i)
+      $words[0] =~ /[a-z0-9]\![a-z]/i)
     {
       $::log->out;
       return (1, $words[0], join(" ", @comment)||"");
@@ -380,7 +410,7 @@
 	$::log->out("failed");
 	return (0, "The user name exceeds 64 characters in length.\n");
       }
-      # Username components must lie betweem 038 and 0177.  (It's really
+      # Username components must lie betweem 040 and 0177.  (It's really
       # more complicated than that, but this will catch most of the
       # problems.)
       if ($words[$i] =~ /[^\040-\177]/) {



Follow-Ups:
Indexed By Date Previous: Re: Fake-ID
From: Jason L Tibbitts III <tibbs@hpc.uh.edu>
Next: Majordomo or formail register/confirm script? (123)
From: Nick Halloway <snowe@rain.org>
Indexed By Thread Previous: Re: Fake-ID
From: Norbert Bollow <nb@thinkcoach.com>
Next: Re: Some more minor fixes
From: Jason L Tibbitts III <tibbs@hpc.uh.edu>

Google
 
Search Internet Search www.greatcircle.com