--- sshmitm.c.orig 2015-01-29 00:12:33.000000000 +0100
+++ sshmitm.c 2015-01-29 00:13:11.000000000 +0100
int client_fd, server_fd;
SSH_CTX *ssh_client_ctx, *ssh_server_ctx;
SSH *ssh_client, *ssh_server;
-struct sockaddr_in csin, ssin;
+struct sockaddr_in c_sin, s_sin;
if (setsockopt(mitm_fd, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i)) == -1)
- memset(&ssin, 0, sizeof(ssin));
- ssin.sin_family = AF_INET;
- ssin.sin_addr.s_addr = INADDR_ANY;
- ssin.sin_port = htons(lport);
+ memset(&s_sin, 0, sizeof(s_sin));
+ s_sin.sin_family = AF_INET;
+ s_sin.sin_addr.s_addr = INADDR_ANY;
+ s_sin.sin_port = htons(lport);
- if (bind(mitm_fd, (struct sockaddr *)&ssin, sizeof(ssin)) == -1)
+ if (bind(mitm_fd, (struct sockaddr *)&s_sin, sizeof(s_sin)) == -1)
if (listen(mitm_fd, 3) == -1)
- ssin.sin_addr.s_addr = ip;
- ssin.sin_port = htons(rport);
+ s_sin.sin_addr.s_addr = ip;
+ s_sin.sin_port = htons(rport);
warnx("new connection from %s.%d",
- inet_ntoa(csin.sin_addr), ntohs(csin.sin_port));
+ inet_ntoa(c_sin.sin_addr), ntohs(c_sin.sin_port));
if (fcntl(client_fd, F_SETFL, 0) == -1)
if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
- if (connect(server_fd, (struct sockaddr *)&ssin, sizeof(ssin)) == -1)
+ if (connect(server_fd, (struct sockaddr *)&s_sin, sizeof(s_sin)) == -1)
/* Relay version strings. */
- record(csin.sin_addr.s_addr,
+ record(c_sin.sin_addr.s_addr,