From: Alan T. DeKok Date: Sat, 3 Oct 2020 12:30:30 +0000 (-0400) Subject: forbid smashing flags. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee85b14fff05a59ecef5efeff5a98414d41b2736;p=thirdparty%2Ffreeradius-server.git forbid smashing flags. once a flag is set, it shouldn't be overwritten --- diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index 0ecc0b03cc5..cb625702577 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -458,6 +458,17 @@ static int dict_process_flag_field(dict_tokenize_ctx_t *ctx, char *name, fr_type if (value) value[-1] = '='; /* hackity hack */ + /* + * Protocol should use strings + * "key1,key2" to allow for multiple + * flags. + */ + if (flags->subtype) { + fr_strerror_printf("Cannot add flag '%s' - another flag is already set", + key); + return -1; + } + subtype = fr_table_value_by_str(ctx->dict->subtype_table, key, -1); if (subtype < 0) goto unknown_option;