1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Rename SocketPeerInfo to SocketEndpointInfo.

I'm preparing to be able to ask about the other end of the connection
too, so the first step is to give this data structure a neutral name
that can refer to either. No functional change yet.
This commit is contained in:
Simon Tatham
2024-06-26 06:35:40 +01:00
parent 431838747b
commit f454c84a23
25 changed files with 61 additions and 61 deletions

View File

@ -488,7 +488,7 @@ static size_t sk_net_write(Socket *s, const void *data, size_t len);
static size_t sk_net_write_oob(Socket *s, const void *data, size_t len);
static void sk_net_write_eof(Socket *s);
static void sk_net_set_frozen(Socket *s, bool is_frozen);
static SocketPeerInfo *sk_net_peer_info(Socket *s);
static SocketEndpointInfo *sk_net_peer_info(Socket *s);
static const char *sk_net_socket_error(Socket *s);
static const SocketVtable NetSocket_sockvt = {
@ -1494,7 +1494,7 @@ static void sk_net_set_frozen(Socket *sock, bool is_frozen)
uxsel_tell(s);
}
static SocketPeerInfo *sk_net_peer_info(Socket *sock)
static SocketEndpointInfo *sk_net_peer_info(Socket *sock)
{
NetSocket *s = container_of(sock, NetSocket, sock);
union sockaddr_union addr;
@ -1502,12 +1502,12 @@ static SocketPeerInfo *sk_net_peer_info(Socket *sock)
#ifndef NO_IPV6
char buf[INET6_ADDRSTRLEN];
#endif
SocketPeerInfo *pi;
SocketEndpointInfo *pi;
if (getpeername(s->s, &addr.sa, &addrlen) < 0)
return NULL;
pi = snew(SocketPeerInfo);
pi = snew(SocketEndpointInfo);
pi->addressfamily = ADDRTYPE_UNSPEC;
pi->addr_text = NULL;
pi->port = -1;

View File

@ -299,12 +299,12 @@ static int server_accepting(Plug *p, accept_fn_t constructor, accept_ctx_t ctx)
if ((err = sk_socket_error(s)) != NULL)
return 1;
SocketPeerInfo *pi = sk_peer_info(s);
SocketEndpointInfo *pi = sk_peer_info(s);
char *msg = dupprintf("new connection from %s", pi->log_text);
log_to_stderr(inst->id, msg);
sfree(msg);
sk_free_peer_info(pi);
sk_free_endpoint_info(pi);
sk_set_frozen(s, false);
ssh_server_start(plug, s);

View File

@ -514,13 +514,13 @@ static int server_accepting(Plug *p, accept_fn_t constructor, accept_ctx_t ctx)
if ((err = sk_socket_error(s)) != NULL)
return 1;
SocketPeerInfo *pi = sk_peer_info(s);
SocketEndpointInfo *pi = sk_peer_info(s);
if (pi->addressfamily != ADDRTYPE_LOCAL && !sk_peer_trusted(s)) {
fprintf(stderr, "rejected connection to serv#%u "
"from %s (untrustworthy peer)\n",
cfg->config_id, pi->log_text);
sk_free_peer_info(pi);
sk_free_endpoint_info(pi);
sk_close(s);
next_id = old_next_id;
return 1;
@ -530,7 +530,7 @@ static int server_accepting(Plug *p, accept_fn_t constructor, accept_ctx_t ctx)
cfg->config_id, pi->log_text);
log_to_stderr(inst->id, msg);
sfree(msg);
sk_free_peer_info(pi);
sk_free_endpoint_info(pi);
sk_set_frozen(s, false);
ssh_server_start(plug, s);