feat(auth): finish protocol 10 method 2 and 3
This commit is contained in:
parent
8a3f443d85
commit
d18ba43aed
24 changed files with 490 additions and 43 deletions
|
|
@ -1,18 +1,38 @@
|
|||
|
||||
|
||||
pub struct Account{
|
||||
pid: u32,
|
||||
username: Box<str>,
|
||||
kerbros_password: Box<str>,
|
||||
pub pid: u32,
|
||||
pub username: Box<str>,
|
||||
pub kerbros_password: [u8; 16],
|
||||
|
||||
}
|
||||
|
||||
impl Account{
|
||||
pub fn new(pid: u32, username: &str, passwd: &str) -> Self{
|
||||
let passwd_data = passwd.as_bytes();
|
||||
|
||||
let mut passwd = [0u8; 16];
|
||||
|
||||
for (idx, byte) in passwd_data.iter().enumerate(){
|
||||
passwd[idx] = *byte;
|
||||
}
|
||||
|
||||
Self{
|
||||
kerbros_password: passwd.into(),
|
||||
kerbros_password: passwd,
|
||||
username: username.into(),
|
||||
pid
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_raw_password(pid: u32, username: &str, passwd: [u8; 16]) -> Self{
|
||||
Self{
|
||||
kerbros_password: passwd,
|
||||
username: username.into(),
|
||||
pid
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_login_data(&self) -> (u32, [u8; 16]){
|
||||
(self.pid, self.kerbros_password)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue