Browse code

db_redis: fix unfiltered table deletion

Richard Fuchs authored on 14/07/2020 18:13:00
Showing 1 changed files
... ...
@@ -1698,12 +1698,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con
1698 1698
         if (tmp)
1699 1699
             db_redis_key_free(&tmp);
1700 1700
 
1701
-        // skip if delete all rows
1702
-        if (!*manual_keys_count) {
1703
-          db_redis_key_free (&query_v);
1704
-          goto skipkeys;
1705
-        }
1706
-
1707 1701
         if (db_redis_key_prepend_string(&query_v, "HMGET", 5) != 0) {
1708 1702
             LM_ERR("Failed to set hmget command to pre-delete query\n");
1709 1703
             goto error;
... ...
@@ -1795,7 +1789,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con
1795 1789
         db_vals = NULL;
1796 1790
         db_redis_free_reply(&reply);
1797 1791
 
1798
-      skipkeys:
1799 1792
         if (db_redis_key_add_string(&query_v, "DEL", 3) != 0) {
1800 1793
             LM_ERR("Failed to add del command to delete query\n");
1801 1794
             goto error;
... ...
@@ -2655,6 +2648,7 @@ int db_redis_delete(const db1_con_t* _h, const db_key_t* _k,
2655 2648
     } else {
2656 2649
         LM_DBG("no columns given to build query keys, falling back to full table scan\n");
2657 2650
         keys_count = 0;
2651
+        do_table_scan = 1;
2658 2652
     }
2659 2653
 
2660 2654
     if (db_redis_perform_delete(_h, con, _k, _v, query_ops, _n,