SHA256
1
0
forked from pool/libvirt

- Fix parsing xend http response

37564b47-xend-parse-response.patch
  rhb#1055165

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=348
This commit is contained in:
James Fehlig 2014-01-29 21:51:41 +00:00 committed by Git OBS Bridge
parent fb199c00ce
commit 2e70ffe5a3
5 changed files with 54 additions and 6 deletions

View File

@ -0,0 +1,39 @@
commit 37564b471da7e9080284149f8350241afd448515
Author: Jim Fehlig <jfehlig@suse.com>
Date: Tue Jan 28 18:15:48 2014 -0700
xen: fix parsing xend http response
Commit df36af58 broke parsing of http response from xend. The prior
use of atoi() would happily parse e.g. a string containing "200 OK\r\n",
whereas virStrToLong_i() will fail when called with a NULL end_ptr.
Change the calls to virStrToLong_i() to provide a non-NULL end_ptr.
Index: libvirt-1.2.1/src/xen/xend_internal.c
===================================================================
--- libvirt-1.2.1.orig/src/xen/xend_internal.c
+++ libvirt-1.2.1/src/xen/xend_internal.c
@@ -282,6 +282,7 @@ xend_req(int fd, char **content)
size_t buffer_size = 4096;
int content_length = 0;
int retcode = 0;
+ char *end_ptr;
if (VIR_ALLOC_N(buffer, buffer_size) < 0)
return -1;
@@ -291,13 +292,13 @@ xend_req(int fd, char **content)
break;
if (istartswith(buffer, "Content-Length: ")) {
- if (virStrToLong_i(buffer + 16, NULL, 10, &content_length) < 0) {
+ if (virStrToLong_i(buffer + 16, &end_ptr, 10, &content_length) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to parse Xend response content length"));
return -1;
}
} else if (istartswith(buffer, "HTTP/1.1 ")) {
- if (virStrToLong_i(buffer + 9, NULL, 10, &retcode) < 0) {
+ if (virStrToLong_i(buffer + 9, &end_ptr, 10, &retcode) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to parse Xend response return code"));
return -1;

View File

@ -12,7 +12,7 @@ Index: libvirt-1.2.1/src/xen/xend_internal.c
===================================================================
--- libvirt-1.2.1.orig/src/xen/xend_internal.c
+++ libvirt-1.2.1/src/xen/xend_internal.c
@@ -2216,6 +2216,7 @@ xenDaemonAttachDeviceFlags(virConnectPtr
@@ -2217,6 +2217,7 @@ xenDaemonAttachDeviceFlags(virConnectPtr
virBuffer buf = VIR_BUFFER_INITIALIZER;
char class[8], ref[80];
char *target = NULL;
@ -20,7 +20,7 @@ Index: libvirt-1.2.1/src/xen/xend_internal.c
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
@@ -2314,8 +2315,18 @@ xenDaemonAttachDeviceFlags(virConnectPtr
@@ -2315,8 +2316,18 @@ xenDaemonAttachDeviceFlags(virConnectPtr
}
sexpr = virBufferContentAndReset(&buf);

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Jan 29 14:50:27 MST 2014 - jfehlig@suse.com
- Fix parsing xend http response
37564b47-xend-parse-response.patch
rhb#1055165
-------------------------------------------------------------------
Wed Jan 22 10:02:06 MST 2014 - jfehlig@suse.com

View File

@ -421,6 +421,7 @@ Source1: libvirtd.init
Source2: libvirtd-relocation-server.fw
Source99: baselibs.conf
# Upstream patches
Patch0: 37564b47-xend-parse-response.patch
# Need to go upstream
Patch100: xen-name-for-devid.patch
Patch101: ia64-clone.patch
@ -928,6 +929,7 @@ namespaces.
%prep
%setup -q
%patch0 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1

View File

@ -27,7 +27,7 @@ Index: libvirt-1.2.1/src/xen/xend_internal.c
virDomainDeviceDefPtr dev, char *class,
char *ref, int ref_len);
@@ -3325,18 +3325,18 @@ xenDaemonDomainBlockPeek(virConnectPtr c
@@ -3326,18 +3326,18 @@ xenDaemonDomainBlockPeek(virConnectPtr c
* Returns 0 in case of success, -1 in case of failure.
*/
static int
@ -50,7 +50,7 @@ Index: libvirt-1.2.1/src/xen/xend_internal.c
if (dev->data.disk->driverName &&
STREQ(dev->data.disk->driverName, "tap"))
strcpy(class, "tap");
@@ -3346,19 +3346,17 @@ virDomainXMLDevID(virConnectPtr conn,
@@ -3347,19 +3347,17 @@ virDomainXMLDevID(virConnectPtr conn,
else
strcpy(class, "vbd");
@ -81,7 +81,7 @@ Index: libvirt-1.2.1/src/xen/xend_internal.c
} else if (dev->type == VIR_DOMAIN_DEVICE_NET) {
char mac[VIR_MAC_STRING_BUFLEN];
virDomainNetDefPtr netdef = dev->data.net;
@@ -3366,16 +3364,22 @@ virDomainXMLDevID(virConnectPtr conn,
@@ -3367,16 +3365,22 @@ virDomainXMLDevID(virConnectPtr conn,
strcpy(class, "vif");
@ -114,7 +114,7 @@ Index: libvirt-1.2.1/src/xen/xend_internal.c
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
@@ -3391,17 +3395,44 @@ virDomainXMLDevID(virConnectPtr conn,
@@ -3392,17 +3396,44 @@ virDomainXMLDevID(virConnectPtr conn,
strcpy(class, "pci");