@@ -6,6 +6,8 @@ use sable_network::{
66use super :: * ;
77use base64:: prelude:: * ;
88
9+ const DEFAULT_SASL_FAIL : & str = "SASL authentication failed" ;
10+
911#[ command_handler( "AUTHENTICATE" ) ]
1012async fn handle_authenticate (
1113 source : PreClientSource ,
@@ -22,7 +24,7 @@ async fn handle_authenticate(
2224 RemoteServicesServerRequestType :: AbortAuthenticate ( * session)
2325 } else {
2426 let Ok ( data) = BASE64_STANDARD . decode ( text) else {
25- response. notice ( "Invalid base64" ) ;
27+ response. numeric ( make_numeric ! ( SaslFail , "Invalid Base64" ) ) ;
2628 return Ok ( ( ) ) ;
2729 } ;
2830
@@ -39,7 +41,7 @@ async fn handle_authenticate(
3941
4042 for ban in net. network_bans ( ) . find_pre_sasl ( & user_details) {
4143 if let NetworkBanAction :: DenySasl = ban. action {
42- response. numeric ( make_numeric ! ( SaslFail ) ) ;
44+ response. numeric ( make_numeric ! ( SaslFail , DEFAULT_SASL_FAIL ) ) ;
4345 return Ok ( ( ) ) ;
4446 }
4547 }
@@ -88,7 +90,7 @@ async fn handle_authenticate(
8890 response. numeric ( make_numeric ! ( SaslSuccess ) ) ;
8991 }
9092 Fail => {
91- response. numeric ( make_numeric ! ( SaslFail ) ) ;
93+ response. numeric ( make_numeric ! ( SaslFail , DEFAULT_SASL_FAIL ) ) ;
9294 }
9395 Aborted => {
9496 response. numeric ( make_numeric ! ( SaslAborted ) ) ;
@@ -116,6 +118,6 @@ fn do_sasl_external(
116118 }
117119 }
118120
119- response. numeric ( make_numeric ! ( SaslFail ) ) ;
121+ response. numeric ( make_numeric ! ( SaslFail , DEFAULT_SASL_FAIL ) ) ;
120122 Ok ( ( ) )
121123}
0 commit comments