changeset 28:e77af6acb559

Small fixes: abort before updating remote endpoint after serious decryption error, print IP address bytes in the expected order
author Ivo Smits <Ivo@UCIS.nl>
date Sat, 09 Apr 2011 17:46:04 +0200
parents 5ba185ca7102
children 7c5e5be876bb
files src/common.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/common.c	Sat Apr 09 17:36:48 2011 +0200
+++ b/src/common.c	Sat Apr 09 17:46:04 2011 +0200
@@ -260,12 +260,12 @@
 				fprintf(stderr, "Received end of file on udp socket (error %d)\n", out);
 			} else {
 				len = p->decode(&session, buffer_enc, buffer_raw, len);
+				if (len < 0) return len;
 				if (len != 0 && session.remote_float != 0 && (session.remote_addr.sin_addr.s_addr != recvaddr.sin_addr.s_addr || session.remote_addr.sin_port != recvaddr.sin_port)) {
-					fprintf(stderr, "Remote endpoint has changed to %08X:%d\n", recvaddr.sin_addr.s_addr, ntohs(recvaddr.sin_port));
+					fprintf(stderr, "Remote endpoint has changed to %08X:%d\n", ntohl(recvaddr.sin_addr.s_addr), ntohs(recvaddr.sin_port));
 					session.remote_addr = recvaddr;
 					session.remote_float = 2;
 				}
-				if (len < 0) return len;
 				write(ttfd, buffer_raw + p->offset_raw, len);
 			}
 		}