diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-06-21 09:26:34 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-06-21 09:26:34 +0200 |
commit | 16450df18b3f72160aa232d2fb6e0b064f9ff55d (patch) | |
tree | 93fb2f1f58a9a9333860e5ca739cd30e8e5b9574 | |
parent | af464bde4a4649dc51a5ee3c6a70346d1eba173d (diff) | |
download | rsyslog-16450df18b3f72160aa232d2fb6e0b064f9ff55d.tar.gz rsyslog-16450df18b3f72160aa232d2fb6e0b064f9ff55d.tar.bz2 rsyslog-16450df18b3f72160aa232d2fb6e0b064f9ff55d.zip |
omrelp: emit error message on peer authentication failure
-rw-r--r-- | plugins/imrelp/imrelp.c | 2 | ||||
-rw-r--r-- | plugins/omrelp/omrelp.c | 12 | ||||
-rw-r--r-- | runtime/rsyslog.h | 1 |
3 files changed, 13 insertions, 2 deletions
diff --git a/plugins/imrelp/imrelp.c b/plugins/imrelp/imrelp.c index fe12ebf1..1ee512a4 100644 --- a/plugins/imrelp/imrelp.c +++ b/plugins/imrelp/imrelp.c @@ -149,7 +149,7 @@ static void onAuthErr(void *pUsr, char *authinfo, char* errmesg, __attribute__((unused)) relpRetVal errcode) { instanceConf_t *inst = (instanceConf_t*) pUsr; - errmsg.LogError(0, NO_ERRCODE, "imrelp[%s]: authentication error '%s', peer " + errmsg.LogError(0, RS_RET_RELP_AUTH_FAIL, "imrelp[%s]: authentication error '%s', peer " "is '%s'", inst->pszBindPort, errmesg, authinfo); } 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 */ diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h index 179d93e6..63112627 100644 --- a/runtime/rsyslog.h +++ b/runtime/rsyslog.h @@ -416,6 +416,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth /* up to 2350 reserved for 7.4 */ RS_RET_QUEUE_CRY_DISK_ONLY = -2351,/**< crypto provider only supported for disk-associated queues */ RS_RET_NO_DATA = -2352,/**< file has no data; more a state than a real error */ + RS_RET_RELP_AUTH_FAIL = -2353,/**< RELP peer authentication failed */ /* RainerScript error messages (range 1000.. 1999) */ RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */ |