Commit 1e68fe1e authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 349766: Use of uninitialized value in pattern match (m//) at editusers.cgi…

Bug 349766: Use of uninitialized value in pattern match (m//) at editusers.cgi line 270 - Patch by Frédéric Buclin <LpSolit@gmail.com> r=kevin.benton a=myk
parent 9fd592ef
...@@ -195,7 +195,7 @@ if ($action eq 'search') { ...@@ -195,7 +195,7 @@ if ($action eq 'search') {
my $password = $cgi->param('password'); my $password = $cgi->param('password');
my $realname = trim($cgi->param('name') || ''); my $realname = trim($cgi->param('name') || '');
my $disabledtext = trim($cgi->param('disabledtext') || ''); my $disabledtext = trim($cgi->param('disabledtext') || '');
my $disable_mail = $cgi->param('disable_mail') =~ /^(0|1)$/ ? $1 : 0; my $disable_mail = $cgi->param('disable_mail') ? 1 : 0;
# Lock tables during the check+creation session. # Lock tables during the check+creation session.
$dbh->bz_lock_tables('profiles WRITE', 'profiles_activity WRITE', $dbh->bz_lock_tables('profiles WRITE', 'profiles_activity WRITE',
...@@ -235,7 +235,6 @@ if ($action eq 'search') { ...@@ -235,7 +235,6 @@ if ($action eq 'search') {
} elsif ($action eq 'update') { } elsif ($action eq 'update') {
my $otherUser = check_user($otherUserID, $otherUserLogin); my $otherUser = check_user($otherUserID, $otherUserLogin);
$otherUserID = $otherUser->id; $otherUserID = $otherUser->id;
my $oldprofile = new Bugzilla::User($otherUserID);
my $logoutNeeded = 0; my $logoutNeeded = 0;
my @changedFields; my @changedFields;
...@@ -256,25 +255,18 @@ if ($action eq 'search') { ...@@ -256,25 +255,18 @@ if ($action eq 'search') {
action => "modify", action => "modify",
object => "user"}); object => "user"});
# Cleanups
my $loginold = $cgi->param('loginold') || '';
my $realnameold = $cgi->param('nameold') || '';
my $disabledtextold = $cgi->param('disabledtextold') || '';
my $disable_mail_old = $cgi->param('disable_mail_old') =~ /^(0|1)$/ ?
$1 : $oldprofile->email_disabled;
my $login = $cgi->param('login'); my $login = $cgi->param('login');
my $password = $cgi->param('password'); my $password = $cgi->param('password');
my $realname = trim($cgi->param('name') || ''); my $realname = trim($cgi->param('name') || '');
my $disabledtext = trim($cgi->param('disabledtext') || ''); my $disabledtext = trim($cgi->param('disabledtext') || '');
my $disable_mail = $cgi->param('disable_mail') =~ /^(0|1)$/ ? $1 : 0; my $disable_mail = $cgi->param('disable_mail') ? 1 : 0;
# Update profiles table entry; silently skip doing this if the user # Update profiles table entry; silently skip doing this if the user
# is not authorized. # is not authorized.
if ($editusers) { if ($editusers) {
my @values; my @values;
if ($login ne $loginold) { if ($login ne $otherUser->login) {
# Validate, then trick_taint. # Validate, then trick_taint.
$login || ThrowUserError('user_login_required'); $login || ThrowUserError('user_login_required');
validate_email_syntax($login) validate_email_syntax($login)
...@@ -290,7 +282,7 @@ if ($action eq 'search') { ...@@ -290,7 +282,7 @@ if ($action eq 'search') {
# Since we change the login, silently delete any tokens. # Since we change the login, silently delete any tokens.
$dbh->do('DELETE FROM tokens WHERE userid = ?', {}, $otherUserID); $dbh->do('DELETE FROM tokens WHERE userid = ?', {}, $otherUserID);
} }
if ($realname ne $realnameold) { if ($realname ne $otherUser->name) {
# The real name may be anything; we use a placeholder for our # The real name may be anything; we use a placeholder for our
# INSERT, and we rely on displaying code to FILTER html. # INSERT, and we rely on displaying code to FILTER html.
trick_taint($realname); trick_taint($realname);
...@@ -305,7 +297,7 @@ if ($action eq 'search') { ...@@ -305,7 +297,7 @@ if ($action eq 'search') {
push(@values, bz_crypt($password)); push(@values, bz_crypt($password));
$logoutNeeded = 1; $logoutNeeded = 1;
} }
if ($disabledtext ne $disabledtextold) { if ($disabledtext ne $otherUser->disabledtext) {
# The disable text may be anything; we use a placeholder for our # The disable text may be anything; we use a placeholder for our
# INSERT, and we rely on displaying code to FILTER html. # INSERT, and we rely on displaying code to FILTER html.
trick_taint($disabledtext); trick_taint($disabledtext);
...@@ -313,7 +305,7 @@ if ($action eq 'search') { ...@@ -313,7 +305,7 @@ if ($action eq 'search') {
push(@values, $disabledtext); push(@values, $disabledtext);
$logoutNeeded = 1; $logoutNeeded = 1;
} }
if ($disable_mail != $disable_mail_old) { if ($disable_mail != $otherUser->email_disabled) {
trick_taint($disable_mail); trick_taint($disable_mail);
push(@changedFields, 'disable_mail'); push(@changedFields, 'disable_mail');
push(@values, $disable_mail); push(@values, $disable_mail);
...@@ -419,7 +411,7 @@ if ($action eq 'search') { ...@@ -419,7 +411,7 @@ if ($action eq 'search') {
userDataToVars($otherUserID); userDataToVars($otherUserID);
$vars->{'message'} = 'account_updated'; $vars->{'message'} = 'account_updated';
$vars->{'loginold'} = $loginold; $vars->{'loginold'} = $otherUser->login;
$vars->{'changed_fields'} = \@changedFields; $vars->{'changed_fields'} = \@changedFields;
$vars->{'groups_added_to'} = \@groupsAddedTo; $vars->{'groups_added_to'} = \@groupsAddedTo;
$vars->{'groups_removed_from'} = \@groupsRemovedFrom; $vars->{'groups_removed_from'} = \@groupsRemovedFrom;
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
<input size="64" maxlength="255" name="login" <input size="64" maxlength="255" name="login"
id="login" value="[% otheruser.login FILTER html %]" /> id="login" value="[% otheruser.login FILTER html %]" />
[% IF editform %] [% IF editform %]
<input type="hidden" name="loginold"
value="[% otheruser.login FILTER html %]" />
[% IF !otheruser.groups.bz_sudo_protect %] [% IF !otheruser.groups.bz_sudo_protect %]
<br /> <br />
<a href="relogin.cgi?action=prepare-sudo&amp;target_login= <a href="relogin.cgi?action=prepare-sudo&amp;target_login=
...@@ -48,10 +46,6 @@ ...@@ -48,10 +46,6 @@
<input size="64" maxlength="255" name="name" <input size="64" maxlength="255" name="name"
autocomplete="off" autocomplete="off"
id="name" value="[% otheruser.name FILTER html %]" /> id="name" value="[% otheruser.name FILTER html %]" />
[% IF editform %]
<input type="hidden" name="nameold"
value="[% otheruser.name FILTER html %]" />
[% END %]
[% ELSE %] [% ELSE %]
[% otheruser.name FILTER html %] [% otheruser.name FILTER html %]
[% END %] [% END %]
...@@ -76,15 +70,6 @@ ...@@ -76,15 +70,6 @@
[% IF otheruser.email_disabled %] checked="checked" [% END %] /> [% IF otheruser.email_disabled %] checked="checked" [% END %] />
(This affects bugmail and whinemail, not password-reset or other (This affects bugmail and whinemail, not password-reset or other
non-bug-related emails) non-bug-related emails)
[% IF editform %]
<input type="hidden" name="disable_mail_old"
[% IF otheruser.email_disabled %]
value="1"
[% ELSE %]
value="0"
[% END %]
/>
[% END %]
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -101,10 +86,6 @@ ...@@ -101,10 +86,6 @@
%]<br> %]<br>
(If non-empty, then the account will be disabled, and this text should (If non-empty, then the account will be disabled, and this text should
explain why.) explain why.)
[% IF editform %]
<input type="hidden" name="disabledtextold"
value="[% otheruser.disabledtext FILTER html %]" />
[% END %]
</td> </td>
</tr> </tr>
[% END %] [% END %]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment