From 77aa0e51962880c170d924fa735f2268772a0652 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Mon, 14 Jan 2019 10:35:52 -0800 Subject: Use rand_os for random data generation The rand crate comes with a slew of dependencies to cover all sort of randomness related tasks in various scenarios. However, this crate really only requires a tiny subset of this functionality. As it turns out, this core functionality is provided by the rand_os crate. This change drops the dependency to rand in favor of rand_os. In order to accomplish that, it brings back the RngError variant for the CommandError enum to capture the possibility of the creation of the random number generator failing. --- src/auth.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/auth.rs') diff --git a/src/auth.rs b/src/auth.rs index a129bd8..3280924 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -149,7 +149,10 @@ where A: AuthenticatedDevice, T: Fn(*const i8, *const i8) -> c_int, { - let temp_password = generate_password(TEMPORARY_PASSWORD_LENGTH); + let temp_password = match generate_password(TEMPORARY_PASSWORD_LENGTH) { + Ok(temp_password) => temp_password, + Err(err) => return Err((device, err)), + }; let password = match get_cstring(password) { Ok(password) => password, Err(err) => return Err((device, err)), -- cgit v1.2.1