MT#5565 add upstream fix for usrloc db sync

mr3.2.1
Victor Seva 13 years ago
parent 9f52bf076b
commit 506d1d48ee

@ -24,6 +24,7 @@ upstream/0023-htable-use-pkg-for-temporary-hash-table-slots-used-f.patch
upstream/0024-htable-use-system-malloc-for-temporary-allocation-of.patch
upstream/0025-htable-free-temporary-slots-used-to-reload-hash-tabl.patch
upstream/0026-websocket-store-sub-protocol-value-for-later-use-in-.patch
upstream/0027-usrloc-add-user_col-to-the-update-contact-query-with.patch
upstream/acc-allow-pseudo-variables-as-first-parameter-for-fu.patch
upstream/acc-add-documentation-note-indicating-the-use-of-pse.patch
upstream/debug/0001-modules-debugger-trace-msg-out.patch

@ -0,0 +1,94 @@
From 2dd36bbae6f05ea0c980e58f247ac7e4f737f6a6 Mon Sep 17 00:00:00 2001
From: Victor Seva <linuxmaniac@torreviejawireless.org>
Date: Tue, 7 Jan 2014 13:59:37 +0100
Subject: [PATCH] usrloc: add user_col to the update contact query with
instance
(cherry picked from commit b393656c1113eb3630470389f142c53fbc085a90)
---
modules/usrloc/ucontact.c | 48 ++++++++++++++++++++++++++++++++---------------
1 file changed, 33 insertions(+), 15 deletions(-)
diff --git a/modules/usrloc/ucontact.c b/modules/usrloc/ucontact.c
index 4877c7f..b18ce98 100644
--- a/modules/usrloc/ucontact.c
+++ b/modules/usrloc/ucontact.c
@@ -1051,8 +1051,8 @@ int db_update_ucontact_instance(ucontact_t* _c)
{
str auser;
str adomain;
- db_key_t keys1[2];
- db_val_t vals1[2];
+ db_key_t keys1[4];
+ db_val_t vals1[4];
int n1;
db_key_t keys2[13];
@@ -1070,6 +1070,13 @@ int db_update_ucontact_instance(ucontact_t* _c)
}
n1 = 0;
+ keys1[n1] = &user_col;
+ vals1[n1].type = DB1_STR;
+ vals1[n1].nul = 0;
+ vals1[n1].val.str_val = *_c->aor;
+ LM_DBG("aor:%.*s\n", vals1[n1].val.str_val.len, vals1[n1].val.str_val.s);
+ n1++;
+
keys1[n1] = &instance_col;
vals1[n1].type = DB1_STR;
vals1[n1].nul = 0;
@@ -1181,6 +1188,29 @@ int db_update_ucontact_instance(ucontact_t* _c)
LM_DBG("contact:%.*s\n", vals2[n2].val.str_val.len, vals2[n2].val.str_val.s);
n2++;
+ auser = *_c->aor;
+ if (use_domain) {
+ keys1[n1] = &domain_col;
+ vals1[n1].type = DB1_STR;
+ vals1[n1].nul = 0;
+ adomain.s = memchr(_c->aor->s, '@', _c->aor->len);
+ if (adomain.s==0) {
+ vals1[0].val.str_val.len = 0;
+ vals1[n1].val.str_val = *_c->aor;
+ auser.len = 0;
+ adomain = *_c->aor;
+ } else {
+ vals1[0].val.str_val.len = adomain.s - _c->aor->s;
+ vals1[n1].val.str_val.s = adomain.s + 1;
+ vals1[n1].val.str_val.len = _c->aor->s + _c->aor->len - adomain.s - 1;
+ auser.len = adomain.s - _c->aor->s;
+ adomain.s++;
+ adomain.len = _c->aor->s +
+ _c->aor->len - adomain.s;
+ }
+ n1++;
+ }
+
if (ul_dbf.use_table(ul_dbh, _c->domain) < 0) {
LM_ERR("sql use_table failed\n");
return -1;
@@ -1204,19 +1234,7 @@ int db_update_ucontact_instance(ucontact_t* _c)
/* delete old db attrs and add the current list */
if (ul_xavp_contact_name.s) {
- auser = *_c->aor;
- if (use_domain) {
- adomain.s = memchr(_c->aor->s, '@', _c->aor->len);
- if (adomain.s==0) {
- auser.len = 0;
- adomain = *_c->aor;
- } else {
- auser.len = adomain.s - _c->aor->s;
- adomain.s++;
- adomain.len = _c->aor->s +
- _c->aor->len - adomain.s;
- }
-
+ if (use_domain) {
uldb_delete_attrs(_c->domain, &auser,
&adomain, &_c->ruid);
uldb_insert_attrs(_c->domain, &auser,
--
1.8.5.2
Loading…
Cancel
Save