Changeset View
Changeset View
Standalone View
Standalone View
contrib/openbsm/bin/auditdistd/proto_tls.c
Show First 20 Lines • Show All 407 Lines • ▼ Show 20 Lines | #endif | ||||
ssl_check_error(ssl, (int)ret); | ssl_check_error(ssl, (int)ret); | ||||
nonblock(sockfd); | nonblock(sockfd); | ||||
nonblock(tcpfd); | nonblock(tcpfd); | ||||
tls_certificate_verify(ssl, fingerprint); | tls_certificate_verify(ssl, fingerprint); | ||||
/* | /* | ||||
* The following byte is send to make proto_connect_wait() to work. | * The following byte is sent to make proto_connect_wait() work. | ||||
*/ | */ | ||||
connected = 1; | connected = 1; | ||||
for (;;) { | for (;;) { | ||||
switch (send(sockfd, &connected, sizeof(connected), 0)) { | switch (send(sockfd, &connected, sizeof(connected), 0)) { | ||||
case -1: | case -1: | ||||
if (errno == EINTR || errno == ENOBUFS) | if (errno == EINTR || errno == ENOBUFS) | ||||
continue; | continue; | ||||
if (errno == EAGAIN) { | if (errno == EAGAIN) { | ||||
Show All 30 Lines | tls_call_exec_client(struct proto_conn *sock, const char *srcaddr, | ||||
if (proto_descriptor(sock) != startfd) { | if (proto_descriptor(sock) != startfd) { | ||||
/* Move socketpair descriptor to descriptor number startfd. */ | /* Move socketpair descriptor to descriptor number startfd. */ | ||||
if (dup2(proto_descriptor(sock), startfd) == -1) | if (dup2(proto_descriptor(sock), startfd) == -1) | ||||
pjdlog_exit(EX_OSERR, "dup2() failed"); | pjdlog_exit(EX_OSERR, "dup2() failed"); | ||||
proto_close(sock); | proto_close(sock); | ||||
} else { | } else { | ||||
/* | /* | ||||
* The FD_CLOEXEC is cleared by dup2(2), so when we not | * The FD_CLOEXEC is cleared by dup2(2), so when we do not | ||||
* call it, we have to clear it by hand in case it is set. | * call it, we have to clear it by hand in case it is set. | ||||
*/ | */ | ||||
if (fcntl(startfd, F_SETFD, 0) == -1) | if (fcntl(startfd, F_SETFD, 0) == -1) | ||||
pjdlog_exit(EX_OSERR, "fcntl() failed"); | pjdlog_exit(EX_OSERR, "fcntl() failed"); | ||||
} | } | ||||
closefrom(startfd + 1); | closefrom(startfd + 1); | ||||
▲ Show 20 Lines • Show All 603 Lines • Show Last 20 Lines |