Pino Toscano
2014-Sep-04 11:59 UTC
[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
Richard W.M. Jones
2014-Sep-04 13:25 UTC
Re: [Libguestfs] [PATCH] customize: fix locking accounts with passwords
On Thu, Sep 04, 2014 at 01:59:32PM +0200, Pino Toscano wrote:> 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 ^ restYup, that's a big mistake. Let's get that in to master as soon as possible so I can backport it to 1.26. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/