]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl/cli: 'show ssl crl-file' escape the first '*' of a filename
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 16 Dec 2024 15:46:52 +0000 (16:46 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 16 Dec 2024 15:46:52 +0000 (16:46 +0100)
When doing a 'show ssl crl-file <filename>', prefixing a filename with a '*'
allows to show the uncommited transaction asociated to this filename.

However for people using '*' as the first character of their
filename, there is no way to access this filename.

This patch fixes the problem by allowing to escape the first
character with \.

This should be backported in every stable branches.

doc/management.txt
src/ssl_ckch.c

index 12d3788227f600ab7ca4d9abfcd08fb771999890..91b36af3b8bfa3e6aaeb1ec6304aeca919b79f62 100644 (file)
@@ -3617,7 +3617,7 @@ show ssl cert [[*][\]<filename>]
     Status: Used
     [...]
 
-show ssl crl-file [<crlfile>[:<index>]]
+show ssl crl-file [[*][\]<crlfile>[:<index>]]
   Display the list of CRL files loaded into the process. They are not used
   by any frontend or backend until their status is "Used".
   If a filename is prefixed by an asterisk, it is a transaction which is not
@@ -3630,7 +3630,8 @@ show ssl crl-file [<crlfile>[:<index>]]
   If the index is invalid (too big for instance), nothing will be displayed.
   This command can be useful to check if a CRL file was properly updated.
   You can also display the details of an ongoing transaction by prefixing the
-  filename by an asterisk.
+  filename by a '*'. If the first character of the filename is a '*', it can be
+  escaped with '\*'.
 
   Example :
 
index 869b4a2d1325096a20acb9ca0cc122ccc5795d3f..7e9dd44e57f9a07fefef8d2f03e65fc6c6825b82 100644 (file)
@@ -4191,7 +4191,7 @@ end:
        return 0;
 }
 
-/* IO handler of details "show ssl crl-file <filename[:index]>".
+/* IO handler of details "show ssl crl-file [*][\]<filename[:index]>".
  * It uses show_crlfile_ctx and the global
  * crlfile_transaction.new_cafile_entry in read-only.
  */
@@ -4293,18 +4293,26 @@ static int cli_parse_show_crlfile(char **args, char *payload, struct appctx *app
                }
 
                if (*args[3] == '*') {
+                       char *filename = args[3]+1;
+
+                       if (filename[0] == '\\')
+                                filename++;
                        if (!crlfile_transaction.new_crlfile_entry)
                                goto error;
 
                        cafile_entry = crlfile_transaction.new_crlfile_entry;
 
-                       if (strcmp(args[3] + 1, cafile_entry->path) != 0)
+                       if (strcmp(filename, cafile_entry->path) != 0)
                                goto error;
 
                } else {
+                       char *filename = args[3];
+
+                       if (filename[0] == '\\')
+                               filename++;
                        /* Get the "original" cafile_entry and not the
                         * uncommitted one if it exists. */
-                       if ((cafile_entry = ssl_store_get_cafile_entry(args[3], 1)) == NULL || cafile_entry->type != CAFILE_CRL)
+                       if ((cafile_entry = ssl_store_get_cafile_entry(filename, 1)) == NULL || cafile_entry->type != CAFILE_CRL)
                                goto error;
                }