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

Richard W.M. Jones rjones at redhat.com
Thu Sep 4 13:25:18 UTC 2014


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 ^ rest

Yup, 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/




More information about the Libguestfs mailing list