[lxc-devel] [lxd/master] lxd/images: Properly handle invalid protocols

stgraber on Github lxc-bot at linuxcontainers.org
Wed May 8 19:10:44 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190508/47428a3a/attachment.bin>
-------------- next part --------------
From f6b06203a0eef7853b003cd50b619ef0fa7c61c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 8 May 2019 15:10:09 -0400
Subject: [PATCH] lxd/images: Properly handle invalid protocols
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #5738

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/daemon_images.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lxd/daemon_images.go b/lxd/daemon_images.go
index e0270d323b..cc2db2b25c 100644
--- a/lxd/daemon_images.go
+++ b/lxd/daemon_images.go
@@ -528,6 +528,8 @@ func (d *Daemon) ImageDownload(op *operation, server string, protocol string, ce
 		info.CreatedAt = time.Unix(imageMeta.CreationDate, 0)
 		info.ExpiresAt = time.Unix(imageMeta.ExpiryDate, 0)
 		info.Properties = imageMeta.Properties
+	} else {
+		return nil, fmt.Errorf("Unsupported protocol: %v", protocol)
 	}
 
 	// Override visiblity


More information about the lxc-devel mailing list