version 1.194, 2018/09/07 09:55:29 |
version 1.195, 2018/10/04 17:04:50 |
|
|
err(1, "pledge"); |
err(1, "pledge"); |
} |
} |
if (lflag) { |
if (lflag) { |
struct tls *tls_cctx = NULL; |
|
int connfd; |
|
ret = 0; |
ret = 0; |
|
|
if (family == AF_UNIX) { |
if (family == AF_UNIX) { |
|
|
|
|
readwrite(s, NULL); |
readwrite(s, NULL); |
} else { |
} else { |
|
struct tls *tls_cctx = NULL; |
|
int connfd; |
|
|
len = sizeof(cliaddr); |
len = sizeof(cliaddr); |
connfd = accept4(s, (struct sockaddr *)&cliaddr, |
connfd = accept4(s, (struct sockaddr *)&cliaddr, |
&len, SOCK_NONBLOCK); |
&len, SOCK_NONBLOCK); |
|
|
readwrite(connfd, tls_cctx); |
readwrite(connfd, tls_cctx); |
if (!usetls) |
if (!usetls) |
readwrite(connfd, NULL); |
readwrite(connfd, NULL); |
if (tls_cctx) { |
if (tls_cctx) |
timeout_tls(s, tls_cctx, tls_close); |
timeout_tls(s, tls_cctx, tls_close); |
tls_free(tls_cctx); |
|
tls_cctx = NULL; |
|
} |
|
close(connfd); |
close(connfd); |
|
tls_free(tls_cctx); |
} |
} |
if (family == AF_UNIX && uflag) { |
if (family == AF_UNIX && uflag) { |
if (connect(s, NULL, 0) < 0) |
if (connect(s, NULL, 0) < 0) |
|
|
for (s = -1, i = 0; portlist[i] != NULL; i++) { |
for (s = -1, i = 0; portlist[i] != NULL; i++) { |
if (s != -1) |
if (s != -1) |
close(s); |
close(s); |
|
tls_free(tls_ctx); |
|
tls_ctx = NULL; |
|
|
if (usetls) { |
if (usetls) { |
if ((tls_ctx = tls_client()) == NULL) |
if ((tls_ctx = tls_client()) == NULL) |
|
|
tls_setup_client(tls_ctx, s, host); |
tls_setup_client(tls_ctx, s, host); |
if (!zflag) |
if (!zflag) |
readwrite(s, tls_ctx); |
readwrite(s, tls_ctx); |
if (tls_ctx) { |
if (tls_ctx) |
timeout_tls(s, tls_ctx, tls_close); |
timeout_tls(s, tls_ctx, tls_close); |
tls_free(tls_ctx); |
|
tls_ctx = NULL; |
|
} |
|
} |
} |
} |
} |
} |
} |
|
|
if (s != -1) |
if (s != -1) |
close(s); |
close(s); |
|
tls_free(tls_ctx); |
tls_config_free(tls_cfg); |
tls_config_free(tls_cfg); |
|
|
return ret; |
return ret; |