mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-03 02:15:23 +00:00
phyp: Remove virConnectPtr from PHYP_ERROR
This commit is contained in:
parent
ed510fce9c
commit
1870e70707
@ -63,8 +63,8 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_PHYP
|
#define VIR_FROM_THIS VIR_FROM_PHYP
|
||||||
|
|
||||||
#define PHYP_ERROR(conn, code, ...) \
|
#define PHYP_ERROR(code, ...) \
|
||||||
virReportErrorHelper(conn, VIR_FROM_PHYP, code, __FILE__, __FUNCTION__, \
|
virReportErrorHelper(NULL, VIR_FROM_PHYP, code, __FILE__, __FUNCTION__, \
|
||||||
__LINE__, __VA_ARGS__)
|
__LINE__, __VA_ARGS__)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -92,13 +92,13 @@ phypOpen(virConnectPtr conn,
|
|||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
|
||||||
if (conn->uri->server == NULL) {
|
if (conn->uri->server == NULL) {
|
||||||
PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
|
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Missing server name in phyp:// URI"));
|
"%s", _("Missing server name in phyp:// URI"));
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn->uri->path == NULL) {
|
if (conn->uri->path == NULL) {
|
||||||
PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
|
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Missing managed system name in phyp:// URI"));
|
"%s", _("Missing managed system name in phyp:// URI"));
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
}
|
}
|
||||||
@ -145,13 +145,13 @@ phypOpen(virConnectPtr conn,
|
|||||||
*char_ptr = '\0';
|
*char_ptr = '\0';
|
||||||
|
|
||||||
if (escape_specialcharacters(conn->uri->path, string, len) == -1) {
|
if (escape_specialcharacters(conn->uri->path, string, len) == -1) {
|
||||||
PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
|
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Error parsing 'path'. Invalid characters."));
|
"%s", _("Error parsing 'path'. Invalid characters."));
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((session = openSSHSession(conn, auth, &internal_socket)) == NULL) {
|
if ((session = openSSHSession(conn, auth, &internal_socket)) == NULL) {
|
||||||
PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
|
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Error while opening SSH session."));
|
"%s", _("Error while opening SSH session."));
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (auth == NULL || auth->cb == NULL) {
|
if (auth == NULL || auth->cb == NULL) {
|
||||||
PHYP_ERROR(conn, VIR_ERR_AUTH_FAILED,
|
PHYP_ERROR(VIR_ERR_AUTH_FAILED,
|
||||||
"%s", _("No authentication callback provided."));
|
"%s", _("No authentication callback provided."));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
username = virRequestUsername(auth, NULL, conn->uri->server);
|
username = virRequestUsername(auth, NULL, conn->uri->server);
|
||||||
|
|
||||||
if (username == NULL) {
|
if (username == NULL) {
|
||||||
PHYP_ERROR(conn, VIR_ERR_AUTH_FAILED, "Username request failed");
|
PHYP_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
|
|
||||||
ret = getaddrinfo(hostname, "22", &hints, &ai);
|
ret = getaddrinfo(hostname, "22", &hints, &ai);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
|
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Error while getting %s address info"), hostname);
|
_("Error while getting %s address info"), hostname);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@ -310,7 +310,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
cur = cur->ai_next;
|
cur = cur->ai_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
|
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Failed to connect to %s"), hostname);
|
_("Failed to connect to %s"), hostname);
|
||||||
freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
goto err;
|
goto err;
|
||||||
@ -330,7 +330,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
while ((rc = libssh2_session_startup(session, sock)) ==
|
while ((rc = libssh2_session_startup(session, sock)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN) ;
|
LIBSSH2_ERROR_EAGAIN) ;
|
||||||
if (rc) {
|
if (rc) {
|
||||||
PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
|
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Failure establishing SSH session."));
|
"%s", _("Failure establishing SSH session."));
|
||||||
goto disconnect;
|
goto disconnect;
|
||||||
}
|
}
|
||||||
@ -353,7 +353,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
|| rc == LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED
|
|| rc == LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED
|
||||||
|| rc == LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED) {
|
|| rc == LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED) {
|
||||||
if (auth == NULL || auth->cb == NULL) {
|
if (auth == NULL || auth->cb == NULL) {
|
||||||
PHYP_ERROR(conn, VIR_ERR_AUTH_FAILED,
|
PHYP_ERROR(VIR_ERR_AUTH_FAILED,
|
||||||
"%s", _("No authentication callback provided."));
|
"%s", _("No authentication callback provided."));
|
||||||
goto disconnect;
|
goto disconnect;
|
||||||
}
|
}
|
||||||
@ -361,7 +361,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
password = virRequestPassword(auth, username, conn->uri->server);
|
password = virRequestPassword(auth, username, conn->uri->server);
|
||||||
|
|
||||||
if (password == NULL) {
|
if (password == NULL) {
|
||||||
PHYP_ERROR(conn, VIR_ERR_AUTH_FAILED, "Password request failed");
|
PHYP_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
|
||||||
goto disconnect;
|
goto disconnect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
LIBSSH2_ERROR_EAGAIN) ;
|
LIBSSH2_ERROR_EAGAIN) ;
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
PHYP_ERROR(conn, VIR_ERR_AUTH_FAILED,
|
PHYP_ERROR(VIR_ERR_AUTH_FAILED,
|
||||||
"%s", _("Authentication failed"));
|
"%s", _("Authentication failed"));
|
||||||
goto disconnect;
|
goto disconnect;
|
||||||
} else
|
} else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user