From ca0de3ae3ceaa57558b9597640d27bdc9bb50c77 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Fri, 31 Jul 2020 15:14:40 +0200 Subject: [PATCH] TT#85550 pua: update_version_puadb() use pres_id to select record * call_id/from_tag/to_tag can be "" and then **ALL** records get changed Change-Id: Idf24c1eaf9de1a559fe9565eb667782c6cdd6269 --- debian/patches/series | 1 + ...on_puadb-use-pres_id-to-select-recor.patch | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 debian/patches/sipwise/pua-update_version_puadb-use-pres_id-to-select-recor.patch diff --git a/debian/patches/series b/debian/patches/series index e6f262eee..26872bd80 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -82,6 +82,7 @@ sipwise/pua_dialoginfo-use-lock-when-use_puburi_avps-is-set.patch sipwise/dialplan-don-t-stop-loading-rules-on-error.patch ### active development sipwise/pua-fix-send_publish-behavior-on-PUA_DB_ONLY.patch +sipwise/pua-update_version_puadb-use-pres_id-to-select-recor.patch sipwise/fix-db-redis-key-expiry.patch # ### Don't just put stuff in any order diff --git a/debian/patches/sipwise/pua-update_version_puadb-use-pres_id-to-select-recor.patch b/debian/patches/sipwise/pua-update_version_puadb-use-pres_id-to-select-recor.patch new file mode 100644 index 000000000..b7255b948 --- /dev/null +++ b/debian/patches/sipwise/pua-update_version_puadb-use-pres_id-to-select-recor.patch @@ -0,0 +1,54 @@ +From: Victor Seva +Date: Fri, 31 Jul 2020 15:11:11 +0200 +Subject: pua: update_version_puadb() use pres_id to select record + +* call_id/from_tag/to_tag can be "" and then **ALL** records + get changed +--- + src/modules/pua/pua_db.c | 22 +++++----------------- + 1 file changed, 5 insertions(+), 17 deletions(-) + +diff --git a/src/modules/pua/pua_db.c b/src/modules/pua/pua_db.c +index fda1a6c..8b8fb51 100644 +--- a/src/modules/pua/pua_db.c ++++ b/src/modules/pua/pua_db.c +@@ -1482,11 +1482,11 @@ int update_contact_puadb(ua_pres_t *pres, str *contact) + + /******************************************************************************/ + +-int update_version_puadb(ua_pres_t *pres) ++int update_version_puadb(ua_pres_t *pres) + + { +- db_key_t q_cols[3], db_cols[1]; +- db_val_t q_vals[3], db_vals[1]; ++ db_key_t q_cols[1], db_cols[1]; ++ db_val_t q_vals[1], db_vals[1]; + int n_query_cols= 0, n_update_cols=0; + + if (pres==NULL) +@@ -1496,22 +1496,10 @@ int update_version_puadb(ua_pres_t *pres) + } + + /* cols and values used for search query */ +- q_cols[n_query_cols] = &str_call_id_col; +- q_vals[n_query_cols].type = DB1_STR; +- q_vals[n_query_cols].nul = 0; +- q_vals[n_query_cols].val.str_val = pres->call_id; +- n_query_cols++; +- +- q_cols[n_query_cols] = &str_to_tag_col; +- q_vals[n_query_cols].type = DB1_STR; +- q_vals[n_query_cols].nul = 0; +- q_vals[n_query_cols].val.str_val = pres->to_tag; +- n_query_cols++; +- +- q_cols[n_query_cols] = &str_from_tag_col; ++ q_cols[n_query_cols] = &str_pres_id_col; + q_vals[n_query_cols].type = DB1_STR; + q_vals[n_query_cols].nul = 0; +- q_vals[n_query_cols].val.str_val = pres->from_tag; ++ q_vals[n_query_cols].val.str_val = pres->id; + n_query_cols++; + + /* we overwrite contact even if not changed */