Major form improvements: - Custom SMTP/Sieve credentials (separate username/password per protocol) - Connection testing on save (IMAP, SMTP, Sieve) with localized errors - preconfig_only mode to restrict domains to preconfigured entries - Form POST value preservation on save errors (auth selects, passwords) - Smart host placeholders (SMTP/Sieve default to IMAP host) Security and bug: - Fix password re-encryption bug (was comparing raw vs encrypted values) - Fix XSS: escape label output in special folders form - Fix parse_url() return value not checked for false - Fix decrypt() failures not handled (fallback to empty string) - Sanitize log output (remove raw POST data from log messages) - Replace weak == comparisons with strict === (PHP and JS) SQL changes: - Consolidate 4 migrations (2026021000-03) into single 2026021000 - Remove now unused notify_sound_url column - Add smtp_username, smtp_password, sieve_username, sieve_password columns
85 lines
1.5 KiB
SQL
85 lines
1.5 KiB
SQL
CREATE TABLE IF NOT EXISTS `ident_switch`
|
|
(
|
|
`id`
|
|
int UNSIGNED
|
|
NOT NULL
|
|
AUTO_INCREMENT,
|
|
`user_id`
|
|
int UNSIGNED
|
|
NOT NULL,
|
|
`iid`
|
|
int UNSIGNED
|
|
NOT NULL
|
|
UNIQUE,
|
|
`username`
|
|
varchar(64),
|
|
`password`
|
|
varchar(255),
|
|
`imap_host`
|
|
varchar(64),
|
|
`imap_port`
|
|
int
|
|
CHECK(`imap_port` > 0 AND `imap_port` <= 65535),
|
|
`imap_delimiter`
|
|
char(1),
|
|
`label`
|
|
varchar(32),
|
|
`flags`
|
|
int
|
|
NOT NULL
|
|
DEFAULT 0,
|
|
`smtp_host`
|
|
varchar(64),
|
|
`smtp_port`
|
|
int
|
|
CHECK(`smtp_port` > 0 AND `smtp_port` <= 65535),
|
|
`smtp_auth`
|
|
smallint
|
|
NOT NULL
|
|
DEFAULT 1,
|
|
`smtp_username`
|
|
varchar(64),
|
|
`smtp_password`
|
|
varchar(255),
|
|
`sieve_host`
|
|
varchar(64),
|
|
`sieve_port`
|
|
int
|
|
CHECK(`sieve_port` > 0 AND `sieve_port` <= 65535),
|
|
`sieve_auth`
|
|
smallint
|
|
NOT NULL
|
|
DEFAULT 1,
|
|
`sieve_username`
|
|
varchar(64),
|
|
`sieve_password`
|
|
varchar(255),
|
|
`notify_check`
|
|
smallint
|
|
NOT NULL
|
|
DEFAULT 1,
|
|
`notify_basic`
|
|
smallint
|
|
DEFAULT NULL,
|
|
`notify_sound`
|
|
smallint
|
|
DEFAULT NULL,
|
|
`notify_desktop`
|
|
smallint
|
|
DEFAULT NULL,
|
|
`drafts_mbox`
|
|
varchar(64),
|
|
`sent_mbox`
|
|
varchar(64),
|
|
`junk_mbox`
|
|
varchar(64),
|
|
`trash_mbox`
|
|
varchar(64),
|
|
UNIQUE KEY `user_id_label` (`user_id`, `label`),
|
|
CONSTRAINT `fk_user_id` FOREIGN KEY (`user_id`) REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
CONSTRAINT `fk_identity_id` FOREIGN KEY (`iid`) REFERENCES `identities`(`identity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
PRIMARY KEY(`id`),
|
|
INDEX `IX_ident_switch_user_id`(`user_id`),
|
|
INDEX `IX_ident_switch_iid`(`iid`)
|
|
);
|