[Pkg-privacy-commits] [onioncat] 165/241: sylogging implemented
Intrigeri
intrigeri at moszumanska.debian.org
Wed Aug 26 16:16:59 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 c89781fc6066a6dc71c4fb73da8871c2ef128fc2
Author: eagle <eagle at 58e1ccc2-750e-0410-8d0d-f93ca75ab447>
Date: Sun Mar 1 12:36:12 2009 +0000
sylogging implemented
git-svn-id: https://www.cypherpunk.at/svn/onioncat/trunk@485 58e1ccc2-750e-0410-8d0d-f93ca75ab447
---
ChangeLog | 2 +-
configure | 22 +++++++++++-----------
configure.ac | 2 +-
src/ocat.c | 32 ++++++++++++++++----------------
src/ocat.h | 4 +++-
src/ocatlog.c | 20 +++++++++++++++++---
src/ocatsetup.c | 2 +-
7 files changed, 50 insertions(+), 34 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3a3a510..d3db35c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,5 @@
* version 0.1.12
-
+ - syslogging implemented
* version 0.1.11
- version tagged (this actually is 0.1.10-r472)
diff --git a/configure b/configure
index 762178d..a0136d8 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.61 for onioncat 0.1.10-475M.
+# Generated by GNU Autoconf 2.61 for onioncat 0.1.12-484M.
#
# Report bugs to <rahra at cypherpunk.at>.
#
@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='onioncat'
PACKAGE_TARNAME='onioncat'
-PACKAGE_VERSION='0.1.10-475M'
-PACKAGE_STRING='onioncat 0.1.10-475M'
+PACKAGE_VERSION='0.1.12-484M'
+PACKAGE_STRING='onioncat 0.1.12-484M'
PACKAGE_BUGREPORT='rahra at cypherpunk.at'
# Factoring default headers for most tests.
@@ -1206,7 +1206,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.1.10-475M to adapt to many kinds of systems.
+\`configure' configures onioncat 0.1.12-484M to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1272,7 +1272,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of onioncat 0.1.10-475M:";;
+ short | recursive ) echo "Configuration of onioncat 0.1.12-484M:";;
esac
cat <<\_ACEOF
@@ -1362,7 +1362,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-onioncat configure 0.1.10-475M
+onioncat configure 0.1.12-484M
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1376,7 +1376,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.1.10-475M, which was
+It was created by onioncat $as_me 0.1.12-484M, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2066,7 +2066,7 @@ fi
# Define the identity of the package.
PACKAGE='onioncat'
- VERSION='0.1.10-475M'
+ VERSION='0.1.12-484M'
cat >>confdefs.h <<_ACEOF
@@ -2217,7 +2217,7 @@ ac_config_headers="$ac_config_headers config.h"
cat >>confdefs.h <<\_ACEOF
-#define SVN_REVISION "475M"
+#define SVN_REVISION "484M"
_ACEOF
@@ -5300,7 +5300,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.1.10-475M, which was
+This file was extended by onioncat $as_me 0.1.12-484M, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -5353,7 +5353,7 @@ Report bugs to <bug-autoconf at gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-onioncat config.status 0.1.10-475M
+onioncat config.status 0.1.12-484M
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.ac b/configure.ac
index 1c322a3..38d7ee4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
AC_PREREQ(2.61)
define([svnversion], esyscmd([sh -c "svnversion | tr -d '\n'"]))dnl
-AC_INIT([onioncat], [0.1.10-svnversion], [rahra at cypherpunk.at])
+AC_INIT([onioncat], [0.1.12-svnversion], [rahra at cypherpunk.at])
AM_INIT_AUTOMAKE([-Wall -Werror])
AC_CONFIG_HEADERS([config.h])
diff --git a/src/ocat.c b/src/ocat.c
index ebd119b..80d97ca 100644
--- a/src/ocat.c
+++ b/src/ocat.c
@@ -67,19 +67,22 @@ void usage(const char *s)
*/
int open_logfile(void)
{
+ FILE *f;
+
if (CNF(logfn))
{
log_debug("opening log file \"%s\"", CNF(logfn));
- if ((CNF(logf) = fopen(CNF(logfn), "a")))
+ if ((f = fopen(CNF(logfn), "a")))
{
+ CNF(logf) = f;
log_debug("logfile %s opened", CNF(logfn));
if (setvbuf(CNF(logf), NULL, _IOLBF, 0))
log_msg(LOG_ERR, "could not setup line buffering: %s", strerror(errno));
fflush(CNF(logf));
return 0;
}
- CNF(logf) = stderr;
- log_msg(LOG_ERR, "could not open logfile %s: %s. Defaulting to stderr", CNF(logfn), strerror(errno));
+ //CNF(logf) = stderr;
+ log_msg(LOG_ERR, "could not open logfile %s: %s.", CNF(logfn), strerror(errno));
}
return -1;
}
@@ -311,6 +314,15 @@ int main(int argc, char *argv[])
if (!CNF(rand_addr) && !argv[optind])
usage(argv[0]), exit(1);
+ if (urlconv)
+ CNF(daemon) = 0;
+
+ // log to stderr if in foreground
+ if (!CNF(daemon))
+ CNF(logf) = stderr;
+
+ (void) open_logfile();
+
// init main thread
(void) init_ocat_thread("main");
detach_thread();
@@ -355,7 +367,7 @@ int main(int argc, char *argv[])
exit(0);
}
- log_msg(LOG_INFO, "%s (c) %s -- compiled %s %s", OCAT_AUTHOR, PACKAGE_STRING, __DATE__, __TIME__);
+ log_msg(LOG_INFO | LOG_FERR, "%s (c) %s -- compiled %s %s", OCAT_AUTHOR, PACKAGE_STRING, __DATE__, __TIME__);
#if 0
if (CNF(config_file))
@@ -428,18 +440,6 @@ int main(int argc, char *argv[])
}
log_debug("uid/gid = %d/%d", getuid(), getgid());
- // opening logfile
- if (CNF(daemon) && !CNF(logfn))
- {
- log_debug("connecting logfile to /dev/null because of daemon option");
- CNF(logfn) = "/dev/null";
- }
- if ((open_logfile() == -1) && CNF(daemon))
- {
- log_msg(LOG_NOTICE, "staying in foreground");
- CNF(daemon) = 0;
- }
-
if (CNF(create_clog))
open_connect_log(pwd->pw_dir);
diff --git a/src/ocat.h b/src/ocat.h
index 9a2d5dd..7332ca2 100644
--- a/src/ocat.h
+++ b/src/ocat.h
@@ -164,7 +164,8 @@
//! select timeout (to avoid endless blocking)
#define SELECT_TIMEOUT 10
-#define LOG_FCONN 0x80
+#define LOG_FCONN 0x400
+#define LOG_FERR 0x800
#define E_SOCKS_SOCK -1
#define E_SOCKS_CONN -2
@@ -602,6 +603,7 @@ uint16_t *malloc_ckbuf(const struct in6_addr *, const struct in6_addr *, uint16_
/* ocatsocks.c */
void socks_queue(struct in6_addr, int);
void print_socks_queue(FILE *);
+void sig_socks_connector(void);
/* ocatlibe.c */
void oe_close(int);
diff --git a/src/ocatlog.c b/src/ocatlog.c
index e132c4e..fa14fef 100644
--- a/src/ocatlog.c
+++ b/src/ocatlog.c
@@ -118,9 +118,17 @@ void vlog_msgf(FILE *out, int lf, const char *fmt, va_list ap)
}
(void) pthread_mutex_lock(&log_mutex_);
- fprintf(out, "%s.%03d %s [%d:%-*s:%6s] ", timestr, (int) (tv.tv_usec / 1000), timez, th->id, THREAD_NAME_LEN - 1, th->name, flty_[level]);
- vfprintf(out, fmt, ap);
- fprintf(out, "\n");
+ if (out)
+ {
+ fprintf(out, "%s.%03d %s [%d:%-*s:%6s] ", timestr, (int) (tv.tv_usec / 1000), timez, th->id, THREAD_NAME_LEN - 1, th->name, flty_[level]);
+ vfprintf(out, fmt, ap);
+ fprintf(out, "\n");
+ }
+ else
+ {
+ // log to syslog if no output stream is available
+ vsyslog(level | LOG_DAEMON, fmt, ap);
+ }
(void) pthread_mutex_unlock(&log_mutex_);
}
@@ -145,5 +153,11 @@ void log_msg(int lf, const char *fmt, ...)
va_end(ap);
(void) fflush(clog_);
}
+ if (lf & LOG_FERR)
+ {
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ }
}
diff --git a/src/ocatsetup.c b/src/ocatsetup.c
index 41e6f82..e4c105e 100644
--- a/src/ocatsetup.c
+++ b/src/ocatsetup.c
@@ -100,7 +100,7 @@ void init_setup(void)
log_msg(LOG_WARNING, "could gettimeofday(): \"%s\"", strerror(errno));
srand(tv.tv_sec ^ tv.tv_usec);
- setup_.logf = stderr;
+ //setup_.logf = stderr;
setup_.uptime = time(NULL);
setup_.socks_dst->sin_family = AF_INET;
--
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