ソースを参照

fix bug in subscribing via postmaster

Pi 1 年間 前
コミット
feaabf2df2
1 ファイル変更56 行追加60 行削除
  1. 56 60
      filters/postmaster@localhost

+ 56 - 60
filters/postmaster@localhost

@@ -10,6 +10,19 @@ foreach (tolower $ADDR) =~ /^$POSTMASTERREGEX|$ANYGROUPREGEX$/
    elsif (/^X\-GROUP:\s*($ANYGROUPREGEX)\s*$/)
    {
       MAILGROUP=$MATCH1
+      if (/^Subject:\s*\[SIGNUP\]\s*$/)
+      {
+         TOPOSTMASTER=1
+         if (/^X\-GROUP\-ALIAS:\s*(.*)\s*$/)
+         {
+            MAILGROUPALIAS=$MATCH1
+            if (/^X-MEMBER-ALIAS:\s*(.+)\s*$/)
+            {
+               ALIAS=$MATCH1
+               CONTINUE=1
+            }
+         }
+      }
    }
    if ($MAILGROUP ne "")
    {
@@ -20,80 +33,63 @@ foreach (tolower $ADDR) =~ /^$POSTMASTERREGEX|$ANYGROUPREGEX$/
          SUBSCRIBE=$MATCH1
          CONTINUE=1
       }
-      if (/^Subject:\s*\[SIGNUP\]\s*$/)
-      {
-         TOPOSTMASTER=1
-         if (/^X\-GROUP\-ALIAS:\s*(.*)\s*$/)
-         {
-            MAILGROUPALIAS=$MATCH1
-            CONTINUE=1
-         }
-      }
    }
 }
 if ($FORWARD)
 {
-   if (/^X-MEMBER-ALIAS:\s*(.+)\s*$/)
+   gdbmopen($MLIST, "C")
+   SUFFIX=0
+   KEY=$ALIAS
+   EXISTS=gdbmfetch($KEY)
+   while ($EXISTS ne "" && $EXISTS ne tolower($FROM))
    {
-      gdbmopen($MLIST, "C")
-      SUFFIX=0
-      ALIAS=$MATCH1
-      KEY=$ALIAS
+      SUFFIX=($SUFFIX + 1)
+      KEY="$ALIAS $SUFFIX"
       EXISTS=gdbmfetch($KEY)
-      while ($EXISTS ne "" && $EXISTS ne tolower($FROM))
+   }
+   if (gdbmstore(tolower($FROM), $KEY) == 0 && gdbmstore($KEY, tolower($FROM)) == 0)
+   {
+      gdbmclose
+      SLIST="$LISTDIR/alist"
+      gdbmopen($SLIST, "C")
+      if (/^X-AUTH:\s(.+)\s*$/)
       {
-         SUFFIX=($SUFFIX + 1)
-         KEY="$ALIAS $SUFFIX"
-         EXISTS=gdbmfetch($KEY)
+         AUTH=$MATCH1
       }
-      if (gdbmstore(tolower($FROM), $KEY) == 0 && gdbmstore($KEY, tolower($FROM)) == 0)
+      else
       {
-         gdbmclose
-         SLIST="$LISTDIR/alist"
-         gdbmopen($SLIST, "C")
-         if (/^X-AUTH:\s(.+)\s*$/)
-         {
-            AUTH=$MATCH1
-         }
-         else
-         {
-            AUTH="NONE"
-         }
-         if (gdbmstore(tolower($FROM), "$AUTH"))
-         {
-            gdbmclose
-            EXITCODE=$FATAL
-            cc "|$DEBUGMAIL 'auth-store-fail'"
-            exit
-         }
-         if ($AUTH ne "NONE")
-         {
-            SUBSCRIBE="SUBSCRIBE"
-         }
-         else
-         {
-            SUBSCRIBE="UNSUBSCRIBE"
-         }
-         system "$SUBUNSUB '$SUBSCRIBE' '$KEY' '$FROM'"
-         if ($EXITCODE)
-         {
-            cc "|$DEBUGMAIL 'auth-sub-fail'"
-            exit
-         }
-         gdbmclose
-         RESP=$SIGNUPRESP
-         to "|$MAILBOT"
+         AUTH="NONE"
       }
-      else
+      if (gdbmstore(tolower($FROM), "$AUTH"))
       {
          gdbmclose
          EXITCODE=$FATAL
-         cc "|$DEBUGMAIL '$MLSIT-store-fail'"
+         cc "|$DEBUGMAIL 'auth-store-fail'"
          exit
       }
+      if ($AUTH ne "NONE")
+      {
+         SUBSCRIBE="SUBSCRIBE"
+      }
+      else
+      {
+         SUBSCRIBE="UNSUBSCRIBE"
+      }
+      system "$SUBUNSUB '$SUBSCRIBE' '$KEY' '$FROM'"
+      if ($EXITCODE)
+      {
+         cc "|$DEBUGMAIL 'auth-sub-fail'"
+         exit
+      }
+      gdbmclose
+      RESP=$SIGNUPRESP
+      to "|$MAILBOT"
+   }
+   else
+   {
+      gdbmclose
+      EXITCODE=$FATAL
+      cc "|$DEBUGMAIL '$MLSIT-store-fail'"
+      exit
    }
-   EXITCODE=$BADREQUEST
-   cc "|${DEBUGMAIL} signup-fail"
-   # No response to unregistered users
-   exit
 }