[Pkg-privacy-commits] [onioncat] 08/241: regarding sin_len-field of struct sockaddr

Intrigeri intrigeri at moszumanska.debian.org
Wed Aug 26 16:16:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch upstream-master
in repository onioncat.

commit eee37ba94add49dede01a39e41037f43bad81366
Author: eagle <eagle at 58e1ccc2-750e-0410-8d0d-f93ca75ab447>
Date:   Thu Feb 7 17:28:19 2008 +0000

    regarding sin_len-field of struct sockaddr
    
    git-svn-id: https://www.cypherpunk.at/svn/onioncat/trunk@122 58e1ccc2-750e-0410-8d0d-f93ca75ab447
---
 ocatroute.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/ocatroute.c b/ocatroute.c
index 5f7ae7b..f390271 100644
--- a/ocatroute.c
+++ b/ocatroute.c
@@ -499,10 +499,18 @@ void *socket_acceptor(void *p)
 
 void init_socket_acceptor(void)
 {
-   struct sockaddr_in in = {AF_INET, htons(ocat_listen_port_), {htonl(INADDR_LOOPBACK)}};
+   struct sockaddr_in in /*= {AF_INET, htons(ocat_listen_port_), {htonl(INADDR_LOOPBACK)}}*/ ;
    pthread_t thread;
    int rc;
 
+   memset(&in, 0, sizeof(in));
+   in.sin_family = AF_INET;
+   in.sin_port = htons(ocat_listen_port_);
+   in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+#ifndef linux
+   in.sin_len = sizeof(in);
+#endif
+
    if ((sockfd_ = socket(PF_INET, SOCK_STREAM, 0)) < 0)
       log_msg(L_FATAL, "[init_socket_acceptor] could not create listener socker: \"%s\"", strerror(errno)), exit(1);
 
@@ -522,13 +530,21 @@ void init_socket_acceptor(void)
 //int socks_connect(const char *onion)
 int socks_connect(const struct in6_addr *addr)
 {
-   struct sockaddr_in in = {AF_INET, htons(tor_socks_port_), {htonl(INADDR_LOOPBACK)}};
+   struct sockaddr_in in /* = {AF_INET, htons(tor_socks_port_), {htonl(INADDR_LOOPBACK)}}*/;
    int fd;
    char buf[FRAME_SIZE], onion[ONION_NAME_SIZE];
    SocksHdr_t *shdr = (SocksHdr_t*) buf;
 
    log_msg(L_DEBUG, "[socks_connect] called");
 
+   memset(&in, 0, sizeof(in));
+   in.sin_family = AF_INET;
+   in.sin_port = htons(tor_socks_port_);
+   in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+#ifndef linux
+   in.sin_len = sizeof(in);
+#endif
+
    ipv6tonion(addr, onion);
    strcat(onion, ".onion");
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onioncat.git



More information about the Pkg-privacy-commits mailing list