[or-cvs] get network/host order working right again for socks4
Roger Dingledine
arma at seul.org
Sun Sep 21 06:44:55 UTC 2003
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
buffers.c or.h
Log Message:
get network/host order working right again for socks4
Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/buffers.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- buffers.c 21 Sep 2003 06:15:43 -0000 1.34
+++ buffers.c 21 Sep 2003 06:44:53 -0000 1.35
@@ -281,8 +281,8 @@
/* an inlined socks4_unpack() */
socks4_info.version = *buf;
socks4_info.command = *(buf+1);
- socks4_info.destport = *(uint16_t*)(buf+2);
- socks4_info.destip = *(uint32_t*)(buf+4);
+ socks4_info.destport = ntohs(*(uint16_t*)(buf+2));
+ socks4_info.destip = ntohl(*(uint32_t*)(buf+4));
if(socks4_info.version != 4) {
log_fn(LOG_NOTICE,"Unrecognized version %d.",socks4_info.version);
@@ -294,7 +294,7 @@
return -1;
}
- port = ntohs(socks4_info.destport);
+ port = socks4_info.destport;
if(!port) {
log_fn(LOG_NOTICE,"Port is zero.");
return -1;
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- or.h 21 Sep 2003 06:15:43 -0000 1.134
+++ or.h 21 Sep 2003 06:44:53 -0000 1.135
@@ -219,7 +219,7 @@
typedef struct {
unsigned char version; /* socks version number */
unsigned char command; /* command code */
- uint16_t destport; /* destination port, network order */
+ uint16_t destport; /* destination port, host order */
uint32_t destip; /* destination address, host order */
/* userid follows, terminated by a \0 */
/* dest host follows, terminated by a \0 */
More information about the tor-commits
mailing list