mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
BSD: Ensure UNIX socket credentials are valid
Ensure that the socket credentials we got back on BSD are valid before using them.
This commit is contained in:
parent
8294aa0c17
commit
68674169af
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user