]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add unsafe to dict_attr_flags_t
authorAlan T. DeKok <aland@freeradius.org>
Wed, 26 Mar 2025 20:10:56 +0000 (16:10 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 28 Mar 2025 13:47:08 +0000 (09:47 -0400)
which is mainly for Password.Cleartext.  That is user-supplied
input, and is unsafe no matter where it comes from.

share/dictionary/freeradius/dictionary.freeradius.internal.password
src/lib/util/dict.h
src/lib/util/dict_tokenize.c

index 8b14b116f6675a3b86c3bca60c5332a41102e4e4..95d0a2b8820b59be324ae9e1d1287cb2ba3c6484 100644 (file)
@@ -18,9 +18,9 @@ FLAGS internal
 
 ATTRIBUTE      Password                                2004    tlv
 BEGIN  Password
-ATTRIBUTE      With-Header                             1       string
+ATTRIBUTE      With-Header                             1       string  unsafe
 
-ATTRIBUTE      Cleartext                               2       string  secret
+ATTRIBUTE      Cleartext                               2       string  secret,unsafe
 
 ATTRIBUTE      Crypt                                   3       string
 
index a9f19a9a518f8ad99fadb08ea24235108f62fb9b..e3885cec9995265d3d86e4a9fcdabaf8a1daa018 100644 (file)
@@ -103,6 +103,8 @@ typedef struct {
 
        unsigned int            secret : 1;                     //!< this attribute should be omitted in debug mode
 
+       unsigned int            unsafe : 1;                     //!< e.g. Cleartext-Password
+
        /*
         *      @todo - if we want to clean these fields up, make
         *      "subtype" and "type_size" both 4-bit bitfields.  That
index 3386e2431f4685e73a99824329d80776a7d77c9d..892264e479e1055f7b829b249ba2d5f9fdd15d9c 100644 (file)
@@ -700,6 +700,8 @@ static int dict_flag_subtype(fr_dict_attr_t **da_p, char const *value, UNUSED fr
        return 0;
 }
 
+FLAG_FUNC(unsafe)
+
 /** A lookup function for dictionary attribute flags
  *
  */
@@ -720,7 +722,8 @@ static int CC_HINT(nonnull) dict_process_flag_field(dict_tokenize_ctx_t *dctx, c
                { L("precision"),       { .func = dict_flag_precision, .needs_value = true } },
                { L("ref"),             { .func = dict_flag_ref, .needs_value = true } },
                { L("secret"),          { .func = dict_flag_secret } },
-               { L("subtype"),         { .func = dict_flag_subtype, .needs_value = true } }
+               { L("subtype"),         { .func = dict_flag_subtype, .needs_value = true } },
+               { L("unsafe"),          { .func = dict_flag_unsafe } },
        };
        static size_t dict_common_flags_len = NUM_ELEMENTS(dict_common_flags);