From 16450df18b3f72160aa232d2fb6e0b064f9ff55d Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 21 Jun 2013 09:26:34 +0200 Subject: omrelp: emit error message on peer authentication failure --- plugins/omrelp/omrelp.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'plugins/omrelp/omrelp.c') diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c index 31a30921..0534396a 100644 --- a/plugins/omrelp/omrelp.c +++ b/plugins/omrelp/omrelp.c @@ -127,6 +127,14 @@ static uchar *getRelpPt(instanceData *pData) return(pData->port); } +static void +onAuthErr(void *pUsr, char *authinfo, char* errmesg, __attribute__((unused)) relpRetVal errcode) +{ + instanceData *pData = (instanceData*) pUsr; + errmsg.LogError(0, RS_RET_RELP_AUTH_FAIL, "omrelp[%s]: authentication error '%s', peer " + "is '%s'", pData->port, errmesg, authinfo); +} + static inline rsRetVal doCreateRelpClient(instanceData *pData) { @@ -136,6 +144,8 @@ doCreateRelpClient(instanceData *pData) ABORT_FINALIZE(RS_RET_RELP_ERR); if(relpCltSetTimeout(pData->pRelpClt, pData->timeout) != RELP_RET_OK) ABORT_FINALIZE(RS_RET_RELP_ERR); + if(relpCltSetUsrPtr(pData->pRelpClt, pData) != RELP_RET_OK) + ABORT_FINALIZE(RS_RET_RELP_ERR); if(pData->bEnableTLS) { if(relpCltEnableTLS(pData->pRelpClt) != RELP_RET_OK) ABORT_FINALIZE(RS_RET_RELP_ERR); @@ -166,7 +176,6 @@ finalize_it: RETiRet; } - BEGINcreateInstance CODESTARTcreateInstance pData->timeout = 90; @@ -481,6 +490,7 @@ CODEmodInit_QueryRegCFSLineHdlr /* create our relp engine */ CHKiRet(relpEngineConstruct(&pRelpEngine)); CHKiRet(relpEngineSetDbgprint(pRelpEngine, dbgprintf)); + CHKiRet(relpEngineSetOnAuthErr(pRelpEngine, onAuthErr)); CHKiRet(relpEngineSetEnableCmd(pRelpEngine, (uchar*) "syslog", eRelpCmdState_Required)); /* tell which objects we need */ -- cgit v1.2.3