提交 68674169 编写于 作者: D Doug Goldstein

BSD: Ensure UNIX socket credentials are valid

Ensure that the socket credentials we got back on BSD are valid before
using them.
上级 8294aa0c
...@@ -1166,6 +1166,18 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock, ...@@ -1166,6 +1166,18 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
return -1; 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; *pid = -1;
*uid = cr.cr_uid; *uid = cr.cr_uid;
*gid = cr.cr_gid; *gid = cr.cr_gid;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册