[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] customize: fix locking accounts with passwords



When setting the password for a locked account, make sure to still write
the password after the "!!" marker, otherwise the account will have no
password.
---
 customize/password.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/customize/password.ml b/customize/password.ml
index d76ebea..84af0c3 100644
--- a/customize/password.ml
+++ b/customize/password.ml
@@ -109,13 +109,13 @@ let rec set_linux_passwords ~prog ?password_crypto g root passwords =
             match selector with
             | { pw_locked = locked;
                 pw_password = Password password } ->
-              if locked then "!!" else "" ^ encrypt password crypto
+              (if locked then "!!" else "") ^ encrypt password crypto
             | { pw_locked = locked;
                 pw_password = Random_password } ->
               let password = make_random_password () in
               printf (f_"Setting random password of %s to %s\n%!")
                 user password;
-              if locked then "!!" else "" ^ encrypt password crypto
+              (if locked then "!!" else "") ^ encrypt password crypto
             | { pw_locked = true; pw_password = Disabled_password } -> "!!*"
             | { pw_locked = false; pw_password = Disabled_password } -> "*" in
           user ^ ":" ^ pwfield ^ rest
-- 
1.9.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]