]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
stir_shaken: Fix propagation of attest_level and a few other values
authorGeorge Joseph <gjoseph@sangoma.com>
Tue, 24 Sep 2024 16:16:16 +0000 (10:16 -0600)
committerBen Ford <bford@digium.com>
Thu, 26 Sep 2024 16:04:04 +0000 (11:04 -0500)
attest_level, send_mky and check_tn_cert_public_url weren't
propagating correctly from the attestation object to the profile
and tn.

* In the case of attest_level, the enum needed to be changed
so the "0" value (the default) was "NOT_SET" instead of "A".  This
now allows the merging of the attestation object, profile and tn
to detect when a value isn't set and use the higher level value.

* For send_mky and check_tn_cert_public_url, the tn default was
forced to "NO" which always overrode the profile and attestation
objects.  Their defaults are now "NOT_SET" so the propagation
happens correctly.

* Just to remove some redundant code in tn_config.c, a bunch of calls to
generate_sorcery_enum_from_str() and generate_sorcery_enum_to_str() were
replaced with a single call to generate_acfg_common_sorcery_handlers().

Resolves: #904

res/res_stir_shaken/common_config.c
res/res_stir_shaken/common_config.h
res/res_stir_shaken/tn_config.c

index 627ea81e7e4e158ff5f328e8e0a26437149b9f6a..b669762ec3c7b4ef66448ec8fd3f1e4cbf60283c 100644 (file)
@@ -100,6 +100,7 @@ const char *param_name ## _to_str( \
 }
 
 generate_enum_string_functions(attest_level, UNKNOWN,
+       {attest_level_NOT_SET, "not_set"},
        {attest_level_A, "A"},
        {attest_level_B, "B"},
        {attest_level_C, "C"},
index 6a8659b8cd390465ec53d6327be34d508165aa6f..3cb1795d7843a6b1e5c4c6e562b0eb3bdf1354cf 100644 (file)
@@ -110,10 +110,10 @@ generate_enum_string_prototypes(endpoint_behavior,
 
 generate_enum_string_prototypes(attest_level,
        attest_level_UNKNOWN = -1,
-       attest_level_A = 0,
+       attest_level_NOT_SET = 0,
+       attest_level_A,
        attest_level_B,
        attest_level_C,
-       attest_level_NOT_SET,
 );
 
 /*
index 89b9f47be57aec9ee07896ac510225fd4765ad5c..e23f1df191bc3fa787e754062a44af7538ec127c 100644 (file)
 
 #define CONFIG_TYPE "tn"
 
-#define DEFAULT_check_tn_cert_public_url check_tn_cert_public_url_NO
+#define DEFAULT_check_tn_cert_public_url check_tn_cert_public_url_NOT_SET
 #define DEFAULT_private_key_file NULL
 #define DEFAULT_public_cert_url NULL
 #define DEFAULT_attest_level attest_level_NOT_SET
-#define DEFAULT_send_mky send_mky_NO
+#define DEFAULT_send_mky send_mky_NOT_SET
 
 struct tn_cfg *tn_get_cfg(const char *id)
 {
@@ -45,14 +45,7 @@ static struct ao2_container *get_tn_all(void)
                AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL);
 }
 
-generate_sorcery_enum_from_str(tn_cfg, acfg_common., check_tn_cert_public_url, UNKNOWN)
-generate_sorcery_enum_to_str(tn_cfg, acfg_common., check_tn_cert_public_url)
-
-generate_sorcery_enum_from_str(tn_cfg, acfg_common., attest_level, UNKNOWN)
-generate_sorcery_enum_to_str(tn_cfg, acfg_common., attest_level)
-
-generate_sorcery_enum_from_str(tn_cfg, acfg_common., send_mky, UNKNOWN)
-generate_sorcery_enum_to_str(tn_cfg, acfg_common., send_mky)
+generate_acfg_common_sorcery_handlers(tn_cfg);
 
 static void tn_destructor(void *obj)
 {