Revision: 6054
http://openser.svn.sourceforge.net/openser/?rev=6054&view=rev
Author: timoreimann
Date: 2011-03-11 18:18:26 +0000 (Fri, 11 Mar 2011)
Log Message:
-----------
modules/dialog: Refer to external match mode variable instead of using
local copy.
- Fixes a bug that would render w_dlg_manage()'s
backup-override-and-restore logic of the seq_match_mode variable
for the call to dlg_onroute() useless as the units dialog.c and
dlg_handlers.c maintained individual variables each.
Backport from git commit b2426b0c2008809f984073e37a270dcab9a7d8c5
Modified Paths:
--------------
branches/1.5/modules/dialog/dialog.c
branches/1.5/modules/dialog/dlg_handlers.c
branches/1.5/modules/dialog/dlg_handlers.h
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Module: sip-router
Branch: master
Commit: b93c81421f53b6cc1620a01dc8937d92daac1be9
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b93c814…
Author: Alex Hermann <alex(a)speakup.nl>
Committer: Alex Hermann <alex(a)speakup.nl>
Date: Mon Mar 7 14:36:27 2011 +0100
modules_k/permissions: allow_trusted(): Return number of matched entries.
---
modules_k/permissions/hash.c | 12 +++++++-----
modules_k/permissions/trusted.c | 15 ++++++++-------
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/modules_k/permissions/hash.c b/modules_k/permissions/hash.c
index c24b94b..1261227 100644
--- a/modules_k/permissions/hash.c
+++ b/modules_k/permissions/hash.c
@@ -199,6 +199,7 @@ int hash_table_insert(struct trusted_list** table, char* src_ip,
* Check if an entry exists in hash table that has given src_ip and protocol
* value and pattern that matches to From URI. If an entry exists and tag_avp
* has been defined, tag of the entry is added as a value to tag_avp.
+ * Returns number of matches or -1 if none matched.
*/
int match_hash_table(struct trusted_list** table, struct sip_msg* msg,
char *src_ip_c_str, int proto)
@@ -209,7 +210,7 @@ int match_hash_table(struct trusted_list** table, struct sip_msg* msg,
struct trusted_list *np;
str src_ip;
int_str val;
- int rc = -1;
+ int count = 0;
src_ip.s = src_ip_c_str;
src_ip.len = strlen(src_ip.s);
@@ -245,13 +246,14 @@ int match_hash_table(struct trusted_list** table, struct sip_msg* msg,
LM_ERR("setting of tag_avp failed\n");
return -1;
}
- rc = 1;
- } else {
- return 1;
}
+ count++;
}
}
- return rc;
+ if (!count)
+ return -1;
+ else
+ return count;
}
diff --git a/modules_k/permissions/trusted.c b/modules_k/permissions/trusted.c
index 62fba29..32e1313 100644
--- a/modules_k/permissions/trusted.c
+++ b/modules_k/permissions/trusted.c
@@ -328,8 +328,8 @@ static inline int match_proto(const char *proto_string, int proto_int)
}
/*
- * Matches from uri against patterns returned from database. Returns 1 when
- * first pattern matches and -1 if none of the patterns match.
+ * Matches from uri against patterns returned from database. Returns number
+ * of matches or -1 if none of the patterns match.
*/
static int match_res(struct sip_msg* msg, int proto, db1_res_t* _r)
{
@@ -340,7 +340,7 @@ static int match_res(struct sip_msg* msg, int proto, db1_res_t* _r)
db_val_t* val;
regex_t preg;
int_str tag_avp, avp_val;
- int rc = -1;
+ int count = 0;
if (parse_from_header(msg) < 0) return -1;
uri = get_from(msg)->uri;
@@ -383,13 +383,14 @@ static int match_res(struct sip_msg* msg, int proto, db1_res_t* _r)
LM_ERR("failed to set of tag_avp failed\n");
return -1;
}
- rc = 1;
- } else {
- return 1;
}
+ count++;
}
}
- return rc;
+ if (!count)
+ return -1;
+ else
+ return count;
}