more progress on friends
This commit is contained in:
parent
1b802ff33f
commit
7918e54487
19 changed files with 320 additions and 205 deletions
|
|
@ -1,39 +1,38 @@
|
|||
use macros::RmcSerialize;
|
||||
|
||||
#[derive(RmcSerialize)]
|
||||
#[derive(Clone)]
|
||||
pub struct Account{
|
||||
#[derive(RmcSerialize, Clone)]
|
||||
pub struct Account {
|
||||
pub pid: u32,
|
||||
pub username: String,
|
||||
pub kerbros_password: [u8; 16],
|
||||
}
|
||||
|
||||
impl Account{
|
||||
pub fn new(pid: u32, username: &str, passwd: &str) -> Self{
|
||||
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(){
|
||||
for (idx, byte) in passwd_data.iter().enumerate() {
|
||||
passwd[idx] = *byte;
|
||||
}
|
||||
|
||||
Self{
|
||||
Self {
|
||||
kerbros_password: passwd,
|
||||
username: username.into(),
|
||||
pid
|
||||
pid,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_raw_password(pid: u32, username: &str, passwd: [u8; 16]) -> Self{
|
||||
Self{
|
||||
pub fn new_raw_password(pid: u32, username: &str, passwd: [u8; 16]) -> Self {
|
||||
Self {
|
||||
kerbros_password: passwd,
|
||||
username: username.into(),
|
||||
pid
|
||||
pid,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_login_data(&self) -> (u32, [u8; 16]){
|
||||
(self.pid, self.kerbros_password)
|
||||
pub fn get_login_data(&self) -> (u32, &[u8]) {
|
||||
(self.pid, &self.kerbros_password)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue