Hello community, here is the log from the commit of package librelp for openSUSE:Factory checked in at 2016-07-12 23:53:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/librelp (Old) and /work/SRC/openSUSE:Factory/.librelp.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "librelp" Changes: -------- --- /work/SRC/openSUSE:Factory/librelp/librelp.changes 2016-07-01 09:59:47.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.librelp.new/librelp.changes 2016-07-12 23:53:06.000000000 +0200 @@ -1,0 +2,7 @@ +Sun Jul 10 18:43:57 UTC 2016 - [email protected] + +- librelp 1.2.12: + * API enhancement: permit to set connection timeout + * cleanup: replace deprecated GnuTLS data types by current ones + +------------------------------------------------------------------- Old: ---- librelp-1.2.11.tar.gz New: ---- librelp-1.2.12.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ librelp.spec ++++++ --- /var/tmp/diff_new_pack.EggKsP/_old 2016-07-12 23:53:07.000000000 +0200 +++ /var/tmp/diff_new_pack.EggKsP/_new 2016-07-12 23:53:07.000000000 +0200 @@ -18,7 +18,7 @@ %define library_name librelp0 Name: librelp -Version: 1.2.11 +Version: 1.2.12 Release: 0 Summary: A reliable logging library License: GPL-3.0+ ++++++ librelp-1.2.11.tar.gz -> librelp-1.2.12.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.11/ChangeLog new/librelp-1.2.12/ChangeLog --- old/librelp-1.2.11/ChangeLog 2016-06-22 16:23:49.000000000 +0200 +++ new/librelp-1.2.12/ChangeLog 2016-07-07 13:25:48.000000000 +0200 @@ -1,4 +1,12 @@ ---------------------------------------------------------------------- +Version 1.2.12 - 2016-07-07 +- API enhancement: permit to set connection timeout + Thanks to Nathan Brown for the patch. +- cleanup: replace deprecated GnuTLS data types by current ones +- CI improvements: added dynamic tests + we now use the rsyslog testbench to do dynamic librelp tests. This + currently happens only under Travis CI. +---------------------------------------------------------------------- Version 1.2.11 - 2016-06-22 - bugfix: do not accept more than one "open" verb on a connection closes https://github.com/rsyslog/librelp/issues/37 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.11/configure new/librelp-1.2.12/configure --- old/librelp-1.2.11/configure 2016-06-22 16:24:07.000000000 +0200 +++ new/librelp-1.2.12/configure 2016-07-07 14:18:43.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for librelp 1.2.11. +# Generated by GNU Autoconf 2.69 for librelp 1.2.12. # # Report bugs to <[email protected]>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='librelp' PACKAGE_TARNAME='librelp' -PACKAGE_VERSION='1.2.11' -PACKAGE_STRING='librelp 1.2.11' +PACKAGE_VERSION='1.2.12' +PACKAGE_STRING='librelp 1.2.12' PACKAGE_BUGREPORT='[email protected]' PACKAGE_URL='' @@ -1337,7 +1337,7 @@ # 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 librelp 1.2.11 to adapt to many kinds of systems. +\`configure' configures librelp 1.2.12 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1408,7 +1408,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of librelp 1.2.11:";; + short | recursive ) echo "Configuration of librelp 1.2.12:";; esac cat <<\_ACEOF @@ -1528,7 +1528,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -librelp configure 1.2.11 +librelp configure 1.2.12 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2054,7 +2054,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by librelp $as_me 1.2.11, which was +It was created by librelp $as_me 1.2.12, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2917,7 +2917,7 @@ # Define the identity of the package. PACKAGE='librelp' - VERSION='1.2.11' + VERSION='1.2.12' cat >>confdefs.h <<_ACEOF @@ -3032,7 +3032,7 @@ # Define the identity of the package. PACKAGE='librelp' - VERSION='1.2.11' + VERSION='1.2.12' cat >>confdefs.h <<_ACEOF @@ -13785,7 +13785,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by librelp $as_me 1.2.11, which was +This file was extended by librelp $as_me 1.2.12, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13851,7 +13851,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -librelp config.status 1.2.11 +librelp config.status 1.2.12 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.11/configure.ac new/librelp-1.2.12/configure.ac --- old/librelp-1.2.11/configure.ac 2016-06-22 16:23:49.000000000 +0200 +++ new/librelp-1.2.12/configure.ac 2016-07-07 13:24:53.000000000 +0200 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([librelp], [1.2.11], [[email protected]]) +AC_INIT([librelp], [1.2.12], [[email protected]]) AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.11/src/Makefile.am new/librelp-1.2.12/src/Makefile.am --- old/librelp-1.2.11/src/Makefile.am 2016-05-24 08:13:14.000000000 +0200 +++ new/librelp-1.2.12/src/Makefile.am 2016-07-07 07:30:41.000000000 +0200 @@ -35,6 +35,6 @@ cmdif.h librelp_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(GNUTLS_CFLAGS) librelp_la_LIBADD = $(rt_libs) $(GNUTLS_LIBS) -librelp_la_LDFLAGS = -version-info 1:0:1 +librelp_la_LDFLAGS = -version-info 2:0:2 include_HEADERS = librelp.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.11/src/Makefile.in new/librelp-1.2.12/src/Makefile.in --- old/librelp-1.2.11/src/Makefile.in 2016-06-22 16:24:07.000000000 +0200 +++ new/librelp-1.2.12/src/Makefile.in 2016-07-07 14:18:43.000000000 +0200 @@ -370,7 +370,7 @@ librelp_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(GNUTLS_CFLAGS) librelp_la_LIBADD = $(rt_libs) $(GNUTLS_LIBS) -librelp_la_LDFLAGS = -version-info 1:0:1 +librelp_la_LDFLAGS = -version-info 2:0:2 include_HEADERS = librelp.h all: all-am diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.11/src/librelp.h new/librelp-1.2.12/src/librelp.h --- old/librelp-1.2.11/src/librelp.h 2016-06-22 11:23:27.000000000 +0200 +++ new/librelp-1.2.12/src/librelp.h 2016-07-07 07:30:41.000000000 +0200 @@ -209,6 +209,7 @@ relpRetVal relpCltConnect(relpClt_t *pThis, int protFamily, unsigned char *port, unsigned char *host); relpRetVal relpCltSendSyslog(relpClt_t *pThis, unsigned char *pMsg, size_t lenMsg); relpRetVal relpCltSetTimeout(relpClt_t *pThis, unsigned timeout); +relpRetVal relpCltSetConnTimeout(relpClt_t *pThis, int connTimeout); relpRetVal relpCltSetWindowSize(relpClt_t *pThis, int sizeWindow); relpRetVal relpCltSetClientIP(relpClt_t *pThis, unsigned char *ipAddr); relpRetVal relpCltEnableTLS(relpClt_t *pThis); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.11/src/relpclt.c new/librelp-1.2.12/src/relpclt.c --- old/librelp-1.2.11/src/relpclt.c 2016-06-10 12:04:04.000000000 +0200 +++ new/librelp-1.2.12/src/relpclt.c 2016-07-07 07:30:41.000000000 +0200 @@ -59,6 +59,7 @@ RELP_CORE_CONSTRUCTOR(pThis, Clt); pThis->pEngine = pEngine; pThis->timeout = 90; /* 90-second timeout is the default */ + pThis->connTimeout = 10; pThis->pUsr = NULL; pThis->authmode = eRelpAuthMode_None; pThis->pristring = NULL; @@ -117,6 +118,7 @@ CHKRet(relpSessConstruct(&pThis->pSess, pThis->pEngine, RELP_CLT_CONN, pThis)); CHKRet(relpSessSetTimeout(pThis->pSess, pThis->timeout)); + CHKRet(relpSessSetConnTimeout(pThis->pSess, pThis->connTimeout)); CHKRet(relpSessSetWindowSize(pThis->pSess, pThis->sizeWindow)); CHKRet(relpSessSetClientIP(pThis->pSess, pThis->clientIP)); CHKRet(relpSessSetUsrPtr(pThis->pSess, pThis->pUsr)); @@ -190,6 +192,20 @@ LEAVE_RELPFUNC; } +/** Set the timeout value for this client socket connection. */ +relpRetVal relpCltSetConnTimeout(relpClt_t *pThis, int connTimeout) +{ + ENTER_RELPFUNC; + RELPOBJ_assert(pThis, Clt); + if (connTimeout < 0) { + ABORT_FINALIZE(RELP_RET_ERR_INVAL); + } + if (connTimeout != 0) { + pThis->connTimeout = connTimeout; + } +finalize_it: + LEAVE_RELPFUNC; +} /** Set the local IP address to be used when acting as a client. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.11/src/relpclt.h new/librelp-1.2.12/src/relpclt.h --- old/librelp-1.2.11/src/relpclt.h 2016-05-24 08:12:08.000000000 +0200 +++ new/librelp-1.2.12/src/relpclt.h 2016-07-07 07:30:41.000000000 +0200 @@ -55,6 +55,7 @@ unsigned char *host; /**< host(name) to connect to */ unsigned char *clientIP;/**< ip to bind to, or NULL if irrelevant */ unsigned timeout; /**< session timeout */ + int connTimeout; /**< connection timeout */ }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.11/src/relpsess.c new/librelp-1.2.12/src/relpsess.c --- old/librelp-1.2.11/src/relpsess.c 2016-06-22 16:23:49.000000000 +0200 +++ new/librelp-1.2.12/src/relpsess.c 2016-07-07 07:30:41.000000000 +0200 @@ -818,6 +818,7 @@ CHKRet(relpTcpConstruct(&pThis->pTcp, pThis->pEngine, RELP_CLT_CONN, pThis->pClt)); CHKRet(relpTcpSetUsrPtr(pThis->pTcp, pThis->pUsr)); + CHKRet(relpTcpSetConnTimeout(pThis->pTcp, pThis->connTimeout)); if(pThis->bEnableTLS) { CHKRet(relpTcpEnableTLS(pThis->pTcp)); if(pThis->bEnableTLSZip) { @@ -926,6 +927,15 @@ LEAVE_RELPFUNC; } +relpRetVal +relpSessSetConnTimeout(relpSess_t *pThis, int connTimeout) +{ + ENTER_RELPFUNC; + RELPOBJ_assert(pThis, Sess); + pThis->connTimeout = connTimeout; + LEAVE_RELPFUNC; +} + relpRetVal relpSessSetClientIP(relpSess_t *pThis, unsigned char *ip) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.11/src/relpsess.h new/librelp-1.2.12/src/relpsess.h --- old/librelp-1.2.11/src/relpsess.h 2016-06-22 11:23:27.000000000 +0200 +++ new/librelp-1.2.12/src/relpsess.h 2016-07-07 07:30:41.000000000 +0200 @@ -106,6 +106,7 @@ int bAutoRetry; /**< automatically try (once) to reestablish a broken session? */ int sizeWindow; /**< size of our app-level communications window */ unsigned timeout; /**< timeout after which session is to be considered broken */ + int connTimeout; /**< connection timeout */ relpSessState_t sessState; /**< state of our session */ /* linked list of frames with outstanding "rsp" */ relpSessUnacked_t *pUnackedLstRoot; @@ -145,6 +146,7 @@ relpRetVal relpSessTryReestablish(relpSess_t *pThis); relpRetVal relpSessSetProtocolVersion(relpSess_t *pThis, int protocolVersion); relpRetVal relpSessSetTimeout(relpSess_t *pThis, unsigned timeout); +relpRetVal relpSessSetConnTimeout(relpSess_t *pThis, int connTimeout); relpRetVal relpSessSetWindowSize(relpSess_t *pThis, int sizeWindow); relpRetVal relpSessSetClientIP(relpSess_t *pThis, unsigned char *ip); relpRetVal relpSessEnableTLS(relpSess_t *pThis); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.11/src/tcp.c new/librelp-1.2.12/src/tcp.c --- old/librelp-1.2.11/src/tcp.c 2016-06-22 12:29:08.000000000 +0200 +++ new/librelp-1.2.12/src/tcp.c 2016-07-07 13:24:53.000000000 +0200 @@ -46,6 +46,7 @@ #include <unistd.h> #include <string.h> #include <errno.h> +#include <poll.h> #include <assert.h> #include "relp.h" #include "relpsrv.h" @@ -421,6 +422,15 @@ } relpRetVal +relpTcpSetConnTimeout(relpTcp_t *pThis, int connTimeout) +{ + ENTER_RELPFUNC; + RELPOBJ_assert(pThis, Tcp); + pThis->connTimeout = connTimeout; + LEAVE_RELPFUNC; +} + +relpRetVal relpTcpSetGnuTLSPriString(relpTcp_t *pThis, char *pristr) { ENTER_RELPFUNC; @@ -563,7 +573,9 @@ LEAVE_RELPFUNC; } - +#pragma GCC diagnostic push +/* per https://lists.gnupg.org/pipermail/gnutls-help/2004-August/000154.html This is expected */ +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" static relpRetVal relpTcpAcceptConnReqInitTLS(relpTcp_t *pThis, relpSrv_t *pSrv) { @@ -615,6 +627,7 @@ finalize_it: LEAVE_RELPFUNC; } +#pragma GCC diagnostic pop #endif /* #ifdef ENABLE_TLS */ /* Enable KEEPALIVE handling on the socket. */ @@ -796,7 +809,7 @@ /* Check the peer's ID in fingerprint auth mode. */ static int -relpTcpChkPeerFingerprint(relpTcp_t *pThis, gnutls_x509_crt cert) +relpTcpChkPeerFingerprint(relpTcp_t *pThis, gnutls_x509_crt_t cert) { int r = 0; int i; @@ -1088,7 +1101,7 @@ * Note that non-0 is also returned if no CN is found. */ static int -relpTcpGetCN(relpTcp_t *pThis, gnutls_x509_crt cert, char *namebuf, int lenNamebuf) +relpTcpGetCN(relpTcp_t *pThis, gnutls_x509_crt_t cert, char *namebuf, int lenNamebuf) { int r; int gnuRet; @@ -1147,7 +1160,7 @@ /* Check the peer's ID in name auth mode. */ static int -relpTcpChkPeerName(relpTcp_t *pThis, gnutls_x509_crt cert) +relpTcpChkPeerName(relpTcp_t *pThis, gnutls_x509_crt_t cert) { int r = 0; int ret; @@ -1221,9 +1234,9 @@ { int r = 0; relpTcp_t *pThis; - const gnutls_datum *cert_list; + const gnutls_datum_t *cert_list; unsigned int list_size = 0; - gnutls_x509_crt cert; + gnutls_x509_crt_t cert; int bMustDeinitCert = 0; pThis = (relpTcp_t*) gnutls_session_get_ptr(session); @@ -1615,6 +1628,9 @@ } #ifdef ENABLE_TLS +#pragma GCC diagnostic push /* we need to disable a warning below */ +/* per https://lists.gnupg.org/pipermail/gnutls-help/2004-August/000154.html This is expected */ +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" /* this is only called for client-initiated sessions */ static relpRetVal relpTcpConnectTLSInit(relpTcp_t *pThis) @@ -1624,6 +1640,17 @@ ENTER_RELPFUNC; RELPOBJ_assert(pThis, Tcp); + /* We expect a non blocking socket to establish a tls session */ + if((sockflags = fcntl(pThis->sock, F_GETFL)) != -1) { + sockflags &= ~O_NONBLOCK; + sockflags = fcntl(pThis->sock, F_SETFL, sockflags); + } + + if(sockflags == -1) { + pThis->pEngine->dbgprint("error %d unsetting fcntl(O_NONBLOCK) on relp socket", errno); + ABORT_FINALIZE(RELP_RET_IO_ERR); + } + if(!called_gnutls_global_init) { #if GNUTLS_VERSION_NUMBER <= 0x020b00 /* gcry_control must be called first, so that the thread system is correctly set up */ @@ -1717,6 +1744,7 @@ finalize_it: LEAVE_RELPFUNC; } +#pragma GCC diagnostic pop #endif /* #ifdef ENABLE_TLS */ /* open a connection to a remote host (server). @@ -1729,6 +1757,7 @@ struct addrinfo *res = NULL; struct addrinfo hints; struct addrinfo *reslocal = NULL; + struct pollfd pfd; ENTER_RELPFUNC; RELPOBJ_assert(pThis, Tcp); @@ -1758,10 +1787,27 @@ } } - if(connect(pThis->sock, res->ai_addr, res->ai_addrlen) != 0) { + fcntl(pThis->sock, F_SETFL, O_NONBLOCK); + connect(pThis->sock, res->ai_addr, res->ai_addrlen); + + pfd.fd = pThis->sock; + pfd.events = POLLOUT; + + if (poll(&pfd, 1, pThis->connTimeout * 1000) != 1) { + pThis->pEngine->dbgprint("connection timed out after %d seconds\n", pThis->connTimeout); + ABORT_FINALIZE(RELP_RET_TIMED_OUT); + } + + int so_error; + socklen_t len = sizeof so_error; + + getsockopt(pThis->sock, SOL_SOCKET, SO_ERROR, &so_error, &len); + if (so_error != 0) { + pThis->pEngine->dbgprint("socket has an error %d\n", so_error); ABORT_FINALIZE(RELP_RET_IO_ERR); } + #ifdef ENABLE_TLS if(pThis->bEnableTLS) { CHKRet(relpTcpConnectTLSInit(pThis)); @@ -1826,29 +1872,24 @@ * otherwise. */ int -relpTcpWaitWriteable(relpTcp_t *pThis, struct timespec *tTimeout) +relpTcpWaitWriteable(relpTcp_t *const pThis, struct timespec *const tTimeout) { int r; - fd_set writefds; struct timespec tCurr; /* current time */ - struct timeval tvSelect; + struct pollfd pfd; clock_gettime(CLOCK_REALTIME, &tCurr); - tvSelect.tv_sec = tTimeout->tv_sec - tCurr.tv_sec; - tvSelect.tv_usec = (tTimeout->tv_nsec - tCurr.tv_nsec) / 1000000; - if(tvSelect.tv_usec < 0) { - tvSelect.tv_usec += 1000000; - tvSelect.tv_sec--; - } - if(tvSelect.tv_sec < 0) { + const int timeout = (tTimeout->tv_sec - tCurr.tv_sec) * 1000 + + (tTimeout->tv_nsec - tCurr.tv_nsec) / 1000000000; + if(timeout < 0) { r = 0; goto done; } - FD_ZERO(&writefds); - FD_SET(pThis->sock, &writefds); - pThis->pEngine->dbgprint("librelp: telpTcpWaitWritable doing select() " - "on fd %d, timoeut %lld.%lld\n", pThis->sock, - (long long) tTimeout->tv_sec, (long long) tTimeout->tv_nsec); - r = select(pThis->sock+1, NULL, &writefds, NULL, &tvSelect); + pThis->pEngine->dbgprint("librelp: telpTcpWaitWritable doing poll() " + "on fd %d, timoeut %d\n", pThis->sock, timeout); + + pfd.fd = pThis->sock; + pfd.events = POLLOUT; + r = poll(&pfd, 1, timeout); done: return r; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.11/src/tcp.h new/librelp-1.2.12/src/tcp.h --- old/librelp-1.2.11/src/tcp.h 2016-05-24 08:12:08.000000000 +0200 +++ new/librelp-1.2.12/src/tcp.h 2016-07-07 07:30:41.000000000 +0200 @@ -104,6 +104,7 @@ int dhBits; /**< number of bits for Diffie-Hellman key */ char *pristring; /**< priority string for GnuTLS */ relpAuthMode_t authmode; + int connTimeout; #ifdef ENABLE_TLS gnutls_anon_client_credentials_t anoncred; /**< client anon credentials */ gnutls_anon_server_credentials_t anoncredSrv; /**< server anon credentials */ @@ -154,6 +155,7 @@ relpRetVal relpTcpSetPermittedPeers(relpTcp_t *pThis, relpPermittedPeers_t *pPeers); relpRetVal relpTcpRtryHandshake(relpTcp_t *pThis); relpRetVal relpTcpSetUsrPtr(relpTcp_t *pThis, void *pUsr); +relpRetVal relpTcpSetConnTimeout(relpTcp_t *pThis, int connTimeout); relpRetVal relpTcpSetAuthMode(relpTcp_t *pThis, relpAuthMode_t authmode); void relpTcpHintBurstBegin(relpTcp_t *pThis); void relpTcpHintBurstEnd(relpTcp_t *pThis);
