]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
get network/host order working right again for socks4
authorRoger Dingledine <arma@torproject.org>
Sun, 21 Sep 2003 06:44:53 +0000 (06:44 +0000)
committerRoger Dingledine <arma@torproject.org>
Sun, 21 Sep 2003 06:44:53 +0000 (06:44 +0000)
svn:r476

src/or/buffers.c
src/or/or.h

index 7a7bd1fad456c27db39d40044515793b385e0520..087998d28c8cc1b1de6a60407a2220966c127d73 100644 (file)
@@ -281,8 +281,8 @@ int fetch_from_buf_socks(char *buf, int *buf_datalen,
   /* 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 @@ int fetch_from_buf_socks(char *buf, int *buf_datalen,
     return -1;
   }
 
-  port = ntohs(socks4_info.destport);
+  port = socks4_info.destport;
   if(!port) {
     log_fn(LOG_NOTICE,"Port is zero.");
     return -1;
index 234a507d7a1ddab9618454c8d514f18d19f3c984..82601c8ddd75da8c5a6297dd81cd400d9bf9aaa0 100644 (file)
 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 */