Skip to content

Commit 4177216

Browse files
committed
PR Feedback: Calling out the BLOB storage representation for ssl_cipher, x509_issuer, and x509_subject
1 parent 07071cb commit 4177216

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

sql/mysql_db/user.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,11 @@ func UserToRow(ctx *sql.Context, u *User) (sql.Row, error) {
7676
row[userTblColIndex_User_attributes] = *u.Attributes
7777
}
7878
row[userTblColIndex_ssl_type] = u.SslType
79-
row[userTblColIndex_ssl_cipher] = []uint8(u.SslCipher)
80-
row[userTblColIndex_x509_issuer] = []uint8(u.X509Issuer)
81-
row[userTblColIndex_x509_subject] = []uint8(u.X509Subject)
79+
// ssl_cipher, x509_issuer, x509_subject are all represented as BLOBs,
80+
// so we must return a byte slice instead of a string.
81+
row[userTblColIndex_ssl_cipher] = []byte(u.SslCipher)
82+
row[userTblColIndex_x509_issuer] = []byte(u.X509Issuer)
83+
row[userTblColIndex_x509_subject] = []byte(u.X509Subject)
8284

8385
u.privSetToRow(ctx, row)
8486
return row, nil
@@ -131,9 +133,9 @@ func UserFromRow(ctx *sql.Context, row sql.Row) (*User, error) {
131133
Identity: row[userTblColIndex_identity].(string),
132134
IsRole: false,
133135
SslType: sslType,
134-
SslCipher: string(row[userTblColIndex_ssl_cipher].([]uint8)),
135-
X509Issuer: string(row[userTblColIndex_x509_issuer].([]uint8)),
136-
X509Subject: string(row[userTblColIndex_x509_subject].([]uint8)),
136+
SslCipher: string(row[userTblColIndex_ssl_cipher].([]byte)),
137+
X509Issuer: string(row[userTblColIndex_x509_issuer].([]byte)),
138+
X509Subject: string(row[userTblColIndex_x509_subject].([]byte)),
137139
}, nil
138140
}
139141

0 commit comments

Comments
 (0)