Commit 4e1d3f43 authored by Robert Anderson's avatar Robert Anderson
Browse files

Fix use of signed vs unsigned numerics



Replaced the incorrect use of @BIG_INTEGER@ variable which
implied that the numerical value would be signed (default
in at least MySQL).

Note: PostgreSQL does not support signed/unsigned numerics,
INT8 has been kept for this reason.

Change-Id: Ic9087eba040967b1a6790e31dae4cf2460a5cfe0
Signed-off-by: default avatarRobert Anderson <randerson@lbsd.net>
parent 28191505
......@@ -31,13 +31,13 @@ CREATE TABLE checkhelo (
/* Blacklisting, we want to reject people impersonating us */
UseBlacklist SMALLINT, /* Checks blacklist table */
BlacklistPeriod @BIG_INTEGER@, /* Period to keep the host blacklisted for, if not set or 0
BlacklistPeriod @BIG_INTEGER_UNSIGNED@, /* Period to keep the host blacklisted for, if not set or 0
the check will be live */
/* Random helo prevention */
UseHRP SMALLINT, /* Use helo randomization prevention */
HRPPeriod @BIG_INTEGER@, /* Period/window we check for random helo's */
HRPLimit @BIG_INTEGER@, /* Our limit for the number of helo's is this */
HRPPeriod @BIG_INTEGER_UNSIGNED@, /* Period/window we check for random helo's */
HRPLimit @BIG_INTEGER_UNSIGNED@, /* Our limit for the number of helo's is this */
/* RFC compliance options */
RejectInvalid SMALLINT, /* Reject invalid HELO */
......@@ -100,7 +100,7 @@ CREATE TABLE checkhelo_whitelist (
CREATE TABLE checkhelo_tracking (
Address VARCHAR(64) NOT NULL,
Helo VARCHAR(255) NOT NULL,
LastUpdate @BIG_INTEGER@ NOT NULL,
LastUpdate @BIG_INTEGER_UNSIGNED@ NOT NULL,
UNIQUE (Address,Helo)
) @CREATE_TABLE_SUFFIX@;
......
......@@ -60,7 +60,7 @@ case "$database" in
-e 's/@POSTLOAD@/SET FOREIGN_KEY_CHECKS=1;/' \
-e 's/@CREATE_TABLE_SUFFIX@/ENGINE=InnoDB CHARACTER SET latin1 COLLATE latin1_bin/' \
-e 's/@SERIAL_TYPE@/SERIAL/' \
-e 's/@BIGINT_UNSIGNED@/BIGINT UNSIGNED/' \
-e 's/@BIG_INTEGER_UNSIGNED@/BIGINT UNSIGNED/' \
-e 's/@INT_UNSIGNED@/INT UNSIGNED/' \
-e 's/@TRACK_KEY_LEN@/512/' \
-e 's/@SERIAL_REF_TYPE@/BIGINT UNSIGNED/' < "$file"
......@@ -72,7 +72,7 @@ case "$database" in
-e 's/@POSTLOAD@/SET FOREIGN_KEY_CHECKS=1;/' \
-e 's/@CREATE_TABLE_SUFFIX@/TYPE=InnoDB CHARACTER SET latin1 COLLATE latin1_bin/' \
-e 's/@SERIAL_TYPE@/SERIAL/' \
-e 's/@BIG_INTEGER@/BIGINT UNSIGNED/' \
-e 's/@BIG_INTEGER_UNSIGNED@/BIGINT UNSIGNED/' \
-e 's/@TRACK_KEY_LEN@/255/' \
-e 's/@SERIAL_REF_TYPE@/BIGINT UNSIGNED/' < "$file"
;;
......@@ -83,7 +83,7 @@ case "$database" in
-e 's/@POSTLOAD@/SET FOREIGN_KEY_CHECKS=1;/' \
-e 's/@CREATE_TABLE_SUFFIX@/TYPE=InnoDB CHARACTER SET latin1 COLLATE latin1_bin/' \
-e 's/@SERIAL_TYPE@/SERIAL/' \
-e 's/@BIG_INTEGER@/BIGINT UNSIGNED/' \
-e 's/@BIG_INTEGER_UNSIGNED@/BIGINT UNSIGNED/' \
-e 's/@TRACK_KEY_LEN@/512/' \
-e 's/@SERIAL_REF_TYPE@/BIGINT UNSIGNED/' < "$file"
;;
......@@ -94,7 +94,7 @@ case "$database" in
-e 's/@POSTLOAD@//' \
-e 's/@CREATE_TABLE_SUFFIX@//' \
-e 's/@SERIAL_TYPE@/SERIAL PRIMARY KEY/' \
-e 's/@BIG_INTEGER@/INT8/' \
-e 's/@BIG_INTEGER_UNSIGNED@/INT8/' \
-e 's/@TRACK_KEY_LEN@/512/' \
-e 's/@SERIAL_REF_TYPE@/INT8/' < "$file"
;;
......@@ -105,7 +105,7 @@ case "$database" in
-e 's/@POSTLOAD@//' \
-e 's/@CREATE_TABLE_SUFFIX@//' \
-e 's/@SERIAL_TYPE@/INTEGER PRIMARY KEY AUTOINCREMENT/' \
-e 's/@BIG_INTEGER@/INT8/' \
-e 's/@BIG_INTEGER_UNSIGNED@/UNSIGNED BIG INT/' \
-e 's/@TRACK_KEY_LEN@/512/' \
-e 's/@SERIAL_REF_TYPE@/INT8/' < "$file"
;;
......
......@@ -160,7 +160,7 @@ CREATE TABLE session_tracking (
Sender VARCHAR(255),
Size @BIG_INTEGER@,
Size @BIG_INTEGER_UNSIGNED@,
RecipientData TEXT, /* Policy state information */
......
......@@ -31,7 +31,7 @@ CREATE TABLE greylisting (
/* General greylisting settings */
UseGreylisting SMALLINT, /* Actually use greylisting */
GreylistPeriod @BIG_INTEGER@, /* Period in seconds to greylist for */
GreylistPeriod @BIG_INTEGER_UNSIGNED@, /* Period in seconds to greylist for */
/* Record tracking */
Track VARCHAR(255) NOT NULL, /* Format: <type>:<spec>
......@@ -39,24 +39,24 @@ CREATE TABLE greylisting (
*/
/* Bypass greylisting: sender+recipient level */
GreylistAuthValidity @BIG_INTEGER@, /* Period for which last authenticated greylist entry is valid for.
GreylistAuthValidity @BIG_INTEGER_UNSIGNED@, /* Period for which last authenticated greylist entry is valid for.
This effectively bypasses greylisting for the second email a sender
sends a recipient. */
GreylistUnAuthValidity @BIG_INTEGER@, /* Same as above but for unauthenticated entries */
GreylistUnAuthValidity @BIG_INTEGER_UNSIGNED@, /* Same as above but for unauthenticated entries */
/* Auto-whitelisting: sending server level */
UseAutoWhitelist SMALLINT, /* Use auto-whitelisting */
AutoWhitelistPeriod @BIG_INTEGER@, /* Period to look back to find authenticated triplets */
AutoWhitelistCount @BIG_INTEGER@, /* Count of authenticated triplets after which we auto-whitelist */
AutoWhitelistPercentage @BIG_INTEGER@, /* Percentage of at least Count triplets that must be authenticated
AutoWhitelistPeriod @BIG_INTEGER_UNSIGNED@, /* Period to look back to find authenticated triplets */
AutoWhitelistCount @BIG_INTEGER_UNSIGNED@, /* Count of authenticated triplets after which we auto-whitelist */
AutoWhitelistPercentage @BIG_INTEGER_UNSIGNED@, /* Percentage of at least Count triplets that must be authenticated
before auto-whitelisting. This changes the behaviour or Count */
/* Auto-blacklisting: sending server level */
UseAutoBlacklist SMALLINT, /* Use auto-blacklisting */
AutoBlacklistPeriod @BIG_INTEGER@, /* Period to look back to find unauthenticated triplets */
AutoBlacklistCount @BIG_INTEGER@, /* Count of authenticated triplets after which we auto-whitelist */
AutoBlacklistPercentage @BIG_INTEGER@, /* Percentage of at least Count triplets that must be authenticated
AutoBlacklistPeriod @BIG_INTEGER_UNSIGNED@, /* Period to look back to find unauthenticated triplets */
AutoBlacklistCount @BIG_INTEGER_UNSIGNED@, /* Count of authenticated triplets after which we auto-whitelist */
AutoBlacklistPercentage @BIG_INTEGER_UNSIGNED@, /* Percentage of at least Count triplets that must be authenticated
before auto-whitelisting. This changes the behaviour or Count */
Comment VARCHAR(1024),
......@@ -88,8 +88,8 @@ CREATE TABLE greylisting_autowhitelist (
TrackKey VARCHAR(@TRACK_KEY_LEN@) NOT NULL,
Added @BIG_INTEGER@ NOT NULL,
LastSeen @BIG_INTEGER@ NOT NULL,
Added @BIG_INTEGER_UNSIGNED@ NOT NULL,
LastSeen @BIG_INTEGER_UNSIGNED@ NOT NULL,
Comment VARCHAR(1024),
......@@ -104,7 +104,7 @@ CREATE TABLE greylisting_autoblacklist (
TrackKey VARCHAR(@TRACK_KEY_LEN@) NOT NULL,
Added @BIG_INTEGER@ NOT NULL,
Added @BIG_INTEGER_UNSIGNED@ NOT NULL,
Comment VARCHAR(1024),
......@@ -120,11 +120,11 @@ CREATE TABLE greylisting_tracking (
Sender VARCHAR(255) NOT NULL,
Recipient VARCHAR(255) NOT NULL,
FirstSeen @BIG_INTEGER@ NOT NULL,
LastUpdate @BIG_INTEGER@ NOT NULL,
FirstSeen @BIG_INTEGER_UNSIGNED@ NOT NULL,
LastUpdate @BIG_INTEGER_UNSIGNED@ NOT NULL,
Tries @BIG_INTEGER@ NOT NULL, /* Authentication tries */
Count @BIG_INTEGER@ NOT NULL, /* Authenticated count */
Tries @BIG_INTEGER_UNSIGNED@ NOT NULL, /* Authentication tries */
Count @BIG_INTEGER_UNSIGNED@ NOT NULL, /* Authenticated count */
UNIQUE(TrackKey,Sender,Recipient)
) @CREATE_TABLE_SUFFIX@;
......
......@@ -35,7 +35,7 @@ CREATE TABLE quotas (
*/
/* Period over which this policy is valid, this is in seconds */
Period @BIG_INTEGER@,
Period @BIG_INTEGER_UNSIGNED@,
Verdict VARCHAR(255),
Data TEXT,
......@@ -57,7 +57,7 @@ CREATE TABLE quotas_limits (
QuotasID @SERIAL_REF_TYPE@,
Type VARCHAR(255), /* "MessageCount" or "MessageCumulativeSize" */
CounterLimit @BIG_INTEGER@,
CounterLimit @BIG_INTEGER_UNSIGNED@,
Comment VARCHAR(1024),
......@@ -77,7 +77,7 @@ CREATE TABLE quotas_tracking (
TrackKey VARCHAR(@TRACK_KEY_LEN@),
/* Last time this record was update */
LastUpdate @BIG_INTEGER@, /* NULL means not updated yet */
LastUpdate @BIG_INTEGER_UNSIGNED@, /* NULL means not updated yet */
Counter NUMERIC(10,4),
......
Supports Markdown
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