diff options
author | Jim Fehlig <jfehlig@suse.com> | 2012-02-15 10:01:50 -0700 |
---|---|---|
committer | Doug Goldstein <cardoe@cardoe.com> | 2012-02-19 16:53:33 -0600 |
commit | a7cd601813c959535b6d4f3a18c92153cf687cd8 (patch) | |
tree | e14a247c776be6cb634f3ce48cf582bfe7aaf281 | |
parent | Fix build with polkit0 (diff) | |
download | libvirt-a7cd601813c959535b6d4f3a18c92153cf687cd8.tar.gz libvirt-a7cd601813c959535b6d4f3a18c92153cf687cd8.tar.bz2 libvirt-a7cd601813c959535b6d4f3a18c92153cf687cd8.zip |
Fix polkit0 authentication
Commit 7033c5f2 introduced some bugs in polkit0 authentication.
Fix libvirtd segfault in remoteDispatchAuthPolkit().
Fix polkit authentication bypass when caller UID = 0.
-rw-r--r-- | daemon/remote.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/daemon/remote.c b/daemon/remote.c index ed27053d8..74a5f16f2 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -2052,16 +2052,16 @@ remoteDispatchAuthList(virNetServerPtr server ATTRIBUTE_UNUSED, } else if (callerUid == 0) { char *ident; if (virAsprintf(&ident, "pid:%lld,uid:%d", - (long long) callerPid, callerUid) >= 0) { - VIR_INFO("Bypass polkit auth for privileged client %s", - ident); - if (virNetServerClientSetIdentity(client, ident) < 0) - virResetLastError(); - else - auth = VIR_NET_SERVER_SERVICE_AUTH_NONE; - VIR_FREE(ident); + (long long) callerPid, callerUid) < 0) { + virReportOOMError(); + goto cleanup; } - rv = -1; + VIR_INFO("Bypass polkit auth for privileged client %s", ident); + if (virNetServerClientSetIdentity(client, ident) < 0) + virResetLastError(); + else + auth = VIR_NET_SERVER_SERVICE_AUTH_NONE; + VIR_FREE(ident); } } @@ -2593,8 +2593,6 @@ remoteDispatchAuthPolkit(virNetServerPtr server, struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - memset(ident, 0, sizeof ident); - virMutexLock(&priv->lock); action = virNetServerClientGetReadonly(client) ? |