mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-19 17:20:42 +01:00
zeromq: support no auth and multi frame
This commit is contained in:
parent
299f5a637f
commit
7f6da6456a
@ -358,7 +358,8 @@ static rsRetVal rcvData(){
|
||||
|
||||
pData = zlist_next(listenerList);
|
||||
}
|
||||
|
||||
|
||||
zframe_t *frame;
|
||||
zsock_t *which = (zsock_t *)zpoller_wait(poller, -1);
|
||||
while (which) {
|
||||
pData = zlist_first(listenerList);
|
||||
@ -370,7 +371,9 @@ static rsRetVal rcvData(){
|
||||
DBGPRINTF("imczmq: found matching socket\n");
|
||||
}
|
||||
|
||||
char *buf = zstr_recv(which);
|
||||
frame = zframe_recv(which);
|
||||
char *buf = zframe_strdup(frame);
|
||||
|
||||
if (buf == NULL) {
|
||||
DBGPRINTF("imczmq: null buffer\n");
|
||||
continue;
|
||||
@ -389,10 +392,11 @@ static rsRetVal rcvData(){
|
||||
submitMsg2(pMsg);
|
||||
}
|
||||
|
||||
zstr_free(&buf);
|
||||
free(buf);
|
||||
which = (zsock_t *)zpoller_wait(poller, -1);
|
||||
}
|
||||
finalize_it:
|
||||
zframe_destroy(&frame);
|
||||
zpoller_destroy(&poller);
|
||||
pData = zlist_first(listenerList);
|
||||
while(pData) {
|
||||
|
||||
@ -113,38 +113,40 @@ static rsRetVal initCZMQ(instanceData* pData) {
|
||||
ABORT_FINALIZE(RS_RET_SUSPENDED);
|
||||
}
|
||||
zsock_set_sndtimeo (pData->sock, pData->sendTimeout);
|
||||
|
||||
if (!strcmp((const char *)runModConf->authType, "CURVESERVER")) {
|
||||
zcert_t *serverCert = zcert_load(runModConf->serverCertPath);
|
||||
if (!serverCert) {
|
||||
errmsg.LogError(0, NO_ERRCODE, "could not load cert %s",
|
||||
runModConf->serverCertPath);
|
||||
ABORT_FINALIZE(RS_RET_ERR);
|
||||
}
|
||||
zsock_set_zap_domain(pData->sock, "global");
|
||||
zsock_set_curve_server(pData->sock, 1);
|
||||
zcert_apply(serverCert, pData->sock);
|
||||
zcert_destroy(&serverCert);
|
||||
}
|
||||
else if (!strcmp((const char *)runModConf->authType, "CURVECLIENT")) {
|
||||
zcert_t *serverCert = zcert_load(runModConf->serverCertPath);
|
||||
if (!serverCert) {
|
||||
errmsg.LogError(0, NO_ERRCODE, "could not load cert %s",
|
||||
runModConf->serverCertPath);
|
||||
ABORT_FINALIZE(RS_RET_ERR);
|
||||
}
|
||||
const char *server_key = zcert_public_txt(serverCert);
|
||||
zcert_destroy(&serverCert);
|
||||
zsock_set_curve_serverkey(pData->sock, server_key);
|
||||
|
||||
zcert_t *clientCert = zcert_load(runModConf->clientCertPath);
|
||||
if (!clientCert) {
|
||||
errmsg.LogError(0, NO_ERRCODE, "could not load cert %s",
|
||||
runModConf->clientCertPath);
|
||||
ABORT_FINALIZE(RS_RET_ERR);
|
||||
if(runModConf->authType) {
|
||||
if (!strcmp((const char *)runModConf->authType, "CURVESERVER")) {
|
||||
zcert_t *serverCert = zcert_load(runModConf->serverCertPath);
|
||||
if (!serverCert) {
|
||||
errmsg.LogError(0, NO_ERRCODE, "could not load cert %s",
|
||||
runModConf->serverCertPath);
|
||||
ABORT_FINALIZE(RS_RET_ERR);
|
||||
}
|
||||
zsock_set_zap_domain(pData->sock, "global");
|
||||
zsock_set_curve_server(pData->sock, 1);
|
||||
zcert_apply(serverCert, pData->sock);
|
||||
zcert_destroy(&serverCert);
|
||||
}
|
||||
else if (!strcmp((const char *)runModConf->authType, "CURVECLIENT")) {
|
||||
zcert_t *serverCert = zcert_load(runModConf->serverCertPath);
|
||||
if (!serverCert) {
|
||||
errmsg.LogError(0, NO_ERRCODE, "could not load cert %s",
|
||||
runModConf->serverCertPath);
|
||||
ABORT_FINALIZE(RS_RET_ERR);
|
||||
}
|
||||
const char *server_key = zcert_public_txt(serverCert);
|
||||
zcert_destroy(&serverCert);
|
||||
zsock_set_curve_serverkey(pData->sock, server_key);
|
||||
|
||||
zcert_t *clientCert = zcert_load(runModConf->clientCertPath);
|
||||
if (!clientCert) {
|
||||
errmsg.LogError(0, NO_ERRCODE, "could not load cert %s",
|
||||
runModConf->clientCertPath);
|
||||
ABORT_FINALIZE(RS_RET_ERR);
|
||||
}
|
||||
zcert_apply(clientCert, pData->sock);
|
||||
zcert_destroy(&clientCert);
|
||||
}
|
||||
zcert_apply(clientCert, pData->sock);
|
||||
zcert_destroy(&clientCert);
|
||||
}
|
||||
|
||||
switch (pData->sockType) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user