dsoares / roundcube-lastlogin

Roundcube plugin to save and show user login information and login history.
GNU General Public License v3.0
16 stars 12 forks source link

DB Error with IPV6 #20

Closed CRtEurope closed 7 years ago

CRtEurope commented 7 years ago

The Default settings for mysql are: `ip varchar(2) NOT NULL DEFAULT '',`

After every login with an ipv6 address I get bunches of errors in the error.log. To change the varchar to 255 everything is perfect.

Please change it as follows:

-- MySQL/MariaDB initial database structure for lastlogin plugin.

/*!40014  SET FOREIGN_KEY_CHECKS=0 */;

-- Table structure for table `userlogins`

CREATE TABLE IF NOT EXISTS `userlogins` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `user_id` int(10) unsigned NOT NULL DEFAULT 0,
  `username` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
  `sess_id` varchar(128) NOT NULL DEFAULT '',
  `ip` varchar(255) NOT NULL DEFAULT '',
  `real_ip` varchar(20) NOT NULL DEFAULT '',
  `hostname` varchar(255) NOT NULL DEFAULT '',
  `geoloc` varchar(255) NOT NULL DEFAULT '',
  `tor` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  INDEX `user_id` (`user_id`)
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;

/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
dsoares commented 7 years ago

Hi, Thank you for pointing that! NOTE: before it was varchar(20) and not varchar(2) ;) Still, it was wrong and it did not support IPv6 addresses. Fixed for MySQL/MariaDB and PostgreSQL in release 0.1.9.