Skip to content

[BUG] nmrs empty password handling #176

@cachebag

Description

@cachebag

fn decide_saved_connection(
saved: Option<OwnedObjectPath>,
creds: &WifiSecurity,
) -> Result<SavedDecision> {
match saved {
Some(_) if matches!(creds, WifiSecurity::WpaPsk { psk } if !psk.trim().is_empty()) => {
Ok(SavedDecision::RebuildFresh)
}
Some(path) => Ok(SavedDecision::UseSaved(path)),
None if matches!(creds, WifiSecurity::WpaPsk { psk } if psk.trim().is_empty()) => {
Err(ConnectionError::NoSavedConnection)
}
None => Ok(SavedDecision::RebuildFresh),
}
}

The logic for empty PSK passwords is unclear and could lead to user confusion. When a user provides an empty PSK and there's no saved connection, we return NoSavedConnection error, but the real issue is that they didn't provide a password.

We should probably add a new error variant ConnectionError::MissingPassword or ConnectionError::InvalidCredentials for clarity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomersnmrsChanges to nmrs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions