mail-server icon indicating copy to clipboard operation
mail-server copied to clipboard

[enhancement]: exclude SEL licensed code from AGPL licensed code

Open afontenot opened this issue 5 months ago • 2 comments

What happened?

I attempted to build the program after removing code licensed under SEL, in particular the snippet here: https://github.com/stalwartlabs/mail-server/blob/main/crates/directory/src/backend/internal/mod.rs#L101

    // SPDX-SnippetBegin
    // SPDX-FileCopyrightText: 2020 Stalwart Labs Ltd <[email protected]>
    // SPDX-License-Identifier: LicenseRef-SEL

    pub fn has_tenant_access(&self, tenant_id: Option<u32>) -> bool {
        tenant_id.map_or(true, |tenant_id| {
            self.tenant.map_or(false, |t| tenant_id == t)
                || (self.typ == Type::Tenant && self.id == tenant_id)
        })
    }

    // SPDX-SnippetEnd

Quite a bit of code that is AGPL 3.0 licensed in crates/directory/src/backend/internal/manage.rs depends on this function. I'm building without the enterprise --feature and this doesn't make a difference here as the code isn't conditionally compiled.

How can we reproduce the problem?

git clone https://github.com/stalwartlabs/mail-server && cd mail-server
# remove SEL licensed code
perl -i -0pe 's/ *\/\/ SPDX-SnippetBegin[^\n]*\n[^\n]*\n[^\n]*SPDX-License-Identifier: LicenseRef-SEL.*?\/\/ SPDX-SnippetEnd *//gms' crates/**/*.rs
grep -l 'SPDX-License-Identifier: LicenseRef-SEL' crates/**/*.rs | xargs truncate -s0
# build
export RUSTUP_TOOLCHAIN=stable
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
cargo build --frozen --release -p mail-server --no-default-features --features 'rocks'

Version

v0.10.x

What database are you using?

None

What blob storage are you using?

None

Where is your directory located?

None

What operating system are you using?

None

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

afontenot avatar Sep 21 '24 19:09 afontenot