Hello community, here is the log from the commit of package librelp for openSUSE:Factory checked in at 2017-02-26 17:02:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2017-02-04 18:00:58.636165549 +0100 +++ /work/SRC/openSUSE:Factory/.librelp.new/librelp.changes 2017-02-26 17:02:01.373733218 +0100 @@ -1,0 +2,6 @@ +Thu Feb 23 13:28:52 UTC 2017 - [email protected] + +- librelp 1.2.13: + * bugfix: duplicated lines after server reconnect + +------------------------------------------------------------------- Old: ---- librelp-1.2.12.tar.gz New: ---- librelp-1.2.13.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ librelp.spec ++++++ --- /var/tmp/diff_new_pack.FGCOx6/_old 2017-02-26 17:02:01.765673767 +0100 +++ /var/tmp/diff_new_pack.FGCOx6/_new 2017-02-26 17:02:01.765673767 +0100 @@ -18,7 +18,7 @@ %define library_name librelp0 Name: librelp -Version: 1.2.12 +Version: 1.2.13 Release: 0 Summary: A reliable logging library License: GPL-3.0+ @@ -113,7 +113,7 @@ make %{?_smp_mflags} V=1 %install -make %{?_smp_mflags} DESTDIR=%{buildroot} install +%make_install rm %{buildroot}%{_libdir}/librelp.la %post -n %{library_name} -p /sbin/ldconfig ++++++ librelp-1.2.12.tar.gz -> librelp-1.2.13.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/ChangeLog new/librelp-1.2.13/ChangeLog --- old/librelp-1.2.12/ChangeLog 2016-07-07 13:25:48.000000000 +0200 +++ new/librelp-1.2.13/ChangeLog 2017-02-20 08:08:42.000000000 +0100 @@ -1,4 +1,9 @@ ---------------------------------------------------------------------- +Version 1.2.13 - 2017-02-20 +- make build under BSD +- bugfix: duplicated lines after server reconnect + Thanks to Hervé for the patch. +---------------------------------------------------------------------- Version 1.2.12 - 2016-07-07 - API enhancement: permit to set connection timeout Thanks to Nathan Brown for the patch. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/configure new/librelp-1.2.13/configure --- old/librelp-1.2.12/configure 2016-07-07 14:18:43.000000000 +0200 +++ new/librelp-1.2.13/configure 2017-02-20 08:10:48.000000000 +0100 @@ -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.12. +# Generated by GNU Autoconf 2.69 for librelp 1.2.13. # # Report bugs to <[email protected]>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='librelp' PACKAGE_TARNAME='librelp' -PACKAGE_VERSION='1.2.12' -PACKAGE_STRING='librelp 1.2.12' +PACKAGE_VERSION='1.2.13' +PACKAGE_STRING='librelp 1.2.13' 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.12 to adapt to many kinds of systems. +\`configure' configures librelp 1.2.13 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.12:";; + short | recursive ) echo "Configuration of librelp 1.2.13:";; 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.12 +librelp configure 1.2.13 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.12, which was +It was created by librelp $as_me 1.2.13, 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.12' + VERSION='1.2.13' cat >>confdefs.h <<_ACEOF @@ -3032,7 +3032,7 @@ # Define the identity of the package. PACKAGE='librelp' - VERSION='1.2.12' + VERSION='1.2.13' 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.12, which was +This file was extended by librelp $as_me 1.2.13, 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.12 +librelp config.status 1.2.13 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.12/configure.ac new/librelp-1.2.13/configure.ac --- old/librelp-1.2.12/configure.ac 2016-07-07 13:24:53.000000000 +0200 +++ new/librelp-1.2.13/configure.ac 2017-02-20 08:09:22.000000000 +0100 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([librelp], [1.2.12], [[email protected]]) +AC_INIT([librelp], [1.2.13], [[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.12/src/librelp.h new/librelp-1.2.13/src/librelp.h --- old/librelp-1.2.12/src/librelp.h 2016-07-07 07:30:41.000000000 +0200 +++ new/librelp-1.2.13/src/librelp.h 2016-11-23 13:52:21.000000000 +0100 @@ -3,7 +3,7 @@ * This file is meant to be included by applications using the relp library. * For relp library files themselves, include "relp.h". * - * Copyright 2008-2013 by Rainer Gerhards and Adiscon GmbH. + * Copyright 2008-2016 by Rainer Gerhards and Adiscon GmbH. * * This file is part of librelp. * @@ -143,7 +143,8 @@ #define RELP_RET_AUTH_ERR_FP RELPERR_BASE + 33 /**< auth failed: non-permitted peer fingerprint */ #define RELP_RET_AUTH_ERR_NAME RELPERR_BASE + 34 /**< auth failed: no permitted peer name found */ #define RELP_RET_AUTH_NO_CERT RELPERR_BASE + 35 /**< auth failed: peer did not present a certificate */ -#define RELP_RET_AUTH_CERT_INVL RELPERR_BASE + 36 /**< auth failed: peer certificate invalid (did not pass validation) */ +#define RELP_RET_AUTH_CERT_INVL RELPERR_BASE + 36 /**< auth failed: peer certificate invalid + (did not pass validation) */ #define RELP_RET_INVLD_AUTH_MD RELPERR_BASE + 37 /**< lib user tried to set invalid auth mode */ #define RELP_RET_INVLD_WILDCARD RELPERR_BASE + 38 /**< invalid wildcard given in permitted peer name */ #define RELP_RET_ERR_TLS_HANDS RELPERR_BASE + 39 /**< TLS handshake failed */ @@ -166,7 +167,8 @@ void relpEngineSetShutdownImmdtPtr(relpEngine_t *pThis, int *ptr); relpRetVal relpEngineConstruct(relpEngine_t **ppThis); relpRetVal relpEngineDestruct(relpEngine_t **ppThis); -relpRetVal relpEngineSetDbgprint(relpEngine_t *pThis, void (*dbgprint)(char *fmt, ...) __attribute__((format(printf, 1, 2)))); +relpRetVal relpEngineSetDbgprint(relpEngine_t *pThis, + void (*dbgprint)(char *fmt, ...) __attribute__((format(printf, 1, 2)))); relpRetVal relpEngineAddListner(relpEngine_t *pThis, unsigned char *pLstnPort) __attribute__ ((deprecated)); relpRetVal relpEngineAddListner2(relpEngine_t *pThis, unsigned char *pLstnPort, void*) __attribute__ ((deprecated)); relpRetVal relpEngineListnerConstruct(relpEngine_t *pThis, relpSrv_t **ppSrv); @@ -197,7 +199,8 @@ relpRetVal relpSrvEnableTLS2(relpSrv_t *pThis); relpRetVal relpSrvEnableTLSZip2(relpSrv_t *pThis); void relpSrvSetDHBits(relpSrv_t *pThis, int bits); -void relpSrvSetKeepAlive(relpSrv_t *pThis, const int bEnabled, const int iKeepAliveIntvl, const int iKeepAliveProbes, const int iKeepAliveTime); +void relpSrvSetKeepAlive(relpSrv_t *pThis, const int bEnabled, const int iKeepAliveIntvl, + const int iKeepAliveProbes, const int iKeepAliveTime); relpRetVal relpSrvSetGnuTLSPriString(relpSrv_t *pThis, char *pristr); relpRetVal relpSrvSetCACert(relpSrv_t *pThis, char *cert); relpRetVal relpSrvSetOwnCert(relpSrv_t *pThis, char *cert); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/offers.h new/librelp-1.2.13/src/offers.h --- old/librelp-1.2.12/src/offers.h 2016-04-15 09:32:11.000000000 +0200 +++ new/librelp-1.2.13/src/offers.h 2016-11-22 18:18:02.000000000 +0100 @@ -51,7 +51,7 @@ } relpOfferValue_t; -/* the RELPOFFER object +/* the RELPOFFER object * rgerhards, 2008-03-24 */ struct relpOffer_s { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/relp.c new/librelp-1.2.13/src/relp.c --- old/librelp-1.2.12/src/relp.c 2016-06-10 12:04:04.000000000 +0200 +++ new/librelp-1.2.13/src/relp.c 2016-11-23 13:52:21.000000000 +0100 @@ -1,6 +1,6 @@ /* The RELP (reliable event logging protocol) core protocol library. * - * Copyright 2008-2013 by Rainer Gerhards and Adiscon GmbH. + * Copyright 2008-2016 by Rainer Gerhards and Adiscon GmbH. * * This file is part of librelp. * @@ -69,6 +69,7 @@ } } +#if defined(HAVE_EPOLL_CREATE1) || defined(HAVE_EPOLL_CREATE) static char * relpEngine_strerror_r(int errnum, char *buf, size_t buflen) { #ifndef HAVE_STRERROR_R @@ -91,7 +92,6 @@ return buf; } -#if defined(HAVE_EPOLL_CREATE1) || defined(HAVE_EPOLL_CREATE) static relpRetVal addToEpollSet(relpEngine_t *pThis, epolld_type_t typ, void *ptr, int sock, epolld_t **pepd) { @@ -272,7 +272,7 @@ /** Destruct a RELP engine instance * Should be called only a after all RELP functions have been terminated. - * Terminates librelp operations, no calls are permitted after engine + * Terminates librelp operations, no calls are permitted after engine * destruction. */ relpRetVal @@ -362,7 +362,7 @@ } /* unfortunately, we need to duplicate some functionality to support the <= 0.1.2 - * callback interface (which did not contain a user pointer) and the >= 0.1.3 + * callback interface (which did not contain a user pointer) and the >= 0.1.3 * callback interface. I have thought a lot about doing this smarter, but there * is no better way the API offers. The functions ending in ...2() are the new * interface. -- rgerhards, 2008-07-08 @@ -379,7 +379,8 @@ * not implemented dummy. */ relpRetVal -relpEngineSetSyslogRcv2(relpEngine_t *pThis, relpRetVal (*pCB)(void *, unsigned char*, unsigned char*, unsigned char*, size_t)) +relpEngineSetSyslogRcv2(relpEngine_t *pThis, relpRetVal (*pCB)(void *, unsigned char*, + unsigned char*, unsigned char*, size_t)) { ENTER_RELPFUNC; RELPOBJ_assert(pThis, Engine); @@ -400,12 +401,12 @@ * * This handler will only be called in a mode with authenticaton. * Practically, this means when TLS support is enabled. - * + * * Callback parameters: * * pUsr - the user pointer set * authinfo - the credentials that have been used to authenticate - * the remote peer. This may be a fingerprint or something + * the remote peer. This may be a fingerprint or something * else, depending on authentication settings. * errmsg - error message as far as librelp is concerned * errcode - contains librelp error status that lead to the failed auth. @@ -444,7 +445,7 @@ } /** - * Set an event handler that shall receive information when some GENERIC + * Set an event handler that shall receive information when some GENERIC * error occured for which no special handler exists. A generic error is * one that cannot be assigned to a specific listener or session. * Callback parameters: @@ -600,7 +601,8 @@ { ENTER_RELPFUNC; /* TODO: remove the status dbgprint's once we have some practice drill 2013-07-05 */ - pThis->dbgprint("librelp: epoll_set_events sock %d, target bits %2.2x, current %2.2x\n", sock, events, pSessEtry->epevt->ev.events); + pThis->dbgprint("librelp: epoll_set_events sock %d, target bits %2.2x, current %2.2x\n", + sock, events, pSessEtry->epevt->ev.events); if(pSessEtry->epevt->ev.events != events) { pSessEtry->epevt->ev.events = events; pThis->dbgprint("librelp: epoll_set_events sock %d, setting new bits\n", sock); @@ -701,7 +703,7 @@ # else pThis->dbgprint("librelp error: handshake retry requested in " "non-TLS mode"); - + # endif /* #ifdef ENABLE_TLS */ } } else { @@ -902,7 +904,7 @@ # else pThis->dbgprint("librelp error: handshake retry requested in " "non-TLS mode"); - + # endif /* #ifdef ENABLE_TLS */ } } @@ -984,18 +986,18 @@ pThis->dbgprint("relp engine is dispatching frame with command '%s'\n", pFrame->cmd); - /* currently, we hardcode the commands. Over time, they may be dynamically + /* currently, we hardcode the commands. Over time, they may be dynamically * loaded and, when so, should come from a linked list. * NOTE: the command handler are sorted so that most frequently used are * at the top of the list! */ if(!strcmp((char*)pFrame->cmd, "syslog")) { - /* When processing Syslog frames, we ignore return code. - * Otherwise valid messages in the frame buffer will be - * discarded. And it's better to have duplicated messages - * instead of losing them. + /* When processing Syslog frames, we ignore return code. + * Otherwise valid messages in the frame buffer will be + * discarded. And it's better to have duplicated messages + * instead of losing them. */ - relpSCSyslog(pFrame, pSess); + relpSCSyslog(pFrame, pSess); } else if(!strcmp((char*)pFrame->cmd, "rsp")) { CHKRet(relpSCRsp(pFrame, pSess)); } else if(!strcmp((char*)pFrame->cmd, "open")) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/relp.h new/librelp-1.2.13/src/relp.h --- old/librelp-1.2.12/src/relp.h 2016-04-15 09:32:11.000000000 +0200 +++ new/librelp-1.2.13/src/relp.h 2016-11-23 13:52:21.000000000 +0100 @@ -1,6 +1,6 @@ /* The RELP (reliable event logging protocol) core protocol library. * - * Copyright 2008-2013 by Rainer Gerhards and Adiscon GmbH. + * Copyright 2008-2016 by Rainer Gerhards and Adiscon GmbH. * * This file is part of librelp. * @@ -106,7 +106,7 @@ } relpEngSessLst_t; -/* the RELP engine object +/* the RELP engine object * Having a specific engine object enables multiple plugins to call the * RELP engine at the same time. The core idea of librelp is to have no * static data at all and everything stored in RELP engine objects. Every @@ -213,13 +213,13 @@ ((txnr > 999999999) ? 1 : txnr + 1) static inline int relpEngineShouldStop(relpEngine_t *pThis) { -//pThis->dbgprint("DDDD: librelp bStop %d, ShutdownImmdt %p, immdet result %d\n", pThis->bStop, pThis->bShutdownImmdt, (pThis->bShutdownImmdt == NULL) ? 0 : *pThis->bShutdownImmdt); return pThis->bStop || (pThis->bShutdownImmdt != NULL && *pThis->bShutdownImmdt); } /* prototypes needed by library itself (rest is in librelp.h) */ relpRetVal relpEngineDispatchFrame(relpEngine_t *pThis, relpSess_t *pSess, relpFrame_t *pFrame); -void __attribute__((format(printf, 4, 5))) relpEngineCallOnGenericErr(relpEngine_t *pThis, char *eobj, relpRetVal ecode, char *fmt, ...); +void __attribute__((format(printf, 4, 5))) relpEngineCallOnGenericErr(relpEngine_t *pThis, + char *eobj, relpRetVal ecode, char *fmt, ...); #endif /* #ifndef RELP_H_INCLUDED */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/relpclt.c new/librelp-1.2.13/src/relpclt.c --- old/librelp-1.2.12/src/relpclt.c 2016-07-07 07:30:41.000000000 +0200 +++ new/librelp-1.2.13/src/relpclt.c 2016-11-22 18:18:02.000000000 +0100 @@ -258,7 +258,7 @@ { ENTER_RELPFUNC; RELPOBJ_assert(pThis, Clt); - if(mode == NULL) + if(mode == NULL) FINALIZE; if(!strcasecmp(mode, "fingerprint")) @@ -267,7 +267,7 @@ pThis->authmode = eRelpAuthMode_Name; else ABORT_FINALIZE(RELP_RET_INVLD_AUTH_MD); - + finalize_it: LEAVE_RELPFUNC; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/relpclt.h new/librelp-1.2.13/src/relpclt.h --- old/librelp-1.2.12/src/relpclt.h 2016-07-07 07:30:41.000000000 +0200 +++ new/librelp-1.2.13/src/relpclt.h 2016-11-22 18:18:02.000000000 +0100 @@ -33,7 +33,7 @@ #ifndef RELPCLT_H_INCLUDED #define RELPCLT_H_INCLUDED -/* the RELPCLT object +/* the RELPCLT object * rgerhards, 2008-03-16 */ struct relpClt_s { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/relpframe.c new/librelp-1.2.13/src/relpframe.c --- old/librelp-1.2.12/src/relpframe.c 2016-04-15 09:32:11.000000000 +0200 +++ new/librelp-1.2.13/src/relpframe.c 2016-11-22 18:18:02.000000000 +0100 @@ -89,7 +89,7 @@ * This is a state machine. The transport driver needs to pass in octets received * one after the other. This function builds frames and submits them for processing * as need arises. Please note that the frame pointed to be ppThis may change during - * processing. It may be NULL after a frame has fully be processed. On Init, the + * processing. It may be NULL after a frame has fully be processed. On Init, the * caller can pass in a NULL pointer. * rgerhards, 2008-03-16 */ @@ -102,7 +102,7 @@ assert(ppThis != NULL); pThis = *ppThis; - /* we allow NULL pointers, as we would not like to have unprocessed frame. + /* we allow NULL pointers, as we would not like to have unprocessed frame. * Instead, a NULL frame pointer means that we have finished the previous frame * (or did never before receive one) and so this character must be the first * of a new frame. -- rgerhards, 2008-03-17 @@ -407,7 +407,7 @@ pSendbuf->lenData += 1 + lenData; if((pSendbuf->pData = malloc(pSendbuf->lenData + (9 - lenTxnr) + 1)) == NULL) - // remove +1 above (for debugging only!) + // remove +1 above (for debugging only!) ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY); ptrMembuf = pSendbuf->pData + 9 - lenTxnr; /* set ptr to start of area we intend to write to */ @@ -502,7 +502,7 @@ /* we got everything, so now let's get our membuf */ lenMembuf = lenTxnr + 1 + lenCmd + 1 + lenDatalen + 1 + pThis->lenData + 1; /* +1 for SP and TRAILER */ - if((pMembuf = malloc(lenMembuf)) == NULL) + if((pMembuf = malloc(lenMembuf)) == NULL) ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY); ptrMembuf = pMembuf; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/relpframe.h new/librelp-1.2.13/src/relpframe.h --- old/librelp-1.2.12/src/relpframe.h 2016-05-24 08:05:38.000000000 +0200 +++ new/librelp-1.2.13/src/relpframe.h 2016-11-22 18:18:02.000000000 +0100 @@ -46,7 +46,7 @@ } relpFrameRcvState_t; -/* the RELPFRAME object +/* the RELPFRAME object * rgerhards, 2008-03-16 */ struct relpFrame_s { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/relpsess.c new/librelp-1.2.13/src/relpsess.c --- old/librelp-1.2.12/src/relpsess.c 2016-07-07 07:30:41.000000000 +0200 +++ new/librelp-1.2.13/src/relpsess.c 2017-02-20 08:07:05.000000000 +0100 @@ -308,7 +308,7 @@ } -/* Send a command hint to the remote peer. This function works for the +/* Send a command hint to the remote peer. This function works for the * server-side of the connection. A modified version must be used for the * client side (because we have different ways of sending the data). We do * not yet need the client side. If we do, way should think about a generic @@ -493,11 +493,6 @@ ENTER_RELPFUNC; RELPOBJ_assert(pThis, Sess); - /* are we already ready? */ - if(pThis->sessState == stateExpected || pThis->sessState == eRelpSessState_BROKEN) { - FINALIZE; - } - /* first read any outstanding data and process the packets. Note that this * call DOES NOT block. */ @@ -505,7 +500,7 @@ if(localRet != RELP_RET_OK && localRet != RELP_RET_SESSION_BROKEN) ABORT_FINALIZE(localRet); - /* re-check if we are already in the desired state. If so, we can immediately + /* check if we are already in the desired state. If so, we can immediately * return. That saves us doing a costly clock call to set the timeout. As a * side-effect, the timeout is actually applied without the time needed for * above reception. I think is is OK, even a bit logical ;) @@ -538,7 +533,7 @@ ABORT_FINALIZE(RELP_RET_SESSION_BROKEN); } } - else + else pThis->pEngine->dbgprint("relpSessWaitRsp poll returns, " "nfds %d, errno %d\n", nfds, errno); if(relpEngineShouldStop(pThis->pEngine)) @@ -556,8 +551,8 @@ finalize_it: pThis->pEngine->dbgprint("relpSessWaitState returns %d\n", iRet); - if( iRet == RELP_RET_TIMED_OUT || - iRet == RELP_RET_SESSION_BROKEN || + if( iRet == RELP_RET_TIMED_OUT || + iRet == RELP_RET_SESSION_BROKEN || relpEngineShouldStop(pThis->pEngine)) { /* the session is broken! */ pThis->sessState = eRelpSessState_BROKEN; @@ -685,7 +680,7 @@ /* callback when the "open" command has been processed - * Most importantly, this function needs to check if we are + * Most importantly, this function needs to check if we are * compatible with the server-provided offers and terminate if * not. If we are, we must set our own parameters to match the * server-provided ones. Please note that the offer processing here diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/relpsess.h new/librelp-1.2.13/src/relpsess.h --- old/librelp-1.2.12/src/relpsess.h 2016-07-07 07:30:41.000000000 +0200 +++ new/librelp-1.2.13/src/relpsess.h 2016-11-22 18:18:02.000000000 +0100 @@ -63,7 +63,7 @@ } relpSessType_t; /* what type of session are we? */ -/* the RELPSESS object +/* the RELPSESS object * rgerhards, 2008-03-16 */ struct relpSess_s { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/relpsrv.c new/librelp-1.2.13/src/relpsrv.c --- old/librelp-1.2.12/src/relpsrv.c 2016-04-15 09:32:11.000000000 +0200 +++ new/librelp-1.2.13/src/relpsrv.c 2016-11-23 13:52:21.000000000 +0100 @@ -1,6 +1,6 @@ /* The relp server. * - * Copyright 2008-2014 by Rainer Gerhards and Adiscon GmbH. + * Copyright 2008-2016 by Rainer Gerhards and Adiscon GmbH. * * This file is part of librelp. * @@ -177,7 +177,7 @@ if((pThis->pLstnPort = (unsigned char*) strdup((char*)pLstnPort)) == NULL) ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY); } - + finalize_it: LEAVE_RELPFUNC; } @@ -188,7 +188,7 @@ { ENTER_RELPFUNC; RELPOBJ_assert(pThis, Srv); - if(mode == NULL) + if(mode == NULL) FINALIZE; if(!strcasecmp(mode, "fingerprint")) @@ -197,7 +197,7 @@ pThis->authmode = eRelpAuthMode_Name; else ABORT_FINALIZE(RELP_RET_INVLD_AUTH_MD); - + finalize_it: LEAVE_RELPFUNC; } @@ -356,8 +356,9 @@ CHKRet(relpTcpSetPrivKey(pTcp, pThis->privKey)); CHKRet(relpTcpSetPermittedPeers(pTcp, &(pThis->permittedPeers))); } - CHKRet(relpTcpLstnInit(pTcp, (pThis->pLstnPort == NULL) ? (unsigned char*) RELP_DFLT_PORT : pThis->pLstnPort, pThis->ai_family)); - + CHKRet(relpTcpLstnInit(pTcp, (pThis->pLstnPort == NULL) ? + (unsigned char*) RELP_DFLT_PORT : pThis->pLstnPort, pThis->ai_family)); + pThis->pTcp = pTcp; finalize_it: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/relpsrv.h new/librelp-1.2.13/src/relpsrv.h --- old/librelp-1.2.12/src/relpsrv.h 2016-04-15 09:32:11.000000000 +0200 +++ new/librelp-1.2.13/src/relpsrv.h 2016-11-22 18:18:02.000000000 +0100 @@ -36,7 +36,7 @@ #include "relp.h" #include "tcp.h" -/* the RELPSRV object +/* the RELPSRV object * rgerhards, 2008-03-17 */ struct relpSrv_s { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/sendbuf.c new/librelp-1.2.13/src/sendbuf.c --- old/librelp-1.2.12/src/sendbuf.c 2016-06-22 12:29:08.000000000 +0200 +++ new/librelp-1.2.13/src/sendbuf.c 2016-11-23 13:52:21.000000000 +0100 @@ -1,6 +1,6 @@ /* The relp send buffer object. * - * Copyright 2008-2013 by Rainer Gerhards and Adiscon GmbH. + * Copyright 2008-2016 by Rainer Gerhards and Adiscon GmbH. * * This file is part of librelp. * @@ -208,7 +208,8 @@ relpSessUnacked_t *pUnackedEtry; pUnackedEtry = pThis->pUnackedLstRoot; if(pUnackedEtry != NULL) { -pThis->pEngine->dbgprint("resending frame '%s'\n", pUnackedEtry->pSendbuf->pData + 9 - pUnackedEtry->pSendbuf->lenTxnr); + pThis->pEngine->dbgprint("resending frame '%s'\n", + pUnackedEtry->pSendbuf->pData + 9 - pUnackedEtry->pSendbuf->lenTxnr); CHKRet(relpFrameRewriteTxnr(pUnackedEtry->pSendbuf, pThis->txnr)); pThis->txnr = relpEngineNextTXNR(pThis->txnr); CHKRet(relpSendbufSendAll(pUnackedEtry->pSendbuf, pThis, 0)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/sendbuf.h new/librelp-1.2.13/src/sendbuf.h --- old/librelp-1.2.12/src/sendbuf.h 2016-04-15 09:32:11.000000000 +0200 +++ new/librelp-1.2.13/src/sendbuf.h 2016-11-22 18:18:02.000000000 +0100 @@ -35,7 +35,7 @@ #include "relpsess.h" -/* the RELPSENDBUF object +/* the RELPSENDBUF object * rgerhards, 2008-03-16 */ struct relpSendbuf_s { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/sendq.h new/librelp-1.2.13/src/sendq.h --- old/librelp-1.2.12/src/sendq.h 2016-04-15 09:32:11.000000000 +0200 +++ new/librelp-1.2.13/src/sendq.h 2016-11-22 18:18:02.000000000 +0100 @@ -48,7 +48,7 @@ relpSendbuf_t *pBuf; /* our send buffer */ } relpSendqe_t; -/* the RELPSENDQ object +/* the RELPSENDQ object * This provides more or less just the root of the sendq entries. * rgerhards, 2008-03-16 */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/tcp.c new/librelp-1.2.13/src/tcp.c --- old/librelp-1.2.12/src/tcp.c 2016-07-07 13:24:53.000000000 +0200 +++ new/librelp-1.2.13/src/tcp.c 2016-11-22 18:18:02.000000000 +0100 @@ -64,6 +64,9 @@ #endif +#ifndef SOL_TCP +# define SOL_TCP (getprotobyname("tcp")->p_proto) +#endif #ifdef ENABLE_TLS /* forward definitions */ @@ -209,8 +212,8 @@ #ifdef ENABLE_TLS -/* helper to call an error code handler if gnutls failed. If there is a failure, - * an error message is pulled form gnutls and the error message properly +/* helper to call an error code handler if gnutls failed. If there is a failure, + * an error message is pulled form gnutls and the error message properly * populated. * Returns 1 if an error was detected, 0 otherwise. This can be used as a * shortcut for error handling (safes doing it twice). @@ -260,7 +263,7 @@ if((*ppThis)->sock != -1) { ling.l_onoff = 1; ling.l_linger = 0; - if(setsockopt((*ppThis)->sock, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling)) < 0 ) { + if(setsockopt((*ppThis)->sock, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling)) < 0 ) { (*ppThis)->pEngine->dbgprint("could not set SO_LINGER, errno %d\n", errno); } } @@ -491,7 +494,7 @@ if(cert == NULL) { pThis->privKeyFile = NULL; } else { -# ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION +# ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION if((pThis->privKeyFile = strdup(cert)) == NULL) ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY); # else @@ -625,7 +628,7 @@ pThis->bTLSActive = 1; finalize_it: - LEAVE_RELPFUNC; + LEAVE_RELPFUNC; } #pragma GCC diagnostic pop #endif /* #ifdef ENABLE_TLS */ @@ -700,7 +703,7 @@ // pThis->pEngine->dbgprint("KEEPALIVE enabled for socket %d\n", sock); done: - return; + return; } /* a portable way to put the current thread asleep. Note that @@ -791,7 +794,7 @@ } #ifdef ENABLE_TLS -#ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION +#ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION /* Convert a fingerprint to printable data. The function must be provided a * sufficiently large buffer. 512 bytes shall always do. */ @@ -964,7 +967,7 @@ /* now check if we have an empty component at end of string */ if(*pC == '.' && *(pC + 1) == '\0') { /* pStart is a dummy, it is not used if length is 0 */ - CHKRet(AddPermittedPeerWildcard(pEtry, pStart, 0)); + CHKRet(AddPermittedPeerWildcard(pEtry, pStart, 0)); } if(*pC != '\0') ++pC; @@ -974,7 +977,7 @@ LEAVE_RELPFUNC; } -#ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION +#ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION /* check a peer against a wildcard entry. This is a more lengthy * operation. */ @@ -1090,7 +1093,7 @@ } /* Obtain the CN from the DN field and hand it back to the caller - * (which is responsible for destructing it). We try to follow + * (which is responsible for destructing it). We try to follow * RFC2253 as far as it makes sense for our use-case. This function * is considered a compromise providing good-enough correctness while * limiting code size and complexity. If a problem occurs, we may enhance @@ -1254,7 +1257,7 @@ r = GNUTLS_E_CERTIFICATE_ERROR; goto done; } - /* If we reach this point, we have at least one valid certificate. + /* If we reach this point, we have at least one valid certificate. * We always use only the first certificate. As of GnuTLS documentation, the * first certificate always contains the remote peer's own certificate. All other * certificates are issuer's certificates (up the chain). We are only interested @@ -1321,7 +1324,7 @@ } gnutls_anon_set_server_dh_params(pThis->anoncredSrv, pThis->dh_params); } else { -# ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION +# ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION r = gnutls_certificate_allocate_credentials(&pThis->xcred); if(chkGnutlsCode(pThis, "Failed to allocate certificate credentials", RELP_RET_ERR_TLS_SETUP, r)) { ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP); @@ -1360,8 +1363,8 @@ relpRetVal relpTcpLstnInit(relpTcp_t *pThis, unsigned char *pLstnPort, int ai_family) { - struct addrinfo hints, *res, *r; - int error, maxs, *s, on = 1; + struct addrinfo hints, *res, *r; + int error, maxs, *s, on = 1; int sockflags; unsigned char *pLstnPt; @@ -1373,54 +1376,54 @@ pThis->pEngine->dbgprint("creating relp tcp listen socket on port %s\n", pLstnPt); - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = AI_PASSIVE; - hints.ai_family = ai_family; - hints.ai_socktype = SOCK_STREAM; + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_PASSIVE; + hints.ai_family = ai_family; + hints.ai_socktype = SOCK_STREAM; - error = getaddrinfo(NULL, (char*) pLstnPt, &hints, &res); - if(error) { + error = getaddrinfo(NULL, (char*) pLstnPt, &hints, &res); + if(error) { pThis->pEngine->dbgprint("error %d querying port '%s'\n", error, pLstnPt); ABORT_FINALIZE(RELP_RET_INVALID_PORT); } - /* Count max number of sockets we may open */ - for(maxs = 0, r = res; r != NULL ; r = r->ai_next, maxs++) + /* Count max number of sockets we may open */ + for(maxs = 0, r = res; r != NULL ; r = r->ai_next, maxs++) /* EMPTY */; - pThis->socks = malloc((maxs+1) * sizeof(int)); - if (pThis->socks == NULL) { - pThis->pEngine->dbgprint("couldn't allocate memory for TCP listen sockets, suspending RELP message reception."); - freeaddrinfo(res); - ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY); - } + pThis->socks = malloc((maxs+1) * sizeof(int)); + if (pThis->socks == NULL) { + pThis->pEngine->dbgprint("couldn't allocate memory for TCP listen sockets, suspending RELP message reception."); + freeaddrinfo(res); + ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY); + } - *pThis->socks = 0; /* num of sockets counter at start of array */ - s = pThis->socks + 1; + *pThis->socks = 0; /* num of sockets counter at start of array */ + s = pThis->socks + 1; for(r = res; r != NULL ; r = r->ai_next) { - *s = socket(r->ai_family, r->ai_socktype, r->ai_protocol); - if (*s < 0) { + *s = socket(r->ai_family, r->ai_socktype, r->ai_protocol); + if (*s < 0) { if(!(r->ai_family == PF_INET6 && errno == EAFNOSUPPORT)) pThis->pEngine->dbgprint("creating relp tcp listen socket"); /* it is debatable if PF_INET with EAFNOSUPPORT should * also be ignored... */ - continue; - } + continue; + } #ifdef IPV6_V6ONLY - if (r->ai_family == AF_INET6) { - int iOn = 1; + if (r->ai_family == AF_INET6) { + int iOn = 1; if (setsockopt(*s, IPPROTO_IPV6, IPV6_V6ONLY, - (char *)&iOn, sizeof (iOn)) < 0) { - close(*s); - *s = -1; - continue; - } - } + (char *)&iOn, sizeof (iOn)) < 0) { + close(*s); + *s = -1; + continue; + } + } #endif - if(setsockopt(*s, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on)) < 0 ) { + if(setsockopt(*s, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on)) < 0 ) { pThis->pEngine->dbgprint("error %d setting relp/tcp socket option\n", errno); - close(*s); + close(*s); *s = -1; continue; } @@ -1435,7 +1438,7 @@ } if(sockflags == -1) { pThis->pEngine->dbgprint("error %d setting fcntl(O_NONBLOCK) on relp socket", errno); - close(*s); + close(*s); *s = -1; continue; } @@ -1456,10 +1459,10 @@ "on port '%s'", pLstnPort); msgbuf[sizeof(msgbuf)-1] = '\0'; callOnErr(pThis, msgbuf, errno); - close(*s); + close(*s); *s = -1; - continue; - } + continue; + } if(listen(*s,pThis->iSessMax / 10 + 5) < 0) { /* If the listen fails, it most probably fails because we ask @@ -1473,7 +1476,7 @@ pThis->pEngine->dbgprint("relp listen error %d, suspending\n", errno); close(*s); *s = -1; - continue; + continue; } } @@ -1481,17 +1484,17 @@ s++; } - if(res != NULL) - freeaddrinfo(res); + if(res != NULL) + freeaddrinfo(res); if(*pThis->socks != maxs) pThis->pEngine->dbgprint("We could initialize %d RELP TCP listen sockets out of %d we received " "- this may or may not be an error indication.\n", *pThis->socks, maxs); - if(*pThis->socks == 0) { + if(*pThis->socks == 0) { pThis->pEngine->dbgprint("No RELP TCP listen socket could successfully be initialized, " "message reception via RELP disabled.\n"); - free(pThis->socks); + free(pThis->socks); ABORT_FINALIZE(RELP_RET_COULD_NOT_BIND); } @@ -1554,7 +1557,7 @@ #endif } /* this function is called to hint librelp that a "burst" of data is to be - * sent. librelp can than try to optimize it's handling. Right now, this + * sent. librelp can than try to optimize it's handling. Right now, this * means we turn on the CORK option and will turn it off when we are * hinted that the burst is over. * The function is intentionally void as it must operate in a way that @@ -1683,7 +1686,7 @@ ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP); } } else { -# ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION +#ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION r = gnutls_certificate_allocate_credentials(&pThis->xcred); if(chkGnutlsCode(pThis, "Failed to allocate certificate credentials", RELP_RET_ERR_TLS_SETUP, r)) { ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP); @@ -1817,10 +1820,10 @@ finalize_it: if(res != NULL) - freeaddrinfo(res); + freeaddrinfo(res); if(reslocal != NULL) - freeaddrinfo(reslocal); - + freeaddrinfo(reslocal); + if(iRet != RELP_RET_OK) { if(pThis->sock != -1) { close(pThis->sock); @@ -1849,7 +1852,7 @@ ENTER_RELPFUNC; r = gnutls_handshake(pThis->session); if(r < 0) { - pThis->pEngine->dbgprint("librelp: state %d during retry handshake: %s\n", r, gnutls_strerror(r)); + pThis->pEngine->dbgprint("librelp: state %d during retry handshake: %s\n", r, gnutls_strerror(r)); } if(r == GNUTLS_E_INTERRUPTED || r == GNUTLS_E_AGAIN) { ; /* nothing to do, just keep our status... */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librelp-1.2.12/src/tcp.h new/librelp-1.2.13/src/tcp.h --- old/librelp-1.2.12/src/tcp.h 2016-07-07 07:30:41.000000000 +0200 +++ new/librelp-1.2.13/src/tcp.h 2016-11-23 13:52:21.000000000 +0100 @@ -1,6 +1,6 @@ /* The mapping for relp over TCP. * - * Copyright 2008-2013 by Rainer Gerhards and Adiscon GmbH. + * Copyright 2008-2016 by Rainer Gerhards and Adiscon GmbH. * * This file is part of librelp. * @@ -40,12 +40,12 @@ #include "relp.h" typedef enum { relpTCP_RETRY_none = 0, - relpTCP_RETRY_handshake = 1, - relpTCP_RETRY_recv = 2, - relpTCP_RETRY_send = 3 } relpTcpRtryState_t; + relpTCP_RETRY_handshake = 1, + relpTCP_RETRY_recv = 2, + relpTCP_RETRY_send = 3 } relpTcpRtryState_t; #define RELP_SRV_CONN 0 /**< this conection is a server connection */ -#define RELP_CLT_CONN 1 /**< this conection is a client connection */ +#define RELP_CLT_CONN 1 /**< this conection is a client connection */ /* The tcp module uses an extended version of the permittedPeers structure, @@ -83,7 +83,7 @@ tcpPermittedPeerEntry_t *peer; } tcpPermittedPeers_t; -/* the RELPTCP object +/* the RELPTCP object * rgerhards, 2008-03-16 */ typedef struct relpTcp_s { @@ -144,7 +144,8 @@ relpRetVal relpTcpAcceptConnReq(relpTcp_t **ppThis, int sock, relpSrv_t *pSrv); relpRetVal relpTcpRcv(relpTcp_t *pThis, relpOctet_t *pRcvBuf, ssize_t *pLenBuf); relpRetVal relpTcpSend(relpTcp_t *pThis, relpOctet_t *pBuf, ssize_t *pLenBuf); -relpRetVal relpTcpConnect(relpTcp_t *pThis, int family, unsigned char *port, unsigned char *host, unsigned char *clientIP); +relpRetVal relpTcpConnect(relpTcp_t *pThis, int family, unsigned char *port, + unsigned char *host, unsigned char *clientIP); relpRetVal relpTcpEnableTLS(relpTcp_t *pThis); relpRetVal relpTcpEnableTLSZip(relpTcp_t *pThis); relpRetVal relpTcpSetDHBits(relpTcp_t *pThis, int bits);
