2
0
Эх сурвалжийг харах

dialog: fix for is_in_profile()

- function was broken, reported by Klaus Darilion
Daniel-Constantin Mierla 12 жил өмнө
parent
commit
83eafc8d8f

+ 5 - 1
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_cell *dlg;
 	struct dlg_profile_link *linker;
 	struct dlg_profile_link *linker;
 	struct dlg_entry *d_entry;
 	struct dlg_entry *d_entry;
+	int ret;
 
 
 	/* get current dialog */
 	/* get current dialog */
 	dlg = dlg_get_msg_dialog(msg);
 	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)
 	if (dlg==NULL)
 		return -1;
 		return -1;
 
 
+	ret = -1;
 	/* check the dialog linkers */
 	/* check the dialog linkers */
 	d_entry = &d_table->entries[dlg->h_entry];
 	d_entry = &d_table->entries[dlg->h_entry];
 	dlg_lock( d_table, d_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 (linker->profile==profile) {
 			if (profile->has_value==0) {
 			if (profile->has_value==0) {
 				dlg_unlock( d_table, d_entry);
 				dlg_unlock( d_table, d_entry);
+				ret = 1;
 				goto done;
 				goto done;
 			} else if (value && value->len==linker->hash_linker.value.len &&
 			} else if (value && value->len==linker->hash_linker.value.len &&
 			memcmp(value->s,linker->hash_linker.value.s,value->len)==0){
 			memcmp(value->s,linker->hash_linker.value.s,value->len)==0){
 				dlg_unlock( d_table, d_entry);
 				dlg_unlock( d_table, d_entry);
+				ret = 1;
 				goto done;
 				goto done;
 			}
 			}
 			/* allow further search - maybe the dialog is inserted twice in
 			/* 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:
 done:
 	dlg_release(dlg);
 	dlg_release(dlg);
-	return -1;
+	return ret;
 }
 }