Skip to content

Commit b4902cb

Browse files
committed
Merge branch 'prime'
2 parents 353b6a2 + 97971a6 commit b4902cb

File tree

15 files changed

+147
-53
lines changed

15 files changed

+147
-53
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
AC_INIT([gromox], [2.40])
1+
AC_INIT([gromox], [2.41])
22
AC_CONFIG_AUX_DIR([build-aux])
33
AC_CONFIG_MACRO_DIR([build-aux])
44
AC_PREFIX_DEFAULT([/usr])

doc/changelog.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
Gromox 2.41 (2025-02-07)
2+
========================
3+
4+
Fixes:
5+
6+
* ldap_adaptor: plug two memory leaks
7+
* exmdb: plug a memory leak related to subscription destruction
8+
* oxcical: do process TRIGGER duration value type for reminders
9+
* midb: resolve flakey update of flagged/replied/forwarded status
10+
* midb: when a MAPI message has changed and requires a new IMAPUID,
11+
convey the expunge of the old IMAPUID much sooner to IMAP clients
12+
* pop3: resolve a NULL deref/crash during RETR command
13+
* imap: restore SEARCH command looking at right portion of a QP-encoded message
14+
15+
Enhancements:
16+
17+
* ews: send flag status to clients
18+
* imap: include username for IMAP actions when imap_cmd_debug logging is
19+
activated
20+
* midb, imap: print asynchronous notification events when imap_cmd_debug>=2
21+
* oxcical: invalid iCal timezone inputs are now logged when
22+
<daemon>_log_level=6 (debug)
23+
24+
Behavioral changes:
25+
26+
* mkprivate: new message stores now have `frightsVisible` set on the calendar
27+
folder, because grommunio-web is picky about the existence of the calendar
28+
folder even if obtaining just freebusy blocks.
29+
30+
131
Gromox 2.40 (2025-01-28)
232
========================
333

doc/gromox-exm2eml.8

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.\" SPDX-FileCopyrightText: 2024 grommunio GmbH
33
.TH gromox\-exm2eml 8 "" "Gromox" "Gromox admin reference"
44
.SH Name
5-
gromox\-exm2eml \(em Utility to export messages to various formats
5+
gromox\-exm2eml \(em Utility to export Gromox messages to various formats
66
.SH Synopsis
77
\fBgromox\-exm2eml \-u\fP \fI[email protected]\fP
88
[\fIfolder_id\fP\fB:\fP]\fImessage_id\fP
@@ -39,7 +39,8 @@ Default: 1
3939
Show properties in detail (enhances \fB\-t\fP).
4040
.TP
4141
\fB\-t\fP
42-
Show a diagnostic tree view of the source data as it is being read.
42+
As the source message is read, print a diagnostic tree view of the MAPI
43+
properties to stderr.
4344
.TP
4445
\fB\-u\fP [\fIuser\fP]\fB@\fIdomin.example\fP
4546
Source mail store from which to load the message from. For the public folder of

doc/gromox-mt2exm.8

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.\" SPDX-License-Identifier: CC-BY-SA-4.0 or-later
2-
.\" SPDX-FileCopyrightText: 2021-2022 grommunio GmbH
2+
.\" SPDX-FileCopyrightText: 2021-2025 grommunio GmbH
33
.TH gromox\-mt2exm 8 "" "Gromox" "Gromox admin reference"
44
.SH Name
5-
gromox\-mt2exm \(em Utility for importing various mail items
5+
gromox\-mt2exm \(em Utility for importing various mail items into Gromox
66
.SH Synopsis
77
\fBgromox\-mt2exm\fP [...] [\fB\-Dcpt\fP] \fB-u\fP
88
[\fIlocalpart\fP]\fB@\fP\fIdomain.example\fP
@@ -15,17 +15,19 @@ Gromox mail store.
1515
There is no cross-check for already-imported messages at this time. Messages
1616
from the input stream will always generate new messages in the target mailbox.
1717
.PP
18-
Note that messages are always owned by the store they are in. Especially if
18+
Note that messages are always owned by the store they are in. Note that, when
1919
importing to a public store, you may need to set some additional permissions on
2020
that public store's folders so that a particular user is able to modify
21-
messages.
21+
messages after they have been imported. (All import/export utilites use
22+
superuser access and need no permissions.)
2223
.SH Options
2324
.TP
2425
\fB\-B\fP \fIname\fP
25-
For unanchored messages (such as produced by the \-\-only\-obj option of
26-
gromox\-pff2mt and gromox\-kdb2mt), place them in this specific folder. The
27-
accepted names are documented in the gromox\-mbop(8) manpage under section
28-
"Folder specification".
26+
Place unanchored messages (loose objects that do not request placement in any
27+
particular folder) in the folder specified by \-B. The accepted names are
28+
documented in the gromox\-mbop(8) manpage under section "Folder specification".
29+
Unanchored messages can be produced by e.g. gromox\-eml2mt, gromox\-tnef2mt,
30+
gromox\-pff2mt \-\-only\-obj, gromox\-kdb2mt \-\-only\-obj.
2931
.br
3032
Default: \fIdraft\fP
3133
.TP

exch/emsmdb/asyncemsmdb_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ int asyncemsmdb_interface_async_wait(uint32_t async_id,
157157
pout->result = ecRejected;
158158
return DISPATCH_SUCCESS;
159159
}
160-
if (emsmdb_interface_check_notify(&pin->acxh)) {
160+
if (emsmdb_interface_notifications_pending(pin->acxh)) {
161161
delete pwait;
162162
pout->flags_out = FLAG_NOTIFICATION_PENDING;
163163
pout->result = ecSuccess;

exch/emsmdb/emsmdb_interface.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,17 @@ BOOL emsmdb_interface_check_acxh(ACXH *pacxh,
186186
return TRUE;
187187
}
188188

189-
BOOL emsmdb_interface_check_notify(ACXH *pacxh)
189+
bool emsmdb_interface_notifications_pending(ACXH &acxh)
190190
{
191+
auto pacxh = &acxh;
191192
if (pacxh->handle_type != HANDLE_EXCHANGE_ASYNCEMSMDB)
192193
return FALSE;
193194
std::lock_guard gl_hold(g_lock);
194195
auto iter = g_handle_hash.find(pacxh->guid);
195196
if (iter == g_handle_hash.end())
196197
return false;
197198
auto phandle = &iter->second;
198-
return double_list_get_nodes_num(&phandle->notify_list) > 0 ? TRUE : false;
199+
return double_list_get_nodes_num(&phandle->notify_list) > 0;
199200
}
200201

201202
/* called by moh_emsmdb module */

exch/emsmdb/emsmdb_interface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ int emsmdb_interface_async_connect_ex(CXH cxh, ACXH *pacxh);
3838
void emsmdb_interface_unbind_rpc_handle(uint64_t hrpc);
3939
BOOL emsmdb_interface_check_acxh(ACXH *pacxh,
4040
char *username, uint16_t *pcxr, BOOL b_touch);
41-
BOOL emsmdb_interface_check_notify(ACXH *pacxh);
41+
extern bool emsmdb_interface_notifications_pending(ACXH &);
4242
extern void emsmdb_interface_touch_handle(const CXH &);
4343
extern const char *emsmdb_interface_get_username();
4444
extern const GUID *emsmdb_interface_get_handle();

exch/exmdb/db_engine.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0-only WITH linking exception
2-
// SPDX-FileCopyrightText: 2021-2024 grommunio GmbH
2+
// SPDX-FileCopyrightText: 2021-2025 grommunio GmbH
33
// This file is part of Gromox.
44
#include <algorithm>
55
#include <cassert>
@@ -712,6 +712,11 @@ POPULATING_NODE::~POPULATING_NODE()
712712
free(folder_ids.pll);
713713
}
714714

715+
/**
716+
* Construct pseudo-packets for different clients based on who is watching
717+
* @folder_id/@message_id. The output ID_ARRAYS is referencing db data, so
718+
* watch your lifetimes. (The ID_ARRAYS object must not outlive @db).
719+
*/
715720
static db_conn::ID_ARRAYS db_engine_classify_id_array(const db_base &db,
716721
unsigned int bits, uint64_t folder_id, uint64_t message_id) try
717722
{
@@ -720,8 +725,10 @@ static db_conn::ID_ARRAYS db_engine_classify_id_array(const db_base &db,
720725
if (!(sub.notification_type & bits))
721726
continue;
722727
if (sub.b_whole || (sub.folder_id == folder_id &&
723-
sub.message_id == message_id))
724-
out[sub.remote_id].push_back(sub.sub_id);
728+
sub.message_id == message_id)) {
729+
auto rid = sub.remote_id.has_value() ? sub.remote_id->c_str() : nullptr;
730+
out[rid].push_back(sub.sub_id);
731+
}
725732
}
726733
return out;
727734
} catch (const std::bad_alloc &) {
@@ -3845,8 +3852,10 @@ void db_conn::notify_message_movecopy(BOOL b_copy, uint64_t folder_id,
38453852
continue;
38463853
}
38473854
if (pnsub->b_whole || (pnsub->folder_id == old_fid &&
3848-
pnsub->message_id == old_mid))
3849-
recv_list[pnsub->remote_id].push_back(pnsub->sub_id);
3855+
pnsub->message_id == old_mid)) {
3856+
auto rid = sub.remote_id.has_value() ? sub.remote_id->c_str() : nullptr;
3857+
recv_list[rid].push_back(pnsub->sub_id);
3858+
}
38503859
}
38513860
if (recv_list.size() > 0) {
38523861
datagram.dir = deconst(dir);
@@ -3896,8 +3905,10 @@ void db_conn::notify_folder_movecopy(BOOL b_copy, uint64_t parent_id,
38963905
}
38973906
if (pnsub->b_whole ||
38983907
(pnsub->folder_id == folder_id && pnsub->message_id == 0) ||
3899-
(pnsub->folder_id == old_fid && pnsub->message_id == 0))
3900-
recv_list[pnsub->remote_id].push_back(pnsub->sub_id);
3908+
(pnsub->folder_id == old_fid && pnsub->message_id == 0)) {
3909+
auto rid = sub.remote_id.has_value() ? sub.remote_id->c_str() : nullptr;
3910+
recv_list[rid].push_back(pnsub->sub_id);
3911+
}
39013912
}
39023913
if (recv_list.size() > 0) {
39033914
datagram.dir = deconst(dir);

exch/exmdb/db_engine.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct table_node {
6868
};
6969

7070
struct nsub_node {
71-
char *remote_id = nullptr;
71+
std::optional<std::string> remote_id;
7272
uint32_t sub_id = 0;
7373
uint8_t notification_type = 0;
7474
BOOL b_whole = false;
@@ -167,6 +167,7 @@ struct db_conn {
167167
strcasecmp(a, b) < 0;
168168
}
169169
};
170+
/* remote_id => subscription ids */
170171
using ID_ARRAYS = std::map<const char *, std::vector<uint32_t>, xless>;
171172
/* As long as any NOTIFQ object is alive, dbase should be held at least read-locked. */
172173
using NOTIFQ = std::vector<std::pair<DB_NOTIFY_DATAGRAM, ID_ARRAYS>>;

exch/exmdb/store.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,8 @@ BOOL exmdb_server::subscribe_notification(const char *dir,
377377
nsub_node sub, *pnsub = &sub;
378378
pnsub->sub_id = last_id + 1;
379379
auto remote_id = exmdb_server::get_remote_id();
380-
if (NULL == remote_id) {
381-
pnsub->remote_id = NULL;
382-
} else {
383-
pnsub->remote_id = strdup(remote_id);
384-
if (pnsub->remote_id == nullptr)
385-
return FALSE;
386-
}
380+
if (remote_id != nullptr)
381+
sub.remote_id.emplace(remote_id);
387382
pnsub->notification_type = notification_type;
388383
pnsub->b_whole = b_whole;
389384
if (0 == folder_id) {

0 commit comments

Comments
 (0)