summaryrefslogtreecommitdiffstats
path: root/runtime/librsgt.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-03-08 08:34:57 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-03-08 08:34:57 +0100
commit80f2b9f0cba2c55dcb1640fe73ceec55eda80348 (patch)
tree1e595b8d1b5f1a52e5457d1b413696fef8901e79 /runtime/librsgt.c
parent212d4e4fe684a4562b284c5b07d9873b0135b10f (diff)
downloadrsyslog-80f2b9f0cba2c55dcb1640fe73ceec55eda80348.tar.gz
rsyslog-80f2b9f0cba2c55dcb1640fe73ceec55eda80348.tar.bz2
rsyslog-80f2b9f0cba2c55dcb1640fe73ceec55eda80348.zip
logsig: implement sig.block.sizelimit parameter
Diffstat (limited to 'runtime/librsgt.c')
-rw-r--r--runtime/librsgt.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/runtime/librsgt.c b/runtime/librsgt.c
index 2f336e2d..72a1dfeb 100644
--- a/runtime/librsgt.c
+++ b/runtime/librsgt.c
@@ -527,6 +527,11 @@ sigblkAddRecord(gtctx ctx, const uchar *rec, const size_t len)
/* note: x is freed later as part of roots cleanup */
GTDataHash_free(m);
GTDataHash_free(r);
+
+ if(ctx->nRecords == ctx->blockSizeLimit) {
+ sigblkFinish(ctx);
+ sigblkInit(ctx);
+ }
}
static void
@@ -568,6 +573,9 @@ sigblkFinish(gtctx ctx)
GTDataHash *root, *rootDel;
int8_t j;
+ if(ctx->nRecords == 0)
+ goto done;
+
root = NULL;
for(j = 0 ; j < ctx->nRoots ; ++j) {
if(root == NULL) {
@@ -580,8 +588,12 @@ sigblkFinish(gtctx ctx)
GTDataHash_free(rootDel);
}
}
- /* persist root value here (callback?) */
-printf("root hash is:\n"); outputhash(root);
timestampIt(ctx, root);
+
+ free(ctx->blkStrtHash);
+ ctx->lenBlkStrtHash = ctx->x_prev->digest_length;
+ ctx->blkStrtHash = malloc(ctx->lenBlkStrtHash);
+ memcpy(ctx->blkStrtHash, ctx->x_prev->digest, ctx->lenBlkStrtHash);
+done:
ctx->bInBlk = 0;
}