]> git.ipfire.org Git - thirdparty/asterisk.git/commit
security_agreements.c: Refactor the to_str functions and fix a few other bugs
authorGeorge Joseph <gjoseph@sangoma.com>
Sat, 17 Aug 2024 18:13:40 +0000 (12:13 -0600)
committerGeorge Joseph <gjoseph@sangoma.com>
Tue, 3 Sep 2024 14:06:06 +0000 (14:06 +0000)
commit1872abe672fe29ce8a74b17d5aabd26e9e1a7c0e
tree94935c031d44b0ce5cc48ea02b11ef8b76b64a5c
parent3e2bb5a01a25b7ca44f7c48d5665e9dd9da90ce9
security_agreements.c: Refactor the to_str functions and fix a few other bugs

* A static array of security mechanism type names was created.

* ast_sip_str_to_security_mechanism_type() was refactored to do
  a lookup in the new array instead of using fixed "if/else if"
  statments.

* security_mechanism_to_str() and ast_sip_security_mechanisms_to_str()
  were refactored to use ast_str instead of a fixed length buffer
  to store the result.

* ast_sip_security_mechanism_type_to_str was removed in favor of
  just referencing the new type name array.  Despite starting with
  "ast_sip_", it was a static function so removing it doesn't affect
  ABI.

* Speaking of "ast_sip_", several other static functions that
  started with "ast_sip_" were renamed to avoid confusion about
  their public availability.

* A few VECTOR free loops were replaced with AST_VECTOR_RESET().

* Fixed a meomry leak in pjsip_configuration.c endpoint_destructor
  caused by not calling ast_sip_security_mechanisms_vector_destroy().

* Fixed a memory leak in res_pjsip_outbound_registration.c
  add_security_headers() caused by not specifying OBJ_NODATA in
  an ao2_callback.

* Fixed a few ao2_callback return code misuses.

Resolves: #845
res/res_pjsip/pjsip_configuration.c
res/res_pjsip/security_agreements.c
res/res_pjsip_outbound_registration.c