mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
Revert "virnetsocket: Provide socket address format in a more standard form"
This partially reverts commit 9b45c9f049
.
It changed the default format of socket address from the one SASL
requires, but did not adjust all the callers.
It also removed the test coverage for it.
Revert most of the changes except the virSocketAddrFormatFull support
for URI-formatted strings.
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1345743 while
reverting the format used by virt-admin's client-info command from
the URI one to the SASL one.
https://bugzilla.redhat.com/show_bug.cgi?id=1345743
This commit is contained in:
parent
6d7ba87359
commit
0f7eeb20ad
@ -3016,8 +3016,6 @@ remoteDispatchAuthSaslInit(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
virNetSASLSessionPtr sasl = NULL;
|
||||
struct daemonClientPrivate *priv =
|
||||
virNetServerClientGetPrivateData(client);
|
||||
char *localAddr = NULL;
|
||||
char *remoteAddr = NULL;
|
||||
|
||||
virMutexLock(&priv->lock);
|
||||
|
||||
@ -3028,17 +3026,10 @@ remoteDispatchAuthSaslInit(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
goto authfail;
|
||||
}
|
||||
|
||||
localAddr = virNetServerClientLocalAddrFormatSASL(client);
|
||||
remoteAddr = virNetServerClientRemoteAddrFormatSASL(client);
|
||||
|
||||
sasl = virNetSASLSessionNewServer(saslCtxt,
|
||||
"libvirt",
|
||||
localAddr,
|
||||
remoteAddr);
|
||||
|
||||
VIR_FREE(localAddr);
|
||||
VIR_FREE(remoteAddr);
|
||||
|
||||
virNetServerClientLocalAddrString(client),
|
||||
virNetServerClientRemoteAddrString(client));
|
||||
if (!sasl)
|
||||
goto authfail;
|
||||
|
||||
|
@ -3809,8 +3809,6 @@ remoteAuthSASL(virConnectPtr conn, struct private_data *priv,
|
||||
sasl_callback_t *saslcb = NULL;
|
||||
int ret = -1;
|
||||
const char *mechlist;
|
||||
char *localAddr = NULL;
|
||||
char *remoteAddr = NULL;
|
||||
virNetSASLContextPtr saslCtxt;
|
||||
virNetSASLSessionPtr sasl = NULL;
|
||||
struct remoteAuthInteractState state;
|
||||
@ -3829,9 +3827,6 @@ remoteAuthSASL(virConnectPtr conn, struct private_data *priv,
|
||||
saslcb = NULL;
|
||||
}
|
||||
|
||||
localAddr = virNetClientLocalAddrFormatSASL(priv->client);
|
||||
remoteAddr = virNetClientRemoteAddrFormatSASL(priv->client);
|
||||
|
||||
/* Setup a handle for being a client */
|
||||
if (!(sasl = virNetSASLSessionNewClient(saslCtxt,
|
||||
"libvirt",
|
||||
@ -4019,8 +4014,6 @@ remoteAuthSASL(virConnectPtr conn, struct private_data *priv,
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(serverin);
|
||||
VIR_FREE(localAddr);
|
||||
VIR_FREE(remoteAddr);
|
||||
|
||||
remoteAuthInteractStateClear(&state, true);
|
||||
VIR_FREE(saslcb);
|
||||
|
@ -954,16 +954,6 @@ const char *virNetClientRemoteAddrString(virNetClientPtr client)
|
||||
return virNetSocketRemoteAddrString(client->sock);
|
||||
}
|
||||
|
||||
char *virNetClientLocalAddrFormatSASL(virNetClientPtr client)
|
||||
{
|
||||
return virNetSocketLocalAddrFormatSASL(client->sock);
|
||||
}
|
||||
|
||||
char *virNetClientRemoteAddrFormatSASL(virNetClientPtr client)
|
||||
{
|
||||
return virNetSocketRemoteAddrFormatSASL(client->sock);
|
||||
}
|
||||
|
||||
#if WITH_GNUTLS
|
||||
int virNetClientGetTLSKeySize(virNetClientPtr client)
|
||||
{
|
||||
|
@ -123,8 +123,6 @@ bool virNetClientIsOpen(virNetClientPtr client);
|
||||
|
||||
const char *virNetClientLocalAddrString(virNetClientPtr client);
|
||||
const char *virNetClientRemoteAddrString(virNetClientPtr client);
|
||||
char *virNetClientLocalAddrFormatSASL(virNetClientPtr client);
|
||||
char *virNetClientRemoteAddrFormatSASL(virNetClientPtr client);
|
||||
|
||||
# ifdef WITH_GNUTLS
|
||||
int virNetClientGetTLSKeySize(virNetClientPtr client);
|
||||
|
@ -918,19 +918,6 @@ const char *virNetServerClientRemoteAddrString(virNetServerClientPtr client)
|
||||
return virNetSocketRemoteAddrString(client->sock);
|
||||
}
|
||||
|
||||
char *virNetServerClientLocalAddrFormatSASL(virNetServerClientPtr client)
|
||||
{
|
||||
if (!client->sock)
|
||||
return NULL;
|
||||
return virNetSocketLocalAddrFormatSASL(client->sock);
|
||||
}
|
||||
|
||||
char *virNetServerClientRemoteAddrFormatSASL(virNetServerClientPtr client)
|
||||
{
|
||||
if (!client->sock)
|
||||
return NULL;
|
||||
return virNetSocketRemoteAddrFormatSASL(client->sock);
|
||||
}
|
||||
|
||||
void virNetServerClientDispose(void *obj)
|
||||
{
|
||||
|
@ -140,8 +140,6 @@ int virNetServerClientStartKeepAlive(virNetServerClientPtr client);
|
||||
|
||||
const char *virNetServerClientLocalAddrString(virNetServerClientPtr client);
|
||||
const char *virNetServerClientRemoteAddrString(virNetServerClientPtr client);
|
||||
char *virNetServerClientLocalAddrFormatSASL(virNetServerClientPtr client);
|
||||
char *virNetServerClientRemoteAddrFormatSASL(virNetServerClientPtr client);
|
||||
|
||||
int virNetServerClientSendMessage(virNetServerClientPtr client,
|
||||
virNetMessagePtr msg);
|
||||
|
@ -262,11 +262,11 @@ static virNetSocketPtr virNetSocketNew(virSocketAddrPtr localAddr,
|
||||
|
||||
|
||||
if (localAddr &&
|
||||
!(sock->localAddrStr = virSocketAddrFormatFull(localAddr, true, NULL)))
|
||||
!(sock->localAddrStr = virSocketAddrFormatFull(localAddr, true, ";")))
|
||||
goto error;
|
||||
|
||||
if (remoteAddr &&
|
||||
!(sock->remoteAddrStr = virSocketAddrFormatFull(remoteAddr, true, NULL)))
|
||||
!(sock->remoteAddrStr = virSocketAddrFormatFull(remoteAddr, true, ";")))
|
||||
goto error;
|
||||
|
||||
sock->client = isClient;
|
||||
@ -1465,19 +1465,6 @@ const char *virNetSocketRemoteAddrString(virNetSocketPtr sock)
|
||||
return sock->remoteAddrStr;
|
||||
}
|
||||
|
||||
/* These helper functions return a SASL-formatted socket addr string,
|
||||
* caller is responsible for freeing the string.
|
||||
*/
|
||||
char *virNetSocketLocalAddrFormatSASL(virNetSocketPtr sock)
|
||||
{
|
||||
return virSocketAddrFormatFull(&sock->localAddr, true, ";");
|
||||
}
|
||||
|
||||
char *virNetSocketRemoteAddrFormatSASL(virNetSocketPtr sock)
|
||||
{
|
||||
return virSocketAddrFormatFull(&sock->remoteAddr, true, ";");
|
||||
}
|
||||
|
||||
|
||||
#if WITH_GNUTLS
|
||||
static ssize_t virNetSocketTLSSessionWrite(const char *buf,
|
||||
|
@ -150,8 +150,6 @@ bool virNetSocketHasPendingData(virNetSocketPtr sock);
|
||||
|
||||
const char *virNetSocketLocalAddrString(virNetSocketPtr sock);
|
||||
const char *virNetSocketRemoteAddrString(virNetSocketPtr sock);
|
||||
char *virNetSocketLocalAddrFormatSASL(virNetSocketPtr sock);
|
||||
char *virNetSocketRemoteAddrFormatSASL(virNetSocketPtr sock);
|
||||
|
||||
int virNetSocketListen(virNetSocketPtr sock, int backlog);
|
||||
int virNetSocketAccept(virNetSocketPtr sock,
|
||||
|
@ -249,7 +249,7 @@ static int testSocketUNIXAddrs(const void *data ATTRIBUTE_UNUSED)
|
||||
if (virNetSocketNewListenUNIX(path, 0700, -1, getegid(), &lsock) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (STRNEQ(virNetSocketLocalAddrString(lsock), "127.0.0.1:0")) {
|
||||
if (STRNEQ(virNetSocketLocalAddrString(lsock), "127.0.0.1;0")) {
|
||||
VIR_DEBUG("Unexpected local address");
|
||||
goto cleanup;
|
||||
}
|
||||
@ -265,12 +265,12 @@ static int testSocketUNIXAddrs(const void *data ATTRIBUTE_UNUSED)
|
||||
if (virNetSocketNewConnectUNIX(path, false, NULL, &csock) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (STRNEQ(virNetSocketLocalAddrString(csock), "127.0.0.1:0")) {
|
||||
if (STRNEQ(virNetSocketLocalAddrString(csock), "127.0.0.1;0")) {
|
||||
VIR_DEBUG("Unexpected local address");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (STRNEQ(virNetSocketRemoteAddrString(csock), "127.0.0.1:0")) {
|
||||
if (STRNEQ(virNetSocketRemoteAddrString(csock), "127.0.0.1;0")) {
|
||||
VIR_DEBUG("Unexpected local address");
|
||||
goto cleanup;
|
||||
}
|
||||
@ -282,12 +282,12 @@ static int testSocketUNIXAddrs(const void *data ATTRIBUTE_UNUSED)
|
||||
}
|
||||
|
||||
|
||||
if (STRNEQ(virNetSocketLocalAddrString(ssock), "127.0.0.1:0")) {
|
||||
if (STRNEQ(virNetSocketLocalAddrString(ssock), "127.0.0.1;0")) {
|
||||
VIR_DEBUG("Unexpected local address");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (STRNEQ(virNetSocketRemoteAddrString(ssock), "127.0.0.1:0")) {
|
||||
if (STRNEQ(virNetSocketRemoteAddrString(ssock), "127.0.0.1;0")) {
|
||||
VIR_DEBUG("Unexpected local address");
|
||||
goto cleanup;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user