diff --git a/.travis.yml_old b/.travis.yml similarity index 99% rename from .travis.yml_old rename to .travis.yml index 3b86ea12..341995fa 100644 --- a/.travis.yml_old +++ b/.travis.yml @@ -3,14 +3,11 @@ language: cpp services: - docker env: -- DOVECOT="release-2.2.21" - DOVECOT="master-2.3" -- DOVECOT="master-2.2" before_install: - docker volume create --name ceph_config - docker network create --driver=bridge --subnet=192.168.100.0/24 --gateway=192.168.100.1 ceph_network - travis_wait 30 docker run -d --net=ceph_network --name ceph_demo --mount type=tmpfs,destination=/etc/ceph -v ceph_config:/root/cfg -e MON_IP=192.168.100.2 -e CEPH_PUBLIC_NETWORK=192.168.100.0/24 -e CEPH_DEMO_UID=$DOVECOT ceph/daemon:latest demo - - travis_wait 30 docker run -itd --name build --net=ceph_network -e SOURCE_VERSION=$DOVECOT -v ceph_config:/etc/ceph -v $(pwd):/repo cephdovecot/travis-build-$DOVECOT:latest sh - docker exec build sh -c 'printf "nameserver 8.8.8.8\n" > /etc/resolv.conf' - docker exec build apt-get -qq update diff --git a/CHANGELOG.md b/CHANGELOG.md index efbec09a..250d55a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Change Log +## [0.0.25](https://github.com/ceph-dovecot/dovecot-ceph-plugin/tree/0.0.25) (2022-02-23) + +- virtual_mailbox: bugfix fetch fields (x-guid, date.saved..) + ## [0.0.24](https://github.com/ceph-dovecot/dovecot-ceph-plugin/tree/0.0.24) (2022-02-07) - list namespace object only once, in case of force-resync diff --git a/configure.ac b/configure.ac index 3c78d025..e258e270 100644 --- a/configure.ac +++ b/configure.ac @@ -8,7 +8,7 @@ AC_PREREQ([2.59]) -AC_INIT([dovecot-ceph-plugin], [0.0.24], [https://github.com/ceph-dovecot/dovecot-ceph-plugin/issues/new], ,[https://github.com/ceph-dovecot/dovecot-ceph-plugin]) +AC_INIT([dovecot-ceph-plugin], [0.0.25], [https://github.com/ceph-dovecot/dovecot-ceph-plugin/issues/new], ,[https://github.com/ceph-dovecot/dovecot-ceph-plugin]) AC_CONFIG_AUX_DIR([.]) AC_CONFIG_SRCDIR([src]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/rpm/dovecot-ceph-plugin.spec b/rpm/dovecot-ceph-plugin.spec index df0f97d5..1718d986 100644 --- a/rpm/dovecot-ceph-plugin.spec +++ b/rpm/dovecot-ceph-plugin.spec @@ -13,7 +13,7 @@ Name: dovecot-ceph-plugin Summary: Dovecot Ceph RADOS plugins -Version: 0.0.24 +Version: 0.0.25 Release: 0%{?dist} URL: https://github.com/ceph-dovecot/dovecot-ceph-plugin Group: Productivity/Networking/Email/Servers diff --git a/src/storage-rbox/doveadm-rbox-plugin.cpp b/src/storage-rbox/doveadm-rbox-plugin.cpp index a7f72fb4..7f3a8f27 100644 --- a/src/storage-rbox/doveadm-rbox-plugin.cpp +++ b/src/storage-rbox/doveadm-rbox-plugin.cpp @@ -661,8 +661,8 @@ static int iterate_mailbox(const struct mail_namespace *ns, const struct mailbox [oid](librmb::RadosMail *m) { return m->get_oid()->compare(oid) == 0; }); if (it_mail == mail_objects.end()) { - //std::cout << " missing mail object: uid=" << mail->uid << " guid=" << guid << " oid : " << oid - // << " available: " << (it_mail != mail_objects.end()) << std::endl; + std::cout << " missing mail object: uid=" << mail->uid << " guid=" << guid << " oid : " << oid + << " available: " << (it_mail != mail_objects.end()) << std::endl; ++mail_count_missing; } else { diff --git a/src/storage-rbox/rbox-mail.cpp b/src/storage-rbox/rbox-mail.cpp index 1230f57c..e63cf36f 100644 --- a/src/storage-rbox/rbox-mail.cpp +++ b/src/storage-rbox/rbox-mail.cpp @@ -112,7 +112,7 @@ static int rbox_mail_metadata_get(struct rbox_mail *rmail, enum rbox_metadata_ke FUNC_END(); return -1; } - + // update metadata storage io_ctx and load metadata if (alt_storage) { r_storage->ms->get_storage()->set_io_ctx(&r_storage->alt->get_io_ctx()); @@ -120,6 +120,18 @@ static int rbox_mail_metadata_get(struct rbox_mail *rmail, enum rbox_metadata_ke r_storage->ms->get_storage()->set_io_ctx(&r_storage->s->get_io_ctx()); } + /*#283: virtual mailbox needs this (different initialisation path)*/ + if (rmail->rados_mail == nullptr) { + // make sure that mail_object is initialized, + // else create and load guid from index. + rmail->rados_mail = r_storage->s->alloc_rados_mail(); + if (rbox_get_index_record(mail) < 0) { + i_error("Error rbox_get_index_record uid(%d)", mail->uid); + FUNC_END(); + return -1; + } + } + int ret_load_metadata = r_storage->ms->get_storage()->load_metadata(rmail->rados_mail); if (ret_load_metadata < 0) { std::string metadata_key = librmb::rbox_metadata_key_to_char(key); @@ -127,9 +139,9 @@ static int rbox_mail_metadata_get(struct rbox_mail *rmail, enum rbox_metadata_ke i_warning("Errorcode: %d cannot get x_attr(%s,%c) from object %s, process %d", ret_load_metadata, metadata_key.c_str(), key, rmail->rados_mail->get_oid()->c_str(), getpid()); rbox_mail_set_expunged(rmail); - } else { + } else { i_error("Errorcode: %d cannot get x_attr(%s,%c) from object %s, process %d", ret_load_metadata, - metadata_key.c_str(), key, rmail->rados_mail->get_oid()->c_str(), getpid()); + metadata_key.c_str(), key, rmail->rados_mail != NULL ? rmail->rados_mail->get_oid()->c_str() : " no oid", getpid()); } FUNC_END(); return -1; @@ -164,6 +176,17 @@ static int rbox_mail_get_received_date(struct mail *_mail, time_t *date_r) { // in case we already read the metadata this gives us the value // void get_metadata(rbox_metadata_key key, std::string* value) { + if (rmail->rados_mail == nullptr) { + // make sure that mail_object is initialized, + // else create and load guid from index. + struct rbox_storage *r_storage = (struct rbox_storage *)_mail->box->storage; + rmail->rados_mail = r_storage->s->alloc_rados_mail(); + if (rbox_get_index_record(_mail) < 0) { + i_error("Error rbox_get_index uid(%d)", _mail->uid); + FUNC_END(); + return -1; + } + } librmb::RadosUtils::get_metadata(rbox_metadata_key::RBOX_METADATA_RECEIVED_TIME, rmail->rados_mail->get_metadata(), &value); @@ -223,6 +246,19 @@ static int rbox_mail_get_save_date(struct mail *_mail, time_t *date_r) { FUNC_END_RET("ret == 0"); return 0; } + + if (rmail->rados_mail == nullptr) { + // make sure that mail_object is initialized, + // else create and load guid from index. + struct rbox_storage *r_storage = (struct rbox_storage *)_mail->box->storage; + rmail->rados_mail = r_storage->s->alloc_rados_mail(); + if (rbox_get_index_record(_mail) < 0) { + i_error("Error rbox_get_index uid(%d)", _mail->uid); + FUNC_END(); + return -1; + } + } + if (rmail->rados_mail->get_rados_save_date() != -1) { *date_r = data->save_date = rmail->rados_mail->get_rados_save_date(); return 0; @@ -391,19 +427,20 @@ static int rbox_mail_get_stream(struct mail *_mail, bool get_body ATTR_UNUSED, s int ret = -1; enum mail_flags flags = index_mail_get_flags(_mail); bool alt_storage = is_alternate_storage_set(flags) && is_alternate_pool_valid(_mail->box); - + if (data->stream == NULL) { if (rbox_open_rados_connection(_mail->box, alt_storage) < 0) { FUNC_END_RET("ret == -1; connection to rados failed"); return -1; } + librmb::RadosStorage *rados_storage = alt_storage ? ((struct rbox_storage *)_mail->box->storage)->alt : ((struct rbox_storage *)_mail->box->storage)->s; if (alt_storage) { rados_storage->set_namespace(rados_storage->get_namespace()); } - /* Pop3 needs this. it looks like rbox_index_mail_set_seq is not called. */ + /* Pop3 and virtual box needs this. it looks like rbox_index_mail_set_seq is not called. */ if (rmail->rados_mail == nullptr) { // make sure that mail_object is initialized, // else create and load guid from index. @@ -605,7 +642,7 @@ static int rbox_mail_get_special(struct mail *_mail, enum mail_fetch_field field if (ret == 0) { index_pop3_uidl_update_exists(&mail->imail.mail.mail, (*value_r)[0] != '\0'); } -#endif +#endif return ret; case MAIL_FETCH_POP3_ORDER: if (!rbox_header_have_flag(_mail->box, mbox->hdr_ext_id, offsetof(struct rbox_index_header, flags),