Skip to main content

UserRecord

Struct UserRecord 

Source
pub struct UserRecord {
    pub role: Role,
    /* private fields */
}

Fields§

§role: Role

Implementations§

Source§

impl UserRecord

Source

pub fn verify(&self, password: &str) -> bool

Source

pub const fn scram(&self) -> Option<&ScramSecrets>

Source

pub const fn mysql_native(&self) -> Option<&[u8; 20]>

v7.17.0 Phase 3.P0-71: borrow the stored mysql_native_password verifier (SHA1(SHA1(password))) for the MySQL-wire shim.

Source

pub const fn caching_sha2(&self) -> Option<&[u8; 32]>

v7.17.0 Phase 3.P0-72: borrow the stored caching_sha2_password verifier (SHA256(SHA256(password))) for the MySQL-wire shim’s fast-path auth.

Source

pub fn verify_caching_sha2_password( &self, scramble: &[u8], client_response: &[u8], ) -> bool

v7.17.0 Phase 3.P0-72 — verify a client caching_sha2_password fast-path response.

Protocol: same XOR shape as mysql_native_password but with SHA-256 instead of SHA-1: client_response = SHA256(password) XOR SHA256(scramble || SHA256(SHA256(password))). Server reconstructs and checks SHA256(reconstructed) == stored_hash.

Full-auth RSA fallback (when the cache misses) is a v7.18 carve-out — clients connecting over plaintext without a cached entry will see Access Denied from the shim until that lands.

Source

pub fn verify_mysql_native_password( &self, scramble: &[u8], client_response: &[u8], ) -> bool

v7.17.0 Phase 3.P0-71 — verify a client mysql_native_password auth response.

Protocol: the client sends a 20-byte response client_proof = SHA1(password) XOR SHA1(scramble || SHA1(SHA1(password))). The server reconstructs SHA1(password) = client_proof XOR SHA1(scramble || stored_hash) and verifies SHA1(reconstructed) == stored_hash. Returns false if the user has no stored hash (loaded from a pre-v7.17 snapshot — the operator has to reset the password to re-populate it).

Trait Implementations§

Source§

impl Clone for UserRecord

Source§

fn clone(&self) -> UserRecord

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UserRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.