diff options
author | Thomas Weißschuh <thomas@t-8ch.de> | 2024-04-17 09:27:08 +0200 |
---|---|---|
committer | Thomas Weißschuh <thomas@t-8ch.de> | 2024-04-17 09:32:12 +0200 |
commit | 72e7b345e216bb1b4ca7294813fa4b5054358242 (patch) | |
tree | 19ca5573cd4c1e8b14aded03afb49d09d1be545a | |
parent | d98b2e161f8b6b59d645631297f81427d85288ac (diff) | |
download | util-linux-72e7b345e216bb1b4ca7294813fa4b5054358242.tar.gz |
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 <thomas@t-8ch.de>
-rw-r--r-- | misc-utils/uuidparse.c | 2 | ||||
-rw-r--r-- | tests/expected/uuid/uuidparse | 42 |
2 files changed, 23 insertions, 21 deletions
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 |