Browse code

Remove x509-username-fields uppercasing

The uppercasing was first introduced together with the
x509-username-field option in commit 935c62be, and first released with
v2.2.0 in 2011. The uppercasing was later deprecated with commit
f4e0ad82 and release v2.4.0 in 2016. It think it is time to finally
remove it.

This deprecated feature prevents you from using non-extension
all-lowercase fieldnames like `name`, because these are converted to
uppercase and then cause an error. The deprecation warning is also shown
in cases where there is no actual uppercasing happening, for example
with numerical forms (aka oids) like `2.5.4.41` (oid of `name`).

Signed-off-by: Corubba Smith <corubba@gmx.de>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <cb8317eb-bfb6-47e8-9bc3-ae5cc603ff21@gmx.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30915.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Corubba Smith authored on 2025/02/16 04:00:33
Showing 3 changed files
... ...
@@ -92,6 +92,11 @@ Compression on send
92 92
     ``--allow-compression yes`` is now an alias for
93 93
     ``--allow-compression asym``.
94 94
 
95
+User-visible Changes
96
+--------------------
97
+- ``--x509-username-field`` will no longer automatically convert fieldnames to
98
+  uppercase. This is deprecated since OpenVPN 2.4, and has now been removed.
99
+
95 100
 Overview of changes in 2.6
96 101
 ==========================
97 102
 
... ...
@@ -765,12 +765,6 @@ If the option is inlined, ``algo`` is always :code:`SHA256`.
765 765
   Only the :code:`subjectAltName` and :code:`issuerAltName` X.509
766 766
   extensions and :code:`serialNumber` X.509 attribute are supported.
767 767
 
768
-  **Please note:** This option has a feature which will convert an
769
-  all-lowercase ``fieldname`` to uppercase characters, e.g.,
770
-  :code:`ou` -> :code:`OU`. A mixed-case ``fieldname`` or one having the
771
-  :code:`ext:` prefix will be left as-is. This automatic upcasing feature is
772
-  deprecated and will be removed in a future release.
773
-
774 768
   Non-compliant symbols are being replaced with the :code:`_` symbol, same as
775 769
   the field separator, so concatenating multiple fields with such or :code:`_`
776 770
   symbols can potentially lead to username collisions.
... ...
@@ -9395,37 +9395,12 @@ add_option(struct options *options,
9395 9395
 #ifdef ENABLE_X509ALTUSERNAME
9396 9396
     else if (streq(p[0], "x509-username-field") && p[1])
9397 9397
     {
9398
-        /* This option used to automatically upcase the fieldnames passed as the
9399
-         * option arguments, e.g., "ou" became "OU". Now, this "helpfulness" is
9400
-         * fine-tuned by only upcasing Subject field attribute names which consist
9401
-         * of all lower-case characters. Mixed-case attributes such as
9402
-         * "emailAddress" are left as-is. An option parameter having the "ext:"
9403
-         * prefix for matching X.509v3 extended fields will also remain unchanged.
9404
-         */
9405 9398
         VERIFY_PERMISSION(OPT_P_GENERAL);
9406 9399
         for (size_t j = 1; j < MAX_PARMS && p[j] != NULL; ++j)
9407 9400
         {
9408 9401
             char *s = p[j];
9409 9402
 
9410
-            if (strncmp("ext:", s, 4) != 0)
9411
-            {
9412
-                size_t i = 0;
9413
-                while (s[i] && !isupper(s[i]))
9414
-                {
9415
-                    i++;
9416
-                }
9417
-                if (strlen(s) == i)
9418
-                {
9419
-                    while ((*s = toupper(*s)) != '\0')
9420
-                    {
9421
-                        s++;
9422
-                    }
9423
-                    msg(M_WARN, "DEPRECATED FEATURE: automatically upcased the "
9424
-                        "--x509-username-field parameter to '%s'; please update your "
9425
-                        "configuration", p[j]);
9426
-                }
9427
-            }
9428
-            else if (!x509_username_field_ext_supported(s+4))
9403
+            if (strncmp("ext:", s, 4) == 0 && !x509_username_field_ext_supported(s+4))
9429 9404
             {
9430 9405
                 msg(msglevel, "Unsupported x509-username-field extension: %s", s);
9431 9406
             }