summaryrefslogtreecommitdiffstats
path: root/globals.pl
diff options
context:
space:
mode:
authordave%intrec.com <>2001-03-20 06:03:52 +0100
committerdave%intrec.com <>2001-03-20 06:03:52 +0100
commit116bc99949d84e72184b3463aa7cc2748e578a71 (patch)
tree3bb34e4224d2e81cd7cd176849529f1e408bcf3c /globals.pl
parent74a9b1852f109c45ae03d430b761c5d57dd71556 (diff)
downloadbugzilla-116bc99949d84e72184b3463aa7cc2748e578a71.tar.gz
bugzilla-116bc99949d84e72184b3463aa7cc2748e578a71.tar.xz
Re-re-fix for bug 71550. This will quite likely fix a number of bugs in other places. The DBID<->Name conversion routines in globals.pl were not pushing/popping the SQL state around their SQL calls, which could result in lost data if called from inside a loop which is handling other SQL data.
Diffstat (limited to 'globals.pl')
-rw-r--r--globals.pl8
1 files changed, 8 insertions, 0 deletions
diff --git a/globals.pl b/globals.pl
index d112b0c8f..20f75debc 100644
--- a/globals.pl
+++ b/globals.pl
@@ -587,6 +587,7 @@ sub InsertNewUser {
}
my $usenewemailtech = Param('newemailtech') & Param('newemailtechdefault');
+ PushGlobalSQLState();
SendSQL("select bit, userregexp from groups where userregexp != ''");
my $groupset = "0";
while (MoreSQLData()) {
@@ -605,13 +606,16 @@ sub InsertNewUser {
$username = SqlQuote($username);
$realname = SqlQuote($realname);
SendSQL("insert into profiles (login_name, realname, password, cryptpassword, groupset, newemailtech) values ($username, $realname, '$password', encrypt('$password'), $groupset, $usenewemailtech)");
+ PopGlobalSQLState();
return $password;
}
sub DBID_to_real_or_loginname {
my ($id) = (@_);
+ PushGlobalSQLState();
SendSQL("SELECT login_name,realname FROM profiles WHERE userid = $id");
my ($l, $r) = FetchSQLData();
+ PopGlobalSQLState();
if (!defined $r || $r eq "") {
return $l;
} else {
@@ -622,8 +626,10 @@ sub DBID_to_real_or_loginname {
sub DBID_to_name {
my ($id) = (@_);
if (!defined $::cachedNameArray{$id}) {
+ PushGlobalSQLState();
SendSQL("select login_name from profiles where userid = $id");
my $r = FetchOneColumn();
+ PopGlobalSQLState();
if (!defined $r || $r eq "") {
$r = "__UNKNOWN__";
}
@@ -634,8 +640,10 @@ sub DBID_to_name {
sub DBname_to_id {
my ($name) = (@_);
+ PushGlobalSQLState();
SendSQL("select userid from profiles where login_name = @{[SqlQuote($name)]}");
my $r = FetchOneColumn();
+ PopGlobalSQLState();
if (!defined $r || $r eq "") {
return 0;
}