[PATCH 3/7] Introduce virNetServerClientRemoteAddrStringURI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use it in virNetServerClientGetInfo to switch back to using
the URI-format (separated by ':') instead of the SASL format
(separated by ';').

Also use it in the error message reported byvirNetServerAddClient.
---
 src/libvirt_remote.syms      | 1 +
 src/rpc/virnetserver.c       | 2 +-
 src/rpc/virnetserverclient.c | 8 +++++++-
 src/rpc/virnetserverclient.h | 1 +
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
index f3cf65d..fd80e46 100644
--- a/src/libvirt_remote.syms
+++ b/src/libvirt_remote.syms
@@ -145,6 +145,7 @@ virNetServerClientNew;
 virNetServerClientNewPostExecRestart;
 virNetServerClientPreExecRestart;
 virNetServerClientRemoteAddrString;
+virNetServerClientRemoteAddrStringURI;
 virNetServerClientRemoveFilter;
 virNetServerClientSendMessage;
 virNetServerClientSetAuth;
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 4c4b144..8c8af97 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -243,7 +243,7 @@ int virNetServerAddClient(virNetServerPtr srv,
     if (srv->nclients >= srv->nclients_max) {
         virReportError(VIR_ERR_RPC,
                        _("Too many active clients (%zu), dropping connection from %s"),
-                       srv->nclients_max, virNetServerClientRemoteAddrString(client));
+                       srv->nclients_max, virNetServerClientRemoteAddrStringURI(client));
         goto error;
     }
 
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 2bc058c..15715a9 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -918,6 +918,12 @@ const char *virNetServerClientRemoteAddrString(virNetServerClientPtr client)
     return virNetSocketRemoteAddrString(client->sock);
 }
 
+const char *virNetServerClientRemoteAddrStringURI(virNetServerClientPtr client)
+{
+    if (!client->sock)
+        return NULL;
+    return virNetSocketRemoteAddrStringURI(client->sock);
+}
 
 void virNetServerClientDispose(void *obj)
 {
@@ -1608,7 +1614,7 @@ virNetServerClientGetInfo(virNetServerClientPtr client,
     virObjectLock(client);
     *readonly = client->readonly;
 
-    if (!(*sock_addr = virNetServerClientRemoteAddrString(client))) {
+    if (!(*sock_addr = virNetServerClientRemoteAddrStringURI(client))) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("No network socket associated with client"));
         goto cleanup;
diff --git a/src/rpc/virnetserverclient.h b/src/rpc/virnetserverclient.h
index c8b8dc1..bb9c937 100644
--- a/src/rpc/virnetserverclient.h
+++ b/src/rpc/virnetserverclient.h
@@ -140,6 +140,7 @@ int virNetServerClientStartKeepAlive(virNetServerClientPtr client);
 
 const char *virNetServerClientLocalAddrString(virNetServerClientPtr client);
 const char *virNetServerClientRemoteAddrString(virNetServerClientPtr client);
+const char *virNetServerClientRemoteAddrStringURI(virNetServerClientPtr client);
 
 int virNetServerClientSendMessage(virNetServerClientPtr client,
                                   virNetMessagePtr msg);
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]