Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mda: never override any already queued messages #136

Open
wants to merge 1 commit into
base: prime
Choose a base branch
from

Conversation

liske
Copy link

@liske liske commented Mar 7, 2025

The flush id handling seems to be highly fragile for race conditions. This commit makes the fopen fail if a mess file does already exist (i.e. the user moved files from save/ to mess/) and not override it silently.

The flush id handling seems to be highly fragile for race
conditions. This commit makes the fopen fail if a mess file does
already exist (i.e. the user moved files from `save/` to `mess/`)
and **not** override it silently.
liske added a commit to liske/grommunio-documentation that referenced this pull request Mar 7, 2025
Using a filenames which cannot be interpreted as integer values in decimal notation
without any leading zeros does not work[1]. The **only** id which can be used save seems
to be `0`, other values can be overwritten due to[2] and the implementation
of `message_enqueue_retrieve_max_ID`[3] which is **not** free of race conditions. So
better be save than sorry.

[1] grommunio/gromox#135
[2] grommunio/gromox#136
[3] https://github.com/grommunio/gromox/blob/17ca866e731a3c19a6e66491442dd68a72b0ad39/mda/message_enqueue.cpp#L328

The code has been improved:
- always use `mv -n` to **never** replace existing files
- do not croak if `save/` is empty
liske added a commit to liske/grommunio-documentation that referenced this pull request Mar 7, 2025
Using a filename which cannot be interpreted as integer value in decimal notation
without any leading zeros does not work[1]. The **only** id which can be used save seems
to be `0`, other values can be overwritten due to [2] and the implementation
of `message_enqueue_retrieve_max_ID`[3] which is **not** free of race conditions. So
better be save than sorry.

[1] grommunio/gromox#135
[2] grommunio/gromox#136
[3] https://github.com/grommunio/gromox/blob/17ca866e731a3c19a6e66491442dd68a72b0ad39/mda/message_enqueue.cpp#L328

The code has been improved:
- always use `mv -n` to **never** replace existing files
- do not croak if `save/` is empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant