esx: Report an error when auth pointer is missing instead of declining

Otherwise an attempt to use virConnectOpen or virConnectOpenAuth without
auth pointer results in the driver declining the URI and libvirt falling
back to the remote driver for an esx:// URI.
This commit is contained in:
Matthias Bolte 2011-05-25 15:52:34 +02:00
parent 492e493a1e
commit dea64db1d2

View File

@ -922,9 +922,18 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
return VIR_DRV_OPEN_DECLINED; return VIR_DRV_OPEN_DECLINED;
} }
/* Decline URIs without server part, or missing auth */ /* Require server part */
if (conn->uri->server == NULL || auth == NULL || auth->cb == NULL) { if (conn->uri->server == NULL) {
return VIR_DRV_OPEN_DECLINED; ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
_("URI is missing the server part"));
return VIR_DRV_OPEN_ERROR;
}
/* Require auth */
if (auth == NULL || auth->cb == NULL) {
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
_("Missing or invalid auth pointer"));
return VIR_DRV_OPEN_ERROR;
} }
/* Allocate per-connection private data */ /* Allocate per-connection private data */