From: Florent Bruneau Date: Thu, 24 Feb 2011 20:26:17 +0000 (+0100) Subject: Fix the 'Norbert Bug'. X-Git-Tag: xorg/1.1.0~1^2~3 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=6876570a57daa0ae5c43cfda0a4edfb039b241c0;hp=91b9255bf67fa0f9d7093a9930d20a5327972270;p=platal.git Fix the 'Norbert Bug'. 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 --- diff --git a/bin/lists.rpc.py b/bin/lists.rpc.py index 56067ba..e006547 100755 --- a/bin/lists.rpc.py +++ b/bin/lists.rpc.py @@ -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: diff --git a/include/validations/listes.inc.php b/include/validations/listes.inc.php index a32ad10..c44b645 100644 --- a/include/validations/listes.inc.php +++ b/include/validations/listes.inc.php @@ -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;