Commit e70b77bb authored by tara%tequilarista.org's avatar tara%tequilarista.org

Landing Adam Spiers' contributions for security and small functional issues

parent 4e1c57ce
...@@ -276,6 +276,7 @@ List users with login name matching: ...@@ -276,6 +276,7 @@ List users with login name matching:
</SELECT> </SELECT>
<BR> <BR>
<INPUT TYPE=SUBMIT VALUE="Submit"> <INPUT TYPE=SUBMIT VALUE="Submit">
</FORM>
}; };
PutTrailer(); PutTrailer();
exit; exit;
......
...@@ -66,18 +66,27 @@ sub CrossCheck { ...@@ -66,18 +66,27 @@ sub CrossCheck {
} }
while (@_) { while (@_) {
my $ref = shift @_; my $ref = shift @_;
my $t2 = shift @$ref; my ($t2, $f2, $key2, $exceptions) = @$ref;
my $f2 = shift @$ref;
my %exceptions; $exceptions ||= [];
foreach my $v (@$ref) { my %exceptions = map { $_ => 1 } @$exceptions;
$exceptions{$v} = 1;
}
Status("... from $t2.$f2"); Status("... from $t2.$f2");
SendSQL("SELECT DISTINCT $f2 FROM $t2");
SendSQL("SELECT DISTINCT $f2" . ($key2 ? ", $key2" : '') ." FROM $t2");
while (MoreSQLData()) { while (MoreSQLData()) {
my $value = FetchOneColumn(); my ($value, $key) = FetchSQLData();
if (!$valid{$value} && !$exceptions{$value}) { if (!$valid{$value} && !$exceptions{$value}) {
Alert("Bad value $value found in $t2.$f2"); my $alert = "Bad value $value found in $t2.$f2";
if ($key2) {
if ($key2 eq 'bug_id') {
$alert .= qq{ (<a href="show_bug.cgi?id=$key">bug $key</a>)};
}
else {
$alert .= " ($key2 == '$key')";
}
Alert($alert);
}
} }
} }
} }
...@@ -128,14 +137,14 @@ CrossCheck("bugs", "bug_id", ...@@ -128,14 +137,14 @@ CrossCheck("bugs", "bug_id",
["keywords", "bug_id"]); ["keywords", "bug_id"]);
CrossCheck("profiles", "userid", CrossCheck("profiles", "userid",
["bugs", "reporter"], ["bugs", "reporter", "bug_id"],
["bugs", "assigned_to"], ["bugs", "assigned_to", "bug_id"],
["bugs", "qa_contact", 0], ["bugs", "qa_contact", "bug_id", ["0"]],
["attachments", "submitter_id"], ["attachments", "submitter_id", "bug_id"],
["bugs_activity", "who"], ["bugs_activity", "who", "bug_id"],
["cc", "who"], ["cc", "who", "bug_id"],
["votes", "who"], ["votes", "who", "bug_id"],
["longdescs", "who"], ["longdescs", "who", "bug_id"],
["namedqueries", "userid"]); ["namedqueries", "userid"]);
...@@ -237,9 +246,9 @@ foreach my $ref (@checklist) { ...@@ -237,9 +246,9 @@ foreach my $ref (@checklist) {
Status("Checking profile logins"); Status("Checking profile logins");
my $emailregexp = Param("emailregexp"); my $emailregexp = Param("emailregexp");
$emailregexp =~ s/'/\\'/g;
SendSQL("SELECT userid, login_name FROM profiles " . SendSQL("SELECT userid, login_name FROM profiles " .
"WHERE login_name NOT REGEXP " . SqlQuote($emailregexp)); "WHERE login_name NOT REGEXP '" . $emailregexp . "'");
while (my ($id,$email) = (FetchSQLData())) { while (my ($id,$email) = (FetchSQLData())) {
......
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