Module: sip-router Branch: 3.3 Commit: a1502e5ca1470276ca6d7c82956fee9a5390348b URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a1502e5c...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Wed Jan 16 22:37:08 2013 +0100
dialog: fix for is_in_profile()
- function was broken, reported by Klaus Darilion (cherry picked from commit 83eafc8d8f767f4705d5f76ad0ffd4349a06c927)
---
modules_k/dialog/dlg_profile.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/modules_k/dialog/dlg_profile.c b/modules_k/dialog/dlg_profile.c index 3317216..370f370 100644 --- a/modules_k/dialog/dlg_profile.c +++ b/modules_k/dialog/dlg_profile.c @@ -613,6 +613,7 @@ int is_dlg_in_profile(struct sip_msg *msg, struct dlg_profile_table *profile, struct dlg_cell *dlg; struct dlg_profile_link *linker; struct dlg_entry *d_entry; + int ret;
/* get current dialog */ dlg = dlg_get_msg_dialog(msg); @@ -620,6 +621,7 @@ int is_dlg_in_profile(struct sip_msg *msg, struct dlg_profile_table *profile, if (dlg==NULL) return -1;
+ ret = -1; /* check the dialog linkers */ d_entry = &d_table->entries[dlg->h_entry]; dlg_lock( d_table, d_entry); @@ -627,10 +629,12 @@ int is_dlg_in_profile(struct sip_msg *msg, struct dlg_profile_table *profile, if (linker->profile==profile) { if (profile->has_value==0) { dlg_unlock( d_table, d_entry); + ret = 1; goto done; } else if (value && value->len==linker->hash_linker.value.len && memcmp(value->s,linker->hash_linker.value.s,value->len)==0){ dlg_unlock( d_table, d_entry); + ret = 1; goto done; } /* allow further search - maybe the dialog is inserted twice in @@ -642,7 +646,7 @@ int is_dlg_in_profile(struct sip_msg *msg, struct dlg_profile_table *profile,
done: dlg_release(dlg); - return -1; + return ret; }