[Libguestfs] [PATCH] customize: password: improve unknown default crypto message

Pino Toscano ptoscano at redhat.com
Fri Jul 24 14:42:20 UTC 2015


On Friday 24 July 2015 15:02:11 Richard W.M. Jones wrote:
> On Fri, Jul 24, 2015 at 03:26:45PM +0200, Pino Toscano wrote:
> > When warning that there is no known default password encryption for the
> > current guest, print its version in MAJOR.MINOR format if MAJOR is zero.
> > 
> > Also, fix wrapping (and indentation) of the message.
> > ---
> >  customize/password.ml | 11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> > 
> > diff --git a/customize/password.ml b/customize/password.ml
> > index 111240e..7a050d6 100644
> > --- a/customize/password.ml
> > +++ b/customize/password.ml
> > @@ -163,6 +163,13 @@ and default_crypto g root =
> >    | "ubuntu", _ -> `MD5
> >  
> >    | _, _ ->
> > -    warning (f_"password: using insecure md5 password encryption for
> > -guest of type %s version %d.\nIf this is incorrect, use --password-crypto option and file a bug.") distro major;
> > +    let verstr =
> > +      let minor = g#inspect_get_minor_version root in
> > +      match major, minor with
> > +      | x, _ when x > 0 -> string_of_int x
> > +      | 0, 0 -> "0"
> > +      | x, y -> "0." ^ string_of_int y in
> > +    warning (f_"password: using insecure md5 password encryption for guest of type %s version %s.
> > +If this is incorrect, use --password-crypto option and file a bug.")
> > +      distro verstr;
> >      `MD5
> 
> Since this is basically a debugging message for us, wouldn't it be
> better to report the major and minor numbers directly, ie just print
> %d.%d instead of verstr?

Makes sense indeed, amended and pushed.

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20150724/c1566f9c/attachment.sig>


More information about the Libguestfs mailing list