diff options
Diffstat (limited to 'plugins/omrelp/omrelp.c')
-rw-r--r-- | plugins/omrelp/omrelp.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c index ae65f40f..32f7ad73 100644 --- a/plugins/omrelp/omrelp.c +++ b/plugins/omrelp/omrelp.c @@ -55,6 +55,8 @@ DEF_OMOD_STATIC_DATA DEFobjCurrIf(errmsg) DEFobjCurrIf(glbl) +#define DFLT_ENABLE_TLS 0 + static relpEngine_t *pRelpEngine; /* our relp engine */ typedef struct _instanceData { @@ -64,6 +66,7 @@ typedef struct _instanceData { int bIsConnected; /* currently connected to server? 0 - no, 1 - yes */ unsigned timeout; relpClt_t *pRelpClt; /* relp client for this instance */ + sbool bEnableTLS; uchar *tplName; } instanceData; @@ -77,6 +80,7 @@ static configSettings_t __attribute__((unused)) cs; /* action (instance) parameters */ static struct cnfparamdescr actpdescr[] = { { "target", eCmdHdlrGetWord, 1 }, + { "tls", eCmdHdlrBinary, 0 }, { "port", eCmdHdlrGetWord, 0 }, { "timeout", eCmdHdlrInt, 0 }, { "template", eCmdHdlrGetWord, 1 } @@ -112,6 +116,16 @@ 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(pData->bEnableTLS) { + if(relpCltEnableTLS(pData->pRelpClt) != RELP_RET_OK) + ABORT_FINALIZE(RS_RET_RELP_ERR); + } + + if(glbl.GetSourceIPofLocalClient() == NULL) { /* ar Do we have a client IP set? */ + if(relpCltSetClientIP(pData->pRelpClt, glbl.GetSourceIPofLocalClient()) != RELP_RET_OK) + ABORT_FINALIZE(RS_RET_RELP_ERR); + } finalize_it: RETiRet; } @@ -121,6 +135,7 @@ BEGINcreateInstance CODESTARTcreateInstance pData->bInitialConnect = 1; pData->timeout = 90; + pData->bEnableTLS = DFLT_ENABLE_TLS; ENDcreateInstance BEGINfreeInstance @@ -139,6 +154,7 @@ setInstParamDefaults(instanceData *pData) pData->port = NULL; pData->tplName = NULL; pData->timeout = 90; + pData->bEnableTLS = DFLT_ENABLE_TLS; } @@ -164,6 +180,8 @@ CODESTARTnewActInst pData->tplName = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); } else if(!strcmp(actpblk.descr[i].name, "timeout")) { pData->timeout = (unsigned) pvals[i].val.d.n; + } else if(!strcmp(actpblk.descr[i].name, "tls")) { + pData->bEnableTLS = (unsigned) pvals[i].val.d.n; } else { dbgprintf("omrelp: program error, non-handled " "param '%s'\n", actpblk.descr[i].name); @@ -328,7 +346,6 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1) ++p; } - /* TODO: make this if go away! */ if(*p == ';') { *p = '\0'; /* trick to obtain hostname (later)! */ CHKmalloc(pData->target = ustrdup(q)); |