Changeset 547 for trunk/src/ocatsocks.c
- Timestamp:
- 04/26/10 13:29:15 (2 years ago)
- File:
-
- 1 edited
-
trunk/src/ocatsocks.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ocatsocks.c
r534 r547 27 27 #include "ocat.h" 28 28 #include "ocat_netdesc.h" 29 #include "ocathosts.h" 29 30 30 31 … … 37 38 int socks_send_request(const SocksQueue_t *sq) 38 39 { 39 int len, ret ;40 char buf[SOCKS_BUFLEN], onion[N DESC(name_size)];40 int len, ret = -1; 41 char buf[SOCKS_BUFLEN], onion[NI_MAXHOST]; 41 42 SocksHdr_t *shdr = (SocksHdr_t*) buf; 42 43 43 ipv6tonion(&sq->addr, onion); 44 strlcat(onion, NDESC(domain), sizeof(onion)); 45 log_msg(LOG_INFO, "trying to connect to \"%s\" [%s]", onion, inet_ntop(AF_INET6, &sq->addr, buf, SOCKS_BUFLEN)); 44 // Do a hostname lookup if network type is I2P. 45 // This is done in order to be able to retrieve a 256 bit base32 46 // host from e.g. /etc/hosts. 47 if ((CNF(net_type) == NTYPE_I2P) && CNF(hosts_lookup)) 48 { 49 hosts_check(); 50 ret = hosts_get_name(&sq->addr, onion, sizeof(onion)); 51 } 52 53 // If no hostname was found above or network type is Tor 54 // do usual OnionCat name transformation. 55 if (ret == -1) 56 { 57 ipv6tonion(&sq->addr, onion); 58 strlcat(onion, NDESC(domain), sizeof(onion)); 59 } 60 61 if (inet_ntop(AF_INET6, &sq->addr, buf, sizeof(buf)) == NULL) 62 { 63 log_msg(LOG_WARNING, "inet_ntop failed: \"%s\"", strerror(errno)); 64 buf[0] = '\0'; 65 } 66 log_msg(LOG_INFO, "trying to connect to \"%s\" [%s] on %d", onion, buf, sq->fd); 46 67 47 68 log_debug("doing SOCKS4a handshake");
Note: See TracChangeset
for help on using the changeset viewer.
