All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
To: xen-devel@lists.xensource.com
Subject: [PATCH][RESENT] xend: fix bug in xend option parsing
Date: Sun, 16 May 2010 23:34:59 +0200	[thread overview]
Message-ID: <4BF06503.2000600@nets.rwth-aachen.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 2529 bytes --]

Resent of mail sent on 28.04.


xend: fix bug in option parsing

If you enable legacy tcp xmlrpc in xend's config but omit to enable ssl
the following backtrace is generated when starting xend:

[2010-04-28 16:09:04 15754] ERROR (SrvDaemon:349) Exception starting xend ('NoneType' object has no attribute 'rfind')
Traceback (most recent call last):
  File "usr/lib/python2.5/site-packages/xen/xend/server/SrvDaemon.py", line 341, in run
    servers = SrvServer.create()
  File "usr/lib/python2.5/site-packages/xen/xend/server/SrvServer.py", line 253, in create
    _loadConfig(servers, root, False)
  File "usr/lib/python2.5/site-packages/xen/xend/server/SrvServer.py", line 233, in _loadConfig
    ssl_key_file = xoptions.get_xend_tcp_xmlrpc_server_ssl_key_file()
  File "usr/lib/python2.5/site-packages/xen/xend/XendOptions.py", line 210, in get_xend_tcp_xmlrpc_server_ssl_key_file
    if os.path.dirname(file) == "":
  File "/usr/lib/python2.5/posixpath.py", line 119, in dirname
    return split(p)[0]
  File "/usr/lib/python2.5/posixpath.py", line 77, in split
    i = p.rfind('/') + 1

This patch fixes above bug.
Patch should be considered for 4.0.x as the bug is present in release 4.0.0.

Signed-off-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>

diff -r 9a1d7caa2024 -r 0d3979903bac tools/python/xen/xend/XendOptions.py
--- a/tools/python/xen/xend/XendOptions.py	Mon Apr 26 12:13:23 2010 +0100
+++ b/tools/python/xen/xend/XendOptions.py	Wed Apr 28 16:54:04 2010 +0200
@@ -207,18 +207,18 @@
     def get_xend_tcp_xmlrpc_server_ssl_key_file(self):
         name = 'xend-tcp-xmlrpc-server-ssl-key-file'
         file = self.get_config_string(name)
-        if os.path.dirname(file) == "":
+        if file and os.path.dirname(file) == "":
             file = auxbin.xen_configdir() + '/' + file;
-        if not os.path.exists(file):
+        if file and not os.path.exists(file):
             raise XendError("invalid xend config %s: directory '%s' does not exist" % (name, file))
         return file

     def get_xend_tcp_xmlrpc_server_ssl_cert_file(self):
         name = 'xend-tcp-xmlrpc-server-ssl-cert-file'
         file = self.get_config_string(name)
-        if os.path.dirname(file) == "":
+        if file and os.path.dirname(file) == "":
             file = auxbin.xen_configdir() + '/' + file;
-        if not os.path.exists(file):
+        if file and not os.path.exists(file):
             raise XendError("invalid xend config %s: directory '%s' does not exist" % (name, file))
         return file


[-- Attachment #2: fix_xend_xmlrpc_tcp_without_ssl.patch --]
[-- Type: text/x-patch, Size: 2719 bytes --]

Exportiere Patch:
# HG changeset patch
# User Arnd Hannemann <hannemann@nets.rwth-aachen.de>
# Date 1272466444 -7200
# Node ID 0d3979903bac114437297618b4d012f90e75ef72
# Parent  9a1d7caa20246f89bf7395131483f44e686bd9cd
xend: fix bug in option parsing

If you enable legacy tcp xmlrpc in xend's config but omit to enable ssl
the following backtrace is generated when starting xend:

[2010-04-28 16:09:04 15754] ERROR (SrvDaemon:349) Exception starting xend ('NoneType' object has no attribute 'rfind')
Traceback (most recent call last):
  File "usr/lib/python2.5/site-packages/xen/xend/server/SrvDaemon.py", line 341, in run
    servers = SrvServer.create()
  File "usr/lib/python2.5/site-packages/xen/xend/server/SrvServer.py", line 253, in create
    _loadConfig(servers, root, False)
  File "usr/lib/python2.5/site-packages/xen/xend/server/SrvServer.py", line 233, in _loadConfig
    ssl_key_file = xoptions.get_xend_tcp_xmlrpc_server_ssl_key_file()
  File "usr/lib/python2.5/site-packages/xen/xend/XendOptions.py", line 210, in get_xend_tcp_xmlrpc_server_ssl_key_file
    if os.path.dirname(file) == "":
  File "/usr/lib/python2.5/posixpath.py", line 119, in dirname
    return split(p)[0]
  File "/usr/lib/python2.5/posixpath.py", line 77, in split
    i = p.rfind('/') + 1

This patch fixes above bug.
Patch should be considered for 4.0.x as the bug is present in release 4.0.0.

Signed-off-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>

diff -r 9a1d7caa2024 -r 0d3979903bac tools/python/xen/xend/XendOptions.py
--- a/tools/python/xen/xend/XendOptions.py	Mon Apr 26 12:13:23 2010 +0100
+++ b/tools/python/xen/xend/XendOptions.py	Wed Apr 28 16:54:04 2010 +0200
@@ -207,18 +207,18 @@
     def get_xend_tcp_xmlrpc_server_ssl_key_file(self):
         name = 'xend-tcp-xmlrpc-server-ssl-key-file'
         file = self.get_config_string(name)
-        if os.path.dirname(file) == "":
+        if file and os.path.dirname(file) == "":
             file = auxbin.xen_configdir() + '/' + file;
-        if not os.path.exists(file):
+        if file and not os.path.exists(file):
             raise XendError("invalid xend config %s: directory '%s' does not exist" % (name, file))
         return file
 
     def get_xend_tcp_xmlrpc_server_ssl_cert_file(self):
         name = 'xend-tcp-xmlrpc-server-ssl-cert-file'
         file = self.get_config_string(name)
-        if os.path.dirname(file) == "":
+        if file and os.path.dirname(file) == "":
             file = auxbin.xen_configdir() + '/' + file;
-        if not os.path.exists(file):
+        if file and not os.path.exists(file):
             raise XendError("invalid xend config %s: directory '%s' does not exist" % (name, file))
         return file
 


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2010-05-16 21:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-16 21:34 Arnd Hannemann [this message]
2010-05-17  9:59 ` [PATCH][RESENT] xend: fix bug in xend option parsing Keir Fraser
2010-05-17 10:57   ` Arnd Hannemann

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=4BF06503.2000600@nets.rwth-aachen.de \
    --to=hannemann@nets.rwth-aachen.de \
    --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.