diff options
Diffstat (limited to 'Godeps/_workspace/src/github.com/go-sql-driver/mysql/utils.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/go-sql-driver/mysql/utils.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Godeps/_workspace/src/github.com/go-sql-driver/mysql/utils.go b/Godeps/_workspace/src/github.com/go-sql-driver/mysql/utils.go index 6693d2970..6a26ad129 100644 --- a/Godeps/_workspace/src/github.com/go-sql-driver/mysql/utils.go +++ b/Godeps/_workspace/src/github.com/go-sql-driver/mysql/utils.go @@ -80,8 +80,6 @@ func parseDSN(dsn string) (cfg *config, err error) { collation: defaultCollation, } - // TODO: use strings.IndexByte when we can depend on Go 1.2 - // [user[:password]@][net[(addr)]]/dbname[?param1=value1¶mN=valueN] // Find the last '/' (since the password or the net addr might contain a '/') foundSlash := false @@ -201,6 +199,14 @@ func parseDSNParams(cfg *config, params string) (err error) { return fmt.Errorf("Invalid Bool value: %s", value) } + // Use cleartext authentication mode (MySQL 5.5.10+) + case "allowCleartextPasswords": + var isBool bool + cfg.allowCleartextPasswords, isBool = readBool(value) + if !isBool { + return fmt.Errorf("Invalid Bool value: %s", value) + } + // Use old authentication mode (pre MySQL 4.1) case "allowOldPasswords": var isBool bool @@ -771,6 +777,10 @@ func skipLengthEncodedString(b []byte) (int, error) { // returns the number read, whether the value is NULL and the number of bytes read func readLengthEncodedInteger(b []byte) (uint64, bool, int) { + // See issue #349 + if len(b) == 0 { + return 0, true, 1 + } switch b[0] { // 251: NULL |