[aur-dev] [PATCH] Store last login address as plain text
Directly store the information contained in $_SERVER['REMOTE_ADDR']
instead of using ip2long() which does not support IPv6 addresses. Note
that the LastLoginIPAddress field is designed to be used by the
administrator on rare occasions only (e.g. to fight spam) and is not
displayed anywhere.
Fixes FS#48557.
Signed-off-by: Lukas Fleischer
* Lukas Fleischer
- LastLoginIPAddress INTEGER UNSIGNED NOT NULL DEFAULT 0, + LastLoginIPAddress VARCHAR(40) NULL DEFAULT NULL,
VARCHAR(40) is too short, I think, see http://stackoverflow.com/q/166132/258127 According to Linux header files, the maximum length of an IPv6 address is 45 characters. Regards, Marcel
On Mon, 2016-03-14 at 10:12 +0100, Marcel Korpel wrote:
* Lukas Fleischer
(Sun, 13 Mar 2016 11:49:01 +0100): - LastLoginIPAddress INTEGER UNSIGNED NOT NULL DEFAULT 0, + LastLoginIPAddress VARCHAR(40) NULL DEFAULT NULL,
VARCHAR(40) is too short, I think, see http://stackoverflow.com/q/166132/258127
According to Linux header files, the maximum length of an IPv6 address is 45 characters.
Regards, Marcel
I'm not 100% sure how this actually stores the address, but if it's stored in its hex form, it can only be as large as 39 characters (4*8+7) making 40 characters more than enough. Mark Weiman
* Mark Weiman
On Mon, 2016-03-14 at 10:12 +0100, Marcel Korpel wrote:
VARCHAR(40) is too short, I think, see http://stackoverflow.com/q/166132/258127
According to Linux header files, the maximum length of an IPv6 address is 45 characters.
I'm not 100% sure how this actually stores the address, but if it's stored in its hex form, it can only be as large as 39 characters (4*8+7) making 40 characters more than enough.
Plain text: $q.= "LastLoginIPAddress = " . $dbh->quote($_SERVER['REMOTE_ADDR']) . " "; Anyway, consumer-wise it doesn't matter whether it's a VARCHAR(39) or VARCHAR(48), see https://dev.mysql.com/doc/refman/5.7/en/storage-requirements.html#idm1396904... Marcel
participants (3)
-
Lukas Fleischer
-
Marcel Korpel
-
Mark Weiman