]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Check that mail_server_admin is valid URI
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 5 Nov 2024 11:56:43 +0000 (13:56 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:40:00 +0000 (10:40 +0200)
src/config/settings-get.pl
src/lib-storage/mail-storage-settings.c

index 0946bd621a6a73c387a73f48960d57425722c501..6cbf542b0458d2cc6b8e8fec6c9dcab638bc2517 100755 (executable)
@@ -20,6 +20,7 @@ print '#include "fsync-mode.h"'."\n";
 print '#include "hash-format.h"'."\n";
 print '#include "net.h"'."\n";
 print '#include "unichar.h"'."\n";
+print '#include "uri-util.h"'."\n";
 print '#include "hash-method.h"'."\n";
 print '#include "settings.h"'."\n";
 print '#include "message-header-parser.h"'."\n";
index a7c2b7e7e533e1ab3aa9f095923185e2a599c93f..0680c821e3e4cdf4998e08b0cd9312e498d58081 100644 (file)
@@ -5,6 +5,7 @@
 #include "hash-format.h"
 #include "unichar.h"
 #include "hostpid.h"
+#include "uri-util.h"
 #include "settings.h"
 #include "message-address.h"
 #include "message-header-parser.h"
@@ -675,7 +676,14 @@ mail_storage_settings_ext_check(struct event *event ATTR_UNUSED,
        }
        hash_format_deinit_free(&format);
 
-       // FIXME: check set->mail_server_admin syntax (RFC 5464, Section 6.2.2)
+       /* check mail_server_admin syntax (RFC 5464, Section 6.2.2) */
+       if (*set->mail_server_admin != '\0' &&
+           uri_check(set->mail_server_admin, 0, &error) < 0) {
+               *error_r = t_strdup_printf("mail_server_admin: "
+                                          "'%s' is not a valid URI: %s",
+                                          set->mail_server_admin, error);
+               return FALSE;
+       }
 
        /* parse mail_attachment_indicator_options */
        if (array_not_empty(&set->mail_attachment_detection_options)) {