From: Karl Fleischmann Date: Wed, 1 Mar 2023 13:41:46 +0000 (+0100) Subject: lib-imap: Remove obsolete ID parameter log functions X-Git-Tag: 2.4.0~2832 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3dd49e6af4e376746011109fa02ae3bfe26fc5bd;p=thirdparty%2Fdovecot%2Fcore.git lib-imap: Remove obsolete ID parameter log functions --- diff --git a/src/lib-imap/imap-id.c b/src/lib-imap/imap-id.c index 39f00c84bb..b399d20543 100644 --- a/src/lib-imap/imap-id.c +++ b/src/lib-imap/imap-id.c @@ -121,56 +121,6 @@ const char *imap_id_reply_generate(const char *settings) return ret; } -void imap_id_log_reply_append(string_t *reply, const char *key, - const char *value) -{ - if (str_len(reply) > 0) - str_append(reply, ", "); - str_append(reply, str_sanitize(key, IMAP_ID_KEY_MAX_LEN)); - str_append_c(reply, '='); - str_append(reply, value == NULL ? "NIL" : str_sanitize(value, 80)); -} - -const char *imap_id_args_get_log_reply(const struct imap_arg *args, - const char *settings) -{ - const char *const *keys, *key, *value; - string_t *reply; - bool log_all; - - if (settings == NULL || *settings == '\0') - return NULL; - if (!imap_arg_get_list(args, &args)) - return NULL; - - log_all = strcmp(settings, "*") == 0; - reply = t_str_new(256); - keys = t_strsplit_spaces(settings, " "); - while (!IMAP_ARG_IS_EOL(&args[0]) && - !IMAP_ARG_IS_EOL(&args[1])) { - if (!imap_arg_get_string(args, &key)) { - /* broken input */ - args += 2; - continue; - } - args++; - if (strlen(key) > 30) { - /* broken: ID spec requires fields to be max. 30 - octets */ - args++; - continue; - } - - if (log_all || str_array_icase_find(keys, key)) { - if (!imap_arg_get_nstring(args, &value)) - value = ""; - imap_id_log_reply_append(reply, key, value); - } - args++; - } - return str_len(reply) == 0 ? NULL : str_c(reply); -} - void imap_id_add_log_entry(struct imap_id_log_entry *log_entry, const char *key, const char *value) diff --git a/src/lib-imap/imap-id.h b/src/lib-imap/imap-id.h index 8dc3916d90..88d15aefe8 100644 --- a/src/lib-imap/imap-id.h +++ b/src/lib-imap/imap-id.h @@ -18,13 +18,6 @@ struct imap_id_log_entry { /* Return ID reply based on given settings. */ const char *imap_id_reply_generate(const char *settings); -/* Return a line that should be logged based on given args and settings. - Returns NULL if nothing should be logged. */ -const char *imap_id_args_get_log_reply(const struct imap_arg *args, - const char *settings); -/* Append [, ]key=value to the reply sanitized. */ -void imap_id_log_reply_append(string_t *reply, const char *key, - const char *value); /* Format the IMAP ID parameters into string-fields of the given event, and into a printable log message. */ void imap_id_add_log_entry(struct imap_id_log_entry *log_entry,