From: Arran Cudbard-Bell Date: Mon, 20 Sep 2021 22:04:24 +0000 (-0500) Subject: Allow printing/parsing NULL X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15692b3c5d9a5532e55d8ab24d81c736764ffbb3;p=thirdparty%2Ffreeradius-server.git Allow printing/parsing NULL --- diff --git a/src/lib/util/value.c b/src/lib/util/value.c index 4b9e46113ab..58dcd501bdc 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -4737,12 +4737,17 @@ parse: } break; + case FR_TYPE_NULL: + if ((quote == '\0') && (strcmp(in, "NULL") == 0)) goto finish; + fr_strerror_const("String value was not NULL"); + break; + case FR_TYPE_VALUE_BOX: case FR_TYPE_VARIABLE_SIZE: /* Should have been dealt with above */ case FR_TYPE_STRUCTURAL: /* Listed again to suppress compiler warnings */ case FR_TYPE_VOID: case FR_TYPE_MAX: - case FR_TYPE_NULL: + fr_strerror_printf("Unknown attribute dst_type %d", dst_type); return -1; } @@ -5035,6 +5040,9 @@ ssize_t fr_value_box_print(fr_sbuff_t *out, fr_value_box_t const *data, fr_sbuff FR_SBUFF_IN_CHAR_RETURN(&our_out, '}'); break; + case FR_TYPE_NULL: + FR_SBUFF_IN_STRCPY_LITERAL_RETURN(&our_out, "NULL"); + break; /* * Don't add default here */ @@ -5045,7 +5053,6 @@ ssize_t fr_value_box_print(fr_sbuff_t *out, fr_value_box_t const *data, fr_sbuff case FR_TYPE_VALUE_BOX: case FR_TYPE_VOID: case FR_TYPE_MAX: - case FR_TYPE_NULL: (void)fr_cond_assert(0); return 0; }