Module: kamailio Branch: 5.3 Commit: 3bc06fdb87d86d3269f7774f52b8040be1c1f76c URL: https://github.com/kamailio/kamailio/commit/3bc06fdb87d86d3269f7774f52b8040b...
Author: Richard Fuchs rfuchs@sipwise.com Committer: Richard Fuchs rfuchs@sipwise.com Date: 2020-07-16T11:26:20-04:00
db_redis: fix unfiltered table deletion
---
Modified: src/modules/db_redis/redis_dbase.c
---
Diff: https://github.com/kamailio/kamailio/commit/3bc06fdb87d86d3269f7774f52b8040b... Patch: https://github.com/kamailio/kamailio/commit/3bc06fdb87d86d3269f7774f52b8040b...
---
diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c index 97fd19ee01..8965f7d65a 100644 --- a/src/modules/db_redis/redis_dbase.c +++ b/src/modules/db_redis/redis_dbase.c @@ -1325,12 +1325,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con if (tmp) db_redis_key_free(&tmp);
- // skip if delete all rows - if (!*manual_keys_count) { - db_redis_key_free (&query_v); - goto skipkeys; - } - if (db_redis_key_prepend_string(&query_v, "HMGET", 5) != 0) { LM_ERR("Failed to set hmget command to pre-delete query\n"); goto error; @@ -1422,7 +1416,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con db_vals = NULL; db_redis_free_reply(&reply);
- skipkeys: if (db_redis_key_add_string(&query_v, "DEL", 3) != 0) { LM_ERR("Failed to add del command to delete query\n"); goto error; @@ -2060,6 +2053,7 @@ int db_redis_delete(const db1_con_t* _h, const db_key_t* _k, } else { LM_DBG("no columns given to build query keys, falling back to full table scan\n"); keys_count = 0; + do_table_scan = 1; }
if (db_redis_perform_delete(_h, con, _k, _v, query_ops, _n,