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

maddy imap-msgs list crashes #509

Closed
cbrake opened this issue Jun 24, 2022 · 2 comments
Closed

maddy imap-msgs list crashes #509

cbrake opened this issue Jun 24, 2022 · 2 comments
Assignees
Labels
bug Something isn't working.

Comments

@cbrake
Copy link

cbrake commented Jun 24, 2022

Describe the bug

[email@mail5 ~]$ maddy-git imap-msgs list <email address> INBOX
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x9ebdbe]

goroutine 24 [running]:
github.com/foxcpp/go-imap-mess.(*MailboxHandle).ResolveSeq(0x0, 0xe8?, 0xc000241bf0)
        /home/cbrake/go/pkg/mod/github.com/foxcpp/go-imap-mess@v0.0.0-20220105225909-b3469f4a4315/mailbox.go:50 +0x5e
github.com/foxcpp/go-imap-sql.(*Mailbox).ListMessages(0xc000259920, 0x0, 0xc000241bf0, {0xc0002d3180?, 0x5, 0x5}, 0xc000259980)
        /home/cbrake/go/pkg/mod/github.com/foxcpp/go-imap-sql@v0.5.1-0.20220623181604-c20be1a387b4/fetch.go:50 +0x555
github.com/foxcpp/maddy/internal/cli/ctl.msgsList.func1()
        /home/cbrake/maddy/internal/cli/ctl/imap.go:733 +0xf2
created by github.com/foxcpp/maddy/internal/cli/ctl.msgsList
        /home/cbrake/maddy/internal/cli/ctl/imap.go:732 +0x38f

Steps to reproduce

See above.

Using sqlite db.

Configuration file

## Maddy Mail Server - default configuration file (2021-08-16)
# Suitable for small-scale deployments. Uses its own format for local users DB,
# should be managed via maddyctl utility.
#
# See tutorials at https://maddy.email for guidance on typical
# configuration changes.
#
# See manual pages (also available at https://maddy.email) for reference
# documentation.

# ----------------------------------------------------------------------------
# Base variables

$(hostname) = <deleted>
$(primary_domain) = <deleted>
$(local_domains) = $(primary_domain) <deleted>

tls file <deleted>

# ----------------------------------------------------------------------------
# Local storage & authentication

# pass_table provides local hashed passwords storage for authentication of
# users. It can be configured to use any "table" module, in default
# configuration a table in SQLite DB is used.
# Table can be replaced to use e.g. a file for passwords. Or pass_table module
# can be replaced altogether to use some external source of credentials (e.g.
# PAM, /etc/shadow file).
#
# If table module supports it (sql_table does) - credentials can be managed
# using 'maddyctl creds' command.

auth.pass_table local_authdb {
    table sql_table {
        driver sqlite3
        dsn credentials.db
        table_name passwords
    }
}

# imapsql module stores all indexes and metadata necessary for IMAP using a
# relational database. It is used by IMAP endpoint for mailbox access and
# also by SMTP & Submission endpoints for delivery of local messages.
#
# IMAP accounts, mailboxes and all message metadata can be inspected using
# imap-* subcommands of maddyctl utility.

storage.imapsql local_mailboxes {
    driver sqlite3
    dsn imapsql.db
}

# ----------------------------------------------------------------------------
# SMTP endpoints + message routing

hostname $(hostname)

table.chain local_rewrites {
    optional_step regexp "(.+)\+(.+)@(.+)" "$1@$3"
    optional_step static {
        entry postmaster postmaster@$(primary_domain)
    }
    optional_step file /etc/maddy/aliases
}

msgpipeline local_routing {
    # Insert handling for special-purpose local domains here.
    # e.g.
    # destination lists.example.org {
    #     deliver_to lmtp tcp://127.0.0.1:8024
    # }

    destination postmaster $(local_domains) {
        modify {
            replace_rcpt &local_rewrites
        }

        deliver_to &local_mailboxes
    }

    default_destination {
        reject 550 5.1.1 "User doesn't exist"
    }
}

smtp tcp://0.0.0.0:25 {
    limits {
        # Up to 20 msgs/sec across max. 10 SMTP connections.
        all rate 20 1s
        all concurrency 10
    }

    dmarc yes
    check {
      require_mx_record
      dkim
      spf {
        debug no
        enforce_early no
        none_action ignore
        neutral_action ignore
        fail_action quarantine
        softfail_action ignore
        permerr_action quarantine
        temperr_action quarantine
      }
    }

    source $(local_domains) {
        reject 501 5.1.8 "Use Submission for outgoing SMTP"
    }
    default_source {
        destination postmaster $(local_domains) {
            deliver_to &local_routing
        }
        default_destination {
            reject 550 5.1.1 "User doesn't exist"
        }
    }
}

submission tls://0.0.0.0:465 tcp://0.0.0.0:587 {
    limits {
        # Up to 50 msgs/sec across any amount of SMTP connections.
        all rate 50 1s
    }

    auth &local_authdb

    source $(local_domains) {
        check {
            authorize_sender {
                prepare_email &local_rewrites
                user_to_email identity
            }
        }

        destination postmaster $(local_domains) {
            deliver_to &local_routing
        }
        default_destination {
            modify {
                dkim $(primary_domain) $(local_domains) default
            }
            deliver_to &remote_queue
        }
    }
    default_source {
        reject 501 5.1.8 "Non-local sender domain"
    }
}

target.remote outbound_delivery {
    limits {
        # Up to 20 msgs/sec across max. 10 SMTP connections
        # for each recipient domain.
        destination rate 20 1s
        destination concurrency 10
    }
    mx_auth {
        dane
        mtasts {
            cache fs
            fs_dir mtasts_cache/
        }
        local_policy {
            min_tls_level none
            min_mx_level none
        }
    }
}

target.queue remote_queue {
    target &outbound_delivery

    autogenerated_msg_domain $(primary_domain)
    bounce {
        destination postmaster $(local_domains) {
            deliver_to &local_routing
        }
        default_destination {
            reject 550 5.0.0 "Refusing to send DSNs to non-local addresses"
        }
    }
}

# ----------------------------------------------------------------------------
# IMAP endpoints

imap tls://0.0.0.0:993 tcp://0.0.0.0:143 {
    auth &local_authdb
    storage &local_mailboxes
}

Environment information

built from source, bbaea04, tag v0.6.1

@cbrake cbrake added the bug Something isn't working. label Jun 24, 2022
@foxcpp foxcpp self-assigned this Jun 25, 2022
foxcpp added a commit that referenced this issue Jun 25, 2022
@foxcpp
Copy link
Owner

foxcpp commented Jun 25, 2022

Should be fixed in 8463ee1.

@cbrake
Copy link
Author

cbrake commented Jun 27, 2022

works, thanks!

@cbrake cbrake closed this as completed Jun 27, 2022
shift pushed a commit to shift/maddy that referenced this issue Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants