[utilities COMMIT] in /cpp-log4shib/trunk: configure.ac src/RemoteSyslogAppender.cpp

noreply at shibboleth.net noreply at shibboleth.net
Wed Jan 28 14:47:00 EST 2015


Author: scantor
Date: Wed Jan 28 14:47:00 2015
New Revision: 730

URL: http://svn.shibboleth.net/view/utilities?rev=730&view=rev
Log:
https://issues.shibboleth.net/jira/browse/SSPCPP-621

Modified:
    cpp-log4shib/trunk/configure.ac
    cpp-log4shib/trunk/src/RemoteSyslogAppender.cpp

Modified: cpp-log4shib/trunk/configure.ac
URL: http://svn.shibboleth.net/view/utilities/cpp-log4shib/trunk/configure.ac?rev=730&r1=729&r2=730&view=diff
==============================================================================
--- cpp-log4shib/trunk/configure.ac (original)
+++ cpp-log4shib/trunk/configure.ac Wed Jan 28 14:47:00 2015
@@ -1,4 +1,4 @@
-AC_INIT(log4shib, 1.0.8)
+AC_INIT(log4shib, 1.0.9)
 
 # autoconf 2.50 or higher to rebuild aclocal.m4, because the
 # AC_CREATE_PREFIX_CONFIG_H macro needs the AS_DIRNAME macro.
@@ -11,7 +11,7 @@
 #  ? :+1 : ?   == just some internal changes, nothing breaks but might work 
 #                 better
 # CURRENT : REVISION : AGE
-LT_VERSION=1:8:0
+LT_VERSION=1:9:0
 
 AC_SUBST(LT_VERSION)
 
@@ -24,14 +24,14 @@
 
 # General "with" options
 # ----------------------------------------------------------------------------
-AC_ARG_WITH(idsa, [  --with-idsa             include idsa support])
+AC_ARG_WITH(idsa, AS_HELP_STRING(--with-idsa, [include idsa support]),)
 
 # Checks for programs
 # ----------------------------------------------------------------------------
 AC_CANONICAL_HOST
 
 AC_ARG_ENABLE(debug,
-    AC_HELP_STRING(--enable-debug, [Have GCC compile with symbols (Default = no)]),
+    AS_HELP_STRING(--enable-debug, [Have GCC compile with symbols (Default = no)]),
     enable_debug=$enableval, enable_debug=no)
 
 if test "$enable_debug" = "yes" ; then
@@ -126,7 +126,7 @@
 
 # idsa_test
 if test "x$with_idsa" = xyes; then
-    AC_CHECK_LIB([idsa], [idsa_open])
+    AC_CHECK_LIB([idsa], [idsa_open],)
     if test "$ac_cv_lib_idsa_idsa_open" = no; then
         AC_MSG_ERROR([could not locate idsa library])
     fi

Modified: cpp-log4shib/trunk/src/RemoteSyslogAppender.cpp
URL: http://svn.shibboleth.net/view/utilities/cpp-log4shib/trunk/src/RemoteSyslogAppender.cpp?rev=730&r1=729&r2=730&view=diff
==============================================================================
--- cpp-log4shib/trunk/src/RemoteSyslogAppender.cpp (original)
+++ cpp-log4shib/trunk/src/RemoteSyslogAppender.cpp Wed Jan 28 14:47:00 2015
@@ -10,7 +10,7 @@
 #include "PortabilityImpl.hh"
 
 #ifdef LOG4SHIB_HAVE_UNISTD_H
-#    include <unistd.h>
+# include <unistd.h>
 #endif
 #include <cstdlib>
 #include <cstdio>
@@ -19,13 +19,15 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <log4shib/RemoteSyslogAppender.hh>
+#include <sstream>
 #ifdef WIN32
-#include <winsock2.h>
+# include <winsock2.h>
+# include <ws2tcpip.h>
 #else
-#include <netdb.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
+# include <netdb.h>
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
 #endif
 
 using std::memcpy;
@@ -55,9 +57,9 @@
 
     RemoteSyslogAppender::RemoteSyslogAppender(const std::string& name, 
                                    const std::string& syslogName, 
-				   const std::string& relayer,
+                                   const std::string& relayer,
                                    int facility,
-				   int portNumber) : 
+                                   int portNumber) :
         LayoutAppender(name),
         _syslogName(syslogName),
         _relayer(relayer),
@@ -72,47 +74,9 @@
     
     RemoteSyslogAppender::~RemoteSyslogAppender() {
         close();
-#ifdef WIN32
-	if (_cludge) {
-	    // we started it, we end it.
-	    WSACleanup ();
-	}
-#endif
     }
 
     void RemoteSyslogAppender::open() {
-        if (!_ipAddr) {
-            struct hostent *pent = gethostbyname (_relayer.c_str ());
-#ifdef WIN32
-            if (pent == NULL) {
-                if (WSAGetLastError () == WSANOTINITIALISED) {
-                    WSADATA wsaData;
-                    int err;
-
-                    err = WSAStartup (0x101, &wsaData );
-                    if (err) {
-                                // loglog("RemoteSyslogAppender: WSAStartup returned %d", err);
-                                return; // fail silently
-                            }
-                    pent = gethostbyname (_relayer.c_str ());
-                    _cludge = 1;
-                } else {
-                    // loglog("RemoteSyslogAppender: gethostbyname returned error");
-                            return; // fail silently
-                }
-            }
-#endif
-            if (pent == NULL) {
-                in_addr_t ip = inet_addr (_relayer.c_str ());
-                pent = gethostbyaddr ((const char *) &ip, sizeof(in_addr_t), AF_INET);
-                    if (pent == NULL) {
-                        // loglog("RemoteSyslogAppender: failed to resolve host %s", _relayer.c_str());
-                        return; // fail silently
-                    }
-            }
-            _ipAddr = *(pent->h_addr);
-        }
-
         // Get a datagram socket.

[... 75 lines stripped ...]


More information about the commits mailing list