Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into getifaddrs
Browse files Browse the repository at this point in the history
  • Loading branch information
celan69 committed Dec 30, 2015
2 parents 875950d + c7e411e commit 8ddc618
Show file tree
Hide file tree
Showing 17 changed files with 116 additions and 32 deletions.
2 changes: 2 additions & 0 deletions modules/auth_radius/authrad_mod.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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}
};

Expand Down
1 change: 1 addition & 0 deletions modules/auth_radius/authrad_mod.h
Expand Up @@ -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;

Expand Down
5 changes: 5 additions & 0 deletions modules/auth_radius/doc/auth_radius.xml
Expand Up @@ -38,6 +38,11 @@
<surname>Janak</surname>
<email>jan@iptel.org</email>
</editor>
<editor>
<firstname>Phil</firstname>
<surname>Lavin</surname>
<email>phil.lavin@synety.com</email>
</editor>
</authorgroup>
<copyright>
<year>2002</year>
Expand Down
17 changes: 17 additions & 0 deletions modules/auth_radius/doc/auth_radius_admin.xml
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion modules/auth_radius/sterman.c
Expand Up @@ -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;
Expand Down
57 changes: 36 additions & 21 deletions modules/permissions/README
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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")) {
Expand Down Expand Up @@ -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")) {
Expand Down Expand Up @@ -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();
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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();
Expand All @@ -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");
Expand All @@ -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();
Expand Down
20 changes: 20 additions & 0 deletions modules/permissions/doc/permissions_admin.xml
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions modules/permissions/hash.c
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions modules/permissions/hash.h
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions modules/permissions/permissions.c
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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}
};

Expand Down
2 changes: 1 addition & 1 deletion modules/presence_dialoginfo/notify_body.c
Expand Up @@ -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();

Expand Down
15 changes: 12 additions & 3 deletions modules/tm/h_table.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions modules/tm/h_table.h
Expand Up @@ -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 );

Expand Down
6 changes: 6 additions & 0 deletions modules/tm/t_funcs.c
Expand Up @@ -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) */
Expand Down
1 change: 1 addition & 0 deletions modules/tm/t_funcs.h
Expand Up @@ -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 ,
Expand Down

0 comments on commit 8ddc618

Please sign in to comment.