summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-26 10:07:49 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-26 10:07:49 +0000
commit0a698ab8931d19685cb39110a5db62a81099cd9c (patch)
tree9a9b0d632ab6ec055f35f1d9f3251c9e160896a7
parent01ceb6d79979ea8aedd174c47ed8c65fbf168c43 (diff)
downloadrsyslog-0a698ab8931d19685cb39110a5db62a81099cd9c.tar.gz
rsyslog-0a698ab8931d19685cb39110a5db62a81099cd9c.tar.xz
rsyslog-0a698ab8931d19685cb39110a5db62a81099cd9c.zip
implemented STARTSWITH vm instruction
-rw-r--r--configure.ac2
-rw-r--r--doc/imgssapi.html17
-rwxr-xr-xstringbuf.c8
-rw-r--r--vm.c19
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 @@
<body>
<h1>GSSAPI Syslog Input Module</h1>
<p><b>Module Name:&nbsp;&nbsp;&nbsp; imtcp</b></p>
-<p><b>Author: </b>varmojfekoj
-&lt;email address here? which?&gt;</p>
+<p><b>Author: </b>varmojfekoj</p>
<p><b>Description</b>:</p>
<p>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.</li>
<li>InputGSSServerServiceName &lt;name&gt;<br>
The service name to use for the GSS server.</li>
-<li>$InputTCPServerRun &lt;port&gt;<br>
-Starts a TCP server on selected port</li>
+<li>$InputGSSServerPermitPlainTCP on|<span style="font-weight: bold;">off</span><br>
+Permits the server to receive plain tcp syslog (without GSS) on the
+same port</li>
<li>$InputTCPMaxSessions &lt;number&gt;<br>
Sets the maximum number of sessions supported</li>
</ul>
@@ -37,13 +37,12 @@ probably&nbsp;need &nbsp;to be changed in the future when that
change happens.</li>
</ul>
<p><b>Sample:</b></p>
-<p>This sets up a TCP server on port 514 and a GSSAPI protected
-syslog server at port 1514:<br>
+<p>This sets up a GSS server on port 1514 that also permits to
+receive plain tcp syslog messages (on the same port):<br>
</p>
-<textarea rows="15" cols="60">$ModLoad imtcp.so #
-needs to be done just once
-$InputTCPServerRun 514
+<textarea rows="15" cols="60">$ModLoad imtcp.so # needs to be done just once
$InputGSSServerRun 1514
+$InputGSSServerPermitPlainTCP on
</textarea>
<p>[<a href="rsyslog_conf.html">rsyslog.conf overview</a>]
[<a href="manual.html">manual index</a>] [<a href="http://www.rsyslog.com/">rsyslog site</a>]</p>
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);