kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
February 2015
----- 2025 -----
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
39 participants
342 discussions
Start a n
N
ew thread
git:master:a6510bbb: tls: regenerated the readme file
by Daniel-Constantin Mierla
17 Feb '15
17 Feb '15
Module: kamailio Branch: master Commit: a6510bbb2d3bcf29f672c2e649a9e4d63487bca7 URL:
https://github.com/kamailio/kamailio/commit/a6510bbb2d3bcf29f672c2e649a9e4d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2015-02-17T14:50:57+01:00 tls: regenerated the readme file --- Modified: modules/tls/README --- Diff:
https://github.com/kamailio/kamailio/commit/a6510bbb2d3bcf29f672c2e649a9e4d…
Patch:
https://github.com/kamailio/kamailio/commit/a6510bbb2d3bcf29f672c2e649a9e4d…
1
0
0
0
git:master:56389d7a: tls: documentation for server_name and xavp_cfg
by Daniel-Constantin Mierla
17 Feb '15
17 Feb '15
Module: kamailio Branch: master Commit: 56389d7adcbc1a71551ba4b93900ba993a2291e6 URL:
https://github.com/kamailio/kamailio/commit/56389d7adcbc1a71551ba4b93900ba9…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2015-02-17T14:50:43+01:00 tls: documentation for server_name and xavp_cfg --- Modified: modules/tls/doc/params.xml --- Diff:
https://github.com/kamailio/kamailio/commit/56389d7adcbc1a71551ba4b93900ba9…
Patch:
https://github.com/kamailio/kamailio/commit/56389d7adcbc1a71551ba4b93900ba9…
--- diff --git a/modules/tls/doc/params.xml b/modules/tls/doc/params.xml index ecd5802..60d62fc 100644 --- a/modules/tls/doc/params.xml +++ b/modules/tls/doc/params.xml @@ -350,6 +350,28 @@ modparam("tls", "cipher_list", "HIGH") </example> </section> + <section id="tls.p.server_name"> + <title><varname>server_name</varname> (string)</title> + <para> + Sets the Server Name Indication (SNI) value. + </para> + <para> + This is a TLS extension and is not working for old and obsoleted + SSL versions. + </para> + <para> + The default value is empty (not set). + </para> + <example> + <title>Set <varname>server_name</varname> parameter</title> + <programlisting> +... +modparam("tls", "server_name", "
kamailio.org
") +... + </programlisting> + </example> + </section> + <section id="tls.p.send_timeout"> <title><varname>send_timeout</varname> (int)</title> <para> @@ -993,6 +1015,7 @@ modparam("tls", "renegotiation", 1) <listitem><para>ca_list</para></listitem> <listitem><para>crl</para></listitem> <listitem><para>cipher_list</para></listitem> + <listitem><para>server_name</para></listitem> </itemizedlist> <para> All the parameters that take filenames as values will be resolved @@ -1031,6 +1054,7 @@ private_key = local_key.pem certificate = local_cert.pem verify_depth = 3 ca_list = local_ca.pem +server_name =
kamailio.org
</programlisting> </example> @@ -1058,4 +1082,32 @@ modparam("tls", "config", "/usr/local/etc/kamailio/tls.cfg") </para> </section> + <section id="tls.p.xavp_cfg"> + <title><varname>xavp_cfg</varname> (string)</title> + <para> + Sets the name of XAVP that stored attributes for TLS connections. + </para> + <para> + The following (inner) attributes can be set: + </para> + <itemizedlist> + <listitem><para>server_name - SNI to be used for outbound connections</para></listitem> + </itemizedlist> + <para> + The default value is empty (not set). + </para> + <example> + <title>Set <varname>xavp_cfg</varname> parameter</title> + <programlisting> +... + modparam("tls", "xavp_cfg", "tls") + ... + $xavp(tls=>server_name) = "
kamailio.org
"; + $du = "sip:kamailio.org:5061;transport=tls"; + route(RELAY); +... + </programlisting> + </example> + </section> + </section>
1
0
0
0
git:master:9a36fb7a: tls: set SNI for outbound connections via xavp
by Daniel-Constantin Mierla
17 Feb '15
17 Feb '15
Module: kamailio Branch: master Commit: 9a36fb7aae0adc39efb17a967a88db2eebfd8c36 URL:
https://github.com/kamailio/kamailio/commit/9a36fb7aae0adc39efb17a967a88db2…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2015-02-17T14:11:07+01:00 tls: set SNI for outbound connections via xavp - new parameter: xavp_cfg to set the name of the xavp that holds attributes for tls connections - server_name attribute can be used to specify SNI for outbound connections: modparam("tls", "xavp_cfg", "tls") ... $xavp(tls=>server_name) = "
kamailio.org
"; $du = "sip:kamailio.org:5061;transport=tls"; route(RELAY); - note: kamailio tries to identify the client context from tls.cfg by ip, port and server_name, but many OSes allocate a local random port when initiating TCP/TLS connection, so it is hard to add such contexts, in this case the client:default being used --- Modified: modules/tls/tls_domain.c Modified: modules/tls/tls_mod.c Modified: modules/tls/tls_server.c --- Diff:
https://github.com/kamailio/kamailio/commit/9a36fb7aae0adc39efb17a967a88db2…
Patch:
https://github.com/kamailio/kamailio/commit/9a36fb7aae0adc39efb17a967a88db2…
--- diff --git a/modules/tls/tls_domain.c b/modules/tls/tls_domain.c index 260522f..e31a4fe 100644 --- a/modules/tls/tls_domain.c +++ b/modules/tls/tls_domain.c @@ -1302,6 +1302,12 @@ tls_domain_t* tls_lookup_cfg(tls_domains_cfg_t* cfg, int type, } while (p) { + if(sname) { + LM_DBG("comparing addr: [%s:%d] [%s:%d] -- sni: [%.*s] [%.*s]\n", + ip_addr2a(&p->ip), p->port, ip_addr2a(ip), port, + p->server_name.len, ZSW(p->server_name.s), + sname->len, ZSW(sname->s)); + } if ((p->port == port) && ip_addr_cmp(&p->ip, ip)) { if(sname && sname->len>0) { if(p->server_name.len==sname->len diff --git a/modules/tls/tls_mod.c b/modules/tls/tls_mod.c index ed8ac01..2d085d0 100644 --- a/modules/tls/tls_mod.c +++ b/modules/tls/tls_mod.c @@ -82,6 +82,7 @@ static int is_peer_verified(struct sip_msg* msg, char* foo, char* foo2); MODULE_VERSION +str sr_tls_xavp_cfg = {0, 0}; /* * Default settings when modparams are used */ @@ -203,6 +204,7 @@ static param_export_t params[] = { {"low_mem_threshold1", PARAM_INT, &default_tls_cfg.low_mem_threshold1}, {"low_mem_threshold2", PARAM_INT, &default_tls_cfg.low_mem_threshold2}, {"renegotiation", PARAM_INT, &sr_tls_renegotiation}, + {"xavp_cfg", PARAM_STR, &sr_tls_xavp_cfg}, {0, 0, 0} }; diff --git a/modules/tls/tls_server.c b/modules/tls/tls_server.c index f8abb5b..b7e3207 100644 --- a/modules/tls/tls_server.c +++ b/modules/tls/tls_server.c @@ -42,6 +42,7 @@ #include "../../route.h" #include "../../forward.h" #include "../../onsend.h" +#include "../../xavp.h" #include "tls_init.h" #include "tls_domain.h" @@ -127,6 +128,30 @@ int tls_run_event_routes(struct tcp_connection *c); #endif /* TLS_RD_DEBUG */ +extern str sr_tls_xavp_cfg; + +/** + * get the server name (sni) for outbound connections from xavp + */ +static str *tls_get_connect_server_name(void) +{ +#ifndef OPENSSL_NO_TLSEXT + sr_xavp_t *vavp = NULL; + str sname = {"server_name", 11}; + + if(sr_tls_xavp_cfg.s!=NULL) + vavp = xavp_get_child_with_sval(&sr_tls_xavp_cfg, &sname); + if(vavp==NULL || vavp->val.v.s.len<=0) { + LM_DBG("xavp with outbound server name not found\n"); + return NULL; + } + LM_DBG("found xavp with outbound server name: %s\n", vavp->val.v.s.s); + return &vavp->val.v.s; +#else + return NULL; +#endif +} + /** finish the ssl init. * Creates the SSL context + internal tls_extra_data and sets * extra_data to it. @@ -141,6 +166,7 @@ static int tls_complete_init(struct tcp_connection* c) struct tls_extra_data* data = 0; tls_domains_cfg_t* cfg; enum tls_conn_states state; + str *sname = NULL; if (LOW_MEM_NEW_CONNECTION_TEST()){ ERR("tls: ssl bug #1491 workaround: not enough memory for safe" @@ -169,8 +195,9 @@ static int tls_complete_init(struct tcp_connection* c) &c->rcv.dst_ip, c->rcv.dst_port, 0); } else { state=S_TLS_CONNECTING; + sname = tls_get_connect_server_name(); dom = tls_lookup_cfg(cfg, TLS_DOMAIN_CLI, - &c->rcv.dst_ip, c->rcv.dst_port, 0); + &c->rcv.dst_ip, c->rcv.dst_port, sname); } if (unlikely(c->state<0)) { BUG("Invalid connection (state %d)\n", c->state); @@ -199,6 +226,20 @@ static int tls_complete_init(struct tcp_connection* c) BIO_free(data->rwbio); goto error; } + +#ifndef OPENSSL_NO_TLSEXT + if (sname!=NULL) { + if(!SSL_set_tlsext_host_name(data->ssl, sname->s)) { + if (data->ssl) + SSL_free(data->ssl); + if (data->rwbio) + BIO_free(data->rwbio); + goto error; + } + LM_DBG("outbound TLS server name set to: %s\n", sname->s); + } +#endif + #ifdef TLS_KSSL_WORKARROUND /* if needed apply workaround for openssl bug #1467 */ if (data->ssl->kssl_ctx && openssl_kssl_malloc_bug){ @@ -211,7 +252,6 @@ static int tls_complete_init(struct tcp_connection* c) /* link the extra data struct inside ssl connection*/ SSL_set_app_data(data->ssl, data); - return 0; error:
1
0
0
0
git:master:f37344dd: tls: added server_name to module parameters
by Daniel-Constantin Mierla
17 Feb '15
17 Feb '15
Module: kamailio Branch: master Commit: f37344dddf53514e35a3d8c0e2d47c0672a80825 URL:
https://github.com/kamailio/kamailio/commit/f37344dddf53514e35a3d8c0e2d47c0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2015-02-17T14:11:07+01:00 tls: added server_name to module parameters - not that useful in the case of defining a single set of tls attributes, but has to be coherent with the config options --- Modified: modules/tls/tls_cfg.c Modified: modules/tls/tls_cfg.h Modified: modules/tls/tls_mod.c --- Diff:
https://github.com/kamailio/kamailio/commit/f37344dddf53514e35a3d8c0e2d47c0…
Patch:
https://github.com/kamailio/kamailio/commit/f37344dddf53514e35a3d8c0e2d47c0…
--- diff --git a/modules/tls/tls_cfg.c b/modules/tls/tls_cfg.c index d6e1048..fd3b950 100644 --- a/modules/tls/tls_cfg.c +++ b/modules/tls/tls_cfg.c @@ -35,6 +35,7 @@ struct cfg_group_tls default_tls_cfg = { 0, /* tls_force_run */ STR_STATIC_INIT("TLSv1"), /* method */ + STR_NULL, /* server name (sni) */ 0, /* verify_certificate */ 9, /* verify_depth */ 0, /* require_certificate */ @@ -138,7 +139,9 @@ cfg_def_t tls_cfg_def[] = { {"force_run", CFG_VAR_INT | CFG_READONLY, 0, 1, 0, 0, "force loading the tls module even when initial sanity checks fail"}, {"method", CFG_VAR_STR | CFG_READONLY, 0, 0, 0, 0, - "TLS method used (TLSv1, SSLv3, SSLv2, SSLv23)"}, + "TLS method used (TLSv1.2, TLSv1.1, TLSv1, SSLv3, SSLv2, SSLv23)"}, + {"server_name", CFG_VAR_STR | CFG_READONLY, 0, 0, 0, 0, + "Server name (SNI)"}, {"verify_certificate", CFG_VAR_INT | CFG_READONLY, 0, 1, 0, 0, "if enabled the certificates will be verified" }, {"verify_depth", CFG_VAR_INT | CFG_READONLY, 0, 100, 0, 0, diff --git a/modules/tls/tls_cfg.h b/modules/tls/tls_cfg.h index 2768f0b..36cb662 100644 --- a/modules/tls/tls_cfg.h +++ b/modules/tls/tls_cfg.h @@ -41,6 +41,7 @@ struct cfg_group_tls { int force_run; str method; + str server_name; int verify_cert; int verify_depth; int require_cert; diff --git a/modules/tls/tls_mod.c b/modules/tls/tls_mod.c index b02e1a1..ed8ac01 100644 --- a/modules/tls/tls_mod.c +++ b/modules/tls/tls_mod.c @@ -99,6 +99,7 @@ static tls_domain_t mod_params = { {0, }, /* Cipher list */ TLS_USE_TLSv1, /* TLS method */ STR_STATIC_INIT(TLS_CRL_FILE), /* Certificate revocation list */ + {0, 0}, /* Server name (SNI) */ 0 /* next */ }; @@ -120,6 +121,7 @@ tls_domain_t srv_defaults = { {0, 0}, /* Cipher list */ TLS_USE_TLSv1, /* TLS method */ STR_STATIC_INIT(TLS_CRL_FILE), /* Certificate revocation list */ + {0, 0}, /* Server name (SNI) */ 0 /* next */ }; @@ -141,6 +143,7 @@ tls_domain_t cli_defaults = { {0, 0}, /* Cipher list */ TLS_USE_TLSv1, /* TLS method */ {0, 0}, /* Certificate revocation list */ + {0, 0}, /* Server name (SNI) */ 0 /* next */ }; @@ -170,6 +173,7 @@ static cmd_export_t cmds[] = { */ static param_export_t params[] = { {"tls_method", PARAM_STR, &default_tls_cfg.method }, + {"server_name", PARAM_STR, &default_tls_cfg.server_name }, {"verify_certificate", PARAM_INT, &default_tls_cfg.verify_cert }, {"verify_depth", PARAM_INT, &default_tls_cfg.verify_depth }, {"require_certificate", PARAM_INT, &default_tls_cfg.require_cert }, @@ -307,6 +311,7 @@ static int mod_init(void) mod_params.crl_file = cfg_get(tls, tls_cfg, crl); mod_params.cert_file = cfg_get(tls, tls_cfg, certificate); mod_params.cipher_list = cfg_get(tls, tls_cfg, cipher_list); + mod_params.server_name = cfg_get(tls, tls_cfg, server_name); tls_domains_cfg = (tls_domains_cfg_t**)shm_malloc(sizeof(tls_domains_cfg_t*));
1
0
0
0
git:master:44db9cdb: Merge pull request #87 from kamailio/lazedo/dbtext
by lazedo
17 Feb '15
17 Feb '15
Module: kamailio Branch: master Commit: 44db9cdb44e6d2e11b6f423015350625a6d75637 URL:
https://github.com/kamailio/kamailio/commit/44db9cdb44e6d2e11b6f42301535062…
Author: lazedo <luis.azedo(a)factorlusitano.com> Committer: lazedo <luis.azedo(a)factorlusitano.com> Date: 2015-02-17T12:08:34Z Merge pull request #87 from kamailio/lazedo/dbtext db_text - add affected rows capability --- Modified: modules/db_text/dbt_base.c Modified: modules/db_text/dbt_res.h Modified: modules/db_text/dbtext.c Modified: modules/db_text/dbtext.h --- Diff:
https://github.com/kamailio/kamailio/commit/44db9cdb44e6d2e11b6f42301535062…
Patch:
https://github.com/kamailio/kamailio/commit/44db9cdb44e6d2e11b6f42301535062…
--- diff --git a/modules/db_text/dbt_base.c b/modules/db_text/dbt_base.c index c29a5e0..1a7f10c 100644 --- a/modules/db_text/dbt_base.c +++ b/modules/db_text/dbt_base.c @@ -336,6 +336,20 @@ int dbt_raw_query(db1_con_t* _h, char* _s, db1_res_t** _r) } /* + * Affected Rows + */ +int dbt_affected_rows(db1_con_t* _h) +{ + if (!_h || !CON_TABLE(_h)) + { + LM_ERR("invalid parameter\n"); + return -1; + } + + return ((dbt_con_p)_h->tail)->affected; +} + +/* * Insert a row into table */ int dbt_insert(db1_con_t* _h, db_key_t* _k, db_val_t* _v, int _n) @@ -350,6 +364,9 @@ int dbt_insert(db1_con_t* _h, db_key_t* _k, db_val_t* _v, int _n) LM_ERR("invalid parameter\n"); return -1; } + + ((dbt_con_p)_h->tail)->affected = 0; + if(!_k || !_v || _n<=0) { LM_ERR("no key-value to insert\n"); @@ -407,6 +424,8 @@ int dbt_insert(db1_con_t* _h, db_key_t* _k, db_val_t* _v, int _n) goto clean; } + ((dbt_con_p)_h->tail)->affected = 1; + /* dbt_print_table(_tbc, NULL); */ /* unlock databse */ @@ -452,6 +471,8 @@ int dbt_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n) return -1; } + ((dbt_con_p)_h->tail)->affected = 0; + /* lock database */ _tbc = dbt_db_get_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); if(!_tbc) @@ -464,6 +485,7 @@ int dbt_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n) if(!_k || !_v || _n<=0) { LM_DBG("deleting all records\n"); + ((dbt_con_p)_h->tail)->affected = _tbc->nrrows; dbt_table_free_rows(_tbc); /* unlock databse */ dbt_release_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); @@ -490,6 +512,9 @@ int dbt_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n) _tbc->nrrows--; // free row dbt_row_free(_tbc, _drp); + + ((dbt_con_p)_h->tail)->affected++; + } _drp = _drp0; } @@ -530,7 +555,9 @@ int dbt_update(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, LM_ERR("invalid parameters\n"); return -1; } - + + ((dbt_con_p)_h->tail)->affected = 0; + /* lock database */ _tbc = dbt_db_get_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); if(!_tbc) @@ -569,6 +596,9 @@ int dbt_update(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, goto error; } } + + ((dbt_con_p)_h->tail)->affected++; + } _drp = _drp->next; } diff --git a/modules/db_text/dbt_res.h b/modules/db_text/dbt_res.h index a143097..0f908e7 100644 --- a/modules/db_text/dbt_res.h +++ b/modules/db_text/dbt_res.h @@ -47,6 +47,7 @@ typedef struct _dbt_result typedef struct _dbt_con { dbt_cache_p con; + int affected; } dbt_con_t, *dbt_con_p; #define DBT_CON_CONNECTION(db_con) (((dbt_con_p)((db_con)->tail))->con) diff --git a/modules/db_text/dbtext.c b/modules/db_text/dbtext.c index 47cf295..ab84562 100644 --- a/modules/db_text/dbtext.c +++ b/modules/db_text/dbtext.c @@ -134,6 +134,8 @@ int dbt_bind_api(db_func_t *dbb) dbb->insert = (db_insert_f)dbt_insert; dbb->delete = (db_delete_f)dbt_delete; dbb->update = (db_update_f)dbt_update; + dbb->affected_rows = (db_affected_rows_f) dbt_affected_rows; + dbb->cap = DB_CAP_AFFECTED_ROWS; return 0; } diff --git a/modules/db_text/dbtext.h b/modules/db_text/dbtext.h index 936bb3d..48f62cd 100644 --- a/modules/db_text/dbtext.h +++ b/modules/db_text/dbtext.h @@ -87,5 +87,10 @@ int dbt_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n); int dbt_update(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, db_key_t* _uk, db_val_t* _uv, int _n, int _un); +/* + * Affected rows + */ +int dbt_affected_rows(db1_con_t* _h); + #endif
1
0
0
0
git:master:193e8b35: db_text - fix indentation
by Luis Azedo
17 Feb '15
17 Feb '15
Module: kamailio Branch: master Commit: 193e8b35a93b4fee7479cfc0d7c27aff08342230 URL:
https://github.com/kamailio/kamailio/commit/193e8b35a93b4fee7479cfc0d7c27af…
Author: Luis Azedo <luis(a)2600hz.com> Committer: Luis Azedo <luis(a)2600hz.com> Date: 2015-02-16T15:47:13Z db_text - fix indentation --- Modified: modules/db_text/dbtext.c --- Diff:
https://github.com/kamailio/kamailio/commit/193e8b35a93b4fee7479cfc0d7c27af…
Patch:
https://github.com/kamailio/kamailio/commit/193e8b35a93b4fee7479cfc0d7c27af…
--- diff --git a/modules/db_text/dbtext.c b/modules/db_text/dbtext.c index cde16af..ab84562 100644 --- a/modules/db_text/dbtext.c +++ b/modules/db_text/dbtext.c @@ -134,8 +134,8 @@ int dbt_bind_api(db_func_t *dbb) dbb->insert = (db_insert_f)dbt_insert; dbb->delete = (db_delete_f)dbt_delete; dbb->update = (db_update_f)dbt_update; - dbb->affected_rows = (db_affected_rows_f) dbt_affected_rows; - dbb->cap = DB_CAP_AFFECTED_ROWS; + dbb->affected_rows = (db_affected_rows_f) dbt_affected_rows; + dbb->cap = DB_CAP_AFFECTED_ROWS; return 0; }
1
0
0
0
git:master:c8533037: db_text - fix indentation
by Luis Azedo
17 Feb '15
17 Feb '15
Module: kamailio Branch: master Commit: c8533037c916497c328d0ed4e30a6ef51dfc8882 URL:
https://github.com/kamailio/kamailio/commit/c8533037c916497c328d0ed4e30a6ef…
Author: Luis Azedo <luis(a)2600hz.com> Committer: Luis Azedo <luis(a)2600hz.com> Date: 2015-02-16T14:52:02Z db_text - fix indentation --- Modified: modules/db_text/dbt_base.c Modified: modules/db_text/dbt_res.h --- Diff:
https://github.com/kamailio/kamailio/commit/c8533037c916497c328d0ed4e30a6ef…
Patch:
https://github.com/kamailio/kamailio/commit/c8533037c916497c328d0ed4e30a6ef…
--- diff --git a/modules/db_text/dbt_base.c b/modules/db_text/dbt_base.c index e862e86..1a7f10c 100644 --- a/modules/db_text/dbt_base.c +++ b/modules/db_text/dbt_base.c @@ -340,13 +340,13 @@ int dbt_raw_query(db1_con_t* _h, char* _s, db1_res_t** _r) */ int dbt_affected_rows(db1_con_t* _h) { - if (!_h || !CON_TABLE(_h)) - { - LM_ERR("invalid parameter\n"); - return -1; - } + if (!_h || !CON_TABLE(_h)) + { + LM_ERR("invalid parameter\n"); + return -1; + } - return ((dbt_con_p)_h->tail)->affected; + return ((dbt_con_p)_h->tail)->affected; } /* @@ -364,8 +364,8 @@ int dbt_insert(db1_con_t* _h, db_key_t* _k, db_val_t* _v, int _n) LM_ERR("invalid parameter\n"); return -1; } - - ((dbt_con_p)_h->tail)->affected = 0; + + ((dbt_con_p)_h->tail)->affected = 0; if(!_k || !_v || _n<=0) { @@ -424,7 +424,7 @@ int dbt_insert(db1_con_t* _h, db_key_t* _k, db_val_t* _v, int _n) goto clean; } - ((dbt_con_p)_h->tail)->affected = 1; + ((dbt_con_p)_h->tail)->affected = 1; /* dbt_print_table(_tbc, NULL); */ @@ -471,7 +471,7 @@ int dbt_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n) return -1; } - ((dbt_con_p)_h->tail)->affected = 0; + ((dbt_con_p)_h->tail)->affected = 0; /* lock database */ _tbc = dbt_db_get_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); @@ -485,7 +485,7 @@ int dbt_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n) if(!_k || !_v || _n<=0) { LM_DBG("deleting all records\n"); - ((dbt_con_p)_h->tail)->affected = _tbc->nrrows; + ((dbt_con_p)_h->tail)->affected = _tbc->nrrows; dbt_table_free_rows(_tbc); /* unlock databse */ dbt_release_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); @@ -513,7 +513,7 @@ int dbt_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n) // free row dbt_row_free(_tbc, _drp); - ((dbt_con_p)_h->tail)->affected++; + ((dbt_con_p)_h->tail)->affected++; } _drp = _drp0; @@ -556,7 +556,7 @@ int dbt_update(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, return -1; } - ((dbt_con_p)_h->tail)->affected = 0; + ((dbt_con_p)_h->tail)->affected = 0; /* lock database */ _tbc = dbt_db_get_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); @@ -597,7 +597,7 @@ int dbt_update(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, } } - ((dbt_con_p)_h->tail)->affected++; + ((dbt_con_p)_h->tail)->affected++; } _drp = _drp->next; diff --git a/modules/db_text/dbt_res.h b/modules/db_text/dbt_res.h index 00bdb40..0f908e7 100644 --- a/modules/db_text/dbt_res.h +++ b/modules/db_text/dbt_res.h @@ -47,7 +47,7 @@ typedef struct _dbt_result typedef struct _dbt_con { dbt_cache_p con; - int affected; + int affected; } dbt_con_t, *dbt_con_p; #define DBT_CON_CONNECTION(db_con) (((dbt_con_p)((db_con)->tail))->con)
1
0
0
0
git:master:b93b7b39: db_text - add affected rows capability
by Luis Azedo
17 Feb '15
17 Feb '15
Module: kamailio Branch: master Commit: b93b7b39537f8858b34052f77e3ce0512cdc72c0 URL:
https://github.com/kamailio/kamailio/commit/b93b7b39537f8858b34052f77e3ce05…
Author: Luis Azedo <luis(a)2600hz.com> Committer: Luis Azedo <luis(a)2600hz.com> Date: 2015-02-16T13:48:58Z db_text - add affected rows capability --- Modified: modules/db_text/dbt_base.c Modified: modules/db_text/dbt_res.h Modified: modules/db_text/dbtext.c Modified: modules/db_text/dbtext.h --- Diff:
https://github.com/kamailio/kamailio/commit/b93b7b39537f8858b34052f77e3ce05…
Patch:
https://github.com/kamailio/kamailio/commit/b93b7b39537f8858b34052f77e3ce05…
--- diff --git a/modules/db_text/dbt_base.c b/modules/db_text/dbt_base.c index c29a5e0..e862e86 100644 --- a/modules/db_text/dbt_base.c +++ b/modules/db_text/dbt_base.c @@ -336,6 +336,20 @@ int dbt_raw_query(db1_con_t* _h, char* _s, db1_res_t** _r) } /* + * Affected Rows + */ +int dbt_affected_rows(db1_con_t* _h) +{ + if (!_h || !CON_TABLE(_h)) + { + LM_ERR("invalid parameter\n"); + return -1; + } + + return ((dbt_con_p)_h->tail)->affected; +} + +/* * Insert a row into table */ int dbt_insert(db1_con_t* _h, db_key_t* _k, db_val_t* _v, int _n) @@ -350,6 +364,9 @@ int dbt_insert(db1_con_t* _h, db_key_t* _k, db_val_t* _v, int _n) LM_ERR("invalid parameter\n"); return -1; } + + ((dbt_con_p)_h->tail)->affected = 0; + if(!_k || !_v || _n<=0) { LM_ERR("no key-value to insert\n"); @@ -407,6 +424,8 @@ int dbt_insert(db1_con_t* _h, db_key_t* _k, db_val_t* _v, int _n) goto clean; } + ((dbt_con_p)_h->tail)->affected = 1; + /* dbt_print_table(_tbc, NULL); */ /* unlock databse */ @@ -452,6 +471,8 @@ int dbt_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n) return -1; } + ((dbt_con_p)_h->tail)->affected = 0; + /* lock database */ _tbc = dbt_db_get_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); if(!_tbc) @@ -464,6 +485,7 @@ int dbt_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n) if(!_k || !_v || _n<=0) { LM_DBG("deleting all records\n"); + ((dbt_con_p)_h->tail)->affected = _tbc->nrrows; dbt_table_free_rows(_tbc); /* unlock databse */ dbt_release_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); @@ -490,6 +512,9 @@ int dbt_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n) _tbc->nrrows--; // free row dbt_row_free(_tbc, _drp); + + ((dbt_con_p)_h->tail)->affected++; + } _drp = _drp0; } @@ -530,7 +555,9 @@ int dbt_update(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, LM_ERR("invalid parameters\n"); return -1; } - + + ((dbt_con_p)_h->tail)->affected = 0; + /* lock database */ _tbc = dbt_db_get_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); if(!_tbc) @@ -569,6 +596,9 @@ int dbt_update(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, goto error; } } + + ((dbt_con_p)_h->tail)->affected++; + } _drp = _drp->next; } diff --git a/modules/db_text/dbt_res.h b/modules/db_text/dbt_res.h index a143097..00bdb40 100644 --- a/modules/db_text/dbt_res.h +++ b/modules/db_text/dbt_res.h @@ -47,6 +47,7 @@ typedef struct _dbt_result typedef struct _dbt_con { dbt_cache_p con; + int affected; } dbt_con_t, *dbt_con_p; #define DBT_CON_CONNECTION(db_con) (((dbt_con_p)((db_con)->tail))->con) diff --git a/modules/db_text/dbtext.c b/modules/db_text/dbtext.c index 47cf295..cde16af 100644 --- a/modules/db_text/dbtext.c +++ b/modules/db_text/dbtext.c @@ -134,6 +134,8 @@ int dbt_bind_api(db_func_t *dbb) dbb->insert = (db_insert_f)dbt_insert; dbb->delete = (db_delete_f)dbt_delete; dbb->update = (db_update_f)dbt_update; + dbb->affected_rows = (db_affected_rows_f) dbt_affected_rows; + dbb->cap = DB_CAP_AFFECTED_ROWS; return 0; } diff --git a/modules/db_text/dbtext.h b/modules/db_text/dbtext.h index 936bb3d..48f62cd 100644 --- a/modules/db_text/dbtext.h +++ b/modules/db_text/dbtext.h @@ -87,5 +87,10 @@ int dbt_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n); int dbt_update(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, db_key_t* _uk, db_val_t* _uv, int _n, int _un); +/* + * Affected rows + */ +int dbt_affected_rows(db1_con_t* _h); + #endif
1
0
0
0
[kamailio] db_text - add affected rows capability (#87)
by lazedo
17 Feb '15
17 Feb '15
this will allow better interaction with usrloc module param db_check_update You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/87
-- Commit Summary -- * db_text - add affected rows capability -- File Changes -- M modules/db_text/dbt_base.c (32) M modules/db_text/dbt_res.h (1) M modules/db_text/dbtext.c (2) M modules/db_text/dbtext.h (5) -- Patch Links --
https://github.com/kamailio/kamailio/pull/87.patch
https://github.com/kamailio/kamailio/pull/87.diff
--- Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/87
2
4
0
0
[kamailio] rename sercmd to kamcmd (#81)
by Victor Seva
17 Feb '15
17 Feb '15
Finish the migration from sercmd to kamcmd inside the code too, not only the name of the binary --- Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/81
3
4
0
0
← Newer
1
...
11
12
13
14
15
16
17
...
35
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Results per page:
10
25
50
100
200