Module: kamailio
Branch: 5.1
Commit: c4549a0bcb1c9a9d61d40d4c933a4afd89fd5fd3
URL: https://github.com/kamailio/kamailio/commit/c4549a0bcb1c9a9d61d40d4c933a4af…
Author: Jan Janak <jan(a)janakj.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2019-02-17T21:05:19+01:00
imc: fix a chat room related crash and DB reload problems (GH #1855)
- Avoid crash in case a chat room has no members.
The imc module may encounter chat rooms that, for one reason or another,
have no members. In that case, we cannot use the URI of the first member
as the owner URI. This happens, for example, when the destroy function
fails to save chat room members into the database.
- When storing data in database, use replace instead of insert.
The insert statement would fail with an index violation if the
database already contains a matching record. That would happen, for
example, if some of the records being saved in mod_destroy were
re-loaded from the database on server start.
(cherry picked from commit 669bb9a07773399a1305ee6b977529b39f0932aa)
---
Modified: src/modules/imc/imc.c
---
Diff: https://github.com/kamailio/kamailio/commit/c4549a0bcb1c9a9d61d40d4c933a4af…
Patch: https://github.com/kamailio/kamailio/commit/c4549a0bcb1c9a9d61d40d4c933a4af…
---
diff --git a/src/modules/imc/imc.c b/src/modules/imc/imc.c
index 2ae31c997c..547e7b72d4 100644
--- a/src/modules/imc/imc.c
+++ b/src/modules/imc/imc.c
@@ -680,9 +680,9 @@ static void destroy(void)
return;
}
- if(imc_dbf.insert(imc_db, rq_cols, rq_vals, 3)<0)
+ if(imc_dbf.replace(imc_db, rq_cols, rq_vals, 3, 2, 0)<0)
{
- LM_ERR("failed to insert into table imc_rooms\n");
+ LM_ERR("failed to replace into table imc_rooms\n");
return;
}
LM_DBG("room %d %.*s\n", i, irp->name.len, irp->name.s);
@@ -700,9 +700,9 @@ static void destroy(void)
return;
}
- if(imc_dbf.insert(imc_db, mq_cols, mq_vals, 4)<0)
+ if(imc_dbf.replace(imc_db, mq_cols, mq_vals, 4, 2, 0)<0)
{
- LM_ERR("failed to insert into table imc_rooms\n");
+ LM_ERR("failed to replace into table imc_rooms\n");
return;
}
member = member->next;
@@ -722,6 +722,7 @@ static void imc_rpc_list_rooms(rpc_t* rpc, void* ctx)
int i;
imc_room_p irp = NULL;
void *vh;
+ static str unknown = STR_STATIC_INIT("");
for(i=0; i<imc_hash_size; i++)
{
@@ -736,7 +737,7 @@ static void imc_rpc_list_rooms(rpc_t* rpc, void* ctx)
rpc->struct_add(vh, "SdS",
"room", &irp->uri,
"members", irp->nr_of_members,
- "owner", &irp->members->uri);
+ "owner", (irp->nr_of_members > 0) ? &irp->members->uri : &unknown);
irp = irp->next;
}
Module: kamailio
Branch: 5.2
Commit: b61fc371f8057d3a4a688507c9e43d89719cedc4
URL: https://github.com/kamailio/kamailio/commit/b61fc371f8057d3a4a688507c9e43d8…
Author: Jan Janak <jan(a)janakj.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2019-02-17T21:05:04+01:00
imc: fix a chat room related crash and DB reload problems (GH #1855)
- Avoid crash in case a chat room has no members.
The imc module may encounter chat rooms that, for one reason or another,
have no members. In that case, we cannot use the URI of the first member
as the owner URI. This happens, for example, when the destroy function
fails to save chat room members into the database.
- When storing data in database, use replace instead of insert.
The insert statement would fail with an index violation if the
database already contains a matching record. That would happen, for
example, if some of the records being saved in mod_destroy were
re-loaded from the database on server start.
(cherry picked from commit 669bb9a07773399a1305ee6b977529b39f0932aa)
---
Modified: src/modules/imc/imc.c
---
Diff: https://github.com/kamailio/kamailio/commit/b61fc371f8057d3a4a688507c9e43d8…
Patch: https://github.com/kamailio/kamailio/commit/b61fc371f8057d3a4a688507c9e43d8…
---
diff --git a/src/modules/imc/imc.c b/src/modules/imc/imc.c
index e670ea7e0d..e9c88a294a 100644
--- a/src/modules/imc/imc.c
+++ b/src/modules/imc/imc.c
@@ -674,9 +674,9 @@ static void destroy(void)
return;
}
- if(imc_dbf.insert(imc_db, rq_cols, rq_vals, 3)<0)
+ if(imc_dbf.replace(imc_db, rq_cols, rq_vals, 3, 2, 0)<0)
{
- LM_ERR("failed to insert into table imc_rooms\n");
+ LM_ERR("failed to replace into table imc_rooms\n");
return;
}
LM_DBG("room %d %.*s\n", i, irp->name.len, irp->name.s);
@@ -694,9 +694,9 @@ static void destroy(void)
return;
}
- if(imc_dbf.insert(imc_db, mq_cols, mq_vals, 4)<0)
+ if(imc_dbf.replace(imc_db, mq_cols, mq_vals, 4, 2, 0)<0)
{
- LM_ERR("failed to insert into table imc_rooms\n");
+ LM_ERR("failed to replace into table imc_rooms\n");
return;
}
member = member->next;
@@ -716,6 +716,7 @@ static void imc_rpc_list_rooms(rpc_t* rpc, void* ctx)
int i;
imc_room_p irp = NULL;
void *vh;
+ static str unknown = STR_STATIC_INIT("");
for(i=0; i<imc_hash_size; i++)
{
@@ -730,7 +731,7 @@ static void imc_rpc_list_rooms(rpc_t* rpc, void* ctx)
rpc->struct_add(vh, "SdS",
"room", &irp->uri,
"members", irp->nr_of_members,
- "owner", &irp->members->uri);
+ "owner", (irp->nr_of_members > 0) ? &irp->members->uri : &unknown);
irp = irp->next;
}
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [ ] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] Each component has a single commit (if not, squash them into one commit)
- [ ] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1855
-- Commit Summary --
* Avoid crash in case a chat room has no members.
* When storing data in database, use replace instead of insert.
-- File Changes --
M src/modules/imc/imc.c (11)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1855.patchhttps://github.com/kamailio/kamailio/pull/1855.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1855
Module: kamailio
Branch: master
Commit: 669bb9a07773399a1305ee6b977529b39f0932aa
URL: https://github.com/kamailio/kamailio/commit/669bb9a07773399a1305ee6b977529b…
Author: Jan Janak <jan(a)janakj.org>
Committer: Henning Westerholt <henningw(a)users.noreply.github.com>
Date: 2019-02-17T21:00:47+01:00
imc: fix a chat room related crash and DB reload problems (GH #1855)
- Avoid crash in case a chat room has no members.
The imc module may encounter chat rooms that, for one reason or another,
have no members. In that case, we cannot use the URI of the first member
as the owner URI. This happens, for example, when the destroy function
fails to save chat room members into the database.
- When storing data in database, use replace instead of insert.
The insert statement would fail with an index violation if the
database already contains a matching record. That would happen, for
example, if some of the records being saved in mod_destroy were
re-loaded from the database on server start.
---
Modified: src/modules/imc/imc.c
---
Diff: https://github.com/kamailio/kamailio/commit/669bb9a07773399a1305ee6b977529b…
Patch: https://github.com/kamailio/kamailio/commit/669bb9a07773399a1305ee6b977529b…
---
diff --git a/src/modules/imc/imc.c b/src/modules/imc/imc.c
index e670ea7e0d..e9c88a294a 100644
--- a/src/modules/imc/imc.c
+++ b/src/modules/imc/imc.c
@@ -674,9 +674,9 @@ static void destroy(void)
return;
}
- if(imc_dbf.insert(imc_db, rq_cols, rq_vals, 3)<0)
+ if(imc_dbf.replace(imc_db, rq_cols, rq_vals, 3, 2, 0)<0)
{
- LM_ERR("failed to insert into table imc_rooms\n");
+ LM_ERR("failed to replace into table imc_rooms\n");
return;
}
LM_DBG("room %d %.*s\n", i, irp->name.len, irp->name.s);
@@ -694,9 +694,9 @@ static void destroy(void)
return;
}
- if(imc_dbf.insert(imc_db, mq_cols, mq_vals, 4)<0)
+ if(imc_dbf.replace(imc_db, mq_cols, mq_vals, 4, 2, 0)<0)
{
- LM_ERR("failed to insert into table imc_rooms\n");
+ LM_ERR("failed to replace into table imc_rooms\n");
return;
}
member = member->next;
@@ -716,6 +716,7 @@ static void imc_rpc_list_rooms(rpc_t* rpc, void* ctx)
int i;
imc_room_p irp = NULL;
void *vh;
+ static str unknown = STR_STATIC_INIT("");
for(i=0; i<imc_hash_size; i++)
{
@@ -730,7 +731,7 @@ static void imc_rpc_list_rooms(rpc_t* rpc, void* ctx)
rpc->struct_add(vh, "SdS",
"room", &irp->uri,
"members", irp->nr_of_members,
- "owner", &irp->members->uri);
+ "owner", (irp->nr_of_members > 0) ? &irp->members->uri : &unknown);
irp = irp->next;
}
- add get_answer and warning that reinit will drop exisiting database
- even seasoned users forget and theres no backing out
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [X] Commit message has the format required by CONTRIBUTING guide
- [X] Commits are split per component (core, individual modules, libs, utils, ...)
- [X] Each component has a single commit (if not, squash them into one commit)
- [X] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [X] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
If one _accidentally_ runs kamdbctl reinit, there is no easy way to abort without dropping your existing database. Adding the get_answer provides a warning that the database will drop and a method of exiting without damage.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1852
-- Commit Summary --
* kamdbctl: added verification before reinit
* kamdbctl: added verification before reinit
-- File Changes --
M utils/kamctl/kamdbctl (8)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1852.patchhttps://github.com/kamailio/kamailio/pull/1852.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1852
Module: kamailio
Branch: master
Commit: 39756fff5776bb1bf38215e90bd19a859a287b93
URL: https://github.com/kamailio/kamailio/commit/39756fff5776bb1bf38215e90bd19a8…
Author: Fred Posner <fred(a)palner.com>
Committer: Henning Westerholt <henningw(a)users.noreply.github.com>
Date: 2019-02-17T19:38:33+01:00
kamdbctl: added verification before reinit (#1852)
kamdbctl: added verification before reinit command (GH #1852)
- add get_answer and warning that reinit command will drop existing database
- even seasoned users forget and ther is no backing out, results in data loss
---
Modified: utils/kamctl/kamdbctl
---
Diff: https://github.com/kamailio/kamailio/commit/39756fff5776bb1bf38215e90bd19a8…
Patch: https://github.com/kamailio/kamailio/commit/39756fff5776bb1bf38215e90bd19a8…
---
diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index a8d429a728..45ed0f50d9 100755
--- a/utils/kamctl/kamdbctl
+++ b/utils/kamctl/kamdbctl
@@ -386,6 +386,14 @@ case $1 in
reinit)
# delete database and create a new one
# create new database structures
+
+ # confirm dropping of database
+ echo -e "This will drop your current database and create a new one.\nIt is recommended to first backup your database.\n"
+ get_answer ask "Continue with reinit? (y/n): "
+ if [ "$ANSWER" != "y" ]; then
+ exit 1
+ fi
+
shift
if [ $# -eq 1 ] ; then
DBNAME="$1"
Hello,
Let me know how i could insert my module (hiops) into Kamailio github
project?
Also i've had some changes into other Kamailio file sources core path(such
as those that i asked before here, with this subject: A bit trick in
msg_translator.c source file"), How i could push them to Kamailio
project,too?
Does it's enough i just pull all file sources and add my module along with
all others changes, push them with new branche in Kamailio project?
With Regardd.Mojtaba
### Description
BYE requests received after 4 minutes are failing with 481
### Troubleshooting
#### Reproduction
<!--
If the issue can be reproduced, describe how it can be done.
-->
#### Debugging Data
Seems like REDIS is set to expire the leg infomartion after 3 minutes.
Not sure where / why this is the case.
```
T 2019/02/11 16:49:55.818935 137.54.60.160:58580 -> 137.54.2.161:6379 [AP]
*3..$6..EXPIRE..$26..d:z:atpsh-5c3d1562-16-cf25..$5..10800..
#
T 2019/02/11 16:50:21.325761 137.54.60.160:58580 -> 137.54.2.161:6379 [AP]
*3..$6..EXPIRE..$26..d:z:atpsh-5c3d1562-16-df25..$5..10800..
#
T 2019/02/11 16:50:26.582118 137.54.60.160:58574 -> 137.54.2.161:6379 [AP]
*3..$6..EXPIRE..$26..d:z:atpsh-5c3d1562-16-df25..$3..180..
#
T 2019/02/11 16:50:43.299621 137.54.60.160:58574 -> 137.54.2.161:6379 [AP]
*3..$6..EXPIRE..$26..d:z:atpsh-5c3d1562-16-df25..$3..180..
#
```
I will troubleshoot this further.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1848
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [ ] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] Each component has a single commit (if not, squash them into one commit)
- [ ] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [x] Related to issue #1848
#### Description
<!-- Describe your changes in detail -->
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1849
-- Commit Summary --
* topos_redis: fix branch insert expire duration
-- File Changes --
M src/modules/topos_redis/topos_redis_storage.c (4)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1849.patchhttps://github.com/kamailio/kamailio/pull/1849.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1849