fingerd: use structs from proto, fix clippy lints
This commit is contained in:
@@ -202,7 +202,7 @@ fn parse_bsd_finger_time(time: &str) -> anyhow::Result<DateTime<Utc>> {
|
||||
// if not, try to get the local timezone offset.
|
||||
// if not, assume UTC.
|
||||
|
||||
return Ok(DateTime::<Utc>::from_utc(dt, Utc));
|
||||
return Ok(DateTime::<Utc>::from_naive_utc_and_offset(dt, Utc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,6 +259,7 @@ pub struct FingerResponseUserEntry {
|
||||
}
|
||||
|
||||
impl FingerResponseUserEntry {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
username: String,
|
||||
full_name: String,
|
||||
@@ -400,8 +401,10 @@ impl FingerResponseUserEntry {
|
||||
.filter_map(|line| {
|
||||
match FingerResponseUserSession::try_from_finger_response_line(line) {
|
||||
Ok(session) => Some(session),
|
||||
// TODO: log warning if parsing fails
|
||||
Err(_) => None,
|
||||
Err(_) => {
|
||||
tracing::warn!("Failed to parse user session from line: {}", line);
|
||||
None
|
||||
}
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
@@ -509,8 +512,6 @@ impl FingerResponseUserSession {
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse the login time from the text string generated by bsd-finger
|
||||
|
||||
/// Parse the idle time from the text string generated by bsd-finger
|
||||
fn parse_idle_time(str: &str) -> anyhow::Result<Duration> {
|
||||
// Parse idle time from finger response format.
|
||||
|
||||
Reference in New Issue
Block a user