- add get_answer and warning that drop command will drop existing database
<!-- 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 -->
Added verification to drop command. Allows for someone to change their mind before dropping existing database similar to #1852
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1858
-- Commit Summary --
* kamdbctl: added verification before reinit
* kamdbctl: added verification before reinit
* Merge remote-tracking branch 'upstream/master'
* kamdbctl: added verification before drop command
-- File Changes --
M utils/kamctl/kamdbctl (8)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1858.patchhttps://github.com/kamailio/kamailio/pull/1858.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/1858
### Description
When setting `listen` with `advertise` in the configuration file the advertise section cannot contain an address that has the string `dns` within it. If at any point the domain used in advertise contains the three letters consecutively without being broken by a hypen or a dot it causes the parser to fail, see logging below.
I tried quoting the string but it didn't seam to parse properly. It interpenetrated the full thing as the listen address portion.
### Troubleshooting
#### Reproduction
Add any advertise address to the config file with the string dns.
e.g.
```
listen=tcp:127.0.0.1:5060 advertise sip.dns.example.com:5060
```
Also using it in the `advertised_address` section without quotes causes the error.
```
advertised_address=sip.dns.example.com:5060
```
#### Log Messages
``````
0(98) CRITICAL: <core> [core/cfg.y:3507]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 62, column 43-45: syntax error
0(98) CRITICAL: <core> [core/cfg.y:3507]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 62, column 43-45: invalid host or interface name
0(98) CRITICAL: <core> [core/cfg.y:3507]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 62, column 43-45: ip address, interface name or hostname expected
0(98) CRITICAL: <core> [core/cfg.y:3507]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 62, column 47-54:
ERROR: bad config file (4 errors)
```
### Possible Solutions
A solution could be to use the a `advertised_address` though the cookbook states that this could be deprecated in future and that the `listen` config parameter is preferred.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.2.1 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 6.3.0
```
* **Operating System**:
Running in Debian container image.
```
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Linux 1498e1ef835d 4.20.6-arch1-1-ARCH #1 SMP PREEMPT Thu Jan 31 08:22:01 UTC 2019 x86_64 GNU/Linux
```
--
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/1854
Module: kamailio
Branch: 5.1
Commit: 780438599de627bfdc9406b7dd469767b35123f5
URL: https://github.com/kamailio/kamailio/commit/780438599de627bfdc9406b7dd46976…
Author: Henning Westerholt <hw(a)kamailio.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2019-02-18T20:58:41+01:00
kamdbctl: warn that drop cmd will drop existing DB, ask for confirmation (GH #1858)
- warn that the drop command will drop existing DB, ask for confirmation
- manually merge pull request GH #1858 from fredposner, fred at qxork dot com
---
Modified: utils/kamctl/kamdbctl
---
Diff: https://github.com/kamailio/kamailio/commit/780438599de627bfdc9406b7dd46976…
Patch: https://github.com/kamailio/kamailio/commit/780438599de627bfdc9406b7dd46976…
---
diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index e66f3eb4ce..ea15329a19 100755
--- a/utils/kamctl/kamdbctl
+++ b/utils/kamctl/kamdbctl
@@ -398,6 +398,14 @@ case $1 in
drop)
# delete kamailio database
# create new database structures
+
+ # confirm dropping of database
+ echo -e "This will drop your current database.\nIt is recommended to first backup your database.\n"
+ get_answer ask "Continue with drop? (y/n): "
+ if [ "$ANSWER" != "y" ]; then
+ exit 1
+ fi
+
shift
if [ $# -eq 1 ] ; then
DBNAME="$1"
Module: kamailio
Branch: 5.1
Commit: d0da5663bf5761a68c6e135c270ab637539f74a4
URL: https://github.com/kamailio/kamailio/commit/d0da5663bf5761a68c6e135c270ab63…
Author: Fred Posner <fred(a)palner.com>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2019-02-18T20:58:14+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
(cherry picked from commit 39756fff5776bb1bf38215e90bd19a859a287b93)
---
Modified: utils/kamctl/kamdbctl
---
Diff: https://github.com/kamailio/kamailio/commit/d0da5663bf5761a68c6e135c270ab63…
Patch: https://github.com/kamailio/kamailio/commit/d0da5663bf5761a68c6e135c270ab63…
---
diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index 224111b9fb..e66f3eb4ce 100755
--- a/utils/kamctl/kamdbctl
+++ b/utils/kamctl/kamdbctl
@@ -409,6 +409,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"
Module: kamailio
Branch: 5.2
Commit: c07e85a8031f771690f4da7f28ff31e265c98a60
URL: https://github.com/kamailio/kamailio/commit/c07e85a8031f771690f4da7f28ff31e…
Author: Henning Westerholt <hw(a)kamailio.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2019-02-18T20:59:05+01:00
kamdbctl: warn that drop cmd will drop existing DB, ask for confirmation (GH #1858)
- warn that the drop command will drop existing DB, ask for confirmation
- manually merge pull request GH #1858 from fredposner, fred at qxork dot com
---
Modified: utils/kamctl/kamdbctl
---
Diff: https://github.com/kamailio/kamailio/commit/c07e85a8031f771690f4da7f28ff31e…
Patch: https://github.com/kamailio/kamailio/commit/c07e85a8031f771690f4da7f28ff31e…
---
diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index 62501a4420..ae44c5df45 100755
--- a/utils/kamctl/kamdbctl
+++ b/utils/kamctl/kamdbctl
@@ -375,6 +375,14 @@ case $1 in
drop)
# delete kamailio database
# create new database structures
+
+ # confirm dropping of database
+ echo -e "This will drop your current database.\nIt is recommended to first backup your database.\n"
+ get_answer ask "Continue with drop? (y/n): "
+ if [ "$ANSWER" != "y" ]; then
+ exit 1
+ fi
+
shift
if [ $# -eq 1 ] ; then
DBNAME="$1"
Module: kamailio
Branch: 5.2
Commit: d0ee6bcd902bf95486ed02ea21b234bcc978894a
URL: https://github.com/kamailio/kamailio/commit/d0ee6bcd902bf95486ed02ea21b234b…
Author: Fred Posner <fred(a)palner.com>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2019-02-18T20:58:09+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
(cherry picked from commit 39756fff5776bb1bf38215e90bd19a859a287b93)
---
Modified: utils/kamctl/kamdbctl
---
Diff: https://github.com/kamailio/kamailio/commit/d0ee6bcd902bf95486ed02ea21b234b…
Patch: https://github.com/kamailio/kamailio/commit/d0ee6bcd902bf95486ed02ea21b234b…
---
diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index cac33fd1ce..62501a4420 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"