|
|
6ae9ed |
From 4046e4e0a1d031f37b7e614e64ee0eeb968ecaeb Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <4046e4e0a1d031f37b7e614e64ee0eeb968ecaeb@dist-git>
|
|
|
6ae9ed |
From: Erik Skultety <eskultet@redhat.com>
|
|
|
6ae9ed |
Date: Tue, 2 Aug 2016 08:47:45 +0200
|
|
|
6ae9ed |
Subject: [PATCH] daemon: sasl: Don't forget to save SASL username to client's
|
|
|
6ae9ed |
identity
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Once the SASL authentication process has successfully passed, we should also
|
|
|
6ae9ed |
save the SASL username used to client's identity, so that when a client like
|
|
|
6ae9ed |
virt-admin tries to obtain it, the server will actually format the username to
|
|
|
6ae9ed |
the response data.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
|
|
6ae9ed |
(cherry picked from commit 5289e21f31be226fd22bc3b512b8cc233fa24046)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1361948
|
|
|
6ae9ed |
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
daemon/remote.c | 6 ++++++
|
|
|
6ae9ed |
1 file changed, 6 insertions(+)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/daemon/remote.c b/daemon/remote.c
|
|
|
6ae9ed |
index 4aa43c2..6991a7e 100644
|
|
|
6ae9ed |
--- a/daemon/remote.c
|
|
|
6ae9ed |
+++ b/daemon/remote.c
|
|
|
6ae9ed |
@@ -3116,6 +3116,7 @@ static int
|
|
|
6ae9ed |
remoteSASLFinish(virNetServerPtr server,
|
|
|
6ae9ed |
virNetServerClientPtr client)
|
|
|
6ae9ed |
{
|
|
|
6ae9ed |
+ virIdentityPtr clnt_identity = NULL;
|
|
|
6ae9ed |
const char *identity;
|
|
|
6ae9ed |
struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
|
|
|
6ae9ed |
int ssf;
|
|
|
6ae9ed |
@@ -3138,9 +3139,13 @@ remoteSASLFinish(virNetServerPtr server,
|
|
|
6ae9ed |
if (!virNetSASLContextCheckIdentity(saslCtxt, identity))
|
|
|
6ae9ed |
return -2;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
+ if (!(clnt_identity = virNetServerClientGetIdentity(client)))
|
|
|
6ae9ed |
+ goto error;
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
virNetServerClientSetAuth(client, 0);
|
|
|
6ae9ed |
virNetServerTrackCompletedAuth(server);
|
|
|
6ae9ed |
virNetServerClientSetSASLSession(client, priv->sasl);
|
|
|
6ae9ed |
+ virIdentitySetSASLUserName(clnt_identity, identity);
|
|
|
6ae9ed |
|
|
|
6ae9ed |
VIR_DEBUG("Authentication successful %d", virNetServerClientGetFD(client));
|
|
|
6ae9ed |
|
|
|
6ae9ed |
@@ -3148,6 +3153,7 @@ remoteSASLFinish(virNetServerPtr server,
|
|
|
6ae9ed |
"client=%p auth=%d identity=%s",
|
|
|
6ae9ed |
client, REMOTE_AUTH_SASL, identity);
|
|
|
6ae9ed |
|
|
|
6ae9ed |
+ virObjectUnref(clnt_identity);
|
|
|
6ae9ed |
virObjectUnref(priv->sasl);
|
|
|
6ae9ed |
priv->sasl = NULL;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.9.2
|
|
|
6ae9ed |
|