Re: [PATCH 6/6] xend: Escape reserved sexpr characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/22/2010 10:28 AM, Cole Robinson wrote:
> If we don't escape ' or \ xend can't parse the generated sexpr. This
> might over apply the EscapeSexpr routine, but it shouldn't hurt.
> 
> Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
> ---
>  src/util/buf.c                             |   55 ++++++++++++++
>  src/util/buf.h                             |    1 +
>  src/xen/xend_internal.c                    |  112 +++++++++++++++------------
>  tests/xml2sexprdata/xml2sexpr-escape.sexpr |    1 +
>  tests/xml2sexprdata/xml2sexpr-escape.xml   |   24 ++++++
>  tests/xml2sexprtest.c                      |    1 +
>  6 files changed, 144 insertions(+), 50 deletions(-)
>  create mode 100644 tests/xml2sexprdata/xml2sexpr-escape.sexpr
>  create mode 100644 tests/xml2sexprdata/xml2sexpr-escape.xml

ACK series, with two nits:

You also need to update src/libvirt_private.syms:

diff --git i/src/libvirt_private.syms w/src/libvirt_private.syms
index 9ed05df..edbc4bc 100644
--- i/src/libvirt_private.syms
+++ w/src/libvirt_private.syms
@@ -23,6 +23,7 @@ virBufferAdd;
 virBufferAddChar;
 virBufferContentAndReset;
 virBufferError;
+virBufferEscapeSexpr;
 virBufferEscapeString;
 virBufferFreeAndReset;
 virBufferStrcat;


> @@ -5322,8 +5322,9 @@ xenDaemonFormatSxprChr(virDomainChrDefPtr def,
>          break;
>  
>      case VIR_DOMAIN_CHR_TYPE_UNIX:
> -        virBufferVSprintf(buf, "%s:%s%s", type,
> -                          def->data.nix.path,
> +        virBufferVSprintf(buf, "%s:", type);
> +        virBufferEscapeSexpr(buf, "%s", def->data.nix.path);
> +        virBufferVSprintf(buf, "%s",
>                            def->data.nix.listen ? ",server,nowait" : "");

Change that last line to:

if (def->data.nix.listen)
    virBufferAddLit(buf, ",server,nowait");

> +++ b/tests/xml2sexprdata/xml2sexpr-escape.xml
> @@ -0,0 +1,24 @@
> +<domain type='xen' id='15'>
> +  <name>fvtest</name>
> +  <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
> +  <os>
> +    <type>hvm</type>
> +    <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
> +    <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
> +    <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os&amp;version="devel";  </cmdline>

Yep, definitely makes more sense for a use of '&' in a URL.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]