Fix the 'Norbert Bug'.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 24 Feb 2011 20:26:17 +0000 (21:26 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 24 Feb 2011 20:33:49 +0000 (21:33 +0100)
This bug had two sources:
 - The first source is the fact that we passed a string instead of a list
   as the members argument of mass_subscribe

 - The second source is the fact that python is a stupid languages and
   iterating on a string works, it just enumerates the string character
   per character.

Our founders attributed themselves one-letter email aliases(like 'n' for
Norbert L. and 'y' for Yann B.) and as soon as a list created through the
validation process contained an email with a 'n' (this happen quite often
when the email contains polytechnique), the enumeration of the string
triggered the subscription of 'n@polytechnique.org'.

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
bin/lists.rpc.py
include/validations/listes.inc.php

index 56067ba..e006547 100755 (executable)
@@ -464,6 +464,8 @@ def mass_subscribe(userdesc, perms, mlist, users):
             @edit
             @admin
     """
+    if not isinstance(users, list):
+        raise Exception("userlist must be a list")
     members = mlist.getRegularMemberKeys()
     added = []
     for user in users:
index a32ad10..c44b645 100644 (file)
@@ -160,7 +160,6 @@ class ListeReq extends Validate
                 XDB::execute('INSERT INTO virtual_redirect (vid, redirect)
                                         VALUES ({?}, {?})', XDB::insertId(),
                                        $red . $mdir . '@listes.polytechnique.org');
-                $list->mass_subscribe($liste, join(' ', $this->members));
             }
         }
         return $ret;