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

scripts: disallow alias = account #3270

Merged
merged 3 commits into from Apr 17, 2023

Conversation

georglauterbach
Copy link
Member

@georglauterbach georglauterbach commented Apr 17, 2023

Description

We do not support aliases that are accounts at the same time. This commit provides a guard that checks the condition.

@bibiak1 made us aware of the fact that we allow creating aliases as users (and vice versa). I think we do not support this, and at least to me, it does not make a lot of sense.

Fixes #3262
Closes #3259

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

We do not support aliases that are accounts at the same time. This
commit provides a guard that checks the condition.
@georglauterbach georglauterbach added area/scripts kind/bug/fix A fix (PR) for a confirmed bug labels Apr 17, 2023
@georglauterbach georglauterbach added this to the v12.1.0 milestone Apr 17, 2023
@georglauterbach georglauterbach self-assigned this Apr 17, 2023
@georglauterbach
Copy link
Member Author

@polarathene I am not 100% certain whether we should disallow both directions, but to me that makes sense.

Copy link
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 😀

Preventing either DB adding a key that belongs to the other makes sense to me 👍

@georglauterbach georglauterbach merged commit 3f22cbc into master Apr 17, 2023
7 checks passed
@georglauterbach georglauterbach deleted the scripts/aliases-as-users-equals-no branch April 17, 2023 17:22
@@ -74,6 +74,10 @@ function _arg_expect_mail_account
function _account_should_not_exist_yet
{
__account_already_exists && _exit_with_error "'${MAIL_ACCOUNT}' already exists"
if grep -q "^${MAIL_ACCOUNT}" "${DATABASE_VIRTUAL}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember, that we had a similar issue in the past:

postfix-virtual.cf looks like:

myalias@example.com user@example.com

The grep statement above would also match on:

myalias@example.company.com

Adding a space for example should fix it:

if grep -q "^${MAIL_ACCOUNT} " "${DATABASE_VIRTUAL}"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be handled in both lookups then? But for accounts table, instead of space a |?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/scripts kind/bug/fix A fix (PR) for a confirmed bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug report: alias code for group mail aliases
3 participants