All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-2.9 2/2] block/curl: Check protocol prefix
Date: Fri, 31 Mar 2017 14:14:53 -0500	[thread overview]
Message-ID: <730e59dc-f46f-41cb-b842-9a91b0dc63bb@redhat.com> (raw)
In-Reply-To: <20170331120431.1767-3-mreitz@redhat.com>

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

On 03/31/2017 07:04 AM, Max Reitz wrote:
> If the user has explicitly specified a block driver and thus a protocol,
> we have to make sure the URL's protocol prefix matches. Otherwise the
> latter will silently override the former which might catch some users by
> surprise.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  block/curl.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/block/curl.c b/block/curl.c
> index 34dbd335f4..2708d57c2f 100644
> --- a/block/curl.c
> +++ b/block/curl.c
> @@ -659,6 +659,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
>      const char *cookie;
>      double d;
>      const char *secretid;
> +    const char *protocol_delimiter;
>  
>      static int inited = 0;
>  
> @@ -700,6 +701,15 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
>          goto out_noclean;
>      }
>  
> +    if (!strstart(file, bs->drv->protocol_name, &protocol_delimiter) ||
> +        !strstart(protocol_delimiter, "://", NULL))

Do we care about case-insensitive comparisons here? But I'm fine with
case-sensitive for now, until we have an actual report of someone that
it breaks.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  parent reply	other threads:[~2017-03-31 19:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 12:04 [Qemu-devel] [PATCH for-2.9 0/2] curl: Extend and fix blockdev-add schema Max Reitz
2017-03-31 12:04 ` [Qemu-devel] [PATCH for-2.9 1/2] qapi/curl: " Max Reitz
2017-03-31 18:57   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-03-31 19:27   ` Jeff Cody
2017-03-31 19:27   ` [Qemu-devel] " Eric Blake
2017-03-31 12:04 ` [Qemu-devel] [PATCH for-2.9 2/2] block/curl: Check protocol prefix Max Reitz
2017-03-31 13:52   ` Philippe Mathieu-Daudé
2017-03-31 18:58   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-03-31 19:14   ` Eric Blake [this message]
2017-03-31 19:30   ` [Qemu-devel] " Eric Blake
2017-03-31 20:50     ` Max Reitz
2017-03-31 19:00 ` [Qemu-devel] [Qemu-block] [PATCH for-2.9 0/2] curl: Extend and fix blockdev-add schema Jeff Cody

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=730e59dc-f46f-41cb-b842-9a91b0dc63bb@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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.