Skip to content

Commit cf6f755

Browse files
committed
allow non-western characters in usernames
1 parent 9c420a1 commit cf6f755

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/sudoers/test/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,16 @@ fn invalid_username() {
364364
parse_eval::<ast::Sudo>("User_Alias FOO = $dollar");
365365
}
366366

367+
#[test]
368+
fn inclusive_username() {
369+
let UserSpecifier::User(Identifier::Name(sirin)) = parse_eval::<ast::UserSpecifier>("şirin")
370+
else {
371+
panic!();
372+
};
373+
374+
assert_eq!(sirin, "şirin");
375+
}
376+
367377
#[test]
368378
fn directive_test() {
369379
let y = parse_eval::<Spec<UserSpecifier>>;

src/sudoers/tokens.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl Token for Username {
2424
}
2525

2626
fn accept(c: char) -> bool {
27-
c.is_ascii_alphanumeric() || ".-_@$".contains(c)
27+
c.is_alphanumeric() || ".-_@$".contains(c)
2828
}
2929

3030
fn accept_1st(c: char) -> bool {

0 commit comments

Comments
 (0)