Codebase list librelp / b19654c
New upstream version 1.6.0 Michael Biebl 4 years ago
9 changed file(s) with 140 addition(s) and 72 deletion(s). Raw diff Collapse all Expand all
0 ----------------------------------------------------------------------
1 Version 1.6.0 - 2020-04-21
2 - fix namespace pollution - some non-API functions were exported
3 While fixing this, also some internal inconsistencies in function
4 visibility were fixed as well.
5 closes https://github.com/rsyslog/librelp/issues/179
6 - replsess: fix double free of sendbuf in some cases.
7 In iRet handler of relpSessSendResponse, the sendbuf
8 was freed if iRet returned a failure.
9 However if error RELP_RET_IO_ERR happened in relpSendqAddBuf,
10 sendbuf was already assigned to relpSendqe_t. As a result
11 sendbuf was double freed in relpSendqDestruct.
12 see also
13 https://github.com/rsyslog/rsyslog/issues/4184
14 https://github.com/rsyslog/rsyslog/issues/4005
15 closes https://github.com/rsyslog/librelp/issues/183
16 - improve support for libressl
17 LibreSSL has no support for @SECLEVEL and SSL_CONF_CTX_set_flags().
18 LibreSSL is now detected and some functionality disabled if it is
19 used.
20 Thanks to Remi Locherer for the patch.
21 - Modified GnuTLS priority according to standard crypto-policy guideline
22 Edited TLS priority string default to conform to system-wide default
23 and align librelp behavior with other crypto-utilizing packages.
24 Note: this may be different from what the openSSL driver does.
25 Thanks to Jiri Vymazal for the patch.
26 - tcp: Missing pUsr Copy to relpTcp Pointer fixed in relpTcpAcceptConnReq
27 The userpointer was not copied into the relpTcp object.
28 Also fixed core dump crash in receive / send helpers when userpointer
29 is returned NULL from librelp.
30 - report io errors for plain tcp connections
31 this already happens with TLS, but not with plain tcp. Error messages
32 are a useful troubleshooting tool.
033 ----------------------------------------------------------------------
134 Version 1.5.0 - 2020-01-14
235 - bugfix: too late termination of relp Engine on shutdown
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for librelp 1.5.0.
2 # Generated by GNU Autoconf 2.69 for librelp 1.6.0.
33 #
44 # Report bugs to <rgerhards@adiscon.com>.
55 #
589589 # Identity of this package.
590590 PACKAGE_NAME='librelp'
591591 PACKAGE_TARNAME='librelp'
592 PACKAGE_VERSION='1.5.0'
593 PACKAGE_STRING='librelp 1.5.0'
592 PACKAGE_VERSION='1.6.0'
593 PACKAGE_STRING='librelp 1.6.0'
594594 PACKAGE_BUGREPORT='rgerhards@adiscon.com'
595595 PACKAGE_URL=''
596596
13671367 # Omit some internal or obsolete options to make the list less imposing.
13681368 # This message is too long to be a string in the A/UX 3.1 sh.
13691369 cat <<_ACEOF
1370 \`configure' configures librelp 1.5.0 to adapt to many kinds of systems.
1370 \`configure' configures librelp 1.6.0 to adapt to many kinds of systems.
13711371
13721372 Usage: $0 [OPTION]... [VAR=VALUE]...
13731373
14381438
14391439 if test -n "$ac_init_help"; then
14401440 case $ac_init_help in
1441 short | recursive ) echo "Configuration of librelp 1.5.0:";;
1441 short | recursive ) echo "Configuration of librelp 1.6.0:";;
14421442 esac
14431443 cat <<\_ACEOF
14441444
15671567 test -n "$ac_init_help" && exit $ac_status
15681568 if $ac_init_version; then
15691569 cat <<\_ACEOF
1570 librelp configure 1.5.0
1570 librelp configure 1.6.0
15711571 generated by GNU Autoconf 2.69
15721572
15731573 Copyright (C) 2012 Free Software Foundation, Inc.
20932093 This file contains any messages produced by compilers while
20942094 running configure, to aid debugging if configure makes a mistake.
20952095
2096 It was created by librelp $as_me 1.5.0, which was
2096 It was created by librelp $as_me 1.6.0, which was
20972097 generated by GNU Autoconf 2.69. Invocation command line was
20982098
20992099 $ $0 $@
29592959
29602960 # Define the identity of the package.
29612961 PACKAGE='librelp'
2962 VERSION='1.5.0'
2962 VERSION='1.6.0'
29632963
29642964
29652965 cat >>confdefs.h <<_ACEOF
1532015320 # report actual input values of CONFIG_FILES etc. instead of their
1532115321 # values after options handling.
1532215322 ac_log="
15323 This file was extended by librelp $as_me 1.5.0, which was
15323 This file was extended by librelp $as_me 1.6.0, which was
1532415324 generated by GNU Autoconf 2.69. Invocation command line was
1532515325
1532615326 CONFIG_FILES = $CONFIG_FILES
1538615386 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1538715387 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1538815388 ac_cs_version="\\
15389 librelp config.status 1.5.0
15389 librelp config.status 1.6.0
1539015390 configured by $0, generated by GNU Autoconf 2.69,
1539115391 with options \\"\$ac_cs_config\\"
1539215392
11 # Process this file with autoconf to produce a configure script.
22
33 AC_PREREQ(2.61)
4 AC_INIT([librelp], [1.5.0], [rgerhards@adiscon.com])
4 AC_INIT([librelp], [1.6.0], [rgerhards@adiscon.com])
55
66 # change to the one below if Travis has a timeout
77 #AM_INIT_AUTOMAKE([subdir-objects serial-tests])
4747 librelp_la_LIBADD = $(rt_libs) $(GNUTLS_LIBS) $(OPENSSL_LIBS)
4848 # info on version-info:
4949 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
50 librelp_la_LDFLAGS = -version-info 5:0:5 -export-symbols-regex '^relp'
50 librelp_la_LDFLAGS = -version-info 5:0:5 -export-symbols-regex '^relp[^_]*$$'
5151
5252 include_HEADERS = librelp.h
377377 librelp_la_LIBADD = $(rt_libs) $(GNUTLS_LIBS) $(OPENSSL_LIBS)
378378 # info on version-info:
379379 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
380 librelp_la_LDFLAGS = -version-info 5:0:5 -export-symbols-regex '^relp'
380 librelp_la_LDFLAGS = -version-info 5:0:5 -export-symbols-regex '^relp[^_]*$$'
381381 include_HEADERS = librelp.h
382382 all: all-am
383383
328328 callOnErr(pThis, "io error, session broken", RELP_RET_SESSION_BROKEN);
329329 pThis->pEngine->dbgprint("relp session %p is broken, io error\n", (void*)pThis);
330330 pThis->sessState = eRelpSessState_BROKEN;
331 }
332
333 if(pSendbuf != NULL)
334 relpSendbufDestruct(&pSendbuf);
331 } else {
332 /* alorbach, 2020-04-08:
333 * Only free sendbuf if error is not RELP_RET_IO_ERR!
334 * otherwise the buffer is double freed in relpSendbufDestruct() (sendbuf.c)
335 */
336 if(pSendbuf != NULL)
337 relpSendbufDestruct(&pSendbuf);
338 }
339
335340 }
336341
337342 LEAVE_RELPFUNC;
651651
652652
653653 #if defined(ENABLE_TLS)
654 relpRetVal LIBRELP_ATTR_NONNULL()
654 static relpRetVal LIBRELP_ATTR_NONNULL()
655655 relpTcpDestructTLS_gtls(relpTcp_t *pThis)
656656 {
657657 int sslRet;
666666 LEAVE_RELPFUNC;
667667 }
668668 #else
669 relpRetVal LIBRELP_ATTR_NONNULL()
669 static relpRetVal LIBRELP_ATTR_NONNULL()
670670 relpTcpDestructTLS_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *pThis)
671671 {
672672 return RELP_RET_ERR_INTERNAL;
673673 }
674674 #endif /* defined(ENABLE_TLS) */
675675 #if defined(ENABLE_TLS_OPENSSL)
676 relpRetVal LIBRELP_ATTR_NONNULL()
676 static relpRetVal LIBRELP_ATTR_NONNULL()
677677 relpTcpDestructTLS_ossl(relpTcp_t *pThis)
678678 {
679679 ENTER_RELPFUNC;
709709 LEAVE_RELPFUNC;
710710 }
711711 #else
712 relpRetVal LIBRELP_ATTR_NONNULL()
712 static relpRetVal LIBRELP_ATTR_NONNULL()
713713 relpTcpDestructTLS_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *pThis)
714714 {
715715 return RELP_RET_ERR_INTERNAL;
11521152 char pristringBuf[4096];
11531153 char *pristring;
11541154 ENTER_RELPFUNC;
1155 /* Compute priority string (in simple cases where the user does not care...) */
1155 /* Set default priority string (in simple cases where the user does not care...) */
11561156 if(pThis->pristring == NULL) {
1157 if(pThis->bEnableTLSZip) {
1158 strncpy(pristringBuf, "NORMAL:+ANON-DH:+COMP-ALL", sizeof(pristringBuf));
1157 if (pThis->authmode == eRelpAuthMode_None) {
1158 if(pThis->bEnableTLSZip) {
1159 strncpy(pristringBuf, "NORMAL:+ANON-DH:+COMP-ALL", sizeof(pristringBuf));
1160 } else {
1161 strncpy(pristringBuf, "NORMAL:+ANON-DH:+COMP-NULL", sizeof(pristringBuf));
1162 }
1163 pristringBuf[sizeof(pristringBuf)-1] = '\0';
1164 pristring = pristringBuf;
1165 r = gnutls_priority_set_direct(pThis->session, pristring, NULL);
11591166 } else {
1160 strncpy(pristringBuf, "NORMAL:+ANON-DH:+COMP-NULL", sizeof(pristringBuf));
1161 }
1162 pristringBuf[sizeof(pristringBuf)-1] = '\0';
1163 pristring = pristringBuf;
1167 r = gnutls_set_default_priority(pThis->session);
1168 strncpy(pristringBuf, "to recommended system default", sizeof(pristringBuf));
1169 pristringBuf[sizeof(pristringBuf)-1] = '\0';
1170 pristring = pristringBuf;
1171 }
1172
11641173 } else {
11651174 pristring = pThis->pristring;
1166 }
1167
1168 r = gnutls_priority_set_direct(pThis->session, pristring, NULL);
1175 r = gnutls_priority_set_direct(pThis->session, pristring, NULL);
1176 }
1177
11691178 if(r == GNUTLS_E_INVALID_REQUEST) {
11701179 ABORT_FINALIZE(RELP_RET_INVLD_TLS_PRIO);
11711180 } else if(r != GNUTLS_E_SUCCESS) {
11811190 LEAVE_RELPFUNC;
11821191 }
11831192 #else /* #ifdef ENABLE_TLS */
1184 relpRetVal LIBRELP_ATTR_NONNULL()
1193 static relpRetVal LIBRELP_ATTR_NONNULL()
11851194 relpTcpTLSSetPrio_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
11861195 {
11871196 return RELP_RET_ERR_INTERNAL;
11991208 /* Compute priority string (in simple cases where the user does not care...) */
12001209 if(pThis->pristring == NULL) {
12011210 if (pThis->authmode == eRelpAuthMode_None) {
1202 #if OPENSSL_VERSION_NUMBER >= 0x10100000L
1211 #if OPENSSL_VERSION_NUMBER >= 0x10100000L \
1212 && !defined(LIBRESSL_VERSION_NUMBER)
12031213 /* NOTE: do never use: +eNULL, it DISABLES encryption! */
12041214 strncpy(pristringBuf, "ALL:+COMPLEMENTOFDEFAULT:+ADH:+ECDH:+aNULL@SECLEVEL=0",
12051215 sizeof(pristringBuf));
12951305 #endif
12961306
12971307 #else /* #ifdef ENABLE_TLS */
1298 relpRetVal LIBRELP_ATTR_NONNULL()
1308 static relpRetVal LIBRELP_ATTR_NONNULL()
12991309 relpTcpAcceptConnReqInitTLS_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED relpSrv_t *const pSrv)
13001310 {
13011311 return RELP_RET_ERR_INTERNAL;
15011511
15021512 /* Perform all necessary actions for Handshake
15031513 */
1504 relpRetVal
1514 static relpRetVal
15051515 relpTcpRtryHandshake_ossl(relpTcp_t *const pThis)
15061516 {
15071517 int res, resErr;
15771587 } else {
15781588 pThis->pEngine->dbgprint("relpTcpSetSslConfCmd_ossl: set to '%s'\n", tlsConfigCmd);
15791589 char errmsg[1424];
1580 #if OPENSSL_VERSION_NUMBER >= 0x10020000L
1590 #if OPENSSL_VERSION_NUMBER >= 0x10020000L && !defined(LIBRESSL_VERSION_NUMBER)
15811591 char *pCurrentPos;
15821592 char *pNextPos;
15831593 char *pszCmd;
18581868 return RELP_RET_ERR_INTERNAL;
18591869 }
18601870
1861 relpRetVal LIBRELP_ATTR_NONNULL()
1871 static relpRetVal LIBRELP_ATTR_NONNULL()
18621872 relpTcpGetRtryDirection_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
18631873 {
18641874 return RELP_RET_ERR_INTERNAL;
18651875 }
18661876
1867 relpRetVal LIBRELP_ATTR_NONNULL()
1877 static relpRetVal LIBRELP_ATTR_NONNULL()
18681878 relpTcpRtryHandshake_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
18691879 {
18701880 return RELP_RET_ERR_INTERNAL;
18711881 }
18721882
1873 relpRetVal LIBRELP_ATTR_NONNULL()
1883 static relpRetVal LIBRELP_ATTR_NONNULL()
18741884 relpTcpLstnInitTLS_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
18751885 {
18761886 return RELP_RET_ERR_INTERNAL;
18771887 }
18781888
1879 relpRetVal LIBRELP_ATTR_NONNULL()
1889 static relpRetVal LIBRELP_ATTR_NONNULL()
18801890 relpTcpAcceptConnReqInitTLS_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED relpSrv_t *const pSrv)
18811891 {
18821892 return RELP_RET_ERR_INTERNAL;
18831893 }
18841894
1885 relpRetVal LIBRELP_ATTR_NONNULL()
1895 static relpRetVal LIBRELP_ATTR_NONNULL()
18861896 relpTcpConnectTLSInit_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
18871897 {
18881898 return RELP_RET_ERR_INTERNAL;
20042014
20052015 /* construct our object so that we can use it... */
20062016 CHKRet(relpTcpConstruct(&pThis, pEngine, RELP_SRV_CONN, pSrv));
2017 pThis->pUsr = pSrv->pUsr;
20072018
20082019 if(pSrv->bKeepAlive)
20092020 EnableKeepAlive(pThis, pSrv, iNewSock);
26482659 LEAVE_RELPFUNC;
26492660 }
26502661 #else /* #ifdef ENABLE_TLS */
2651 relpRetVal LIBRELP_ATTR_NONNULL()
2662 static relpRetVal LIBRELP_ATTR_NONNULL()
26522663 relpTcpLstnInitTLS_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
26532664 {
26542665 return RELP_RET_ERR_INTERNAL;
29392950
29402951 /* -- first TLS-lib specific versions -- */
29412952 #if defined(ENABLE_TLS)
2942 relpRetVal LIBRELP_ATTR_NONNULL()
2953 static relpRetVal LIBRELP_ATTR_NONNULL()
29432954 relpTcpRcv_gtls(relpTcp_t *const pThis, relpOctet_t *const pRcvBuf, ssize_t *const pLenBuf)
29442955 {
29452956 ENTER_RELPFUNC;
29632974 LEAVE_RELPFUNC;
29642975 }
29652976 #else
2966 relpRetVal LIBRELP_ATTR_NONNULL()
2977 static relpRetVal LIBRELP_ATTR_NONNULL()
29672978 relpTcpRcv_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED relpOctet_t *const pRcvBuf,
29682979 LIBRELP_ATTR_UNUSED ssize_t *const pLenBuf)
29692980 {
29712982 }
29722983 #endif /* defined(ENABLE_TLS) */
29732984 #if defined(ENABLE_TLS_OPENSSL)
2974 relpRetVal LIBRELP_ATTR_NONNULL()
2985 static relpRetVal LIBRELP_ATTR_NONNULL()
29752986 relpTcpRcv_ossl(relpTcp_t *const pThis, relpOctet_t *const pRcvBuf, ssize_t *const pLenBuf)
29762987 {
29772988 ENTER_RELPFUNC;
30073018 LEAVE_RELPFUNC;
30083019 }
30093020 #else
3010 relpRetVal LIBRELP_ATTR_NONNULL()
3021 static relpRetVal LIBRELP_ATTR_NONNULL()
30113022 relpTcpRcv_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED relpOctet_t *const pRcvBuf,
30123023 LIBRELP_ATTR_UNUSED ssize_t *const pLenBuf)
30133024 {
30933104
30943105 /* -- first TLS-lib specific versions -- */
30953106 #if defined(ENABLE_TLS)
3096 relpRetVal LIBRELP_ATTR_NONNULL()
3107 static relpRetVal LIBRELP_ATTR_NONNULL()
30973108 relpTcpSend_gtls(relpTcp_t *const pThis, relpOctet_t *const pBuf, ssize_t *const pLenBuf)
30983109 {
30993110 ssize_t written;
31183129 LEAVE_RELPFUNC;
31193130 }
31203131 #else
3121 relpRetVal LIBRELP_ATTR_NONNULL()
3132 static relpRetVal LIBRELP_ATTR_NONNULL()
31223133 relpTcpSend_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED relpOctet_t *const pBuf,
31233134 LIBRELP_ATTR_UNUSED ssize_t *const pLenBuf)
31243135 {
31263137 }
31273138 #endif /* defined(ENABLE_TLS) */
31283139 #if defined(ENABLE_TLS_OPENSSL)
3129 relpRetVal LIBRELP_ATTR_NONNULL()
3140 static relpRetVal LIBRELP_ATTR_NONNULL()
31303141 relpTcpSend_ossl(relpTcp_t *const pThis, relpOctet_t *const pBuf, ssize_t *const pLenBuf)
31313142 {
31323143 ssize_t written;
31663177 LEAVE_RELPFUNC;
31673178 }
31683179 #else
3169 relpRetVal LIBRELP_ATTR_NONNULL()
3180 static relpRetVal LIBRELP_ATTR_NONNULL()
31703181 relpTcpSend_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED relpOctet_t *const pBuf,
31713182 LIBRELP_ATTR_UNUSED ssize_t *const pLenBuf)
31723183 {
32063217 /* this is fine, just retry... */
32073218 written = 0;
32083219 break;
3209 default:
3220 default: {
3221 char msgbuf[900];
3222 char errStr[800];
3223 _relpEngine_strerror_r(errno, errStr, sizeof(errStr));
3224 snprintf(msgbuf, sizeof(msgbuf), "error sending relp: %s", errStr);
3225 msgbuf[sizeof(msgbuf)-1] = '\0';
3226 callOnErr(pThis, msgbuf, RELP_RET_IO_ERR);
32103227 ABORT_FINALIZE(RELP_RET_IO_ERR);
3228 }
32113229 break;
32123230 }
32133231 }
33473365 #endif
33483366
33493367 #else /* #ifdef ENABLE_TLS */
3350 relpRetVal LIBRELP_ATTR_NONNULL()
3368 static relpRetVal LIBRELP_ATTR_NONNULL()
33513369 relpTcpConnectTLSInit_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
33523370 {
33533371 return RELP_RET_ERR_INTERNAL;
35633581 #endif /* #ifdef ENABLE_TLS */
35643582
35653583 #ifdef ENABLE_TLS
3566 relpRetVal LIBRELP_ATTR_NONNULL()
3584 static relpRetVal LIBRELP_ATTR_NONNULL()
35673585 relpTcpRtryHandshake_gtls(relpTcp_t *const pThis)
35683586 {
35693587 int r;
35853603 LEAVE_RELPFUNC;
35863604 }
35873605 #else /* #ifdef ENABLE_TLS */
3588 relpRetVal LIBRELP_ATTR_NONNULL()
3606 static relpRetVal LIBRELP_ATTR_NONNULL()
35893607 relpTcpRtryHandshake_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
35903608 {
35913609 return RELP_RET_ERR_INTERNAL;
157157 onErr(void *pUsr, char *objinfo, char* errmesg, LIBRELP_ATTR_UNUSED relpRetVal errcode)
158158 {
159159 struct usrdata *pThis = (struct usrdata*) pUsr;
160 if(pUsr != userdata) {
161 fprintf(stderr, "receive: pUsr NOT pointing to usrdata!\n");
162 }
163 if(pThis->magic != USR_MAGIC) {
164 fprintf(stderr, "receive: pUsr magic incorrect in onErr, magic %8.8x "
165 "pUsr %p\n", pThis->magic, (void*) pThis);
166 }
167 fprintf(stderr, "%s: error '%s', object '%s'\n", pThis->progname, errmesg, objinfo);
160 if(pUsr != NULL) {
161 if(pUsr != userdata) {
162 fprintf(stderr, "receive: pUsr %p NOT pointing to userdata %p!\n", pUsr, (void*)userdata);
163 }
164 if(pThis->magic != USR_MAGIC) {
165 fprintf(stderr, "receive: pUsr magic incorrect in onErr, magic %8.8x "
166 "pUsr %p\n", pThis->magic, (void*) pThis);
167 }
168 fprintf(stderr, "%s: error '%s', object '%s'\n", pThis->progname, errmesg, objinfo);
169 } else {
170 fprintf(stderr, "receive: [pUsr==NULL] error '%s', object '%s'\n", errmesg, objinfo);
171 }
168172 if(errFile != NULL) {
169173 fprintf(errFile, "receive: error '%s', object '%s'\n", errmesg, objinfo);
170174 }
405409 TRY(relpEngineSetDnsLookupMode(pRelpEngine, 0)); /* 0=disable */
406410
407411 TRY(relpEngineListnerConstruct(pRelpEngine, &pRelpSrv));
408 TRY(relpSrvSetLstnPort(pRelpSrv, port));
412 // Create userdata pointer as soon as possible for error callbacks
409413 userdata = calloc(1, sizeof(struct usrdata));
410414 userdata->magic = USR_MAGIC;
411415 userdata->progname = strdup("receive");
412416 relpSrvSetUsrPtr(pRelpSrv, userdata);
417
418 TRY(relpSrvSetLstnPort(pRelpSrv, port));
413419 if(maxDataSize != 0) {
414420 TRY(relpSrvSetMaxDataSize(pRelpSrv, maxDataSize));
415421 }
9191 onErr(void *pUsr, char *objinfo, char* errmesg, LIBRELP_ATTR_UNUSED relpRetVal errcode)
9292 {
9393 struct usrdata *pThis = (struct usrdata*) pUsr;
94 if(pUsr != userdata) {
95 fprintf(stderr, "send: pUsr NOT pointing to usrdata!\n");
96 }
97 if(pThis->magic != USR_MAGIC) {
98 fprintf(stderr, "send: pUsr magic incorrect in onErr, magic %8.8x "
99 "pUsr %p\n", pThis->magic, (void*) pThis);
100 }
101 printf("%s: error '%s', object '%s'\n", pThis->progname, errmesg, objinfo);
94 if(pUsr != NULL) {
95 if(pUsr != userdata) {
96 fprintf(stderr, "send: pUsr %p NOT pointing to userdata %p!\n", pUsr, (void*)userdata);
97 }
98 if(pThis->magic != USR_MAGIC) {
99 fprintf(stderr, "send: pUsr magic incorrect in onErr, magic %8.8x "
100 "pUsr %p\n", pThis->magic, (void*) pThis);
101 }
102 printf("%s: error '%s', object '%s'\n", pThis->progname, errmesg, objinfo);
103 } else {
104 fprintf(stderr, "send: [pUsr==NULL] error '%s', object '%s'\n", errmesg, objinfo);
105 }
106
102107 if(errFile != NULL) {
103108 fprintf(errFile, "send: error '%s', object '%s'\n", errmesg, objinfo);
104109 }
409414
410415 TRY(relpEngineSetEnableCmd(pRelpEngine, (unsigned char*)"syslog", eRelpCmdState_Required));
411416 TRY(relpEngineCltConstruct(pRelpEngine, &pRelpClt));
412 TRY(relpCltSetTimeout(pRelpClt, timeout));
417 // Create userdata pointer as soon as possible for error callbacks
413418 userdata = calloc(1, sizeof(struct usrdata));
414419 userdata->magic = USR_MAGIC;
415420 userdata->progname = strdup("send");
416421 TRY(relpCltSetUsrPtr(pRelpClt, userdata));
417422
423 TRY(relpCltSetTimeout(pRelpClt, timeout));
418424 if(bEnableTLS) {
419425 TRY(relpCltEnableTLS(pRelpClt));
420426 TRY(relpCltSetTlsConfigCmd(pRelpClt, tlsConfigCmd));