Re: [libvirt PATCH] rpc: do not fail if the pid of the connecting process is not set

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

 



Martin Kletzander <mkletzan@xxxxxxxxxx> writes:

> On Wed, Nov 19, 2014 at 06:29:48PM +0100, Giuseppe Scrivano wrote:
>>getsockopt(sock->fd, SOL_SOCKET, SO_PEERCRED, ...) sets the pid to 0
>>when the process that opens the connection is in another container.
>>
>>Signed-off-by: Giuseppe Scrivano <gscrivan@xxxxxxxxxx>
>>---
>> src/rpc/virnetsocket.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>>diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
>>index 882fbec..6b019cc 100644
>>--- a/src/rpc/virnetsocket.c
>>+++ b/src/rpc/virnetsocket.c
>>@@ -1251,10 +1251,14 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
>>         goto cleanup;
>>     }
>>
>>-    if (virProcessGetStartTime(cr.pid, timestamp) < 0)
>>+    *timestamp = -1;
>>+    if (cr.pid && virProcessGetStartTime(cr.pid, timestamp) < 0)
>>         goto cleanup;
>>
>>-    *pid = cr.pid;
>>+    if (cr.pid)
>>+        *pid = cr.pid;
>>+    else
>>+        *pid = -1;
>>     *uid = cr.uid;
>>     *gid = cr.gid;
>>
>>--
>>1.9.3
>>
>
> ACK,
>
> Martin

Thanks, pushed now.

Giuseppe

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