• B
    better error checking for LOCAL_PEERCRED · aa0f0992
    Brian Candler 提交于
    This patch improves the error checking in the LOCAL_PEERCRED version
    of virNetSocketGetUNIXIdentity, used by FreeBSD and Mac OSX.
    
    1. The error return paths now correctly unlock the socket. This is
    implemented in exactly the same way as the SO_PEERCRED version,
    using "goto cleanup"
    
    2. cr.cr_ngroups is initialised to -1, and cr.cr_ngroups is checked
    for negative and overlarge values.
    
    This means that if the getsockopt() call returns success but doesn't
    actually update the xucred structure, this is now caught. This
    happened previously when getsockopt was called with SOL_SOCKET
    instead of SOL_LOCAL, prior to commit 5a468b38, and resulted in
    random uids being accepted.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    aa0f0992
virnetsocket.c 50.0 KB