diff options
author | Erik Skultety <eskultet@redhat.com> | 2016-04-26 13:39:06 +0200 |
---|---|---|
committer | Erik Skultety <eskultet@redhat.com> | 2016-05-03 15:52:50 +0200 |
commit | 9b45c9f049a7e9b6c1abfa6988b63b760714e169 (patch) | |
tree | d0e78a5c95e19a1ce70230a800b312cc30f81ab4 /daemon/remote.c | |
parent | f84a4c0a4149d31631bdfe4dbc7854b39b5128fd (diff) | |
download | libvirt-9b45c9f049a7e9b6c1abfa6988b63b760714e169.tar.gz |
virnetsocket: Provide socket address format in a more standard form
Our socket address format is in a rather non-standard format and that is
because sasl library requires the IP address and service to be delimited by a
semicolon. The string form is a completely internal matter, however once the
admin interfaces to retrieve client identity information are merged, we should
return the socket address string in a common format, e.g. format defined by
URI rfc-3986, i.e. the IP address and service are delimited by a colon and
in case of an IPv6 address, square brackets are added:
Examples:
127.0.0.1:1234
[::1]:1234
This patch changes our default format to the one described above, while adding
separate methods to request the non-standard SASL format using semicolon as a
delimiter.
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Diffstat (limited to 'daemon/remote.c')
-rw-r--r-- | daemon/remote.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/daemon/remote.c b/daemon/remote.c index fde029da21..b2a420bc00 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -2937,6 +2937,8 @@ remoteDispatchAuthSaslInit(virNetServerPtr server ATTRIBUTE_UNUSED, virNetSASLSessionPtr sasl = NULL; struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); + char *localAddr = NULL; + char *remoteAddr = NULL; virMutexLock(&priv->lock); @@ -2947,10 +2949,17 @@ remoteDispatchAuthSaslInit(virNetServerPtr server ATTRIBUTE_UNUSED, goto authfail; } + localAddr = virNetServerClientLocalAddrFormatSASL(client); + remoteAddr = virNetServerClientRemoteAddrFormatSASL(client); + sasl = virNetSASLSessionNewServer(saslCtxt, "libvirt", - virNetServerClientLocalAddrString(client), - virNetServerClientRemoteAddrString(client)); + localAddr, + remoteAddr); + + VIR_FREE(localAddr); + VIR_FREE(remoteAddr); + if (!sasl) goto authfail; |