hypervOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
{
virDrvOpenStatus result = VIR_DRV_OPEN_ERROR;
+ char *plus;
hypervPrivate *priv = NULL;
char *username = NULL;
char *password = NULL;
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
- /* Decline if the URI is NULL or the scheme is not hyperv */
- if (conn->uri == NULL || conn->uri->scheme == NULL ||
- STRCASENEQ(conn->uri->scheme, "hyperv")) {
+ /* Decline if the URI is NULL or the scheme is NULL */
+ if (conn->uri == NULL || conn->uri->scheme == NULL) {
return VIR_DRV_OPEN_DECLINED;
}
+ /* Decline if the scheme is not hyperv */
+ plus = strchr(conn->uri->scheme, '+');
+
+ if (plus == NULL) {
+ if (STRCASENEQ(conn->uri->scheme, "hyperv")) {
+ return VIR_DRV_OPEN_DECLINED;
+ }
+ } else {
+ if (plus - conn->uri->scheme != 6 ||
+ STRCASENEQLEN(conn->uri->scheme, "hyperv", 6)) {
+ return VIR_DRV_OPEN_DECLINED;
+ }
+
+ HYPERV_ERROR(VIR_ERR_INVALID_ARG,
+ _("Transport '%s' in URI scheme is not supported, try again "
+ "without the transport part"), plus + 1);
+ return VIR_DRV_OPEN_ERROR;
+ }
+
/* Require server part */
if (conn->uri->server == NULL) {
HYPERV_ERROR(VIR_ERR_INVALID_ARG, "%s",