openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/rsyslog/8.1903.0-r0/rsyslog-8.1903.0/tools/rsyslogd.c
static rsRetVal preprocessBatch(batch_t* pBatch, int* pbShutdownImmediate)
{
    prop_t* ip;
    prop_t* fqdn;
    prop_t* localName;
    int bIsPermitted;
    smsg_t* pMsg;
    int i;
    rsRetVal localRet;
    DEFiRet;

    for (i = 0; i < pBatch->nElem && !*pbShutdownImmediate; i++)
    {
        pMsg = pBatch->pElem[i].pMsg;
        if ((pMsg->msgFlags & NEEDS_ACLCHK_U) != 0)
        {
            DBGPRINTF("msgConsumer: UDP ACL must be checked for message "
                      "(hostname-based)\n");
            if (net.cvthname(pMsg->rcvFrom.pfrominet, &localName, &fqdn, &ip) !=
                RS_RET_OK)
                continue;
            bIsPermitted = net.isAllowedSender2(
                (uchar*)"UDP", (struct sockaddr*)pMsg->rcvFrom.pfrominet,
                (char*)propGetSzStr(fqdn), 1);
            if (!bIsPermitted)
            {
                DBGPRINTF("Message from '%s' discarded, not a permitted sender "
                          "host\n",
                          propGetSzStr(fqdn));
                pBatch->eltState[i] = BATCH_STATE_DISC;
            }
            else
            {
                /* save some of the info we obtained */
                MsgSetRcvFrom(pMsg, localName);
                CHKiRet(MsgSetRcvFromIP(pMsg, ip));
                pMsg->msgFlags &= ~NEEDS_ACLCHK_U;
            }
        }
        if ((pMsg->msgFlags & NEEDS_PARSING) != 0)
        {
            if ((localRet = parser.ParseMsg(pMsg)) != RS_RET_OK)
            {
                DBGPRINTF("Message discarded, parsing error %d\n", localRet);
                pBatch->eltState[i] = BATCH_STATE_DISC;
            }
        }
    }

finalize_it:
    RETiRet;
}
/* preprocess a batch of messages, that is ready them for actual processing.
 * This is done as a first stage and totally in parallel to any other worker
 * active in the system. So it helps us keep up the overall concurrency level.
 * rgerhards, 2010-06-09
 */
preprocess a batch of messages, that is ready them for actual processing.
This is done as a first stage and totally in parallel to any other worker
active in the system. So it helps us keep up the overall concurrency level.
preprocess a batch of messages that is ready them for actual processing . This is done as a first stage and totally in parallel to any other worker active in the system . So it helps us keep up the overall concurrency level .
static rsRetVal preprocessBatch(batch_t* pBatch, int* pbShutdownImmediate)
{
    prop_t* ip;
    prop_t* fqdn;
    prop_t* localName;
    int bIsPermitted;
    smsg_t* pMsg;
    int i;
    rsRetVal localRet;
    DEFiRet;
    for (i = 0; i < pBatch->nElem && !*pbShutdownImmediate; i++)
    {
        pMsg = pBatch->pElem[i].pMsg;
        if ((pMsg->msgFlags & NEEDS_ACLCHK_U) != 0)
        {
            DBGPRINTF("msgConsumer: UDP ACL must be checked for message "
                      "(hostname-based)\n");
            if (net.cvthname(pMsg->rcvFrom.pfrominet, &localName, &fqdn, &ip) !=
                RS_RET_OK)
                continue;
            bIsPermitted = net.isAllowedSender2(
                (uchar*)"UDP", (struct sockaddr*)pMsg->rcvFrom.pfrominet,
                (char*)propGetSzStr(fqdn), 1);
            if (!bIsPermitted)
            {
                DBGPRINTF("Message from '%s' discarded, not a permitted sender "
                          "host\n",
                          propGetSzStr(fqdn));
                pBatch->eltState[i] = BATCH_STATE_DISC;
            }
            else
            {
                MsgSetRcvFrom(pMsg, localName);
                CHKiRet(MsgSetRcvFromIP(pMsg, ip));
                pMsg->msgFlags &= ~NEEDS_ACLCHK_U;
            }
        }
        if ((pMsg->msgFlags & NEEDS_PARSING) != 0)
        {
            if ((localRet = parser.ParseMsg(pMsg)) != RS_RET_OK)
            {
                DBGPRINTF("Message discarded, parsing error %d\n", localRet);
                pBatch->eltState[i] = BATCH_STATE_DISC;
            }
        }
    }
finalize_it:
    RETiRet;
}
static rsRetVal preprocessBatch ( batch_t * pBatch , int * pbShutdownImmediate ) { prop_t * ip ; prop_t * fqdn ; prop_t * localName ; int bIsPermitted ; smsg_t * pMsg ; int i ; rsRetVal localRet ; DEFiRet ; for ( i = 0 ; i < pBatch -> nElem && ! * pbShutdownImmediate ; i ++ ) { pMsg = pBatch -> pElem [ i ] . pMsg ; if ( ( pMsg -> msgFlags & NEEDS_ACLCHK_U ) != 0 ) { DBGPRINTF ( " " " \n " ) ; if ( net . cvthname ( pMsg -> rcvFrom . pfrominet , & localName , & fqdn , & ip ) != RS_RET_OK ) continue ; bIsPermitted = net . isAllowedSender2 ( ( uchar * ) " " , ( struct sockaddr * ) pMsg -> rcvFrom . pfrominet , ( char * ) propGetSzStr ( fqdn ) , 1 ) ; if ( ! bIsPermitted ) { DBGPRINTF ( " " " \n " , propGetSzStr ( fqdn ) ) ; pBatch -> eltState [ i ] = BATCH_STATE_DISC ; } else { MsgSetRcvFrom ( pMsg , localName ) ; CHKiRet ( MsgSetRcvFromIP ( pMsg , ip ) ) ; pMsg -> msgFlags &= ~ NEEDS_ACLCHK_U ; } } if ( ( pMsg -> msgFlags & NEEDS_PARSING ) != 0 ) { if ( ( localRet = parser . ParseMsg ( pMsg ) ) != RS_RET_OK ) { DBGPRINTF ( " \n " , localRet ) ; pBatch -> eltState [ i ] = BATCH_STATE_DISC ; } } } finalize_it : RETiRet ; }
preprocess a batch of messages, that is ready them for actual processing.
preprocess a batch of messages that is ready them for actual processing .
/* save some of the info we obtained */