nts: log early client NTS-KE socket errors
Log an error message when SCK_OpenTcpSocket() fails in the NTS-KE client, e.g. when connect() fails due to the port not being allowed in the SELinux policy.
This commit is contained in:
parent
9cb9021c87
commit
0fcdf4389b
1 changed files with 6 additions and 4 deletions
|
@ -335,15 +335,17 @@ NKC_Start(NKC_Instance inst)
|
||||||
local_addr.port = 0;
|
local_addr.port = 0;
|
||||||
iface = CNF_GetBindAcquisitionInterface();
|
iface = CNF_GetBindAcquisitionInterface();
|
||||||
|
|
||||||
sock_fd = SCK_OpenTcpSocket(&inst->address, &local_addr, iface, 0);
|
|
||||||
if (sock_fd < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Make a label containing both the address and name of the server */
|
/* Make a label containing both the address and name of the server */
|
||||||
if (snprintf(label, sizeof (label), "%s (%s)",
|
if (snprintf(label, sizeof (label), "%s (%s)",
|
||||||
UTI_IPSockAddrToString(&inst->address), inst->name) >= sizeof (label))
|
UTI_IPSockAddrToString(&inst->address), inst->name) >= sizeof (label))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
sock_fd = SCK_OpenTcpSocket(&inst->address, &local_addr, iface, 0);
|
||||||
|
if (sock_fd < 0) {
|
||||||
|
LOG(LOGS_ERR, "Could not connect to %s", label);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Start an NTS-KE session */
|
/* Start an NTS-KE session */
|
||||||
if (!NKSN_StartSession(inst->session, sock_fd, label, client_credentials, CLIENT_TIMEOUT)) {
|
if (!NKSN_StartSession(inst->session, sock_fd, label, client_credentials, CLIENT_TIMEOUT)) {
|
||||||
SCK_CloseSocket(sock_fd);
|
SCK_CloseSocket(sock_fd);
|
||||||
|
|
Loading…
Reference in a new issue