Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix User-Password authentication #776

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions io/zenoh-transport/src/unicast/establishment/ext/auth/usrpwd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,18 @@ impl AuthUsrPwd {
// usr3:pwd3
// I.e.: one <user>:<password> entry per line
for l in content.lines() {
let idx = l.find(':').ok_or_else(|| {
let line = l.trim();
if line.is_empty() {
continue;
}
let idx = line.find(':').ok_or_else(|| {
zerror!("{S} Invalid user-password dictionary file: invalid format.")
})?;
let user = l[..idx].as_bytes().to_owned();
let user = line[..idx].trim().as_bytes().to_owned();
if user.is_empty() {
bail!("{S} Invalid user-password dictionary file: empty user.")
}
let password = l[idx + 1..].as_bytes().to_owned();
let password = line[idx + 1..].trim().as_bytes().to_owned();
if password.is_empty() {
bail!("{S} Invalid user-password dictionary file: empty password.")
}
Expand Down
Loading