From: Thomas Weißschuh Date: Wed, 17 Apr 2024 07:27:08 +0000 (+0200) Subject: uuidparse: only report type/version for DCE variant X-Git-Tag: v2.42-start~396^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=72e7b345e216bb1b4ca7294813fa4b5054358242;p=thirdparty%2Futil-linux.git uuidparse: only report type/version for DCE variant The type/version is only defined in scope for the DCE variant. From RFC4122 Section 4.1.1: "the interpretation of all other bits in the UUID depends on the setting of the bits in the variant field." Signed-off-by: Thomas Weißschuh --- diff --git a/misc-utils/uuidparse.c b/misc-utils/uuidparse.c index 2dd7fb3888..33d961c922 100644 --- a/misc-utils/uuidparse.c +++ b/misc-utils/uuidparse.c @@ -191,6 +191,8 @@ static void fill_table_row(struct libscols_table *tb, char const *const uuid) str = xstrdup(_("invalid")); break; } + if (variant != UUID_VARIANT_DCE) + break; switch (type) { case UUID_TYPE_DCE_NIL: if (uuid_is_null(buf)) diff --git a/tests/expected/uuid/uuidparse b/tests/expected/uuid/uuidparse index 8b23a25487..5cac367559 100644 --- a/tests/expected/uuid/uuidparse +++ b/tests/expected/uuid/uuidparse @@ -1,31 +1,31 @@ UUID VARIANT TYPE TIME -00000000-0000-0000-0000-000000000000 NCS nil -00000000-0000-1000-0000-000000000000 NCS time-based -00000000-0000-2000-0000-000000000000 NCS DCE -00000000-0000-3000-0000-000000000000 NCS name-based -00000000-0000-4000-0000-000000000000 NCS random -00000000-0000-5000-0000-000000000000 NCS sha1-based -00000000-0000-6000-0000-000000000000 NCS unknown +00000000-0000-0000-0000-000000000000 NCS +00000000-0000-1000-0000-000000000000 NCS +00000000-0000-2000-0000-000000000000 NCS +00000000-0000-3000-0000-000000000000 NCS +00000000-0000-4000-0000-000000000000 NCS +00000000-0000-5000-0000-000000000000 NCS +00000000-0000-6000-0000-000000000000 NCS 00000000-0000-0000-8000-000000000000 DCE unknown 00000000-0000-2000-8000-000000000000 DCE DCE 00000000-0000-3000-8000-000000000000 DCE name-based 00000000-0000-4000-8000-000000000000 DCE random 00000000-0000-5000-8000-000000000000 DCE sha1-based 00000000-0000-6000-8000-000000000000 DCE unknown -00000000-0000-0000-d000-000000000000 Microsoft unknown -00000000-0000-1000-d000-000000000000 Microsoft time-based -00000000-0000-2000-d000-000000000000 Microsoft DCE -00000000-0000-3000-d000-000000000000 Microsoft name-based -00000000-0000-4000-d000-000000000000 Microsoft random -00000000-0000-5000-d000-000000000000 Microsoft sha1-based -00000000-0000-6000-d000-000000000000 Microsoft unknown -00000000-0000-0000-f000-000000000000 other unknown -00000000-0000-1000-f000-000000000000 other time-based -00000000-0000-2000-f000-000000000000 other DCE -00000000-0000-3000-f000-000000000000 other name-based -00000000-0000-4000-f000-000000000000 other random -00000000-0000-5000-f000-000000000000 other sha1-based -00000000-0000-6000-f000-000000000000 other unknown +00000000-0000-0000-d000-000000000000 Microsoft +00000000-0000-1000-d000-000000000000 Microsoft +00000000-0000-2000-d000-000000000000 Microsoft +00000000-0000-3000-d000-000000000000 Microsoft +00000000-0000-4000-d000-000000000000 Microsoft +00000000-0000-5000-d000-000000000000 Microsoft +00000000-0000-6000-d000-000000000000 Microsoft +00000000-0000-0000-f000-000000000000 other +00000000-0000-1000-f000-000000000000 other +00000000-0000-2000-f000-000000000000 other +00000000-0000-3000-f000-000000000000 other +00000000-0000-4000-f000-000000000000 other +00000000-0000-5000-f000-000000000000 other +00000000-0000-6000-f000-000000000000 other 9b274c46-544a-11e7-a972-00037f500001 DCE time-based 2017-06-18 17:21:46,544647+00:00 invalid-input invalid invalid invalid return value: 0