~ubuntu-branches/debian/sid/rsyslog/sid

« back to all changes in this revision

Viewing changes to tools/syslogd.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl, Michael Biebl, Daniel Pocock
  • Date: 2014-03-11 19:52:49 UTC
  • mfrom: (1.1.37)
  • Revision ID: package-import@ubuntu.com-20140311195249-phbsh9be8lebawti
Tags: 7.4.8-1
[ Michael Biebl ]
* New upstream release.
* Update Build-Depends:
  - Bump libestr-dev to (>= 0.1.9).
  - Tighten liblognorm-dev to (<< 1.0.0).
  - Replace libjson0-dev with libjson-c-dev, we no longer need the
    transitional package.
* Bump Standards-Version to 3.9.5. No further changes.

[ Daniel Pocock ]
* Make template parameter not mandatory in mongodb output plugin. Patch
  cherry-picked from upstream Git. (Closes: #740869, #721277)
* Ensure JSON templates are NUL terminated. Patch cherry-picked from
  upstream Git.

Show diffs side-by-side

added added

removed removed

Lines of Context:
436
436
 * to log a message orginating from the syslogd itself.
437
437
 */
438
438
rsRetVal
439
 
logmsgInternal(int iErr, int pri, uchar *msg, int flags)
 
439
logmsgInternal(int iErr, int pri, const uchar *const msg, int flags)
440
440
{
441
441
        uchar pszTag[33];
 
442
        size_t lenMsg;
 
443
        unsigned i;
 
444
        char *bufModMsg = NULL; /* buffer for modified message, should we need to modify */
442
445
        msg_t *pMsg;
443
446
        DEFiRet;
444
447
 
 
448
        /* we first do a path the remove control characters that may have accidently
 
449
         * introduced (program error!). This costs performance, but we do not expect
 
450
         * to be called very frequently in any case ;) -- rgerhards, 2013-12-19.
 
451
         */
 
452
        lenMsg = ustrlen(msg);
 
453
        for(i = 0 ; i < lenMsg ; ++i) {
 
454
                if(msg[i] < 0x20 || msg[i] == 0x7f) {
 
455
                        if(bufModMsg == NULL) {
 
456
                                CHKmalloc(bufModMsg = strdup((char*) msg));
 
457
                        }
 
458
                        bufModMsg[i] = ' ';
 
459
                }
 
460
        }
445
461
        CHKiRet(msgConstruct(&pMsg));
446
462
        MsgSetInputName(pMsg, pInternalInputName);
447
 
        MsgSetRawMsgWOSize(pMsg, (char*)msg);
 
463
        MsgSetRawMsg(pMsg, (bufModMsg == NULL) ? (char*)msg : bufModMsg, lenMsg);
448
464
        MsgSetHOSTNAME(pMsg, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName()));
449
465
        MsgSetRcvFrom(pMsg, glbl.GetLocalHostNameProp());
450
466
        MsgSetRcvFromIP(pMsg, glbl.GetLocalHostIP());
474
490
         */
475
491
        if(((Debug == DEBUG_FULL || !doFork) && ourConf->globals.bErrMsgToStderr) || iConfigVerify) {
476
492
                if(LOG_PRI(pri) == LOG_ERR)
477
 
                        fprintf(stderr, "rsyslogd: %s\n", msg);
 
493
                        fprintf(stderr, "rsyslogd: %s\n", (bufModMsg == NULL) ? (char*)msg : bufModMsg);
478
494
        }
479
495
 
480
496
        if(bHaveMainQueue == 0) { /* not yet in queued mode */
484
500
                 * message to the queue engine.
485
501
                 */
486
502
                ratelimitAddMsg(internalMsg_ratelimiter, NULL, pMsg);
487
 
                //submitMsgWithDfltRatelimiter(pMsg);
488
503
        }
489
504
finalize_it:
 
505
        free(bufModMsg);
490
506
        RETiRet;
491
507
}
492
508