]> xenbits.xensource.com Git - libvirt.git/commitdiff
Short circuit SASL auth when no mechanisms are available
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 15 Mar 2017 18:03:37 +0000 (18:03 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 16 Mar 2017 11:01:39 +0000 (11:01 +0000)
If the SASL config does not have any mechanisms we currently
just report an empty list to the client which will then
fail to identify a usable mechanism. This is a server config
error, so we should fail immediately on the server side.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/rpc/virnetsaslcontext.c

index 37a5da279d32e1f482afaad68b58e94532234ef9..c4492ecd2c8624e870802bcb5de5949ae2f5f7be 100644 (file)
@@ -390,6 +390,12 @@ char *virNetSASLSessionListMechanisms(virNetSASLSessionPtr sasl)
                        err, sasl_errdetail(sasl->conn));
         goto cleanup;
     }
+    VIR_DEBUG("SASL mechanism list is '%s'", mechlist);
+    if (STREQ(mechlist, "")) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("no SASL mechanisms are available"));
+        goto cleanup;
+    }
     ignore_value(VIR_STRDUP(ret, mechlist));
 
  cleanup: