def check_credentials(client):
    """
    Checks credentials for given socket.
    """
    pid, uid, gid = get_peercred(client)

    euid = os.geteuid()
    client_name = "PID:%s UID:%s GID:%s" % (pid, uid, gid)
    if uid not in (0, euid):
        raise SuspiciousClient("Can't accept client with %s. It doesn't match the current EUID:%s or ROOT." % (
            client_name, euid
        ))

    _LOG("Accepted connection on fd:%s from %s" % (client.fileno(), client_name))
    return pid, uid, gid
def check_credentials ( client ) : pid , uid , gid = get_peercred ( client ) euid = os . geteuid ( ) client_name = "PID:%s UID:%s GID:%s" % ( pid , uid , gid ) if uid not in ( 0 , euid ) : raise SuspiciousClient ( "Can't accept client with %s. It doesn't match the current EUID:%s or ROOT." % ( client_name , euid ) ) _LOG ( "Accepted connection on fd:%s from %s" % ( client . fileno ( ) , client_name ) ) return pid , uid , gid
Checks credentials for given socket.