[Pkg-privacy-commits] [onioncat] 179/340: error checking for inet_ntop in ocat.c improved syslogging

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:04:37 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 823dd70c6163731e54a15a1f1ce7c462b9a93dda
Author: eagle <eagle at 58e1ccc2-750e-0410-8d0d-f93ca75ab447>
Date:   Wed Apr 15 11:58:03 2009 +0000

    error checking for inet_ntop in ocat.c
    improved syslogging
    
    
    git-svn-id: http://www.cypherpunk.at/svn/onioncat/trunk@499 58e1ccc2-750e-0410-8d0d-f93ca75ab447
---
 configure      | 22 +++++++++++-----------
 src/ocat.c     |  4 +++-
 src/ocatctrl.c |  4 ++++
 src/ocatlog.c  |  6 +++++-
 4 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index c382d9c..3d6b616 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.63 for onioncat 0.1.12.r496.
+# Generated by GNU Autoconf 2.63 for onioncat 0.1.12.r497.
 #
 # 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.1.12.r496'
-PACKAGE_STRING='onioncat 0.1.12.r496'
+PACKAGE_VERSION='0.1.12.r497'
+PACKAGE_STRING='onioncat 0.1.12.r497'
 PACKAGE_BUGREPORT='rahra at cypherpunk.at'
 
 ac_subst_vars='LTLIBOBJS
@@ -1249,7 +1249,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.12.r496 to adapt to many kinds of systems.
+\`configure' configures onioncat 0.1.12.r497 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1315,7 +1315,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of onioncat 0.1.12.r496:";;
+     short | recursive ) echo "Configuration of onioncat 0.1.12.r497:";;
    esac
   cat <<\_ACEOF
 
@@ -1407,7 +1407,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-onioncat configure 0.1.12.r496
+onioncat configure 0.1.12.r497
 generated by GNU Autoconf 2.63
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1421,7 +1421,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.12.r496, which was
+It was created by onioncat $as_me 0.1.12.r497, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   $ $0 $@
@@ -2137,7 +2137,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='onioncat'
- VERSION='0.1.12.r496'
+ VERSION='0.1.12.r497'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2284,7 +2284,7 @@ ac_config_headers="$ac_config_headers config.h"
 
 
 cat >>confdefs.h <<\_ACEOF
-#define SVN_REVISION "496"
+#define SVN_REVISION "497"
 _ACEOF
 
 
@@ -4803,7 +4803,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.12.r496, which was
+This file was extended by onioncat $as_me 0.1.12.r497, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4866,7 +4866,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.1.12.r496
+onioncat config.status 0.1.12.r497
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/src/ocat.c b/src/ocat.c
index cd0f3f8..acecb6f 100644
--- a/src/ocat.c
+++ b/src/ocat.c
@@ -361,7 +361,9 @@ int main(int argc, char *argv[])
    if (CNF(ipv4_enable))
       oniontipv4(CNF(onion_url), &CNF(ocat_addr4), ntohl(CNF(ocat_addr4_mask)));
 
-   inet_ntop(AF_INET6, &CNF(ocat_addr), ip6addr, INET6_ADDRSTRLEN);
+   if (!inet_ntop(AF_INET6, &CNF(ocat_addr), ip6addr, INET6_ADDRSTRLEN))
+      log_msg(LOG_ERR, "cannot convert IP address with inet_ntop: \"%s\"", strerror(errno)),
+         exit(1);
 
    if (urlconv == 1)
    {
diff --git a/src/ocatctrl.c b/src/ocatctrl.c
index 2afb46d..31fe1b1 100644
--- a/src/ocatctrl.c
+++ b/src/ocatctrl.c
@@ -297,6 +297,10 @@ void *ctrl_handler(void *p)
    if (!CNF(config_read))
       CNF(config_read) = 1;
 
+   // close pipe
+   oe_close(pfd[0]);
+   oe_close(pfd[1]);
+
    return NULL;
 }
 
diff --git a/src/ocatlog.c b/src/ocatlog.c
index 8ea33ae..77b28e0 100644
--- a/src/ocatlog.c
+++ b/src/ocatlog.c
@@ -95,6 +95,7 @@ void vlog_msgf(FILE *out, int lf, const char *fmt, va_list ap)
    const OcatThread_t *th = get_thread();
    OcatThread_t ths;
    int level = LOG_PRI(lf);
+   char buf[SIZE_1K];
 
    if (CNF(debug_level) < level)
       return;
@@ -127,7 +128,10 @@ void vlog_msgf(FILE *out, int lf, const char *fmt, va_list ap)
    else
    {
       // log to syslog if no output stream is available
-      vsyslog(level | LOG_DAEMON, fmt, ap);
+      //vsyslog(level | LOG_DAEMON, fmt, ap);
+      vsnprintf(buf, SIZE_1K, fmt, ap);
+      syslog(level | LOG_DAEMON, "[%s] %s", th->name, buf);
+
    }
    (void) pthread_mutex_unlock(&log_mutex_);
 }

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