summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-08-24 17:29:48 +0200
committerByron Jones <glob@mozilla.com>2015-08-24 17:29:48 +0200
commit24e4c03268aa627947f73703f4c283b9b8087d5e (patch)
treed395fec33b34f10141c2c82b512afc51e8e92a3d /Bugzilla
parent57f911c45c2d1a434243633b4b178a8775597593 (diff)
downloadbugzilla-24e4c03268aa627947f73703f4c283b9b8087d5e.tar.gz
bugzilla-24e4c03268aa627947f73703f4c283b9b8087d5e.tar.xz
Bug 1197699 - always store the ip address in the logincookies table (schema only)
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/DB/Schema.pm1
-rw-r--r--Bugzilla/Install/DB.pm11
2 files changed, 12 insertions, 0 deletions
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index dbcffac7c..49ee0ff96 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -1146,6 +1146,7 @@ use constant ABSTRACT_SCHEMA => {
ipaddr => {TYPE => 'varchar(40)'},
lastused => {TYPE => 'DATETIME', NOTNULL => 1},
id => {TYPE => 'INTSERIAL', NOTNULL => 1, PRIMARYKEY => 1},
+ restrict_ipaddr => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0},
],
INDEXES => [
logincookies_lastused_idx => ['lastused'],
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index ce148d62d..5b8cc3992 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -745,6 +745,8 @@ sub update_table_definitions {
$dbh->bz_add_column('user_api_keys', 'last_used_ip',
{TYPE => 'varchar(40)'});
+ _add_restrict_ipaddr();
+
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
@@ -3865,6 +3867,15 @@ sub _fix_disable_mail {
Bugzilla->dbh->do("UPDATE profiles SET disable_mail = 1 WHERE is_enabled = 0");
}
+sub _add_restrict_ipaddr {
+ my $dbh = Bugzilla->dbh;
+ return if $dbh->bz_column_info('logincookies', 'restrict_ipaddr');
+
+ $dbh->bz_add_column('logincookies', 'restrict_ipaddr',
+ {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0});
+ $dbh->do("UPDATE logincookies SET restrict_ipaddr = 1 WHERE ipaddr IS NOT NULL");
+}
+
1;
__END__