File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ Aaron Hopkins <go-sql-driver at die.net>
15
15
Arne Hormann <arnehormann at gmail.com>
16
16
Carlos Nieto <jose.carlos at menteslibres.net>
17
17
Chris Moos <chris at tech9computers.com>
18
+ Daniël van Eeden <daniel.van.eeden at myname.nl>
18
19
DisposaBoy <disposaboy at dby.me>
19
20
Frederick Mayle <frederickmayle at gmail.com>
20
21
Gustavo Kristic <gkristic at gmail.com>
Original file line number Diff line number Diff line change @@ -214,6 +214,7 @@ func (mc *mysqlConn) writeAuthPacket(cipher []byte) error {
214
214
clientLongPassword |
215
215
clientTransactions |
216
216
clientLocalFiles |
217
+ clientConnectAttrs |
217
218
mc .flags & clientLongFlag
218
219
219
220
if mc .cfg .clientFoundRows {
@@ -228,7 +229,12 @@ func (mc *mysqlConn) writeAuthPacket(cipher []byte) error {
228
229
// User Password
229
230
scrambleBuff := scramblePassword (cipher , []byte (mc .cfg .passwd ))
230
231
232
+ attrname := []byte ("_client_name" )
233
+ attrvalue := []byte ("Go MySQL Driver" )
234
+ attrlen := len (attrname ) + len (attrvalue ) + 2
235
+
231
236
pktLen := 4 + 4 + 1 + 23 + len (mc .cfg .user ) + 1 + 1 + len (scrambleBuff )
237
+ pktLen += len (attrname ) + len (attrvalue ) + 3
232
238
233
239
// To specify a db name
234
240
if n := len (mc .cfg .dbname ); n > 0 {
@@ -295,6 +301,17 @@ func (mc *mysqlConn) writeAuthPacket(cipher []byte) error {
295
301
pos += copy (data [pos :], mc .cfg .dbname )
296
302
data [pos ] = 0x00
297
303
}
304
+ pos ++
305
+
306
+ // Connection attributes
307
+ data [pos ] = byte (attrlen )
308
+ pos ++
309
+
310
+ data [pos ] = byte (len (attrname ))
311
+ pos += 1 + copy (data [pos + 1 :], attrname )
312
+
313
+ data [pos ] = byte (len (attrvalue ))
314
+ pos += 1 + copy (data [pos + 1 :], attrvalue )
298
315
299
316
// Send Auth packet
300
317
return mc .writePacket (data )
You can’t perform that action at this time.
0 commit comments