Forráskód Böngészése

core: append_branch(): avoid identical branches

If append_branch() is used from the script, try to avoid having 2
identical branches (one for the main ruri and one because of the
append_branch()). In this case the ruri will be marked as consumed.

Reported-by: Daniel-Constantin Mierla <[email protected]>
Reported-and-tested-by: Miklos Tirpak <[email protected]>
Andrei Pelinescu-Onciul 15 éve
szülő
commit
4cd7a346ad
1 módosított fájl, 5 hozzáadás és 0 törlés
  1. 5 0
      action.c

+ 5 - 0
action.c

@@ -549,6 +549,11 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 			ret=append_branch(msg, &a->val[0].u.str, &msg->dst_uri,
 			ret=append_branch(msg, &a->val[0].u.str, &msg->dst_uri,
 								&msg->path_vec, a->val[1].u.number,
 								&msg->path_vec, a->val[1].u.number,
 								(flag_t)flags, msg->force_send_socket);
 								(flag_t)flags, msg->force_send_socket);
+			/* if the uri is the ruri and q was also not changed, mark
+			   ruri as consumed, to avoid having an identical branch */
+			if ((a->val[0].u.str.s == 0 || a->val[0].u.str.len == 0) &&
+					a->val[1].u.number == Q_UNSPECIFIED)
+				ruri_mark_consumed();
 			break;
 			break;
 
 
 		/* jku begin: is_length_greater_than */
 		/* jku begin: is_length_greater_than */