From 33c3bfbe7127b766d6add19c05bb567ee2fadb01 Mon Sep 17 00:00:00 2001 From: Ivan Chebykin <ivan@chebykin.org> Date: Sat, 11 Nov 2017 22:11:12 +0300 Subject: [PATCH] Migrated to redox_users --- Cargo.lock | 61 +++++--------------------------------------- Cargo.toml | 2 +- src/orblogin/main.rs | 12 ++++----- 3 files changed, 14 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4cbd76..f4595c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,9 +15,9 @@ dependencies = [ "orbtk 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", "redox_event 0.1.0 (git+https://github.com/redox-os/event.git)", "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.1.0 (git+https://github.com/redox-os/users.git)", "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "userutils 0.1.0 (git+https://github.com/redox-os/userutils.git)", ] [[package]] @@ -25,11 +25,6 @@ name = "adler32" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "arg_parser" -version = "0.1.0" -source = "git+https://github.com/redox-os/arg-parser.git#288d2fd9ae27ed2c7a3aaf5a77cf07e2b2bd356c" - [[package]] name = "argon2rs" version = "0.2.5" @@ -362,15 +357,6 @@ name = "libc" version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "liner" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "linked-hash-map" version = "0.5.0" @@ -628,10 +614,12 @@ version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "redox_termios" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "redox_users" +version = "0.1.0" +source = "git+https://github.com/redox-os/users.git#77ce04ba3c2a1e4731e75eb58984598fa8937880" dependencies = [ + "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "extra 0.1.0 (git+https://github.com/redox-os/libextra.git)", "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -803,16 +791,6 @@ dependencies = [ "utf-8 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "termion" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "time" version = "0.1.38" @@ -855,11 +833,6 @@ name = "unicode-normalization" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "unicode-width" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-xid" version = "0.0.4" @@ -888,21 +861,6 @@ dependencies = [ "percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "userutils" -version = "0.1.0" -source = "git+https://github.com/redox-os/userutils.git#28d097dbf37ac0dec44d9f103eab8de79374cb58" -dependencies = [ - "arg_parser 0.1.0 (git+https://github.com/redox-os/arg-parser.git)", - "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "extra 0.1.0 (git+https://github.com/redox-os/libextra.git)", - "liner 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "utf-8" version = "0.6.0" @@ -960,7 +918,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum adler32 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6cbd0b9af8587c72beadc9f72d35b9fbb070982c9e6203e46e93f10df25f8f45" -"checksum arg_parser 0.1.0 (git+https://github.com/redox-os/arg-parser.git)" = "<none>" "checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" "checksum arrayvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6f9bb6deaad90a5bd12b5af488483c8bb318b4b5c1bf836d0148a1c0f3d9da2e" "checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9" @@ -1003,7 +960,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c9e5e58fa1a4c3b915a561a78a22ee0cac6ab97dca2504428bc1cb074375f8d5" "checksum libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "56cce3130fd040c28df6f495c8492e5ec5808fb4c9093c310df02b0c8f030148" -"checksum liner 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f9e406164c25b420480023985bdf65cef366855666ad4cb12cd3eaee82dcb399" "checksum linked-hash-map 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2aab0478615bb586559b0114d94dd8eca4fdbb73b443adcb0d00b61692b4bf" "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" "checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" @@ -1037,7 +993,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rayon-core 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7febc28567082c345f10cddc3612c6ea020fc3297a1977d472cf9fdb73e6e493" "checksum redox_event 0.1.0 (git+https://github.com/redox-os/event.git)" = "<none>" "checksum redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "8dde11f18c108289bef24469638a04dce49da56084f2d50618b226e47eb04509" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum redox_users 0.1.0 (git+https://github.com/redox-os/users.git)" = "<none>" "checksum resize 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e8f5c5cf4d79776ed121e1c5052718b4bb06d2b48049144a2f0e5ad613b608e" "checksum ring 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2a6dc7fc06a05e6de183c5b97058582e9da2de0c136eafe49609769c507724" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" @@ -1058,19 +1014,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum tendril 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4ce04c250d202db8004921e3d3bc95eaa4f2126c6937a428ae39d12d0e38df62" "checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508" -"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f" -"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91" "checksum untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f392d7819dbe58833e26872f5f6f0d68b7bbbe90fc3667e98731c4a15ad9a7ae" "checksum url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb819346883532a271eb626deb43c4a1bb4c4dd47c519bd78137c3e72a4fe27" -"checksum userutils 0.1.0 (git+https://github.com/redox-os/userutils.git)" = "<none>" "checksum utf-8 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9aee9ba280438b56d1ebc5329f2094f0ff457f811eeeff0b278d75aa99db400" "checksum utf-8 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6f923c601c7ac48ef1d66f7d5b5b2d9a7ba9c51333ab75a3ddf8d0309185a56" "checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d" diff --git a/Cargo.toml b/Cargo.toml index b8c2dcf..1c554dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,7 +55,7 @@ orbimage = "0.1" orbtk = "0.2" tendril = "0.4" url = "1.5" -userutils = { git = "https://github.com/redox-os/userutils.git" } +redox_users = { git = "https://github.com/redox-os/users.git" } [dependencies.hyper] version = "0.10" diff --git a/src/orblogin/main.rs b/src/orblogin/main.rs index 60116a6..057e87b 100644 --- a/src/orblogin/main.rs +++ b/src/orblogin/main.rs @@ -15,7 +15,7 @@ use std::process::Command; use orbclient::{Color, EventOption, Renderer, Window, WindowFlag}; use orbfont::Font; use orbimage::Image; -use userutils::Passwd; +use redox_users::User; #[derive(Clone, Copy)] enum BackgroundMode { @@ -85,7 +85,7 @@ fn login_command(user: &str, pass: &str, launcher_cmd: &str, launcher_args: &[St let mut passwd_option = None; for line in passwd_string.lines() { - if let Ok(passwd) = Passwd::parse(line) { + if let Ok(passwd) = User::parse(line) { if user == passwd.user && "" == passwd.hash { passwd_option = Some(passwd); break; @@ -95,8 +95,8 @@ fn login_command(user: &str, pass: &str, launcher_cmd: &str, launcher_args: &[St if passwd_option.is_none() { for line in passwd_string.lines() { - if let Ok(passwd) = Passwd::parse(line) { - if user == passwd.user && passwd.verify(&pass) { + if let Ok(passwd) = User::parse(line) { + if user == passwd.user && passwd.verify_passwd(&pass) { passwd_option = Some(passwd); break; } @@ -113,12 +113,12 @@ fn login_command(user: &str, pass: &str, launcher_cmd: &str, launcher_args: &[St command.uid(passwd.uid); command.gid(passwd.gid); - command.current_dir(passwd.home); + command.current_dir(passwd.home.clone()); command.env("USER", &user); command.env("UID", format!("{}", passwd.uid)); command.env("GROUPS", format!("{}", passwd.gid)); - command.env("HOME", passwd.home); + command.env("HOME", passwd.home.clone()); command.env("SHELL", passwd.shell); Some(command) -- GitLab