File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 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>
1515Arne Hormann <arnehormann at gmail.com>
1616Carlos Nieto <jose.carlos at menteslibres.net>
1717Chris Moos <chris at tech9computers.com>
18+ Daniël van Eeden <daniel.van.eeden at myname.nl>
1819DisposaBoy <disposaboy at dby.me>
1920Frederick Mayle <frederickmayle at gmail.com>
2021Gustavo 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 {
214214		clientLongPassword  | 
215215		clientTransactions  | 
216216		clientLocalFiles  | 
217+ 		clientConnectAttrs  | 
217218		mc .flags & clientLongFlag 
218219
219220	if  mc .cfg .clientFoundRows  {
@@ -228,7 +229,12 @@ func (mc *mysqlConn) writeAuthPacket(cipher []byte) error {
228229	// User Password 
229230	scrambleBuff  :=  scramblePassword (cipher , []byte (mc .cfg .passwd ))
230231
232+ 	attrname  :=  []byte ("_client_name" )
233+ 	attrvalue  :=  []byte ("Go MySQL Driver" )
234+ 	attrlen  :=  len (attrname ) +  len (attrvalue ) +  2 
235+ 
231236	pktLen  :=  4  +  4  +  1  +  23  +  len (mc .cfg .user ) +  1  +  1  +  len (scrambleBuff )
237+ 	pktLen  +=  len (attrname ) +  len (attrvalue ) +  3 
232238
233239	// To specify a db name 
234240	if  n  :=  len (mc .cfg .dbname ); n  >  0  {
@@ -295,6 +301,17 @@ func (mc *mysqlConn) writeAuthPacket(cipher []byte) error {
295301		pos  +=  copy (data [pos :], mc .cfg .dbname )
296302		data [pos ] =  0x00 
297303	}
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 )
298315
299316	// Send Auth packet 
300317	return  mc .writePacket (data )
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments