fingerd: use structs from proto, fix clippy lints
Build and test / build (push) Successful in 1m37s
Build and test / check (push) Successful in 1m50s
Build and test / test (push) Successful in 2m10s
Build and test / docs (push) Successful in 3m10s

This commit is contained in:
2026-02-12 11:05:05 +09:00
parent 23d2611bff
commit 2c646af236
3 changed files with 53 additions and 350 deletions
+6 -5
View File
@@ -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.