]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-imap: imap_id_reply_generate() - Remove obsolete IMAP ID defaults resolving
authorKarl Fleischmann <karl.fleischmann@open-xchange.com>
Tue, 16 Jan 2024 12:34:17 +0000 (13:34 +0100)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:12 +0000 (12:34 +0200)
src/lib-imap/imap-id.c

index 24cdb56574bd3281bc36939323bc58191caf29a3..5685a17ca34a09df87a2fc683fc6946250164e9e 100644 (file)
@@ -9,48 +9,9 @@
 #include "imap-id.h"
 #include "dovecot-version.h"
 
-#ifdef HAVE_SYS_UTSNAME_H
-#  include <sys/utsname.h>
-#endif
-
 /* Limit the allowed characters that an IMAP ID parameter might have. */
 #define IMAP_ID_KEY_ACCEPT_CHARS "abcdefghijklmnopqrstuvwxyz0123456789_-"
 
-static struct utsname utsname_result;
-static bool utsname_set = FALSE;
-
-static const char *imap_id_get_uname(const char *key)
-{
-       if (!utsname_set) {
-               utsname_set = TRUE;
-               if (uname(&utsname_result) < 0) {
-                       i_error("uname() failed: %m");
-                       i_zero(&utsname_result);
-               }
-       }
-
-       if (strcasecmp(key, "os") == 0)
-               return utsname_result.sysname;
-       if (strcasecmp(key, "os-version") == 0)
-               return utsname_result.release;
-       return NULL;
-}
-
-static const char *imap_id_get_default(const char *key)
-{
-       if (strcasecmp(key, "name") == 0)
-               return DOVECOT_NAME;
-       if (strcasecmp(key, "version") == 0)
-               return PACKAGE_VERSION;
-       if (strcasecmp(key, "revision") == 0)
-               return DOVECOT_REVISION;
-       if (strcasecmp(key, "support-url") == 0)
-               return PACKAGE_WEBPAGE;
-       if (strcasecmp(key, "support-email") == 0)
-               return PACKAGE_BUGREPORT;
-       return imap_id_get_uname(key);
-}
-
 const char *imap_id_reply_generate(const ARRAY_TYPE(const_string) *args)
 {
        if (array_is_empty(args))
@@ -66,12 +27,10 @@ const char *imap_id_reply_generate(const ARRAY_TYPE(const_string) *args)
                imap_append_quoted(str, kv[i]);
                str_append_c(str, ' ');
                const char *value = kv[i + 1];
-               if (strcmp(value, "*") == 0)
-                       value = imap_id_get_default(kv[i]);
 #if defined(DOVECOT_EDITION)
-               else if (strcasecmp(kv[i], "name") == 0 &&
-                        strcmp(DOVECOT_EDITION, "Pro") == 0)
-                       value = imap_id_get_default(kv[i]);
+               if (strcasecmp(kv[i], "name") == 0 &&
+                   strcmp(DOVECOT_EDITION, "Pro") == 0)
+                       value = DOVECOT_NAME;
 #endif
                imap_append_nstring(str, value);
        }