From 0a698ab8931d19685cb39110a5db62a81099cd9c Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 26 Feb 2008 10:07:49 +0000 Subject: implemented STARTSWITH vm instruction --- configure.ac | 2 +- doc/imgssapi.html | 17 ++++++++--------- stringbuf.c | 8 +++++++- vm.c | 19 ++++++++++++++++++- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index fcccde10..3521df89 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[3.12.0],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[3.11.6],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/doc/imgssapi.html b/doc/imgssapi.html index 8e6b7d87..a44af8ed 100644 --- a/doc/imgssapi.html +++ b/doc/imgssapi.html @@ -6,8 +6,7 @@

GSSAPI Syslog Input Module

Module Name:    imtcp

-

Author: varmojfekoj -<email address here? which?>

+

Author: varmojfekoj

Description:

Provides the ability to receive syslog messages from the network protected via Kerberos 5 encryption and authentication. This @@ -20,8 +19,9 @@ Starts a GSSAPI server on selected port - note that this runs independently from the TCP server.

  • InputGSSServerServiceName <name>
    The service name to use for the GSS server.
  • -
  • $InputTCPServerRun <port>
    -Starts a TCP server on selected port
  • +
  • $InputGSSServerPermitPlainTCP on|off
    +Permits the server to receive plain tcp syslog (without GSS) on the +same port
  • $InputTCPMaxSessions <number>
    Sets the maximum number of sessions supported
  • @@ -37,13 +37,12 @@ probably need  to be changed in the future when that change happens.

    Sample:

    -

    This sets up a TCP server on port 514 and a GSSAPI protected -syslog server at port 1514:
    +

    This sets up a GSS server on port 1514 that also permits to +receive plain tcp syslog messages (on the same port):

    -

    [rsyslog.conf overview] [manual index] [rsyslog site]

    diff --git a/stringbuf.c b/stringbuf.c index ecd70113..a4f5a3ec 100755 --- a/stringbuf.c +++ b/stringbuf.c @@ -590,9 +590,12 @@ int rsCStrCStrCmp(cstr_t *pCS1, cstr_t *pCS2) } -/* check if a sz-type string start with a CStr object. This function +/* check if a sz-type string starts with a CStr object. This function * is initially written to support the "startswith" property-filter * comparison operation. Maybe it also has other needs. + * This functions is modelled after the strcmp() series, thus a + * return value of 0 indicates that the string starts with the + * sequence while -1 indicates it does not! * rgerhards 2005-10-19 */ int rsCStrSzStrStartsWithCStr(cstr_t *pCS1, uchar *psz, size_t iLenSz) @@ -625,6 +628,9 @@ int rsCStrSzStrStartsWithCStr(cstr_t *pCS1, uchar *psz, size_t iLenSz) /* check if a CStr object starts with a sz-type string. + * This functions is modelled after the strcmp() series, thus a + * return value of 0 indicates that the string starts with the + * sequence while -1 indicates it does not! * rgerhards 2005-09-26 */ int rsCStrStartsWithSzStr(cstr_t *pCS1, uchar *psz, size_t iLenSz) diff --git a/vm.c b/vm.c index f66dd3ee..49342035 100644 --- a/vm.c +++ b/vm.c @@ -202,6 +202,23 @@ CODESTARTop(CMP_CONTAINS) var.Destruct(&operand2); /* no longer needed */ ENDop(CMP_CONTAINS) +BEGINop(CMP_STARTSWITH) /* remember to set the instruction also in the ENDop macro! */ + var_t *operand1; + var_t *operand2; + int bRes; +CODESTARTop(CMP_STARTSWITH) + /* operand2 is on top of stack, so needs to be popped first */ + vmstk.PopString(pThis->pStk, &operand2); + vmstk.PopString(pThis->pStk, &operand1); + /* TODO: extend cstr class so that it supports location of cstr inside cstr */ + bRes = (rsCStrStartsWithSzStr(operand1->val.pStr, rsCStrGetSzStr(operand2->val.pStr), + rsCStrLen(operand2->val.pStr)) == 0) ? 1 : 0; + + /* we have a result, so let's push it */ + PUSHRESULTop(operand1, bRes); + var.Destruct(&operand2); /* no longer needed */ +ENDop(CMP_STARTSWITH) + /* end comare operations that work on strings, only */ BEGINop(STRADD) /* remember to set the instruction also in the ENDop macro! */ @@ -341,7 +358,7 @@ execProg(vm_t *pThis, vmprg_t *pProg) doOP(CMP_LTEQ); doOP(CMP_GTEQ); doOP(CMP_CONTAINS); - // TODO: implement: doOP(CMP_STARTSWITH); + doOP(CMP_STARTSWITH); doOP(NOT); doOP(PUSHCONSTANT); doOP(PUSHMSGVAR); -- cgit