static void i_stream_attachment_extractor_close(struct iostream_private *stream, bool close_parent) { struct attachment_istream *astream = (struct attachment_istream *)stream; struct message_part *parts; if (astream->parser != NULL) { message_parser_deinit(&astream->parser, &parts); } hash_format_deinit_free(&astream->set.hash_format); if (astream->pool != NULL) pool_unref(&astream->pool); if (close_parent) i_stream_close(astream->istream.parent); }
static void i_stream_attachment_extractor_close(struct iostream_private *stream, bool close_parent) { struct attachment_istream *astream = (struct attachment_istream *)stream; struct message_part *parts; int ret; if (astream->parser != NULL) { ret = message_parser_deinit(&astream->parser, &parts); i_assert(ret == 0); /* we didn't use preparsed message_parts */ } hash_format_deinit_free(&astream->set.hash_format); if (astream->pool != NULL) pool_unref(&astream->pool); if (close_parent) i_stream_close(astream->istream.parent); }
/* <settings checks> */ static bool mail_storage_settings_check(void *_set, pool_t pool ATTR_UNUSED, const char **error_r) { struct mail_storage_settings *set = _set; struct hash_format *format; const char *p, *error; bool uidl_format_ok; char c; if (set->mailbox_idle_check_interval == 0) { *error_r = "mailbox_idle_check_interval must not be 0"; return FALSE; } if (strcmp(set->mail_fsync, "optimized") == 0) set->parsed_fsync_mode = FSYNC_MODE_OPTIMIZED; else if (strcmp(set->mail_fsync, "never") == 0) set->parsed_fsync_mode = FSYNC_MODE_NEVER; else if (strcmp(set->mail_fsync, "always") == 0) set->parsed_fsync_mode = FSYNC_MODE_ALWAYS; else { *error_r = t_strdup_printf("Unknown mail_fsync: %s", set->mail_fsync); return FALSE; } if (set->mail_nfs_index && !set->mmap_disable) { *error_r = "mail_nfs_index=yes requires mmap_disable=yes"; return FALSE; } if (set->mail_nfs_index && set->parsed_fsync_mode != FSYNC_MODE_ALWAYS) { *error_r = "mail_nfs_index=yes requires mail_fsync=always"; return FALSE; } if (!file_lock_method_parse(set->lock_method, &set->parsed_lock_method)) { *error_r = t_strdup_printf("Unknown lock_method: %s", set->lock_method); return FALSE; } uidl_format_ok = FALSE; for (p = set->pop3_uidl_format; *p != '\0'; p++) { if (p[0] != '%' || p[1] == '\0') continue; c = var_get_key(++p); switch (c) { case 'v': case 'u': case 'm': case 'f': case 'g': uidl_format_ok = TRUE; break; case '%': break; default: *error_r = t_strdup_printf( "Unknown pop3_uidl_format variable: %%%c", c); return FALSE; } } if (!uidl_format_ok) { *error_r = "pop3_uidl_format setting doesn't contain any " "%% variables."; return FALSE; } if (strchr(set->mail_attachment_hash, '/') != NULL) { *error_r = "mail_attachment_hash setting " "must not contain '/' characters"; return FALSE; } if (hash_format_init(set->mail_attachment_hash, &format, &error) < 0) { *error_r = t_strconcat("Invalid mail_attachment_hash setting: ", error, NULL); return FALSE; } if (strchr(set->mail_attachment_hash, '-') != NULL) { *error_r = "mail_attachment_hash setting " "must not contain '-' characters"; return FALSE; } hash_format_deinit_free(&format); #ifndef CONFIG_BINARY if (*set->ssl_client_ca_dir != '\0' && access(set->ssl_client_ca_dir, X_OK) < 0) { *error_r = t_strdup_printf( "ssl_client_ca_dir: access(%s) failed: %m", set->ssl_client_ca_dir); return FALSE; } #endif return TRUE; }