diff --git a/dmarcdb/db.go b/dmarcdb/db.go index bb3835d..7845869 100644 --- a/dmarcdb/db.go +++ b/dmarcdb/db.go @@ -21,12 +21,9 @@ import ( "github.com/mjl-/mox/dmarcrpt" "github.com/mjl-/mox/dns" - "github.com/mjl-/mox/mlog" "github.com/mjl-/mox/mox-" ) -var xlog = mlog.New("dmarcdb") - var ( DBTypes = []any{DomainFeedback{}} // Types stored in DB. DB *bstore.DB // Exported for backups. diff --git a/dsn/dsn.go b/dsn/dsn.go index 1d530f8..741434b 100644 --- a/dsn/dsn.go +++ b/dsn/dsn.go @@ -310,10 +310,8 @@ func (m *Message) Compose(log *mlog.Log, smtputf8 bool) ([]byte, error) { headers = m.Original } else if err != nil { return nil, err - } else { - // This is a whole message. We still only include the headers. - // todo: include the whole body. } + // Else, this is a whole message. We still only include the headers. todo: include the whole body. origHdr := textproto.MIMEHeader{} if smtputf8 { diff --git a/imapclient/parse.go b/imapclient/parse.go index b0588db..256f8d0 100644 --- a/imapclient/parse.go +++ b/imapclient/parse.go @@ -1072,16 +1072,6 @@ func (c *Conn) xnamespaceDescr() NamespaceDescr { return NamespaceDescr{prefix, b, exts} } -// require one of caps to be enabled. -func (c *Conn) xneedEnabled(msg string, caps ...Capability) { - for _, cap := range caps { - if _, ok := c.CapEnabled[cap]; ok { - return - } - } - c.xerrorf("%s: need one of following enabled capabilities: %v", msg, caps) -} - // require all of caps to be disabled. func (c *Conn) xneedDisabled(msg string, caps ...Capability) { for _, cap := range caps { diff --git a/imapserver/parse.go b/imapserver/parse.go index c699f83..15bff3b 100644 --- a/imapserver/parse.go +++ b/imapserver/parse.go @@ -146,23 +146,6 @@ func (p *parser) xtake1n(n int, what string) string { return p.xtaken(n) } -func (p *parser) xtake1fn(fn func(i int, c rune) bool) string { - i := 0 - s := "" - for _, c := range p.upper[p.o:] { - if !fn(i, c) { - break - } - s += string(c) - i++ - } - if s == "" { - p.xerrorf("expected at least one character") - } - p.o += len(s) - return s -} - func (p *parser) xtakechars(s string, what string) string { p.xnonempty() for i, c := range p.orig[p.o:] { @@ -182,13 +165,6 @@ func (p *parser) xtaken(n int) string { return r } -func (p *parser) peekn(n int) (string, bool) { - if len(p.upper[p.o:]) < n { - return "", false - } - return p.upper[p.o : p.o+n], true -} - func (p *parser) space() bool { return p.take(" ") } @@ -904,62 +880,3 @@ func (p *parser) xdate() time.Time { } return time.Date(year, mon, day, 0, 0, 0, 0, time.UTC) } - -// ../rfc/9051:7090 ../rfc/4466:716 -func (p *parser) xtaggedExtLabel() string { - return p.xtake1fn(func(i int, c rune) bool { - return c >= 'A' && c <= 'Z' || c == '-' || c == '_' || c == '.' || i > 0 && (c >= '0' && c <= '9' || c == ':') - }) -} - -// no return value since we don't currently use the value. -// ../rfc/9051:7111 ../rfc/4466:749 -func (p *parser) xtaggedExtVal() { - if p.take("(") { - if p.take(")") { - return - } - p.xtaggedExtComp() - p.xtake(")") - } else { - p.xtaggedExtSimple() - } -} - -// ../rfc/9051:7109 ../rfc/4466:747 -func (p *parser) xtaggedExtSimple() { - s := p.digits() - if s == "" { - p.xnumSet() - } - - // This can be a number64, or the start of a sequence-set. A sequence-set can also - // start with a number, but only an uint32. After the number we'll try to continue - // parsing as a sequence-set. - _, err := strconv.ParseInt(s, 10, 64) - if err != nil { - p.xerrorf("parsing int: %v", err) - } - - if p.take(":") { - if !p.take("*") { - p.xnznumber() - } - } - for p.take(",") { - p.xnumRange() - } -} - -// ../rfc/9051:7111 ../rfc/4466:735 -func (p *parser) xtaggedExtComp() { - if p.take("(") { - p.xtaggedExtComp() - p.xtake(")") - return - } - p.xastring() - for p.space() { - p.xtaggedExtComp() - } -} diff --git a/imapserver/server_test.go b/imapserver/server_test.go index f9c5849..a7edf56 100644 --- a/imapserver/server_test.go +++ b/imapserver/server_test.go @@ -648,7 +648,7 @@ func TestSequence(t *testing.T) { // Test that a message that is expunged by another session can be read as long as a // reference is held by a session. New sessions do not see the expunged message. // todo: possibly implement the additional reference counting. so far it hasn't been worth the trouble. -func disabledTestReference(t *testing.T) { +func DisabledTestReference(t *testing.T) { tc := start(t) defer tc.close() tc.client.Login("mjl@mox.example", "testtest") diff --git a/integration_test.go b/integration_test.go index 6770ff7..a22e027 100644 --- a/integration_test.go +++ b/integration_test.go @@ -3,7 +3,6 @@ package main import ( - "context" "crypto/tls" "fmt" "net" @@ -21,8 +20,6 @@ import ( "github.com/mjl-/mox/smtpclient" ) -var ctxbg = context.Background() - func tcheck(t *testing.T, err error, errmsg string) { if err != nil { t.Helper() diff --git a/junk/filter.go b/junk/filter.go index c927c44..afceeee 100644 --- a/junk/filter.go +++ b/junk/filter.go @@ -29,8 +29,8 @@ import ( var ( xlog = mlog.New("junk") - errBadContentType = errors.New("bad content-type") // sure sign of spam - errClosed = errors.New("filter is closed") + // errBadContentType = errors.New("bad content-type") // sure sign of spam, todo: use this error + errClosed = errors.New("filter is closed") ) type word struct { diff --git a/smtpserver/server.go b/smtpserver/server.go index ce65685..c9b0151 100644 --- a/smtpserver/server.go +++ b/smtpserver/server.go @@ -1340,13 +1340,10 @@ func (c *conn) cmdRcpt(p *parser) { for p.space() { // ../rfc/5321:2275 key := p.xparamKeyword() - K := strings.ToUpper(key) - switch K { + // K := strings.ToUpper(key) // todo future: DSN, ../rfc/3461, with "NOTIFY" - default: - // ../rfc/5321:2230 - xsmtpUserErrorf(smtp.C555UnrecognizedAddrParams, smtp.SeSys3NotSupported3, "unrecognized parameter %q", key) - } + // ../rfc/5321:2230 + xsmtpUserErrorf(smtp.C555UnrecognizedAddrParams, smtp.SeSys3NotSupported3, "unrecognized parameter %q", key) } p.xend()