]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
uuidparse: add support for RFC9562 UUIDs
authorThomas Weißschuh <thomas@t-8ch.de>
Mon, 12 Feb 2024 17:46:27 +0000 (18:46 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Fri, 10 May 2024 08:36:21 +0000 (10:36 +0200)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
misc-utils/uuidparse.c
tests/expected/uuid/uuidparse
tests/ts/uuid/uuidparse

index 33d961c922cd123621826990e33212c048f3990e..1336038118a6bab4cbaea7b38ef89539d1f1f62d 100644 (file)
@@ -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];
 
index 5cac36755980ea151b9d1e3dd8852966506943a1..9edb05e4e94430e57585b31ad025c98b5992da42 100644 (file)
@@ -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
index 915886c8f78c5d613cc1a9b1eccb5cc404f1890e..2903ce56dcaedaaf9f39b48854b7d54d9df9f7d7 100755 (executable)
@@ -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