[Pkg-privacy-commits] [onioncat] 228/241: add option argument 'none' to -t and -l to disable incoming/outgoind sessions

Intrigeri intrigeri at moszumanska.debian.org
Wed Aug 26 16:17:16 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 3c30d4cd15fd232561ef1c5b160d8af0f5dae13d
Author: eagle <eagle at 58e1ccc2-750e-0410-8d0d-f93ca75ab447>
Date:   Thu Jul 4 11:25:47 2013 +0000

    add option argument 'none' to -t and -l to disable incoming/outgoind sessions
    
    git-svn-id: https://www.cypherpunk.at/svn/onioncat/trunk@557 58e1ccc2-750e-0410-8d0d-f93ca75ab447
---
 man/ocat.1      |  8 +++++++-
 src/ocat.c      | 23 ++++++++++++++++++-----
 src/ocatroute.c |  2 +-
 src/ocatsocks.c |  4 ++++
 4 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/man/ocat.1 b/man/ocat.1
index ffbe7ca..d6170b0 100644
--- a/man/ocat.1
+++ b/man/ocat.1
@@ -104,8 +104,11 @@ with the command name \fBgcat\fP.
 .TP
 \fB\-l\fP \fI[ip:]port\fP
 Bind Onioncat to specific \fIip \fP and/or \fIport\fP number for incoming
-connections.  This defaults to 127.0.0.1:8060. This option could be set
+connections. It defaults to 127.0.0.1:8060. This option could be set
 multiple times. IPv6 addresses must be given in square brackets.
+.br
+The parameter \fI"none"\fP deactivates the listener completely. This is for
+special purpose only and shall not be used in regular operation.
 .TP
 \fB\-L\fP \fIlog_file\fP
 Log output to \fIlog_file\fP. If option is omitted, OnionCat logs to syslog if
@@ -149,6 +152,9 @@ not be changed.
 Set Tor SOCKS \fIIP\fP and/or \fIport\fP. If no \fIIP\fP is specified 127.0.0.1
 will be used, if no \fIport\fP is specified 9050 will be used as defaults. IPv6
 addresses must be escaped by square brackets.
+.br
+The special parameter \fI"none"\fP disables OnionCat from making outbound
+connections. This shall be used only in special test scenarios.
 .TP
 \fB\-T\fP \fItun_dev\fP
 TUN device file to open for creation of TUN interface. It defaults to
diff --git a/src/ocat.c b/src/ocat.c
index 69936e0..d925af7 100644
--- a/src/ocat.c
+++ b/src/ocat.c
@@ -370,7 +370,12 @@ int parse_opt(int argc, char *argv[])
             break;
 
          case 'l':
-            add_listener(optarg);
+            if (CNF(oc_listen_cnt) == -1)
+               break;
+            if (!strcasecmp(optarg, "none"))
+               CNF(oc_listen_cnt) = -1;
+            else
+               add_listener(optarg);
             break;
 
          case 'L':
@@ -410,7 +415,9 @@ int parse_opt(int argc, char *argv[])
             break;
 
          case 't':
-            if (strsockaddr(optarg, (struct sockaddr*) CNF(socks_dst)) == -1)
+            if (!strcasecmp(optarg, "none"))
+               CNF(socks_dst)->sin_family = 0;
+            else if (strsockaddr(optarg, (struct sockaddr*) CNF(socks_dst)) == -1)
                exit(1);
             break;
 
@@ -583,13 +590,16 @@ int main(int argc, char *argv[])
    if (CNF(create_pid_file))
       mk_pid_file();
 
-   if (!CNF(oc_listen))
+   if (!CNF(oc_listen_cnt))
       add_listener(def);
 
    // start socket receiver thread
    run_ocat_thread("receiver", socket_receiver, NULL);
    // create listening socket and start socket acceptor
-   run_ocat_thread("acceptor", socket_acceptor, NULL);
+   if (CNF(oc_listen_cnt) > 0)
+      run_ocat_thread("acceptor", socket_acceptor, NULL);
+   else
+      log_msg(LOG_INFO, "acceptor not started");
    // starting socket cleaner
    run_ocat_thread("cleaner", socket_cleaner, NULL);
 
@@ -627,7 +637,10 @@ int main(int argc, char *argv[])
    // create socks connector thread and communication queue
    if (pipe(CNF(socksfd)) == -1)
       log_msg(LOG_EMERG, "couldn't create socks connector pipe: \"%s\"", strerror(errno)), exit(1);
-   run_ocat_thread("connector", socks_connector_sel, NULL);
+   if (CNF(socks_dst)->sin_family)
+      run_ocat_thread("connector", socks_connector_sel, NULL);
+   else
+      log_msg(LOG_INFO, "connector not started");
 
 #ifdef PACKET_QUEUE
    // start packet dequeuer
diff --git a/src/ocatroute.c b/src/ocatroute.c
index fbbf682..fd9bb78 100644
--- a/src/ocatroute.c
+++ b/src/ocatroute.c
@@ -984,7 +984,7 @@ void *socket_cleaner(void *ptr)
       if (act_time - stat_wup >= STAT_WAKEUP)
       {
          stat_wup = act_time;
-         log_msg(LOG_INFO, "stats: ... (not implemented yet)");
+         //log_msg(LOG_INFO, "stats: ... (not implemented yet)");
 
          lock_setup();
          if (CNF(clear_stats))
diff --git a/src/ocatsocks.c b/src/ocatsocks.c
index 448064f..f9c69fd 100644
--- a/src/ocatsocks.c
+++ b/src/ocatsocks.c
@@ -220,6 +220,10 @@ void socks_queue(struct in6_addr addr, int perm)
 {
    SocksQueue_t *squeue, sq;
 
+   // dont queue if SOCKS is disabled (-t none)
+   if (!CNF(socks_dst)->sin_family)
+      return;
+
    for (squeue = socks_queue_; squeue; squeue = squeue->next)
       if (IN6_ARE_ADDR_EQUAL(&squeue->addr, &addr))
          break;

-- 
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