[Pkg-privacy-commits] [onioncat] 207/340: - separate name for connect log and pid file for OC/GC. - mode detection (OC/GC) improved
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:04:40 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository onioncat.
commit 46aab1a0ce81ba3c5e888dd2894e186ba2d32e41
Author: eagle <eagle at 58e1ccc2-750e-0410-8d0d-f93ca75ab447>
Date: Wed Jan 6 12:08:22 2010 +0000
- separate name for connect log and pid file for OC/GC.
- mode detection (OC/GC) improved
git-svn-id: http://www.cypherpunk.at/svn/onioncat/trunk@536 58e1ccc2-750e-0410-8d0d-f93ca75ab447
---
ChangeLog | 2 ++
configure | 22 +++++++++++-----------
src/ocat.c | 26 +++++++++++++++++---------
src/ocat.h | 2 +-
src/ocat_netdesc.c | 4 ++++
src/ocat_netdesc.h | 6 ++++++
src/ocatlog.c | 3 ++-
src/ocatsetup.c | 1 +
8 files changed, 44 insertions(+), 22 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2c2a97f..8605e2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
* version 0.2.2
+ - separate name for connect log and pid file for OC/GC.
+ - mode detection (OC/GC) improved
- GarliCat branch merged back into trunk
- added onioncat-privatehosts.pl to trunk (written by zzz)
- option -t did not work correctly
diff --git a/configure b/configure
index a45b58f..fabc2ac 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r535.
+# Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r536.
#
# Report bugs to <rahra at cypherpunk.at>.
#
@@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='onioncat'
PACKAGE_TARNAME='onioncat'
-PACKAGE_VERSION='0.2.2.r535'
-PACKAGE_STRING='onioncat 0.2.2.r535'
+PACKAGE_VERSION='0.2.2.r536'
+PACKAGE_STRING='onioncat 0.2.2.r536'
PACKAGE_BUGREPORT='rahra at cypherpunk.at'
ac_subst_vars='SHELL
@@ -1260,7 +1260,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures onioncat 0.2.2.r535 to adapt to many kinds of systems.
+\`configure' configures onioncat 0.2.2.r536 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1330,7 +1330,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of onioncat 0.2.2.r535:";;
+ short | recursive ) echo "Configuration of onioncat 0.2.2.r536:";;
esac
cat <<\_ACEOF
@@ -1422,7 +1422,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-onioncat configure 0.2.2.r535
+onioncat configure 0.2.2.r536
generated by GNU Autoconf 2.62
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1436,7 +1436,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by onioncat $as_me 0.2.2.r535, which was
+It was created by onioncat $as_me 0.2.2.r536, which was
generated by GNU Autoconf 2.62. Invocation command line was
$ $0 $@
@@ -2085,7 +2085,7 @@ fi
# Define the identity of the package.
PACKAGE='onioncat'
- VERSION='0.2.2.r535'
+ VERSION='0.2.2.r536'
cat >>confdefs.h <<_ACEOF
@@ -2236,7 +2236,7 @@ ac_config_headers="$ac_config_headers config.h"
cat >>confdefs.h <<\_ACEOF
-#define SVN_REVISION "535"
+#define SVN_REVISION "536"
_ACEOF
@@ -5220,7 +5220,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by onioncat $as_me 0.2.2.r535, which was
+This file was extended by onioncat $as_me 0.2.2.r536, which was
generated by GNU Autoconf 2.62. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -5273,7 +5273,7 @@ Report bugs to <bug-autoconf at gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-onioncat config.status 0.2.2.r535
+onioncat config.status 0.2.2.r536
configured by $0, generated by GNU Autoconf 2.62,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/src/ocat.c b/src/ocat.c
index 6d22c90..8b32ef1 100644
--- a/src/ocat.c
+++ b/src/ocat.c
@@ -50,7 +50,7 @@ void usage(const char *s)
" -4 enable IPv4 support (default = %d)\n"
, CNF(version), s,
// option defaults start here
- OCAT_DIR, OCAT_CONNECT_LOG, CNF(create_clog),
+ OCAT_DIR, NDESC(clog_file), CNF(create_clog),
CNF(daemon), CNF(daemon) ^ 1,
CNF(debug_level), NDESC(listen_port),
CNF(pid_file),
@@ -275,9 +275,19 @@ int main(int argc, char *argv[])
char *s, ip6addr[INET6_ADDRSTRLEN], hw[20], def[100], pwdbuf[SIZE_1K];
int c, runasroot = 0;
struct passwd *pwd, pwdm;
- int urlconv = 0;
+ int urlconv = 0, mode_detect = 0;
init_setup();
+ // detect network type by command file name
+ // FIXME: this should be not hardcoded in that way
+ // FIXME: basename() should better be used instead of strstr()
+ if (strstr(argv[0], "gcat"))
+ {
+ CNF(net_type) = NTYPE_I2P;
+ snprintf(def, 100, "127.0.0.1:%d", NDESC(listen_port));
+ post_init_setup();
+ mode_detect = 1;
+ }
while ((c = getopt(argc, argv, "abBCd:f:hrRiIopl:t:T:s:u:4L:P:")) != -1)
switch (c)
@@ -380,13 +390,11 @@ int main(int argc, char *argv[])
exit(1);
}
- // detect network type by command file name
- // FIXME: this should be not hardcoded in that way
- if (!strcmp(argv[0], "gcat") || !strcmp(argv[0], "garlicat"))
- CNF(net_type) = NTYPE_I2P;
-
- snprintf(def, 100, "127.0.0.1:%d", NDESC(listen_port));
- post_init_setup();
+ if (!mode_detect)
+ {
+ snprintf(def, 100, "127.0.0.1:%d", NDESC(listen_port));
+ post_init_setup();
+ }
// usage output must be after mode detection (Tor/I2P)
if (argc < 2)
diff --git a/src/ocat.h b/src/ocat.h
index 2c6a797..051085b 100644
--- a/src/ocat.h
+++ b/src/ocat.h
@@ -116,7 +116,7 @@
#define OCAT_UNPRIV_UNAME "(unknown)"
#define OCAT_URL "http://www.abenteuerland.at/onioncat/"
#define OCAT_DIR ".ocat"
-#define OCAT_CONNECT_LOG "connect_log"
+//#define OCAT_CONNECT_LOG "connect_log"
#define PID_FILE "/var/run/ocat.pid"
#define OCAT_AUTHOR "Bernhard R. Fischer"
diff --git a/src/ocat_netdesc.c b/src/ocat_netdesc.c
index 4da56d0..8f74811 100644
--- a/src/ocat_netdesc.c
+++ b/src/ocat_netdesc.c
@@ -30,6 +30,8 @@ const struct NetDesc netdesc_[2] =
TOR_OCAT_CTRL_PORT,
TOR_OCAT_DEST_PORT,
TOR_SOCKS_PORT,
+ TOR_OCAT_CONNECT_LOG,
+ TOR_PID_FILE,
},
{
I2P_PREFIX, I2P_PREFIX_LEN,
@@ -40,6 +42,8 @@ const struct NetDesc netdesc_[2] =
I2P_OCAT_CTRL_PORT,
I2P_OCAT_DEST_PORT,
I2P_SOCKS_PORT,
+ I2P_OCAT_CONNECT_LOG,
+ I2P_PID_FILE,
},
};
diff --git a/src/ocat_netdesc.h b/src/ocat_netdesc.h
index c5f4db0..69f9de5 100644
--- a/src/ocat_netdesc.h
+++ b/src/ocat_netdesc.h
@@ -36,6 +36,8 @@ struct NetDesc
short ctrl_port;
short vdest_port;
short socks_port;
+ char *clog_file;
+ char *pid_file;
};
extern const struct NetDesc netdesc_[2];
@@ -67,6 +69,8 @@ extern const struct NetDesc netdesc_[2];
#define TOR_OCAT_DEST_PORT 8060
//! SOCKS port of TOR proxy
#define TOR_SOCKS_PORT 9050
+#define TOR_OCAT_CONNECT_LOG "ocat_connect_log"
+#define TOR_PID_FILE "/var/run/ocat.pid"
// ----- these are #defines for I2P -----
@@ -88,6 +92,8 @@ extern const struct NetDesc netdesc_[2];
#define I2P_OCAT_DEST_PORT I2P_OCAT_LISTEN_PORT
//! SOCKS port of TOR proxy
#define I2P_SOCKS_PORT 9051
+#define I2P_OCAT_CONNECT_LOG "gcat_connect_log"
+#define I2P_PID_FILE "/var/run/gcat.pid"
#endif
diff --git a/src/ocatlog.c b/src/ocatlog.c
index 77b28e0..65f3ea9 100644
--- a/src/ocatlog.c
+++ b/src/ocatlog.c
@@ -22,6 +22,7 @@
*/
#include "ocat.h"
+#include "ocat_netdesc.h"
#define TIMESTRLEN 64
#define CBUFLEN 1024
@@ -67,7 +68,7 @@ int open_connect_log(const char *dir)
}
strlcat(buf, "/", CBUFLEN);
- strlcat(buf, OCAT_CONNECT_LOG, CBUFLEN);
+ strlcat(buf, NDESC(clog_file), CBUFLEN);
log_debug("opening connect log \"%s\"", buf);
if (!(clog_ = fopen(buf, "a")))
diff --git a/src/ocatsetup.c b/src/ocatsetup.c
index bfdbd7c..90286c0 100644
--- a/src/ocatsetup.c
+++ b/src/ocatsetup.c
@@ -173,6 +173,7 @@ void post_init_setup(void)
#ifdef DEBUG
snprintf(&setup_.version[strlen(setup_.version)], VERSION_STRING_LEN - strlen(setup_.version), " -- compiled %s %s", __DATE__, __TIME__);
#endif
+ setup_.pid_file = NDESC(pid_file);
}
--
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