[sr-dev] git:5.1:cc638e4c: topos: revert "topos: set uuid fields before checking contact/rr fields"

Daniel-Constantin Mierla miconda at gmail.com
Mon Feb 12 09:15:01 CET 2018


Module: kamailio
Branch: 5.1
Commit: cc638e4cd6d6f4ff9aca0bf6c9d6c940a3e64e59
URL: https://github.com/kamailio/kamailio/commit/cc638e4cd6d6f4ff9aca0bf6c9d6c940a3e64e59

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-02-12T09:14:26+01:00

topos: revert "topos: set uuid fields before checking contact/rr fields"

This reverts commit 97532ca18f595d89edf9b0b6e6688847aa38dd44.

(cherry picked from commit be6a419a5b0d6fe3922219a30788ad527a313fd6)

---

Modified: src/modules/topos/tps_storage.c

---

Diff:  https://github.com/kamailio/kamailio/commit/cc638e4cd6d6f4ff9aca0bf6c9d6c940a3e64e59.diff
Patch: https://github.com/kamailio/kamailio/commit/cc638e4cd6d6f4ff9aca0bf6c9d6c940a3e64e59.patch

---

diff --git a/src/modules/topos/tps_storage.c b/src/modules/topos/tps_storage.c
index 95f1097bd6..950d1982f4 100644
--- a/src/modules/topos/tps_storage.c
+++ b/src/modules/topos/tps_storage.c
@@ -214,10 +214,19 @@ int tps_storage_fill_contact(sip_msg_t *msg, tps_data_t *td, str *uuid, int dir)
 	} else {
 		sv = td->as_contact;
 	}
+	if(sv.len<=0) {
+		/* no contact - skip */
+		return 0;
+	}
+
 	if(td->cp + 8 + (2*uuid->len) + sv.len >= td->cbuf + TPS_DATA_SIZE) {
 		LM_ERR("insufficient data buffer\n");
 		return -1;
 	}
+	if (parse_uri(sv.s, sv.len, &puri) < 0) {
+		LM_ERR("failed to parse the uri\n");
+		return -1;
+	}
 	if(dir==TPS_DIR_DOWNSTREAM) {
 		td->b_uuid.s = td->cp;
 		*td->cp = 'b';
@@ -225,6 +234,8 @@ int tps_storage_fill_contact(sip_msg_t *msg, tps_data_t *td, str *uuid, int dir)
 		memcpy(td->cp, uuid->s, uuid->len);
 		td->cp += uuid->len;
 		td->b_uuid.len = td->cp - td->b_uuid.s;
+
+		td->bs_contact.s = td->cp;
 	} else {
 		td->a_uuid.s = td->cp;
 		*td->cp = 'a';
@@ -232,20 +243,7 @@ int tps_storage_fill_contact(sip_msg_t *msg, tps_data_t *td, str *uuid, int dir)
 		memcpy(td->cp, uuid->s, uuid->len);
 		td->cp += uuid->len;
 		td->a_uuid.len = td->cp - td->a_uuid.s;
-	}
 
-	if(sv.len<=0) {
-		/* no contact - skip */
-		return 0;
-	}
-
-	if (parse_uri(sv.s, sv.len, &puri) < 0) {
-		LM_ERR("failed to parse the uri\n");
-		return -1;
-	}
-	if(dir==TPS_DIR_DOWNSTREAM) {
-		td->bs_contact.s = td->cp;
-	} else {
 		td->as_contact.s = td->cp;
 	}
 	*td->cp = '<';




More information about the sr-dev mailing list