All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Masami Watanabe <masami.watanabe@jp.fujitsu.com>
Cc: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>,
	Anthony Liguori <aliguori@us.ibm.com>,
	xen-devel@lists.xensource.com
Subject: Re: [PATCH][Take 2] VNC authentification
Date: Fri, 29 Sep 2006 23:11:45 +0100	[thread overview]
Message-ID: <20060929221145.GE8564@redhat.com> (raw)
In-Reply-To: <JX200609291747343.1765484@jp.fujitsu.com>

On Fri, Sep 29, 2006 at 05:47:34PM +0900, Masami Watanabe wrote:
> Hi,
> 
> This is take 2 on VNC authentification.
> 
> The specification is as mentioned at
> http://lists.xensource.com/archives/html/xen-devel/2006-09/msg00666.html
> The difference is follows.
> - correction that passes information through xenstore.
> - after information is read, qemu deletes information on xenstore.

This patch doesn't compile because it is calling functions before
they are even defined & the implicit definition this results in does
not match the actual definition later

xen-3.0.3-testing-11633/tools/ioemu/vnc.c: In function 'protocol_version':
xen-3.0.3-testing-11633/tools/ioemu/vnc.c:1225: warning: implicit declaration of function 'vnc_auth'
xen-3.0.3-testing-11633/tools/ioemu/vnc.c: In function 'protocol_response':
xen-3.0.3-testing-11633/tools/ioemu/vnc.c:1250: warning: implicit declaration of function 'base64decode'
xen-3.0.3-testing-11633/tools/ioemu/vnc.c: At top level:
xen-3.0.3-testing-11633/tools/ioemu/vnc.c:1399: error: static declaration of 'vnc_auth' follows non-static declaration
xen-3.0.3-testing-11633/tools/ioemu/vnc.c:1225: error: previous implicit declaration of 'vnc_auth' was here
xen-3.0.3-testing-11633/tools/ioemu/vnc.c: In function 'vnc_auth':
xen-3.0.3-testing-11633/tools/ioemu/vnc.c:1417: warning: implicit declaration of function 'make_challenge'
xen-3.0.3-testing-11633/tools/ioemu/vnc.c: At top level:
xen-3.0.3-testing-11633/tools/ioemu/vnc.c:1429: error: static declaration of 'make_challenge' follows non-static declaration
xen-3.0.3-testing-11633/tools/ioemu/vnc.c:1417: error: previous implicit declaration of 'make_challenge' was here
xen-3.0.3-testing-11633/tools/ioemu/vnc.c:1461: error: static declaration of 'base64decode' follows non-static declaration
xen-3.0.3-testing-11633/tools/ioemu/vnc.c:1250: error: previous implicit declaration of 'base64decode' was here


> diff -r 1d0e75523636 tools/python/xen/xend/XendRoot.py
> --- a/tools/python/xen/xend/XendRoot.py Wed Sep 27 17:49:22 2006 +0100
> +++ b/tools/python/xen/xend/XendRoot.py Fri Sep 29 15:46:03 2006 +0900
> @@ -95,6 +95,8 @@ class XendRoot:
>      dom0_min_mem_default = '0'
>  
>      dom0_vcpus_default = '0'
> +
> +    vncpasswd_default = '#None#'

Why not just use the proper Python None value ?



> diff -r 1d0e75523636 tools/python/xen/xend/XendDomainInfo.py
> --- a/tools/python/xen/xend/XendDomainInfo.py   Wed Sep 27 17:49:22 2006 +0100
> +++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Sep 29 15:46:03 2006 +0900
> @@ -391,6 +391,9 @@ def parseConfig(config):
>          else:
>              log.warn("Ignoring malformed and deprecated config option "
>                       "restart = %s", restart)
> +
> +    result['image'].append(
> +        ['vncpasswd_default', xroot.get_vncpasswd_default()])

Why put the system default password into the guest's config record here,
only to remove it again later on. The XendRoot object is a singleton, so
better to just call 'get_vncpasswd_default' when you need it later.... 


> diff -r 1d0e75523636 tools/python/xen/xend/image.py
> --- a/tools/python/xen/xend/image.py    Wed Sep 27 17:49:22 2006 +0100
> +++ b/tools/python/xen/xend/image.py    Fri Sep 29 15:46:03 2006 +0900
> @@ -348,8 +348,20 @@ class HVMImageHandler(ImageHandler):
>          sdl = sxp.child_value(config, 'sdl')
>          ret = []
>          nographic = sxp.child_value(config, 'nographic')
> +
> +        # get password from xend-config(if password omitted, '#None#')
> +        vncpasswd_default = sxp.child_value(config,
> +                                            'vncpasswd_default')

Just call

    vncpassword_default = xen.xend.XendRoot.instance().get_vncpasswd_default()

Then there is no need to keep 'vncpasswd_default' in the guest's sxp at all.

> +        # get password from VM config(if password omitted, None)
> +        vncpasswd_vmconfig = sxp.child_value(config, 'vncpasswd')
> +        vncpasswd = vncpasswd_vmconfig
> +
>          if nographic:
>              ret.append('-nographic')
> +            # remove password
> +            if vncpasswd_vmconfig:
> +                config.remove(['vncpasswd', vncpasswd_vmconfig])
> +            del config[config.index(['vncpasswd_default', vncpasswd_default])]
>              return ret
>          if vnc:
>              vncdisplay = sxp.child_value(config, 'vncdisplay',
> @@ -358,6 +370,19 @@ class HVMImageHandler(ImageHandler):
>              vncunused = sxp.child_value(config, 'vncunused')
>              if vncunused:
>                  ret += ['-vncunused']
> +            # password check
> +            if vncpasswd is None:
> +                if vncpasswd_default=='#None#':
> +                    raise VmError('vncpasswd is not setuped in VMconfig and xend-config.')
> +                else:
> +                    vncpasswd = vncpasswd_default

This should just do  'if vncpasswd_default is None', rather than use some
magic string value '#None#'

> +            if vncpasswd!='':
> +                self.vm.storeVm("vncpasswd", vncpasswd)
> +
> +        # remove password
> +        config.remove(['vncpasswd', vncpasswd_vmconfig])
> +        del config[config.index(['vncpasswd_default', vncpasswd_default])]
> +
>          return ret
>  
>      def createDeviceModel(self):

See comment above about not storing 'vncpasswd_default' in this object 
at all.


Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

  parent reply	other threads:[~2006-09-29 22:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-26 18:23 Individual passwords for guest VNC servers ? Ian Pratt
2006-09-28  1:01 ` Masami Watanabe
2006-09-29  8:47 ` [PATCH][Take 2] VNC authentification Masami Watanabe
2006-09-29 14:01   ` Anthony Liguori
2006-09-30 18:47     ` masami.watanabe
2006-09-29 22:11   ` Daniel P. Berrange [this message]
2006-09-30 18:53     ` Masami Watanabe
2006-10-02 16:22       ` Daniel P. Berrange
2006-10-02 17:24         ` Anthony Liguori
2006-10-02 18:12           ` Daniel P. Berrange
2006-10-02 19:15             ` Ian Pratt
2006-10-03  2:04               ` Masami Watanabe
2006-10-03 16:08               ` [PATCH][Take 3] " Masami Watanabe
2006-10-03 17:56                 ` Anthony Liguori
2006-10-03 18:06                   ` Daniel P. Berrange
2006-10-03 18:49                     ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060929221145.GE8564@redhat.com \
    --to=berrange@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=m+Ian.Pratt@cl.cam.ac.uk \
    --cc=masami.watanabe@jp.fujitsu.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.