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
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
May 2014
----- 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
34 participants
238 discussions
Start a n
N
ew thread
git:master: app_perl: added documentation for perl_destroy_func parameter
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: dfccb6d5b1e1ae7eeca85007157ccced97c7f2e5 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=dfccb6d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Mon May 26 15:55:22 2014 +0200 app_perl: added documentation for perl_destroy_func parameter --- modules/app_perl/README | 32 +++++++++++++++++++++++------- modules/app_perl/doc/app_perl_admin.xml | 19 ++++++++++++++++++ 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/modules/app_perl/README b/modules/app_perl/README index ce1a530..b8c7562 100644 --- a/modules/app_perl/README +++ b/modules/app_perl/README @@ -28,6 +28,7 @@ Bastian Friedrich 5.1. filename (string) 5.2. modpath (string) 5.3. reset_cycles (int) + 5.4. perl_destroy_func (string) 6. Functions @@ -194,10 +195,11 @@ Bastian Friedrich 1.1. Set filename parameter 1.2. Set modpath parameter 1.3. Set reset_cycles parameter - 1.4. perl_exec_simple() usage - 1.5. perl_exec() usage - 1.6. app_perl.set_reset_cycles usage - 1.7. app_perl.get_reset_cycles usage + 1.4. Set perl_destroy_func parameter + 1.5. perl_exec_simple() usage + 1.6. perl_exec() usage + 1.7. app_perl.set_reset_cycles usage + 1.8. app_perl.get_reset_cycles usage Chapter 1. Admin Guide @@ -216,6 +218,7 @@ Chapter 1. Admin Guide 5.1. filename (string) 5.2. modpath (string) 5.3. reset_cycles (int) + 5.4. perl_destroy_func (string) 6. Functions @@ -335,6 +338,7 @@ if (perl_exec("ldap_alias")) { 5.1. filename (string) 5.2. modpath (string) 5.3. reset_cycles (int) + 5.4. perl_destroy_func (string) 5.1. filename (string) @@ -383,6 +387,18 @@ modparam("app_perl", "modpath", "/usr/local/lib/kamailio/perl/") modparam("app_perl", "reset_cycles", 100000) ... +5.4. perl_destroy_func (string) + + The name of Perl function to be executed before the interpreter is + re-initialized (reset -- see reset_cycles parameter) at runtime. This + could be useful to clean global variables or file descriptors from the + Perl script. + + Example 1.4. Set perl_destroy_func parameter +... +modparam("app_perl", "perl_destroy_func", "my_perl_destroy") +... + 6. Functions 6.1. perl_exec_simple(func, [param]) @@ -401,7 +417,7 @@ modparam("app_perl", "reset_cycles", 100000) This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE and BRANCH_ROUTE. - Example 1.4. perl_exec_simple() usage + Example 1.5. perl_exec_simple() usage ... if (method=="INVITE") { perl_exec_simple("dosomething", "on invite messages"); @@ -420,7 +436,7 @@ if (method=="INVITE") { This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE and BRANCH_ROUTE. - Example 1.5. perl_exec() usage + Example 1.6. perl_exec() usage ... if (perl_exec("ldapalias")) { ... @@ -437,7 +453,7 @@ if (perl_exec("ldapalias")) { Set the value of the reset_cycle. The command has one integer parameter. - Example 1.6. app_perl.set_reset_cycles usage + Example 1.7. app_perl.set_reset_cycles usage ... kamcmd app_perl.set_reset_cycles 20000 ... @@ -446,7 +462,7 @@ kamcmd app_perl.set_reset_cycles 20000 Return the value of the reset_cycle. - Example 1.7. app_perl.get_reset_cycles usage + Example 1.8. app_perl.get_reset_cycles usage ... kamcmd app_perl.get_reset_cycles ... diff --git a/modules/app_perl/doc/app_perl_admin.xml b/modules/app_perl/doc/app_perl_admin.xml index 1b377b5..1d85cb7 100644 --- a/modules/app_perl/doc/app_perl_admin.xml +++ b/modules/app_perl/doc/app_perl_admin.xml @@ -220,6 +220,25 @@ modparam("app_perl", "reset_cycles", 100000) </programlisting> </example> </section> + + <section id="app_perl.p.perl_destroy_func"> + <title><varname>perl_destroy_func</varname> (string)</title> + <para> + The name of Perl function to be executed before the interpreter is + re-initialized (reset -- see reset_cycles parameter) at runtime. + This could be useful to clean global variables or file descriptors + from the Perl script. + </para> + <example> + <title>Set <varname>perl_destroy_func</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("app_perl", "perl_destroy_func", "my_perl_destroy") +... +</programlisting> + </example> + </section> + </section> <section>
10 years, 8 months
1
0
0
0
git:master: app_perl: new param perl_destroy_func to specify perl destroy function
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 6fba7ed75cf5c2cc1d267bb7262df4d228e26273 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6fba7ed…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Mon May 26 15:47:07 2014 +0200 app_perl: new param perl_destroy_func to specify perl destroy function - if set, the module will execute the specified perl function before re-initializing the interpreter at runtime --- modules/app_perl/app_perl_mod.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/modules/app_perl/app_perl_mod.c b/modules/app_perl/app_perl_mod.c index 625fec3..035e04d 100644 --- a/modules/app_perl/app_perl_mod.c +++ b/modules/app_perl/app_perl_mod.c @@ -62,6 +62,10 @@ char *filename = NULL; * installed */ char *modpath = NULL; +/* Function to be called before perl interpreter instance is destroyed + * when attempting reinit */ +static char *perl_destroy_func = NULL; + /* Allow unsafe module functions - functions with fixups. This will create * memory leaks, the variable thus is not documented! */ int unsafemodfnc = 0; @@ -128,6 +132,7 @@ static param_export_t params[] = { {"modpath", STR_PARAM, &modpath}, {"unsafemodfnc", INT_PARAM, &unsafemodfnc}, {"reset_cycles", INT_PARAM, &_ap_reset_cycles_init}, + {"perl_destroy_func", STR_PARAM, &perl_destroy_func}, { 0, 0, 0 } }; @@ -426,6 +431,7 @@ int app_perl_reset_interpreter(void) { struct timeval t1; struct timeval t2; + char *args[] = { NULL }; if(*_ap_reset_cycles==0) return 0; @@ -437,6 +443,9 @@ int app_perl_reset_interpreter(void) if(_ap_exec_cycles<=*_ap_reset_cycles) return 0; + if(perl_destroy_func) + call_argv(perl_destroy_func, G_DISCARD | G_NOARGS, args); + gettimeofday(&t1, NULL); if (perl_reload()<0) { LM_ERR("perl interpreter cannot be reset [%d/%d]\n",
10 years, 8 months
1
0
0
0
git:4.1: auth_db: auth_check() to get the auth header from the used api
by Daniel-Constantin Mierla
Module: sip-router Branch: 4.1 Commit: 9a697d04e7bb041e1ec6748727a418866dc0ba54 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9a697d0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Mon May 26 14:47:37 2014 +0200 auth_db: auth_check() to get the auth header from the used api - this avoids using a different auth header that might be in the request before checking usernames in from/to headers against auth user (cherry picked from commit 4992519eed88d94847d742c52e882082b1b41264) --- modules/auth_db/authorize.c | 28 +++++++++++++++++++--------- 1 files changed, 19 insertions(+), 9 deletions(-) diff --git a/modules/auth_db/authorize.c b/modules/auth_db/authorize.c index cf97a8f..e2b0f4f 100644 --- a/modules/auth_db/authorize.c +++ b/modules/auth_db/authorize.c @@ -223,10 +223,10 @@ static int generate_avps(struct sip_msg* msg, db1_res_t* db_res) /* - * Authorize digest credentials + * Authorize digest credentials and set the pointer to used hdr */ -static int digest_authenticate(struct sip_msg* msg, str *realm, - str *table, hdr_types_t hftype, str *method) +static int digest_authenticate_hdr(sip_msg_t* msg, str *realm, + str *table, hdr_types_t hftype, str *method, hdr_field_t **ahdr) { char ha1[256]; int res; @@ -277,6 +277,7 @@ static int digest_authenticate(struct sip_msg* msg, str *realm, } cred = (auth_body_t*)h->parsed; + if(ahdr!=NULL) *ahdr = h; res = get_ha1(&cred->digest.username, realm, table, ha1, &result); if (res < 0) { @@ -315,6 +316,15 @@ end: return ret; } +/* + * Authorize digest credentials + */ +static int digest_authenticate(sip_msg_t* msg, str *realm, + str *table, hdr_types_t hftype, str *method) +{ + return digest_authenticate_hdr(msg, realm, table, hftype, method, NULL); +} + /* * Authenticate using Proxy-Authorize header field @@ -475,15 +485,15 @@ int auth_check(struct sip_msg* _m, char* _realm, char* _table, char *_flags) LM_DBG("realm [%.*s] table [%.*s] flags [%d]\n", srealm.len, srealm.s, stable.len, stable.s, iflags); + hdr = NULL; if(_m->REQ_METHOD==METHOD_REGISTER) - ret = digest_authenticate(_m, &srealm, &stable, HDR_AUTHORIZATION_T, - &_m->first_line.u.request.method); + ret = digest_authenticate_hdr(_m, &srealm, &stable, HDR_AUTHORIZATION_T, + &_m->first_line.u.request.method, &hdr); else - ret = digest_authenticate(_m, &srealm, &stable, HDR_PROXYAUTH_T, - &_m->first_line.u.request.method); + ret = digest_authenticate_hdr(_m, &srealm, &stable, HDR_PROXYAUTH_T, + &_m->first_line.u.request.method, &hdr); - if(ret==AUTH_OK && (iflags&AUTH_CHECK_ID_F)) { - hdr = (_m->proxy_auth==0)?_m->authorization:_m->proxy_auth; + if(ret==AUTH_OK && hdr!=NULL && (iflags&AUTH_CHECK_ID_F)) { srealm = ((auth_body_t*)(hdr->parsed))->digest.username.user; if((furi=parse_from_uri(_m))==NULL)
10 years, 8 months
1
0
0
0
git:master: tls: added missed include file for accessing outgoing connection certificate
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 794af34f4f996de6b6d238b8267ae48650bd2857 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=794af34…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Mon May 26 15:00:29 2014 +0200 tls: added missed include file for accessing outgoing connection certificate --- modules/tls/tls_server.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/modules/tls/tls_server.c b/modules/tls/tls_server.c index ad80400..26de1f3 100644 --- a/modules/tls/tls_server.c +++ b/modules/tls/tls_server.c @@ -55,6 +55,7 @@ #include "tls_util.h" #include "tls_mod.h" #include "tls_server.h" +#include "tls_select.h" #include "tls_bio.h" #include "tls_dump_vf.h" #include "tls_cfg.h"
10 years, 8 months
1
0
0
0
git:master: auth_db: auth_check() to get the auth header from the used api
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 4992519eed88d94847d742c52e882082b1b41264 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4992519…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Mon May 26 14:47:37 2014 +0200 auth_db: auth_check() to get the auth header from the used api - this avoids using a different auth header that might be in the request before checking usernames in from/to headers against auth user --- modules/auth_db/authorize.c | 28 +++++++++++++++++++--------- 1 files changed, 19 insertions(+), 9 deletions(-) diff --git a/modules/auth_db/authorize.c b/modules/auth_db/authorize.c index cf97a8f..e2b0f4f 100644 --- a/modules/auth_db/authorize.c +++ b/modules/auth_db/authorize.c @@ -223,10 +223,10 @@ static int generate_avps(struct sip_msg* msg, db1_res_t* db_res) /* - * Authorize digest credentials + * Authorize digest credentials and set the pointer to used hdr */ -static int digest_authenticate(struct sip_msg* msg, str *realm, - str *table, hdr_types_t hftype, str *method) +static int digest_authenticate_hdr(sip_msg_t* msg, str *realm, + str *table, hdr_types_t hftype, str *method, hdr_field_t **ahdr) { char ha1[256]; int res; @@ -277,6 +277,7 @@ static int digest_authenticate(struct sip_msg* msg, str *realm, } cred = (auth_body_t*)h->parsed; + if(ahdr!=NULL) *ahdr = h; res = get_ha1(&cred->digest.username, realm, table, ha1, &result); if (res < 0) { @@ -315,6 +316,15 @@ end: return ret; } +/* + * Authorize digest credentials + */ +static int digest_authenticate(sip_msg_t* msg, str *realm, + str *table, hdr_types_t hftype, str *method) +{ + return digest_authenticate_hdr(msg, realm, table, hftype, method, NULL); +} + /* * Authenticate using Proxy-Authorize header field @@ -475,15 +485,15 @@ int auth_check(struct sip_msg* _m, char* _realm, char* _table, char *_flags) LM_DBG("realm [%.*s] table [%.*s] flags [%d]\n", srealm.len, srealm.s, stable.len, stable.s, iflags); + hdr = NULL; if(_m->REQ_METHOD==METHOD_REGISTER) - ret = digest_authenticate(_m, &srealm, &stable, HDR_AUTHORIZATION_T, - &_m->first_line.u.request.method); + ret = digest_authenticate_hdr(_m, &srealm, &stable, HDR_AUTHORIZATION_T, + &_m->first_line.u.request.method, &hdr); else - ret = digest_authenticate(_m, &srealm, &stable, HDR_PROXYAUTH_T, - &_m->first_line.u.request.method); + ret = digest_authenticate_hdr(_m, &srealm, &stable, HDR_PROXYAUTH_T, + &_m->first_line.u.request.method, &hdr); - if(ret==AUTH_OK && (iflags&AUTH_CHECK_ID_F)) { - hdr = (_m->proxy_auth==0)?_m->authorization:_m->proxy_auth; + if(ret==AUTH_OK && hdr!=NULL && (iflags&AUTH_CHECK_ID_F)) { srealm = ((auth_body_t*)(hdr->parsed))->digest.username.user; if((furi=parse_from_uri(_m))==NULL)
10 years, 8 months
1
0
0
0
git:master: core: option to specify whether the send info has to be set before sending out
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 9d9e7399b731c8546c2c58ca27971016f221baed URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9d9e739…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Mon May 26 14:16:49 2014 +0200 core: option to specify whether the send info has to be set before sending out --- forward.c | 19 +++++++++++++++++++ forward.h | 2 ++ 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/forward.c b/forward.c index 81a0e1d..a03ba5e 100644 --- a/forward.c +++ b/forward.c @@ -121,6 +121,12 @@ static int mhomed_sock_cache_disabled = 0; static int sock_inet = -1; static int sock_inet6 = -1; +static int _forward_set_send_info = 0; + +void forward_set_send_info(int v) +{ + _forward_set_send_info = v; +} static void apply_force_send_socket(struct dest_info* dst, struct sip_msg* msg); @@ -497,6 +503,7 @@ int forward_request(struct sip_msg* msg, str* dst, unsigned short port, int ret; struct ip_addr ip; /* debugging only */ char proto; + struct onsend_info onsnd_info = {0}; #ifdef USE_DNS_FAILOVER struct socket_info* prev_send_sock; int err; @@ -623,7 +630,18 @@ int forward_request(struct sip_msg* msg, str* dst, unsigned short port, } } #endif + + if(unlikely(_forward_set_send_info==1)) { + onsnd_info.to=&send_info->to; + onsnd_info.send_sock=send_info->send_sock; + onsnd_info.buf=buf; + onsnd_info.len=len; + onsnd_info.msg=msg; + p_onsend=&onsnd_info; + } + if (msg_send(send_info, buf, len)<0){ + p_onsend=0; ret=ser_error=E_SEND; #ifdef USE_DST_BLACKLIST (void)dst_blacklist_add(BLST_ERR_SEND, send_info, msg); @@ -634,6 +652,7 @@ int forward_request(struct sip_msg* msg, str* dst, unsigned short port, goto error; #endif }else{ + p_onsend=0; ret=ser_error=E_OK; /* sent requests stats */ STATS_TX_REQUEST( msg->first_line.u.request.method_value ); diff --git a/forward.h b/forward.h index f377546..98dc70e 100644 --- a/forward.h +++ b/forward.h @@ -109,6 +109,8 @@ int update_sock_struct_from_via( union sockaddr_union* to, int forward_reply( struct sip_msg* msg); int forward_reply_nocb( struct sip_msg* msg); +void forward_set_send_info(int v); + int is_check_self_func_list_set(void);
10 years, 8 months
1
0
0
0
git:master: tls: execute event_route[tls:connection-out]
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 1d6d5cd5d4ff7cd488edfaea5600f02b7d3612fa URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1d6d5cd…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Mon May 26 14:17:43 2014 +0200 tls: execute event_route[tls:connection-out] - done when a new outgoing tls connection is opened - ongoing work, to allow an option to drop the connection based on config decision --- modules/tls/tls_mod.c | 1 + modules/tls/tls_select.c | 10 ++++++++++ modules/tls/tls_select.h | 3 +++ modules/tls/tls_server.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ modules/tls/tls_server.h | 2 ++ 5 files changed, 61 insertions(+), 0 deletions(-) diff --git a/modules/tls/tls_mod.c b/modules/tls/tls_mod.c index 97175e3..eb40b04 100644 --- a/modules/tls/tls_mod.c +++ b/modules/tls/tls_mod.c @@ -348,6 +348,7 @@ static int mod_init(void) #ifndef OPENSSL_NO_DH LM_INFO("With Diffie Hellman\n"); #endif + tls_lookup_event_routes(); return 0; error: destroy_tls_h(); diff --git a/modules/tls/tls_select.c b/modules/tls/tls_select.c index 6305448..5e70d13 100644 --- a/modules/tls/tls_select.c +++ b/modules/tls/tls_select.c @@ -101,11 +101,21 @@ enum { +static struct tcp_connection* _tls_pv_con = 0; +void tls_set_pv_con(struct tcp_connection *c) +{ + _tls_pv_con = c; +} + struct tcp_connection* get_cur_connection(struct sip_msg* msg) { struct tcp_connection* c; + + if(_tls_pv_con != 0) + return _tls_pv_con; + if (msg->rcv.proto != PROTO_TLS) { ERR("Transport protocol is not TLS (bug in config)\n"); return 0; diff --git a/modules/tls/tls_select.h b/modules/tls/tls_select.h index 3d5b8d0..5d40cc1 100644 --- a/modules/tls/tls_select.h +++ b/modules/tls/tls_select.h @@ -43,9 +43,12 @@ #include "../../select.h" #include "../../pvar.h" +#include "../../tcp_conn.h" extern select_row_t tls_sel[]; extern pv_export_t tls_pv[]; +void tls_set_pv_con(struct tcp_connection *c); + #endif /* _TLS_SELECT_H */ diff --git a/modules/tls/tls_server.c b/modules/tls/tls_server.c index cfd09c4..ad80400 100644 --- a/modules/tls/tls_server.c +++ b/modules/tls/tls_server.c @@ -46,6 +46,9 @@ #include "../../tcp_int_send.h" #include "../../tcp_read.h" #include "../../cfg/cfg.h" +#include "../../route.h" +#include "../../forward.h" +#include "../../onsend.h" #include "tls_init.h" #include "tls_domain.h" @@ -56,6 +59,8 @@ #include "tls_dump_vf.h" #include "tls_cfg.h" +int tls_run_event_routes(struct tcp_connection *c); + /* low memory treshold for openssl bug #1491 workaround */ #define LOW_MEM_NEW_CONNECTION_TEST() \ (cfg_get(tls, tls_cfg, low_mem_threshold1) && \ @@ -435,6 +440,7 @@ int tls_connect(struct tcp_connection *c, int* error) LOG(tls_log, "tls_connect: server did not " "present a certificate\n"); } + tls_run_event_routes(c); } else { /* 0 or < 0 */ *error = SSL_get_error(ssl, ret); } @@ -1343,3 +1349,42 @@ bug: c, flags, ssl_read, *flags); return -1; } + + +static int _tls_evrt_connection_out = -1; /* default disabled */ + +/*! + * lookup tls event routes + */ +void tls_lookup_event_routes(void) +{ + _tls_evrt_connection_out=route_lookup(&event_rt, "tls:connection-out"); + if (_tls_evrt_connection_out>=0 && event_rt.rlist[_tls_evrt_connection_out]==0) + _tls_evrt_connection_out=-1; /* disable */ + if(_tls_evrt_connection_out!=-1) + forward_set_send_info(1); +} + +/** + * + */ +int tls_run_event_routes(struct tcp_connection *c) +{ + int backup_rt; + struct run_act_ctx ctx; + sip_msg_t tmsg; + + if(_tls_evrt_connection_out<0) + return 0; + if(p_onsend==0 || p_onsend->msg==0) + return 0; + + backup_rt = get_route_type(); + set_route_type(LOCAL_ROUTE); + init_run_actions_ctx(&ctx); + tls_set_pv_con(c); + run_top_route(event_rt.rlist[_tls_evrt_connection_out], &tmsg, 0); + tls_set_pv_con(0); + set_route_type(backup_rt); + return 0; +} diff --git a/modules/tls/tls_server.h b/modules/tls/tls_server.h index d564425..abb3b13 100644 --- a/modules/tls/tls_server.h +++ b/modules/tls/tls_server.h @@ -93,4 +93,6 @@ int tls_h_fix_read_conn(struct tcp_connection *c); int tls_connect(struct tcp_connection *c, int* error); int tls_accept(struct tcp_connection *c, int* error); + +void tls_lookup_event_routes(void); #endif /* _TLS_SERVER_H */
10 years, 8 months
1
0
0
0
git:master: core: added field to link sip msg in onsend structure
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 80f241b0b1e13021d3494aa7a489d313d6c03f5b URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=80f241b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Mon May 26 14:13:30 2014 +0200 core: added field to link sip msg in onsend structure - to be used when opening an ongoing stream (tcp/tls) connection --- onsend.h | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/onsend.h b/onsend.h index d8511c2..bc6141b 100644 --- a/onsend.h +++ b/onsend.h @@ -43,10 +43,11 @@ #include "sr_compat.h" struct onsend_info{ - union sockaddr_union* to; - struct socket_info* send_sock; - char* buf; - int len; + union sockaddr_union* to; /* dest info */ + struct socket_info* send_sock; /* local send socket */ + char* buf; /* outgoing buffer */ + int len; /* outgoing buffer len */ + sip_msg_t *msg; /* original sip msg struct */ }; extern struct onsend_info* p_onsend; @@ -61,7 +62,7 @@ extern struct onsend_info* p_onsend; static inline int run_onsend(struct sip_msg* orig_msg, struct dest_info* dst, char* buf, int len) { - struct onsend_info onsnd_info; + struct onsend_info onsnd_info = {0}; int ret; struct run_act_ctx ra_ctx; int backup_route_type; @@ -74,6 +75,7 @@ static inline int run_onsend(struct sip_msg* orig_msg, struct dest_info* dst, onsnd_info.send_sock=dst->send_sock; onsnd_info.buf=buf; onsnd_info.len=len; + onsnd_info.msg=orig_msg; p_onsend=&onsnd_info; backup_route_type=get_route_type(); set_route_type(ONSEND_ROUTE);
10 years, 8 months
1
0
0
0
siremis compatibility issues with PHP 5.5.12-1~dotdeb.1
by Peter Villeneuve
Hi, Just installed latest Siremis and Kamailio 4.1 on debian 7 server with PHP 5.5.12-1~dotdeb.1. everything seemed to be ok until I tried to edit the subscribers database and perform other routine operations. It seems that latest PHP version doesn't work with Siremis. What's the currently recommended version? Cheers, Peter [2014-05-25 19:30:56 (GMT)] An exception occurred while executing this script: Error message: #8192, preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead Script name and line number of error: /var/www/siremis-4.1.0/openbiz/others/Smarty/libs/Smarty_Compiler.class.php:270 *function:* errorHandler ( 8192, "preg_replace(): The /e modifier is deprecated, use preg_replace_...", "/var/www/siremis-4.1.0/openbiz/others/Smarty/libs/Smarty_Compile...", 270, Array(8) ) @ /var/www/siremis-4.1.0/openbiz/bin/sysheader.inc 117 *function:* userErrorHandler ( 8192, "preg_replace(): The /e modifier is deprecated, use preg_replace_...", "/var/www/siremis-4.1.0/openbiz/others/Smarty/libs/Smarty_Compile...", 270, Array(8) ) @ *function:* preg_replace ( "~\{\*(.*?)\*\}|\{\s*literal\s*\}(.*?)\{\s*/literal\s*\}|\{\s*php...", "'{php' . str_repeat(" ", substr_count('\0', " ")) .'}'", "{php} $this->assign('template_file', 'system_right_detailform.t..." ) @ /var/www/siremis-4.1.0/openbiz/others/Smarty/libs/Smarty_Compiler.class.php 270 *function:* _compile_file ( "/var/www/siremis-4.1.0/siremis/modules/ser/template/detail.tpl", "{php} $this->assign('template_file', 'system_right_detailform.t...", Null ) @ /var/www/siremis-4.1.0/openbiz/others/Smarty/libs/Smarty.class.php 1484 *function:* _compile_source ( "/var/www/siremis-4.1.0/siremis/modules/ser/template/detail.tpl", "{php} $this->assign('template_file', 'system_right_detailform.t...", Null, "/var/www/siremis-4.1.0/siremis/themes/default/template/cpl/%%CE^..." ) @ /var/www/siremis-4.1.0/openbiz/others/Smarty/libs/Smarty.class.php 1417 *function:* _compile_resource ( "/var/www/siremis-4.1.0/siremis/modules/ser/template/detail.tpl", "/var/www/siremis-4.1.0/siremis/themes/default/template/cpl/%%CE^..." ) @ /var/www/siremis-4.1.0/openbiz/others/Smarty/libs/Smarty.class.php 1256 *function:* fetch ( "/var/www/siremis-4.1.0/siremis/modules/ser/template/detail.tpl" ) @ /var/www/siremis-4.1.0/openbiz/bin/easy/FormRenderer.php 95 *function:* renderSmarty ( Object(EasyForm), "/var/www/siremis-4.1.0/siremis/modules/ser/template/detail.tpl" ) @ /var/www/siremis-4.1.0/openbiz/bin/easy/FormRenderer.php 45 *function:* render ( Object(EasyForm) ) @ /var/www/siremis-4.1.0/openbiz/bin/easy/EasyForm.php 1648 *function:* renderHTML ( ) @ /var/www/siremis-4.1.0/openbiz/bin/easy/EasyForm.php 1538 *function:* render ( ) @ /var/www/siremis-4.1.0/openbiz/bin/easy/EasyForm.php 955 *function:* _showForm ( "ser.sbs.authdb.form.SubscriberEditForm", "", Array(1) ) @ /var/www/siremis-4.1.0/openbiz/bin/easy/EasyForm.php 1800 *function:* processPostAction ( ) @ /var/www/siremis-4.1.0/openbiz/bin/easy/EasyForm.php 917 *function:* editRecord ( ) @ /var/www/siremis-4.1.0/openbiz/bin/BizController.php 310 *function:* invoke ( ) @ /var/www/siremis-4.1.0/openbiz/bin/BizController.php 110 *function:* dispatchRequest ( ) @ /var/www/siremis-4.1.0/openbiz/bin/BizController.php 32 *function:* include_once ( "/var/www/siremis-4.1.0/openbiz/bin/BizController.php" ) @ /var/www/siremis-4.1.0/siremis/bin/controller.php 6
10 years, 8 months
1
0
0
0
git:vseva/6565: debugger: create _dbg_get_json function
by Victor Seva
Module: sip-router Branch: vseva/6565 Commit: f9d8d2b24f8840fe9ef1acab44502d346bb77457 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f9d8d2b…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: Fri May 23 19:30:35 2014 +0200 debugger: create _dbg_get_json function --- modules/debugger/debugger_api.c | 71 +++++++++++++++++++++++--------------- 1 files changed, 43 insertions(+), 28 deletions(-) diff --git a/modules/debugger/debugger_api.c b/modules/debugger/debugger_api.c index c611fa1..9655491 100644 --- a/modules/debugger/debugger_api.c +++ b/modules/debugger/debugger_api.c @@ -1622,36 +1622,27 @@ int _dbg_get_obj_xavp_vals(struct sip_msg *msg, return 0; } -int dbg_dump_json(struct sip_msg* msg, unsigned int mask, int level) +int _dbg_get_json(struct sip_msg* msg, unsigned int mask, srjson_doc_t *jdoc) { int i; pv_value_t value; pv_cache_t **_pv_cache = pv_cache_get_table(); pv_cache_t *el = NULL; - srjson_doc_t jdoc; srjson_t *jobj = NULL; - char *output = NULL; str item_name = STR_NULL; static char iname[128]; - int result = -1; if(_pv_cache==NULL) { LM_ERR("cannot access pv_cache\n"); return -1; } + if(jdoc==NULL){ + LM_ERR("jdoc is null\n"); + return -1; + } memset(_dbg_xavp_dump, 0, sizeof(str*)*DBG_XAVP_DUMP_SIZE); - srjson_InitDoc(&jdoc, NULL); - if(jdoc.root==NULL) - { - jdoc.root = srjson_CreateObject(&jdoc); - if(jdoc.root==NULL) - { - LM_ERR("cannot create json root\n"); - goto error; - } - } for(i=0;i<PV_CACHE_SIZE;i++) { el = _pv_cache[i]; @@ -1684,13 +1675,13 @@ int dbg_dump_json(struct sip_msg* msg, unsigned int mask, int level) } else { - if(_dbg_get_array_avp_vals(msg, &el->spec.pvp, &jdoc, &jobj, &item_name)!=0) + if(_dbg_get_array_avp_vals(msg, &el->spec.pvp, jdoc, &jobj, &item_name)!=0) { LM_WARN("can't get value[%.*s]\n", el->pvname.len, el->pvname.s); el = el->next; continue; } - if(srjson_GetArraySize(&jdoc, jobj)==0 && !(mask&DBG_DP_NULL)) + if(srjson_GetArraySize(jdoc, jobj)==0 && !(mask&DBG_DP_NULL)) { el = el->next; continue; @@ -1705,13 +1696,13 @@ int dbg_dump_json(struct sip_msg* msg, unsigned int mask, int level) el = el->next; continue; } - if(_dbg_get_obj_xavp_vals(msg, &el->spec.pvp, &jdoc, &jobj, &item_name)!=0) + if(_dbg_get_obj_xavp_vals(msg, &el->spec.pvp, jdoc, &jobj, &item_name)!=0) { LM_WARN("can't get value[%.*s]\n", el->pvname.len, el->pvname.s); el = el->next; continue; } - if(srjson_GetArraySize(&jdoc, jobj)==0 && !(mask&DBG_DP_NULL)) + if(srjson_GetArraySize(jdoc, jobj)==0 && !(mask&DBG_DP_NULL)) { el = el->next; continue; @@ -1730,7 +1721,7 @@ int dbg_dump_json(struct sip_msg* msg, unsigned int mask, int level) { if(mask&DBG_DP_NULL) { - jobj = srjson_CreateNull(&jdoc); + jobj = srjson_CreateNull(jdoc); } else { @@ -1738,9 +1729,9 @@ int dbg_dump_json(struct sip_msg* msg, unsigned int mask, int level) continue; } }else if(value.flags&(PV_VAL_INT)){ - jobj = srjson_CreateNumber(&jdoc, value.ri); + jobj = srjson_CreateNumber(jdoc, value.ri); }else if(value.flags&(PV_VAL_STR)){ - jobj = srjson_CreateStr(&jdoc, value.rs.s, value.rs.len); + jobj = srjson_CreateStr(jdoc, value.rs.s, value.rs.len); }else { LM_WARN("el->pvname[%.*s] value[%d] unhandled\n", el->pvname.len, el->pvname.s, value.flags); @@ -1757,23 +1748,47 @@ int dbg_dump_json(struct sip_msg* msg, unsigned int mask, int level) } if(jobj!=NULL) { - srjson_AddItemToObject(&jdoc, jdoc.root, iname, jobj); + srjson_AddItemToObject(jdoc, jdoc->root, iname, jobj); } el = el->next; } } + return 0; + +error: + srjson_DestroyDoc(jdoc); + return -1; +} + +int dbg_dump_json(struct sip_msg* msg, unsigned int mask, int level) +{ + char *output = NULL; + srjson_doc_t jdoc; + + srjson_InitDoc(&jdoc, NULL); + if(jdoc.root==NULL) + { + jdoc.root = srjson_CreateObject(&jdoc); + if(jdoc.root==NULL) + { + LM_ERR("cannot create json root\n"); + goto error; + } + } + + if(_dbg_get_json(msg, mask, &jdoc)<0) return -1; output = srjson_PrintUnformatted(&jdoc, jdoc.root); if(output==NULL) { LM_ERR("cannot print json doc\n"); - goto error; + srjson_DestroyDoc(&jdoc); } LOG(level, "%s\n", output); - result = 0; + jdoc.free_fn(output); + srjson_DestroyDoc(&jdoc); + return 0; error: - if(output!=NULL) jdoc.free_fn(output); srjson_DestroyDoc(&jdoc); - - return result; -} + return -1; +} \ No newline at end of file
10 years, 8 months
1
0
0
0
← Newer
1
...
4
5
6
7
8
9
10
...
24
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
Results per page:
10
25
50
100
200