From f8967ecbc2e23aead2c6e5170af6871012cc5406 Mon Sep 17 00:00:00 2001 From: kanoi Date: Thu, 21 Jul 2016 01:25:48 +1000 Subject: [PATCH] ckdb - report the _require_name() mvalue if it fails the regext test --- src/ckdb.h | 2 +- src/ckdb_data.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ckdb.h b/src/ckdb.h index 34f791a3..15cdf684 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -52,7 +52,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.7" -#define CKDB_VERSION DB_VERSION"-2.205" +#define CKDB_VERSION DB_VERSION"-2.206" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_data.c b/src/ckdb_data.c index c0d686b9..d88f4357 100644 --- a/src/ckdb_data.c +++ b/src/ckdb_data.c @@ -193,7 +193,7 @@ void _free_seqset_data(K_ITEM *item) } /* Data copy functions (added here as needed) - All pointers need to initialised since DUP_POINTER will free them */ + All pointers need to be initialised since DUP_POINTER will free them */ void copy_users(USERS *newu, USERS *oldu) { @@ -828,7 +828,7 @@ K_ITEM *_require_name(K_TREE *trf_root, char *name, int len, char *patt, dlen = 0; if (!mvalue || (int)dlen < len) { LOGERR("%s(): failed, field '%s' short (%s%d<%d) from %s():%d", - __func__, name, mvalue ? EMPTY : "null", + __func__, name, mvalue ? EMPTY : "null ", (int)dlen, len, func, line); snprintf(reply, siz, "failed.short %s", name); return NULL; @@ -847,8 +847,11 @@ K_ITEM *_require_name(K_TREE *trf_root, char *name, int len, char *patt, regfree(&re); if (ret != 0) { - LOGERR("%s(): failed, field '%s' invalid from %s():%d", - __func__, name, func, line); + char *st = NULL; + LOGERR("%s(): failed, field '%s'='%.20s%s' invalid " + "from %s():%d", + __func__, name, st = safe_text_nonull(mvalue), + (dlen > 20) ? "..." : EMPTY, func, line); snprintf(reply, siz, "failed.invalid %s", name); return NULL; }