Browse code

stirshaken: handle NULL or empty origid by generating random uuid

Piotr Gregor authored on 18/03/2021 17:28:41
Showing 1 changed files
... ...
@@ -741,7 +741,16 @@ static int ki_stirshaken_add_identity_with_key(sip_msg_t *msg, str *x5u, str *at
741 741
 		.origtn_val = origtn_val ? origtn_val->s : NULL,
742 742
 		.origid = origid ? origid->s : NULL
743 743
 	};
744
+	char uuid_str[37] = { 0 };
744 745
 
746
+	if (!params.origid || !strlen(params.origid)) {
747
+
748
+		uuid_t uuid;
749
+
750
+		uuid_generate(uuid);
751
+		uuid_unparse_lower(uuid, uuid_str);
752
+		params.origid = uuid_str;
753
+	}
745 754
 
746 755
 	if (keypath && keypath->s) {
747 756