From: lpsolit%gmail.com <> Date: Tue, 21 Jun 2005 03:16:32 +0000 (+0000) Subject: Bug 297794: initBug's verification of user_id being an email is bogus - Patch by... X-Git-Tag: bugzilla-2.20rc1~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0dd1758b2b72126b67afc36ebb0bb9cc36628ab;p=thirdparty%2Fbugzilla.git Bug 297794: initBug's verification of user_id being an email is bogus - Patch by Tiago R. Mello r=LpSolit a=myk --- diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 7cfd1b3824..39864d252a 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -137,14 +137,14 @@ sub initBug { return $self; } -# default userid 0, or get DBID if you used an email address - unless (defined $user_id) { + # If the user is not logged in, sets $user_id to 0. + # Else gets $user_id from the user login name if this + # argument is not numeric. + my $stored_user_id = $user_id; + if (!defined $user_id) { $user_id = 0; - } - else { - if ($user_id =~ /^\@/) { - $user_id = login_to_id($user_id); - } + } elsif (!detaint_natural($user_id)) { + $user_id = login_to_id($stored_user_id); } $self->{'who'} = new Bugzilla::User($user_id);