@@ -55,6 +55,8 @@ pub struct ConnectionProcessor {
5555 received_token : Option < Vec < u8 > > ,
5656 /// User Agent received during authentication (if any)
5757 pub user_agent : Option < String > ,
58+ /// ServerName received in the Login7 packet
59+ received_server_name : Option < String > ,
5860 /// Reference to the shared query registry
5961 query_registry : Arc < Mutex < QueryRegistry > > ,
6062 /// Packet buffer for this connection
@@ -71,6 +73,7 @@ impl ConnectionProcessor {
7173 is_authenticated : false ,
7274 received_token : None ,
7375 user_agent : None ,
76+ received_server_name : None ,
7477 query_registry,
7578 buffer : BytesMut :: with_capacity ( 4096 ) ,
7679 redirection : None ,
@@ -88,6 +91,7 @@ impl ConnectionProcessor {
8891 is_authenticated : false ,
8992 received_token : None ,
9093 user_agent : None ,
94+ received_server_name : None ,
9195 query_registry,
9296 buffer : BytesMut :: with_capacity ( 4096 ) ,
9397 redirection,
@@ -109,6 +113,11 @@ impl ConnectionProcessor {
109113 self . received_token . as_deref ( )
110114 }
111115
116+ /// Get the ServerName received in the Login7 packet
117+ pub fn received_server_name ( & self ) -> Option < & str > {
118+ self . received_server_name . as_deref ( )
119+ }
120+
112121 /// Get the received access token as a UTF-16LE decoded string
113122 pub fn received_token_as_string ( & self ) -> Option < String > {
114123 self . received_token . as_ref ( ) . and_then ( |bytes| {
@@ -175,13 +184,16 @@ impl ConnectionProcessor {
175184 // Log the server name sent by client (important for verifying redirection behavior)
176185 if let Some ( ref server_name) = auth_info. server_name {
177186 info ! (
178- "Login7 from {}: client sent ServerName='{}' " ,
187+ "Login7 from {}: client sent ServerName={:?} " ,
179188 self . addr, server_name
180189 ) ;
181190 } else {
182191 info ! ( "Login7 from {}: no ServerName in packet" , self . addr) ;
183192 }
184193
194+ // Store the server name for test verification
195+ self . received_server_name = auth_info. server_name . clone ( ) ;
196+
185197 // FedAuth is always supported - check if client used it
186198 if auth_info. has_fedauth {
187199 let token_len = auth_info
@@ -336,6 +348,8 @@ pub struct ConnectionInfo {
336348 pub authenticated : bool ,
337349 /// User Agent received during authentication (if any)
338350 pub user_agent : Option < String > ,
351+ /// ServerName received in the Login7 packet
352+ pub received_server_name : Option < String > ,
339353}
340354
341355impl ConnectionInfo {
@@ -373,6 +387,7 @@ impl ConnectionStore {
373387 received_token : processor. received_token ( ) . map ( |t| t. to_vec ( ) ) ,
374388 authenticated : processor. is_authenticated ( ) ,
375389 user_agent : processor. user_agent . clone ( ) ,
390+ received_server_name : processor. received_server_name ( ) . map ( |s| s. to_string ( ) ) ,
376391 } ;
377392 self . connections . insert ( processor. addr ( ) , info) ;
378393 }
0 commit comments