[PATCH 4/4] Rename APIs for fetching UNIX socket credentials

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

To avoid a namespace clash with forthcoming identity APIs,
rename the virNet*GetLocalIdentity() APIs to have the form
virNet*GetUNIXIdentity()

* daemon/remote.c, src/libvirt_private.syms: Update
  for renamed APIs
* src/rpc/virnetserverclient.c, src/rpc/virnetserverclient.h,
  src/rpc/virnetsocket.c, src/rpc/virnetsocket.h: s/LocalIdentity/UNIXIdentity/
---
 daemon/remote.c              |    6 +++---
 src/libvirt_private.syms     |    2 +-
 src/rpc/virnetserverclient.c |    6 +++---
 src/rpc/virnetserverclient.h |    4 ++--
 src/rpc/virnetsocket.c       |   16 ++++++++--------
 src/rpc/virnetsocket.h       |    8 ++++----
 6 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index d917786..3b8ccd9 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -2038,7 +2038,7 @@ remoteDispatchAuthList(virNetServerPtr server ATTRIBUTE_UNUSED,
      * some piece of polkit isn't present/running
      */
     if (auth == VIR_NET_SERVER_SERVICE_AUTH_POLKIT) {
-        if (virNetServerClientGetLocalIdentity(client, &callerUid, &callerGid, &callerPid) < 0) {
+        if (virNetServerClientGetUNIXIdentity(client, &callerUid, &callerGid, &callerPid) < 0) {
             /* Don't do anything on error - it'll be validated at next
              * phase of auth anyway */
             virResetLastError();
@@ -2494,7 +2494,7 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
         goto authfail;
     }
 
-    if (virNetServerClientGetLocalIdentity(client, &callerUid, &callerGid, &callerPid) < 0) {
+    if (virNetServerClientGetUNIXIdentity(client, &callerUid, &callerGid, &callerPid) < 0) {
         goto authfail;
     }
 
@@ -2592,7 +2592,7 @@ remoteDispatchAuthPolkit(virNetServerPtr server,
         goto authfail;
     }
 
-    if (virNetServerClientGetLocalIdentity(client, &callerUid, &callerGid, &callerPid) < 0) {
+    if (virNetServerClientGetUNIXIdentity(client, &callerUid, &callerGid, &callerPid) < 0) {
         VIR_ERROR(_("cannot get peer socket identity"));
         goto authfail;
     }
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 8301c78..cf17ed1 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1291,7 +1291,7 @@ virNetServerClientDelayedClose;
 virNetServerClientFree;
 virNetServerClientGetAuth;
 virNetServerClientGetFD;
-virNetServerClientGetLocalIdentity;
+virNetServerClientGetUNIXIdentity;
 virNetServerClientGetPrivateData;
 virNetServerClientGetReadonly;
 virNetServerClientGetTLSKeySize;
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index ed08e40..67600fd 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -447,13 +447,13 @@ int virNetServerClientGetFD(virNetServerClientPtr client)
     return fd;
 }
 
-int virNetServerClientGetLocalIdentity(virNetServerClientPtr client,
-                                       uid_t *uid, gid_t *gid, pid_t *pid)
+int virNetServerClientGetUNIXIdentity(virNetServerClientPtr client,
+                                      uid_t *uid, gid_t *gid, pid_t *pid)
 {
     int ret = -1;
     virNetServerClientLock(client);
     if (client->sock)
-        ret = virNetSocketGetLocalIdentity(client->sock, uid, gid, pid);
+        ret = virNetSocketGetUNIXIdentity(client->sock, uid, gid, pid);
     virNetServerClientUnlock(client);
     return ret;
 }
diff --git a/src/rpc/virnetserverclient.h b/src/rpc/virnetserverclient.h
index 2dd01c5..154a160 100644
--- a/src/rpc/virnetserverclient.h
+++ b/src/rpc/virnetserverclient.h
@@ -70,8 +70,8 @@ int virNetServerClientSetIdentity(virNetServerClientPtr client,
                                   const char *identity);
 const char *virNetServerClientGetIdentity(virNetServerClientPtr client);
 
-int virNetServerClientGetLocalIdentity(virNetServerClientPtr client,
-                                       uid_t *uid, gid_t *gid, pid_t *pid);
+int virNetServerClientGetUNIXIdentity(virNetServerClientPtr client,
+                                      uid_t *uid, gid_t *gid, pid_t *pid);
 
 void virNetServerClientRef(virNetServerClientPtr client);
 
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 8178ac3..67d33b7 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -824,10 +824,10 @@ int virNetSocketGetPort(virNetSocketPtr sock)
 
 
 #ifdef SO_PEERCRED
-int virNetSocketGetLocalIdentity(virNetSocketPtr sock,
-                                 uid_t *uid,
-                                 gid_t *gid,
-                                 pid_t *pid)
+int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
+                                uid_t *uid,
+                                gid_t *gid,
+                                pid_t *pid)
 {
     struct ucred cr;
     socklen_t cr_len = sizeof (cr);
@@ -848,10 +848,10 @@ int virNetSocketGetLocalIdentity(virNetSocketPtr sock,
     return 0;
 }
 #else
-int virNetSocketGetLocalIdentity(virNetSocketPtr sock ATTRIBUTE_UNUSED,
-                                 uid_t *uid ATTRIBUTE_UNUSED,
-                                 gid_t *gid ATTRIBUTE_UNUSED,
-                                 pid_t *pid ATTRIBUTE_UNUSED)
+int virNetSocketGetUNIXIdentity(virNetSocketPtr sock ATTRIBUTE_UNUSED,
+                                uid_t *uid ATTRIBUTE_UNUSED,
+                                gid_t *gid ATTRIBUTE_UNUSED,
+                                pid_t *pid ATTRIBUTE_UNUSED)
 {
     /* XXX Many more OS support UNIX socket credentials we could port to. See dbus ....*/
     virReportSystemError(ENOSYS, "%s",
diff --git a/src/rpc/virnetsocket.h b/src/rpc/virnetsocket.h
index c2a040f..5ba7c8f 100644
--- a/src/rpc/virnetsocket.h
+++ b/src/rpc/virnetsocket.h
@@ -86,10 +86,10 @@ bool virNetSocketHasPassFD(virNetSocketPtr sock);
 
 int virNetSocketGetPort(virNetSocketPtr sock);
 
-int virNetSocketGetLocalIdentity(virNetSocketPtr sock,
-                                 uid_t *uid,
-                                 gid_t *gid,
-                                 pid_t *pid);
+int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
+                                uid_t *uid,
+                                gid_t *gid,
+                                pid_t *pid);
 
 int virNetSocketSetBlocking(virNetSocketPtr sock,
                             bool blocking);
-- 
1.7.7.5

--
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]