| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().; |
| 2 | |
| 3 | use memchrrust-analyzer cargo memchr 2.8.3 crate/::memchrrust-analyzer cargo memchr 2.8.3 memchr/; |
| 4 | use sqlx_corerust-analyzer cargo sqlx-core 0.8.3 crate/::bytesrust-analyzer cargo bytes 1.12.1 crate/::{Bufrust-analyzer cargo bytes 1.12.1 buf/buf_impl/Buf#, Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#}; |
| 5 | |
| 6 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::errorrust-analyzer cargo sqlx-postgres 0.8.3 error/::Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#; |
| 7 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::iorust-analyzer cargo sqlx-postgres 0.8.3 io/::ProtocolDecoderust-analyzer cargo sqlx-core 0.8.3 io/decode/ProtocolDecode#; |
| 8 | |
| 9 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::messagerust-analyzer cargo sqlx-postgres 0.8.3 message/::{BackendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessage#, BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#}; |
| 10 | use base64rust-analyzer cargo base64 0.23.1 crate/::preluderust-analyzer cargo base64 0.23.1 prelude/::{Enginerust-analyzer cargo base64 0.23.1 engine/Engine# as _, BASE64_STANDARDrust-analyzer cargo base64 0.23.1 engine/general_purpose/STANDARD.}; |
| 11 | // On startup, the server sends an appropriate authentication request message, |
| 12 | // to which the frontend must reply with an appropriate authentication |
| 13 | // response message (such as a password). |
| 14 | |
| 15 | // For all authentication methods except GSSAPI, SSPI and SASL, there is at |
| 16 | // most one request and one response. In some methods, no response at all is |
| 17 | // needed from the frontend, and so no authentication request occurs. |
| 18 | |
| 19 | // For GSSAPI, SSPI and SASL, multiple exchanges of packets may |
| 20 | // be needed to complete the authentication. |
| 21 | |
| 22 | // <https://www.postgresql.org/docs/devel/protocol-flow.html#id-1.10.5.7.3> |
| 23 | // <https://www.postgresql.org/docs/devel/protocol-message-formats.html> |
| 24 | |
| 25 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 26 | pub enum Authenticationrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication# { |
| 27 | /// The authentication exchange is successfully completed. |
| 28 | Okrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#Ok#, |
| 29 | |
| 30 | /// The frontend must now send a [PasswordMessage] containing the |
| 31 | /// password in clear-text form. |
| 32 | CleartextPasswordrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#CleartextPassword#, |
| 33 | |
| 34 | /// The frontend must now send a [PasswordMessage] containing the |
| 35 | /// password (with user name) encrypted via MD5, then encrypted |
| 36 | /// again using the 4-byte random salt. |
| 37 | Md5Passwordrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#Md5Password#(AuthenticationMd5Passwordrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationMd5Password#), |
| 38 | |
| 39 | /// The frontend must now initiate a SASL negotiation, |
| 40 | /// using one of the SASL mechanisms listed in the message. |
| 41 | /// |
| 42 | /// The frontend will send a [SaslInitialResponse] with the name |
| 43 | /// of the selected mechanism, and the first part of the SASL |
| 44 | /// data stream in response to this. |
| 45 | /// |
| 46 | /// If further messages are needed, the server will |
| 47 | /// respond with [Authentication::SaslContinue]. |
| 48 | Saslrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#Sasl#(AuthenticationSaslrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSasl#), |
| 49 | |
| 50 | /// This message contains challenge data from the previous step of SASL negotiation. |
| 51 | /// |
| 52 | /// The frontend must respond with a [SaslResponse] message. |
| 53 | SaslContinuerust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#SaslContinue#(AuthenticationSaslContinuerust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslContinue#), |
| 54 | |
| 55 | /// SASL authentication has completed with additional mechanism-specific |
| 56 | /// data for the client. |
| 57 | /// |
| 58 | /// The server will next send [Authentication::Ok] to |
| 59 | /// indicate successful authentication. |
| 60 | SaslFinalrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#SaslFinal#(AuthenticationSaslFinalrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslFinal#), |
| 61 | } |
| 62 | |
| 63 | impl BackendMessagerust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessage# for Authenticationrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication# { |
| 64 | const FORMATrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[Authentication][BackendMessage]FORMAT.: BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat# = BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::Authenticationrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#Authentication#; |
| 65 | |
| 66 | fn decode_bodyrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[Authentication][BackendMessage]decode_body().(mut buf: Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[Authentication][BackendMessage], Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 67 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(match buf.get_u32rust-analyzer cargo bytes 1.12.1 buf/buf_impl/Buf#get_u32().() { |
| 68 | 0 => Authenticationrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#::Okrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#Ok#, |
| 69 | |
| 70 | 3 => Authenticationrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#::CleartextPasswordrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#CleartextPassword#, |
| 71 | |
| 72 | 5 => { |
| 73 | let mut salt = [0; 4]; |
| 74 | buf.copy_to_slicerust-analyzer cargo bytes 1.12.1 buf/buf_impl/Buf#copy_to_slice().(&mut salt); |
| 75 | |
| 76 | Authenticationrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#::Md5Passwordrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#Md5Password#(AuthenticationMd5Passwordrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationMd5Password# { saltrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationMd5Password#salt. }) |
| 77 | } |
| 78 | |
| 79 | 10 => Authenticationrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#::Saslrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#Sasl#(AuthenticationSaslrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSasl#(buf)), |
| 80 | 11 => Authenticationrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#::SaslContinuerust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#SaslContinue#(AuthenticationSaslContinuerust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslContinue#::decoderust-analyzer cargo sqlx-core 0.8.3 io/decode/ProtocolDecode#decode().(buf)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().), |
| 81 | 12 => Authenticationrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#::SaslFinalrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/Authentication#SaslFinal#(AuthenticationSaslFinalrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslFinal#::decoderust-analyzer cargo sqlx-core 0.8.3 io/decode/ProtocolDecode#decode().(buf)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().), |
| 82 | |
| 83 | ty => { |
| 84 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err_protocolrust-analyzer cargo sqlx-core 0.8.3 error/err_protocol!!("unknown authentication method: {}", ty)); |
| 85 | } |
| 86 | }) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | /// Body of [Authentication::Md5Password]. |
| 91 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 92 | pub struct AuthenticationMd5Passwordrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationMd5Password# { |
| 93 | pub saltrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationMd5Password#salt.: [u8; 4], |
| 94 | } |
| 95 | |
| 96 | /// Body of [Authentication::Sasl]. |
| 97 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 98 | pub struct AuthenticationSaslrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSasl#(Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#); |
| 99 | |
| 100 | impl AuthenticationSaslrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSasl# { |
| 101 | #[inline] |
| 102 | pub fn mechanismsrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[AuthenticationSasl]mechanisms().(&self) -> SaslMechanismsrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/SaslMechanisms#<'_> { |
| 103 | SaslMechanismsrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/SaslMechanisms#(&self.0rust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSasl#0.) |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | /// An iterator over the SASL authentication mechanisms provided by the server. |
| 108 | pub struct SaslMechanismsrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/SaslMechanisms#<'a>(&'a [u8]); |
| 109 | |
| 110 | impl<'a> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for SaslMechanismsrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/SaslMechanisms#<'a> { |
| 111 | type Itemrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[`SaslMechanisms<'a>`][Iterator]Item# = &'a str; |
| 112 | |
| 113 | fn nextrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[`SaslMechanisms<'a>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[`SaslMechanisms<'a>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 114 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.0rust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/SaslMechanisms#0..is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() && self.0rust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/SaslMechanisms#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'\0' { |
| 115 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 116 | } |
| 117 | |
| 118 | let mechanism = memchrrust-analyzer cargo memchr 2.8.3 memchr/memchr().(b'\0', self.0rust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/SaslMechanisms#0.).and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|nul| from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(&self.0rust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/SaslMechanisms#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#nul]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 119 | |
| 120 | self.0rust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/SaslMechanisms#0. = &self.0rust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/SaslMechanisms#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().(mechanism.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1)..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 121 | |
| 122 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mechanism) |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 127 | pub struct AuthenticationSaslContinuerust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslContinue# { |
| 128 | pub saltrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslContinue#salt.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>, |
| 129 | pub iterationsrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslContinue#iterations.: u32, |
| 130 | pub noncerust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslContinue#nonce.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 131 | pub messagerust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslContinue#message.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 132 | } |
| 133 | |
| 134 | impl ProtocolDecoderust-analyzer cargo sqlx-core 0.8.3 io/decode/ProtocolDecode#<'_> for AuthenticationSaslContinuerust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslContinue# { |
| 135 | fn decode_withrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[AuthenticationSaslContinue][`ProtocolDecode<'_, ()>`]decode_with().(buf: Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#, _: ()) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[AuthenticationSaslContinue][`ProtocolDecode<'_, ()>`], Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 136 | let mut iterations: u32 = 4096; |
| 137 | let mut salt = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 138 | let mut nonce = Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#::newrust-analyzer cargo bytes 1.12.1 bytes/impl#[Bytes]new().(); |
| 139 | |
| 140 | // [Example] |
| 141 | // r=/z+giZiTxAH7r8sNAeHr7cvpqV3uo7G/bJBIJO3pjVM7t3ng,s=4UV68bIkC8f9/X8xH7aPhg==,i=4096 |
| 142 | |
| 143 | for item in buf.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split().(|b| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b',') { |
| 144 | let key = item[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 145 | let value = &item[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 146 | |
| 147 | match key { |
| 148 | b'r' => { |
| 149 | nonce = buf.slice_refrust-analyzer cargo bytes 1.12.1 bytes/impl#[Bytes]slice_ref().(value); |
| 150 | } |
| 151 | |
| 152 | b'i' => { |
| 153 | iterations = atoirust-analyzer cargo atoi 2.0.0 crate/::atoirust-analyzer cargo atoi 2.0.0 atoi().(value).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(4096); |
| 154 | } |
| 155 | |
| 156 | b's' => { |
| 157 | salt = BASE64_STANDARDrust-analyzer cargo base64 0.23.1 engine/general_purpose/STANDARD..decoderust-analyzer cargo base64 0.23.1 engine/Engine#decode().(value).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::protocolrust-analyzer cargo sqlx-core 0.8.3 error/impl#[Error]protocol().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 158 | } |
| 159 | |
| 160 | _ => {} |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[AuthenticationSaslContinue][`ProtocolDecode<'_, ()>`] { |
| 165 | iterationsrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslContinue#iterations., |
| 166 | saltrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslContinue#salt., |
| 167 | noncerust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslContinue#nonce.: from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(&nonce).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::protocolrust-analyzer cargo sqlx-core 0.8.3 error/impl#[Error]protocol().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), |
| 168 | messagerust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslContinue#message.: from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(&buf).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::protocolrust-analyzer cargo sqlx-core 0.8.3 error/impl#[Error]protocol().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), |
| 169 | }) |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 174 | pub struct AuthenticationSaslFinalrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslFinal# { |
| 175 | pub verifierrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslFinal#verifier.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>, |
| 176 | } |
| 177 | |
| 178 | impl ProtocolDecoderust-analyzer cargo sqlx-core 0.8.3 io/decode/ProtocolDecode#<'_> for AuthenticationSaslFinalrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslFinal# { |
| 179 | fn decode_withrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[AuthenticationSaslFinal][`ProtocolDecode<'_, ()>`]decode_with().(buf: Bytesrust-analyzer cargo bytes 1.12.1 bytes/Bytes#, _: ()) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[AuthenticationSaslFinal][`ProtocolDecode<'_, ()>`], Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 180 | let mut verifier = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 181 | |
| 182 | for item in buf.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split().(|b| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b',') { |
| 183 | let key = item[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 184 | let value = &item[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 185 | |
| 186 | if let b'v' = key { |
| 187 | verifier = BASE64_STANDARDrust-analyzer cargo base64 0.23.1 engine/general_purpose/STANDARD..decoderust-analyzer cargo base64 0.23.1 engine/Engine#decode().(value).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::protocolrust-analyzer cargo sqlx-core 0.8.3 error/impl#[Error]protocol().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/impl#[AuthenticationSaslFinal][`ProtocolDecode<'_, ()>`] { verifierrust-analyzer cargo sqlx-postgres 0.8.3 message/authentication/AuthenticationSaslFinal#verifier. }) |
| 192 | } |
| 193 | } |