Skip to content

Commit e2171e0

Browse files
author
Shlomi Noach
committed
Validating password length
1 parent ed0fc1c commit e2171e0

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

go/logic/applier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func (this *Applier) CreateChangelogTable() error {
200200
id bigint auto_increment,
201201
last_update timestamp not null DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
202202
hint varchar(64) charset ascii not null,
203-
value varchar(255) charset ascii not null,
203+
value varchar(4096) charset ascii not null,
204204
primary key(id),
205205
unique key hint_uidx(hint)
206206
) auto_increment=256

go/logic/inspect.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ func (this *Inspector) inspectOriginalAndGhostTables() (err error) {
169169

170170
// validateConnection issues a simple can-connect to MySQL
171171
func (this *Inspector) validateConnection() error {
172+
if len(this.connectionConfig.Password) > mysql.MaxReplicationPasswordLength {
173+
return fmt.Errorf("MySQL replication length limited to 32 characters. See https://dev.mysql.com/doc/refman/5.7/en/assigning-passwords.html")
174+
}
172175
query := `select @@global.port, @@global.version`
173176
var port int
174177
if err := this.db.QueryRow(query).Scan(&port, &this.migrationContext.InspectorMySQLVersion); err != nil {

go/mysql/utils.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
)
1818

1919
const MaxTableNameLength = 64
20+
const MaxReplicationPasswordLength = 32
2021

2122
type ReplicationLagResult struct {
2223
Key InstanceKey

0 commit comments

Comments
 (0)