From: Doug Goldstein Date: Wed, 4 Sep 2013 17:21:45 +0000 (-0500) Subject: BSD: Ensure UNIX socket credentials are valid X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=68674169af62c9235b8aae8e4e1699aa6a704381;p=libvirt.git BSD: Ensure UNIX socket credentials are valid Ensure that the socket credentials we got back on BSD are valid before using them. --- diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index b311aae8c2..49c6ddc6fa 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -1166,6 +1166,18 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock, return -1; } + if (cr.cr_version != XUCRED_VERSION) { + virReportError(VIR_ERR_SYSTEM_ERROR, "%s", + _("Failed to get valid client socket identity")); + return -1; + } + + if (cr.cr_ngroups == 0) { + virReportError(VIR_ERR_SYSTEM_ERROR, "%s", + _("Failed to get valid client socket identity groups")); + return -1; + } + *pid = -1; *uid = cr.cr_uid; *gid = cr.cr_gid;