]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Check for duplicated id in virStorageSourceParseRBDColonString
authorJohn Ferlan <jferlan@redhat.com>
Tue, 12 Feb 2019 13:36:40 +0000 (08:36 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 12 Feb 2019 18:11:45 +0000 (13:11 -0500)
If we find multiple "id=" strings during processing, then we need
to force an error since we cannot have multiple <auth>'s defined
for a single source volume.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virstoragefile.c

index 5a8e5667f5a76a359f29a4a3142ccd8f85a98a96..8d85d9dac49a4af11c7144c12579ec1e7ba795fd 100644 (file)
@@ -2840,6 +2840,11 @@ virStorageSourceParseRBDColonString(const char *rbdstr,
 
         if (STRPREFIX(p, "id=")) {
             /* formulate authdef for src->auth */
+            if (src->auth) {
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("duplicate 'id' found in '%s'"), src->path);
+                return -1;
+            }
             if (VIR_ALLOC(authdef) < 0)
                 return -1;