浏览代码

Merge remote-tracking branch 'upstream/master' into getifaddrs

Christian Kuehnke 9 年之前
父节点
当前提交
8ddc618ddf

+ 2 - 0
modules/auth_radius/authrad_mod.c

@@ -66,6 +66,7 @@ static int service_type = -1;
 
 int use_ruri_flag = -1;
 int ar_radius_avps_mode = 0;
+int append_realm_to_username = 1;
 
 static char *auth_extra_str = 0;
 struct extra_attr *auth_extra = 0;
@@ -95,6 +96,7 @@ static param_export_t params[] = {
 	{"use_ruri_flag",    INT_PARAM, &use_ruri_flag	},
 	{"auth_extra",       PARAM_STRING, &auth_extra_str	},
 	{"radius_avps_mode",	 INT_PARAM, &ar_radius_avps_mode	},
+	{"append_realm_to_username", INT_PARAM, &append_realm_to_username       },
 	{0, 0, 0}
 };
 

+ 1 - 0
modules/auth_radius/authrad_mod.h

@@ -41,6 +41,7 @@ extern struct extra_attr *auth_extra;
 
 extern int use_ruri_flag;
 extern int ar_radius_avps_mode;
+extern int append_realm_to_username;
 
 extern auth_api_s_t auth_api;
 

+ 5 - 0
modules/auth_radius/doc/auth_radius.xml

@@ -38,6 +38,11 @@
 		<surname>Janak</surname>
 		<email>[email protected]</email>
 		</editor>
+		<editor>
+		<firstname>Phil</firstname>
+		<surname>Lavin</surname>
+		<email>[email protected]</email>
+		</editor>
 	</authorgroup>
 	<copyright>
 		<year>2002</year>

+ 17 - 0
modules/auth_radius/doc/auth_radius_admin.xml

@@ -206,6 +206,23 @@ modparam("auth_radius", "radius_avps_mode", 1)
 		</programlisting>
 		</example>
 	</section>
+	<section id="auth_radius.p.append_realm_to_username">
+		<title><varname>append_realm_to_username</varname> (integer)</title>
+		<para>
+			If set to 1, the username passed to the RADIUS server will have the
+			digest realm appended to it, if no domain is provided in the digest
+			username.
+		</para>
+		<para>
+			Default value is 1.
+		</para>
+		<example>
+		<title><varname>append_realm_to_username</varname> parameter usage</title>
+		<programlisting format="linespecific">
+modparam("auth_radius", "append_realm_to_username", 0)
+		</programlisting>
+		</example>
+	</section>
 	</section>
 
 	<section>

+ 1 - 1
modules/auth_radius/sterman.c

@@ -243,7 +243,7 @@ int radius_authorize_sterman(struct sip_msg* _msg, dig_cred_t* _cred, str* _meth
 	 * Add all the user digest parameters according to the qop defined.
 	 * Most devices tested only offer support for the simplest digest.
 	 */
-	if (_cred->username.domain.len) {
+	if (_cred->username.domain.len || !append_realm_to_username) {
 		if (!rc_avpair_add(rh, &send, attrs[A_USER_NAME].v, _cred->username.whole.s, _cred->username.whole.len, 0)) {
 			LM_ERR("unable to add User-Name attribute\n");
 			goto err;

+ 36 - 21
modules/permissions/README

@@ -63,6 +63,7 @@ Emmanuel Schmidbauer
               3.19. priority_col (string)
               3.20. peer_tag_avp (AVP string)
               3.21. peer_tag_mode (integer)
+              3.22. max_subnets (int)
 
         4. Functions
 
@@ -119,17 +120,18 @@ Emmanuel Schmidbauer
    1.19. Set priority_col parameter
    1.20. Set peer_tag_avp parameter
    1.21. Set peer_tag_mode parameter
-   1.22. allow_routing usage
-   1.23. allow_routing(basename) usage
-   1.24. allow_routing(allow_file, deny_file) usage
-   1.25. allow_register(basename) usage
-   1.26. allow_register(allow_file, deny_file) usage
-   1.27. allow_uri(basename, pvar) usage
-   1.28. allow_address() usage
-   1.29. allow_source_address(group_id) usage
-   1.30. allow_source_address_group() usage
+   1.22. Set max_subnets parameter
+   1.23. allow_routing usage
+   1.24. allow_routing(basename) usage
+   1.25. allow_routing(allow_file, deny_file) usage
+   1.26. allow_register(basename) usage
+   1.27. allow_register(allow_file, deny_file) usage
+   1.28. allow_uri(basename, pvar) usage
+   1.29. allow_address() usage
+   1.30. allow_source_address(group_id) usage
    1.31. allow_source_address_group() usage
-   1.32. allow_trusted() usage
+   1.32. allow_source_address_group() usage
+   1.33. allow_trusted() usage
 
 Chapter 1. Admin Guide
 
@@ -171,6 +173,7 @@ Chapter 1. Admin Guide
         3.19. priority_col (string)
         3.20. peer_tag_avp (AVP string)
         3.21. peer_tag_mode (integer)
+        3.22. max_subnets (int)
 
    4. Functions
 
@@ -403,6 +406,7 @@ Chapter 1. Admin Guide
    3.19. priority_col (string)
    3.20. peer_tag_avp (AVP string)
    3.21. peer_tag_mode (integer)
+   3.22. max_subnets (int)
 
 3.1. default_allow_file (string)
 
@@ -683,6 +687,17 @@ modparam("permissions", "peer_tag_avp", "$avp(i:707)")
 modparam("permissions", "peer_tag_mode", 1)
 ...
 
+3.22. max_subnets (int)
+
+   The maximum number of subnet addresses to be loaded from address table.
+
+   Default value is "512".
+
+   Example 1.22. Set max_subnets parameter
+...
+modparam("permissions", "max_subnets", 1024)
+...
+
 4. Functions
 
    4.1. allow_routing()
@@ -706,7 +721,7 @@ modparam("permissions", "peer_tag_mode", 1)
 
    This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
 
-   Example 1.22. allow_routing usage
+   Example 1.23. allow_routing usage
 ...
 if (allow_routing()) {
         t_relay();
@@ -729,7 +744,7 @@ if (allow_routing()) {
 
    This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
 
-   Example 1.23. allow_routing(basename) usage
+   Example 1.24. allow_routing(basename) usage
 ...
 if (allow_routing("basename")) {
         t_relay();
@@ -754,7 +769,7 @@ if (allow_routing("basename")) {
 
    This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
 
-   Example 1.24. allow_routing(allow_file, deny_file) usage
+   Example 1.25. allow_routing(allow_file, deny_file) usage
 ...
 if (allow_routing("rules.allow", "rules.deny")) {
         t_relay();
@@ -777,7 +792,7 @@ if (allow_routing("rules.allow", "rules.deny")) {
 
    This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
 
-   Example 1.25. allow_register(basename) usage
+   Example 1.26. allow_register(basename) usage
 ...
 if (method=="REGISTER") {
         if (allow_register("register")) {
@@ -807,7 +822,7 @@ if (method=="REGISTER") {
 
    This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
 
-   Example 1.26. allow_register(allow_file, deny_file) usage
+   Example 1.27. allow_register(allow_file, deny_file) usage
 ...
 if (method=="REGISTER") {
         if (allow_register("register.allow", "register.deny")) {
@@ -836,7 +851,7 @@ if (method=="REGISTER") {
 
    This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
 
-   Example 1.27. allow_uri(basename, pvar) usage
+   Example 1.28. allow_uri(basename, pvar) usage
 ...
 if (allow_uri("basename", "$rt")) {  // Check Refer-To URI
         t_relay();
@@ -862,7 +877,7 @@ if (allow_uri("basename", "$avp(i:705)") {  // Check URI stored in $avp(i:705)
 
    This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
 
-   Example 1.28. allow_address() usage
+   Example 1.29. allow_address() usage
 ...
 
 // Check if source address/port is in group 1
@@ -884,7 +899,7 @@ if (!allow_address("2", "$avp(dst_adr)", "$avp(dst_port)") {
 
    This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
 
-   Example 1.29. allow_source_address(group_id) usage
+   Example 1.30. allow_source_address(group_id) usage
 ...
 
 // Check source address/port of request
@@ -901,7 +916,7 @@ if (!allow_source_address("1")) {
 
    This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
 
-   Example 1.30. allow_source_address_group() usage
+   Example 1.31. allow_source_address_group() usage
 ...
 
 $var(group) = allow_source_address_group();
@@ -919,7 +934,7 @@ if ($var(group) != -1) {
 
    This function can be used from ANY_ROUTE.
 
-   Example 1.31. allow_source_address_group() usage
+   Example 1.32. allow_source_address_group() usage
 ...
 
 $var(group) = allow_address_group("1.2.3.4", "5060");
@@ -944,7 +959,7 @@ if ($var(group) != -1) {
 
    This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
 
-   Example 1.32. allow_trusted() usage
+   Example 1.33. allow_trusted() usage
 ...
 if (allow_trusted()) {
         t_relay();

+ 20 - 0
modules/permissions/doc/permissions_admin.xml

@@ -769,6 +769,26 @@ modparam("permissions", "peer_tag_avp", "$avp(i:707)")
 ...
 modparam("permissions", "peer_tag_mode", 1)
 ...
+</programlisting>
+		</example>
+	</section>
+	<section id ="permissions.p.max_subnets">
+		<title><varname>max_subnets</varname> (int)</title>
+		<para>
+			The maximum number of subnet addresses to be loaded from
+			address table.
+		</para>
+		<para>
+		<emphasis>
+		Default value is <quote>512</quote>.
+		</emphasis>
+		</para>
+		<example>
+		<title>Set <varname>max_subnets</varname> parameter</title>
+		<programlisting format="linespecific">
+...
+modparam("permissions", "max_subnets", 1024)
+...
 </programlisting>
 		</example>
 	</section>

+ 3 - 0
modules/permissions/hash.c

@@ -44,6 +44,9 @@ static int_str tag_avp;
 extern int peer_tag_mode;
 
 
+extern int _perm_max_subnets;
+
+#define PERM_MAX_SUBNETS _perm_max_subnets
 
 /*
  * Parse and set tag AVP specs

+ 0 - 2
modules/permissions/hash.h

@@ -176,8 +176,6 @@ int addr_hash_table_rpc_print(struct addr_list** table, rpc_t* rpc, void* c);
 void empty_addr_hash_table(struct addr_list** hash_table);
 
 
-#define PERM_MAX_SUBNETS 128 
-
 
 /*
  * Structure used to store a subnet

+ 3 - 0
modules/permissions/permissions.c

@@ -88,6 +88,8 @@ str port_col = str_init("port");           /* Name of port column */
 static int check_all_branches = 1;
 
 
+int _perm_max_subnets = 512;
+
 /*  
  * Convert the name of the files into table index
  */
@@ -178,6 +180,7 @@ static param_export_t params[] = {
 	{"ip_addr_col",        PARAM_STR, &ip_addr_col     },
 	{"mask_col",           PARAM_STR, &mask_col        },
 	{"port_col",           PARAM_STR, &port_col        },
+	{"max_subnets",        PARAM_INT, &_perm_max_subnets },
 	{0, 0, 0}
 };
 

+ 1 - 1
modules/presence_dialoginfo/notify_body.c

@@ -604,7 +604,7 @@ str *dlginfo_body_setversion(subs_t *subs, str *body) {
 	}
 	pkg_free(aux_body->s);
         xmlDocDumpFormatMemory(doc,(xmlChar**)(void*)&aux_body->s, &aux_body->len, 1);
-
+	xmlFreeDoc(doc);
         xmlCleanupParser();
         xmlMemoryDump();
 

+ 12 - 3
modules/tm/h_table.c

@@ -40,6 +40,7 @@
 #include "t_reply.h"
 #include "t_cancel.h"
 #include "t_stats.h"
+#include "t_funcs.h"
 #include "h_table.h"
 #include "../../fix_lumps.h" /* free_via_clen_lump */
 #include "timer.h"
@@ -115,7 +116,7 @@ unsigned int transaction_count( void )
 
 
 
-void free_cell_helper( struct cell* dead_cell, const char *fname, unsigned int fline )
+void free_cell_helper(tm_cell_t* dead_cell, int silent, const char *fname, unsigned int fline )
 {
 	char *b;
 	int i;
@@ -126,8 +127,16 @@ void free_cell_helper( struct cell* dead_cell, const char *fname, unsigned int f
 	LM_DBG("freeing transaction %p from %s:%u\n", dead_cell, fname, fline);
 
 	if(dead_cell->prev_c!=NULL && dead_cell->next_c!=NULL) {
-		LM_WARN("removed cell %p is still linked in hash table (%s:%u)\n",
+		if(likely(silent==0)) {
+			LM_WARN("removed cell %p is still linked in hash table (%s:%u)\n",
 				dead_cell, fname, fline);
+			if(t_on_wait(dead_cell)) {
+				INIT_REF(dead_cell, 1);
+				LM_WARN("cell %p is still linked in wait timer (%s:%u)"
+						" - skip freeing now\n", dead_cell, fname, fline);
+				return;
+			}
+		}
 		unlink_timers(dead_cell);
 		remove_from_hash_table_unsafe(dead_cell);
 	}
@@ -437,7 +446,7 @@ void free_hash_table(  )
 			/* delete all synonyms at hash-collision-slot i */
 			clist_foreach_safe(&_tm_table->entries[i], p_cell, tmp_cell,
 									next_c){
-				free_cell(p_cell);
+				free_cell_silent(p_cell);
 			}
 		}
 		shm_free(_tm_table);

+ 3 - 2
modules/tm/h_table.h

@@ -553,8 +553,9 @@ struct s_table* tm_get_table(void);
 struct s_table* init_hash_table(void);
 void   free_hash_table(void);
 
-void   free_cell_helper( struct cell* dead_cell, const char *fname, unsigned int fline);
-#define free_cell(t) free_cell_helper((t), __FILE__, __LINE__)
+void   free_cell_helper(tm_cell_t* dead_cell, int silent, const char *fname, unsigned int fline);
+#define free_cell(t) free_cell_helper((t), 0, __FILE__, __LINE__)
+#define free_cell_silent(t) free_cell_helper((t), 1, __FILE__, __LINE__)
 
 struct cell*  build_cell( struct sip_msg* p_msg );
 

+ 6 - 0
modules/tm/t_funcs.c

@@ -150,6 +150,12 @@ void put_on_wait(  struct cell  *Trans  )
 }
 
 
+int t_on_wait(tm_cell_t *Trans)
+{
+	if(Trans->wait_timer.prev!=NULL || Trans->wait_timer.next!=NULL)
+		return 1;
+	return 0;
+}
 
 /* WARNING: doesn't work from failure route (deadlock, uses t_reply =>
  *  tries to get the reply lock again) */

+ 1 - 0
modules/tm/t_funcs.h

@@ -190,6 +190,7 @@ int get_ip_and_port_from_uri( str* uri , unsigned int *param_ip,
 
 
 void put_on_wait(  struct cell  *Trans  );
+int t_on_wait(tm_cell_t *Trans);
 
 
 int t_relay_to( struct sip_msg  *p_msg ,

+ 2 - 2
modules/tsilo/ts_append.c

@@ -82,7 +82,7 @@ int ts_append(struct sip_msg* msg, str *ruri, char *table) {
 }
 
 int ts_append_to(struct sip_msg* msg, int tindex, int tlabel, char *table, str *uri) {
-	struct cell     *t;
+	struct cell     *t=0;
 	struct cell     *orig_t;
 	struct sip_msg *orig_msg;
 	int ret;
@@ -130,7 +130,7 @@ int ts_append_to(struct sip_msg* msg, int tindex, int tlabel, char *table, str *
 done:
 	/* unref the transaction which had been referred by t_lookup_ident() call. 
 	 * Restore the original transaction (if any) */
-	_tmb.unref_cell(t);
+	if(t) _tmb.unref_cell(t);
 	_tmb.t_sett(orig_t, T_BR_UNDEFINED);
 	
 	return ret;

+ 3 - 0
modules/tsilo/ts_handlers.c

@@ -25,6 +25,7 @@
 #include "ts_handlers.h"
 
 extern struct tm_binds _tmb;
+extern struct ts_table *t_table;
 
 /*!
  * \brief add transaction structure to tm callbacks
@@ -61,6 +62,8 @@ void ts_onreply(struct cell* t, int type, struct tmcb_params *param)
 	ts_entry_t* _e;
 	ts_transaction_t *cb_ptr, *ptr;
 
+	if(t_table==0) return;
+
 	cb_ptr = (ts_transaction_t*)(*param->param);
 	if (cb_ptr == NULL) {
 		LM_DBG("NULL param for type %d\n", type);