From: Thomas Weißschuh Date: Mon, 12 Feb 2024 17:46:27 +0000 (+0100) Subject: uuidparse: add support for RFC9562 UUIDs X-Git-Tag: v2.42-start~339^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=389dfbe6b9692ea793ebc3b3f44fc7d33c668dc4;p=thirdparty%2Futil-linux.git uuidparse: add support for RFC9562 UUIDs Signed-off-by: Thomas Weißschuh --- diff --git a/misc-utils/uuidparse.c b/misc-utils/uuidparse.c index 33d961c922..1336038118 100644 --- a/misc-utils/uuidparse.c +++ b/misc-utils/uuidparse.c @@ -203,6 +203,12 @@ static void fill_table_row(struct libscols_table *tb, char const *const uuid) case UUID_TYPE_DCE_TIME: str = xstrdup(_("time-based")); break; + case UUID_TYPE_DCE_TIME_V6: + str = xstrdup(_("time-v6")); + break; + case UUID_TYPE_DCE_TIME_V7: + str = xstrdup(_("time-v7")); + break; case UUID_TYPE_DCE_SECURITY: str = xstrdup("DCE"); break; @@ -215,6 +221,9 @@ static void fill_table_row(struct libscols_table *tb, char const *const uuid) case UUID_TYPE_DCE_SHA1: str = xstrdup(_("sha1-based")); break; + case UUID_TYPE_DCE_VENDOR: + str = xstrdup(_("vendor")); + break; default: str = xstrdup(_("unknown")); } @@ -224,7 +233,11 @@ static void fill_table_row(struct libscols_table *tb, char const *const uuid) str = xstrdup(_("invalid")); break; } - if (variant == UUID_VARIANT_DCE && type == UUID_TYPE_DCE_TIME) { + if (variant != UUID_VARIANT_DCE) + break; + if (type == UUID_TYPE_DCE_TIME || + type == UUID_TYPE_DCE_TIME_V6 || + type == UUID_TYPE_DCE_TIME_V7) { struct timeval tv; char date_buf[ISO_BUFSIZ]; diff --git a/tests/expected/uuid/uuidparse b/tests/expected/uuid/uuidparse index 5cac367559..9edb05e4e9 100644 --- a/tests/expected/uuid/uuidparse +++ b/tests/expected/uuid/uuidparse @@ -11,7 +11,7 @@ UUID VARIANT TYPE TIME 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-6000-8000-000000000000 DCE time-v6 60038-03-11 05:36:10,955161+00:00 00000000-0000-0000-d000-000000000000 Microsoft 00000000-0000-1000-d000-000000000000 Microsoft 00000000-0000-2000-d000-000000000000 Microsoft @@ -27,5 +27,8 @@ UUID VARIANT TYPE TIME 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 +1ec9414c-232a-6b00-b3c8-9f6bdeced846 DCE time-v6 2022-02-22 19:22:22,000000+00:00 +017f22e2-79b2-7cc3-98c4-dc0c0c07398f DCE time-v7 2022-02-22 19:22:22,002000+00:00 +5c146b14-3c52-8afd-938a-375d0df1fbf6 DCE vendor invalid-input invalid invalid invalid return value: 0 diff --git a/tests/ts/uuid/uuidparse b/tests/ts/uuid/uuidparse index 915886c8f7..2903ce56dc 100755 --- a/tests/ts/uuid/uuidparse +++ b/tests/ts/uuid/uuidparse @@ -54,6 +54,9 @@ echo '00000000-0000-0000-0000-000000000000 00000000-0000-6000-f000-000000000000 9b274c46-544a-11e7-a972-00037f500001 +1ec9414c-232a-6b00-b3c8-9f6bdeced846 +017f22e2-79b2-7cc3-98c4-dc0c0c07398f +5c146b14-3c52-8afd-938a-375d0df1fbf6 invalid-input' | $TS_CMD_UUIDPARSE >> $TS_OUTPUT 2>> $TS_ERRLOG echo "return value: $?" >> $TS_OUTPUT