Commit bd5461ab authored by bugreport%peshkin.net's avatar bugreport%peshkin.net

Second installment of Bug 179260 Unknown table 'map_assigned_to' in order clause…

Second installment of Bug 179260 Unknown table 'map_assigned_to' in order clause at globals.pl line 242 r=bbaetz a=justdave
parent 15767ab7
...@@ -528,12 +528,6 @@ if ($order) { ...@@ -528,12 +528,6 @@ if ($order) {
else { else {
ThrowCodeError("invalid_column_name_form"); ThrowCodeError("invalid_column_name_form");
} }
} elsif (!grep($fragment =~ /^\Q$_\E(\s+(asc|desc))?$/, @selectnames)) {
# Add order columns to selectnames
# The fragment has already been validated
$fragment =~ s/\s+(asc|desc)$//;
trick_taint($fragment);
push @selectnames, $fragment;
} }
} }
# Now that we have checked that all columns in the order are valid, # Now that we have checked that all columns in the order are valid,
...@@ -560,6 +554,16 @@ if ($order) { ...@@ -560,6 +554,16 @@ if ($order) {
# DEFAULT # DEFAULT
$order = "bugs.bug_status, bugs.priority, map_assigned_to.login_name, bugs.bug_id"; $order = "bugs.bug_status, bugs.priority, map_assigned_to.login_name, bugs.bug_id";
} }
foreach my $fragment (split(/,/, $order)) {
$fragment = trim($fragment);
if (!grep($fragment =~ /^\Q$_\E(\s+(asc|desc))?$/, @selectnames)) {
# Add order columns to selectnames
# The fragment has already been validated
$fragment =~ s/\s+(asc|desc)$//;
$fragment =~ tr/a-zA-Z\.0-9\-_//cd;
push @selectnames, $fragment;
}
}
$db_order = $order; # Copy $order into $db_order for use with SQL query $db_order = $order; # Copy $order into $db_order for use with SQL query
......
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