Module: kamailio
Branch: master
Commit: 8e9b8fc4f384eac90c94beffdc5c87a04506d2b4
URL: 
https://github.com/kamailio/kamailio/commit/8e9b8fc4f384eac90c94beffdc5c87a04506d2b4

Author: Richard Fuchs <rfu...@sipwise.com>
Committer: Richard Fuchs <rfu...@sipwise.com>
Date: 2020-07-16T11:25:04-04:00

db_redis: fix unfiltered table deletion

---

Modified: src/modules/db_redis/redis_dbase.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/8e9b8fc4f384eac90c94beffdc5c87a04506d2b4.diff
Patch: 
https://github.com/kamailio/kamailio/commit/8e9b8fc4f384eac90c94beffdc5c87a04506d2b4.patch

---

diff --git a/src/modules/db_redis/redis_dbase.c 
b/src/modules/db_redis/redis_dbase.c
index 9c81385a39..c9a25adf36 100644
--- a/src/modules/db_redis/redis_dbase.c
+++ b/src/modules/db_redis/redis_dbase.c
@@ -1698,12 +1698,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;
@@ -1795,7 +1789,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;
@@ -2655,6 +2648,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,


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to