Пример #1
0
/*
 * Torsocks call for socketpair(2)
 */
LIBC_SOCKETPAIR_RET_TYPE tsocks_socketpair(LIBC_SOCKETPAIR_SIG)
{
	DBG("[socketpair] Creating socket with domain %d, type %d and protocol %d",
			domain, type, protocol);

	if (domain == AF_INET || domain == AF_INET6) {
		DBG("Non TCP socketpair denied. Tor network can't handle it.");
		errno = EPERM;
		return -1;
	}

	/* Stream socket for INET/INET6 is good so open it. */
	return tsocks_libc_socketpair(domain, type, protocol, sv);
}
Пример #2
0
/*
 * Torsocks call for socketpair(2)
 */
LIBC_SOCKETPAIR_RET_TYPE tsocks_socketpair(LIBC_SOCKETPAIR_SIG)
{
    DBG("[socketpair] Creating socket with domain %d, type %d and protocol %d",
        __domain, __type, __protocol);

    switch (__type) {
    case SOCK_STREAM:
        break;
    default:
        if (__domain == AF_INET || __domain == AF_INET6) {
            ERR("Non TCP socketpair denied. Tor network can't handle it. "
                "Stopping everything!");
            errno = EINVAL;
            return -1;
        }
        break;
    }

    /* Stream socket for INET/INET6 is good so open it. */
    return tsocks_libc_socketpair(__domain, __type, __protocol, __sv);
}