...
|
...
|
@@ -1196,7 +1196,7 @@ static int lsigattribs(char *attribs, struct cli_lsig_tdb *tdb)
|
1196
|
1196
|
} while(0);
|
1197
|
1197
|
|
1198
|
1198
|
#define LDB_TOKENS 67
|
1199
|
|
-static int load_oneldb(char *buffer, int chkpua, int chkign, struct cl_engine *engine, unsigned int options, const char *dbname, unsigned int line, unsigned int *sigs, unsigned bc_idx, const char *buffer_cpy)
|
|
1199
|
+static int load_oneldb(char *buffer, int chkpua, struct cl_engine *engine, unsigned int options, const char *dbname, unsigned int line, unsigned int *sigs, unsigned bc_idx, const char *buffer_cpy, int *skip)
|
1200
|
1200
|
{
|
1201
|
1201
|
const char *sig, *virname, *offset, *logic;
|
1202
|
1202
|
struct cli_ac_lsig **newtable, *lsig;
|
...
|
...
|
@@ -1218,8 +1218,11 @@ static int load_oneldb(char *buffer, int chkpua, int chkign, struct cl_engine *e
|
1218
|
1218
|
if (chkpua && cli_chkpua(virname, engine->pua_cats, options))
|
1219
|
1219
|
return CL_SUCCESS;
|
1220
|
1220
|
|
1221
|
|
- if (chkign && cli_chkign(engine->ignored, virname, buffer_cpy))
|
|
1221
|
+ if (engine->ignored && cli_chkign(engine->ignored, virname, buffer_cpy ? buffer_cpy : virname)) {
|
|
1222
|
+ if(skip)
|
|
1223
|
+ *skip = 1;
|
1222
|
1224
|
return CL_SUCCESS;
|
|
1225
|
+ }
|
1223
|
1226
|
|
1224
|
1227
|
if(engine->cb_sigload && engine->cb_sigload("ldb", virname, engine->cb_sigload_ctx)) {
|
1225
|
1228
|
cli_dbgmsg("cli_loadldb: skipping %s due to callback\n", virname);
|
...
|
...
|
@@ -1388,8 +1391,7 @@ static int cli_loadldb(FILE *fs, struct cl_engine *engine, unsigned int *signo,
|
1388
|
1388
|
strcpy(buffer_cpy, buffer);
|
1389
|
1389
|
ret = load_oneldb(buffer,
|
1390
|
1390
|
engine->pua_cats && (options & CL_DB_PUA_MODE) && (options & (CL_DB_PUA_INCLUDE | CL_DB_PUA_EXCLUDE)),
|
1391
|
|
- !!engine->ignored,
|
1392
|
|
- engine, options, dbname, line, &sigs, 0, buffer_cpy);
|
|
1391
|
+ engine, options, dbname, line, &sigs, 0, buffer_cpy, NULL);
|
1393
|
1392
|
if (ret)
|
1394
|
1393
|
break;
|
1395
|
1394
|
}
|
...
|
...
|
@@ -1415,7 +1417,7 @@ static int cli_loadldb(FILE *fs, struct cl_engine *engine, unsigned int *signo,
|
1415
|
1415
|
static int cli_loadcbc(FILE *fs, struct cl_engine *engine, unsigned int *signo, unsigned int options, struct cli_dbio *dbio, const char *dbname)
|
1416
|
1416
|
{
|
1417
|
1417
|
char buf[4096];
|
1418
|
|
- int rc;
|
|
1418
|
+ int rc, skip = 0;
|
1419
|
1419
|
struct cli_all_bc *bcs = &engine->bcs;
|
1420
|
1420
|
struct cli_bc *bc;
|
1421
|
1421
|
unsigned sigs = 0;
|
...
|
...
|
@@ -1476,7 +1478,6 @@ static int cli_loadcbc(FILE *fs, struct cl_engine *engine, unsigned int *signo,
|
1476
|
1476
|
bc->id = bcs->count;/* must set after _load, since load zeroes */
|
1477
|
1477
|
if (engine->bytecode_mode == CL_BYTECODE_MODE_TEST)
|
1478
|
1478
|
cli_infomsg(NULL, "bytecode %u -> %s\n", bc->id, dbname);
|
1479
|
|
- sigs++;
|
1480
|
1479
|
if (bc->kind == BC_LOGICAL || bc->lsig) {
|
1481
|
1480
|
unsigned oldsigs = sigs;
|
1482
|
1481
|
if (!bc->lsig) {
|
...
|
...
|
@@ -1484,12 +1485,17 @@ static int cli_loadcbc(FILE *fs, struct cl_engine *engine, unsigned int *signo,
|
1484
|
1484
|
return CL_EMALFDB;
|
1485
|
1485
|
}
|
1486
|
1486
|
cli_dbgmsg("Bytecode %s(%u) has logical signature: %s\n", dbname, bc->id, bc->lsig);
|
1487
|
|
- rc = load_oneldb(bc->lsig, 0, 0, engine, options, dbname, 0, &sigs, bcs->count, NULL);
|
|
1487
|
+ rc = load_oneldb(bc->lsig, 0, engine, options, dbname, 0, &sigs, bcs->count, NULL, &skip);
|
1488
|
1488
|
if (rc != CL_SUCCESS) {
|
1489
|
1489
|
cli_errmsg("Problem parsing logical signature %s for bytecode %s: %s\n",
|
1490
|
1490
|
bc->lsig, dbname, cl_strerror(rc));
|
1491
|
1491
|
return rc;
|
1492
|
1492
|
}
|
|
1493
|
+ if (skip) {
|
|
1494
|
+ cli_bytecode_destroy(bc);
|
|
1495
|
+ bcs->count--;
|
|
1496
|
+ return CL_SUCCESS;
|
|
1497
|
+ }
|
1493
|
1498
|
if (sigs != oldsigs) {
|
1494
|
1499
|
/* compiler ensures Engine field in lsig matches the one in bytecode,
|
1495
|
1500
|
* so this should never happen. */
|
...
|
...
|
@@ -1497,6 +1503,7 @@ static int cli_loadcbc(FILE *fs, struct cl_engine *engine, unsigned int *signo,
|
1497
|
1497
|
return CL_EMALFDB;
|
1498
|
1498
|
}
|
1499
|
1499
|
}
|
|
1500
|
+ sigs++;
|
1500
|
1501
|
if (bc->kind != BC_LOGICAL) {
|
1501
|
1502
|
if (bc->lsig) {
|
1502
|
1503
|
/* runlsig will only flip a status bit, not report a match,
|