cleaned up deprecations and warnings

This commit is contained in:
Johannes Bülow 2025-03-13 14:40:39 +01:00
parent 006a4f9d6d
commit e4e75cf975
Signed by: jmb
GPG key ID: B56971CF7B8F83A6
7 changed files with 12 additions and 10 deletions

View file

@ -4,7 +4,6 @@ package main
import (
"bytes"
"flag"
"io/ioutil"
"log"
"net/smtp"
@ -60,7 +59,7 @@ func main() {
log.Fatalf("DKIM configuration error: %v", err)
}
privKey, err = ioutil.ReadFile(*privKeyFile)
privKey, err = io.ReadFile(*privKeyFile)
if err != nil {
log.Fatalf("Couldn't read private key: %v", err)
}

View file

@ -20,7 +20,6 @@ func (env *Envelope) AddReceivedLine(peer Peer) {
tlsDetails := ""
tlsVersions := map[uint16]string{
tls.VersionSSL30: "SSL3.0",
tls.VersionTLS10: "TLS1.0",
tls.VersionTLS11: "TLS1.1",
tls.VersionTLS12: "TLS1.2",

View file

@ -5,7 +5,7 @@ import (
"net/smtp"
"strings"
"github.com/chrj/smtpd"
"git.jmbit.de/jmb/smtpd"
)
func ExampleServer() {

4
go.mod
View file

@ -1,3 +1,3 @@
module github.com/chrj/smtpd
module git.jmbit.de/jmb/smtpd
go 1.14
go 1.24

View file

@ -7,7 +7,6 @@ import (
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"net"
"net/textproto"
"strconv"
@ -288,6 +287,7 @@ func (session *session) handleRCPT(cmd command) {
}
func (session *session) handleSTARTTLS(cmd command) {
_ = cmd
if session.tls {
session.reply(502, "Already running in TLS")
@ -334,6 +334,7 @@ func (session *session) handleSTARTTLS(cmd command) {
}
func (session *session) handleDATA(cmd command) {
_ = cmd
if session.envelope == nil || len(session.envelope.Recipients) == 0 {
session.reply(502, "Missing RCPT TO command.")
@ -371,7 +372,7 @@ func (session *session) handleDATA(cmd command) {
}
// Discard the rest and report an error.
_, err = io.Copy(ioutil.Discard, reader)
_, err = io.Copy(io.Discard, reader)
if err != nil {
// Network error, ignore
@ -390,17 +391,20 @@ func (session *session) handleDATA(cmd command) {
}
func (session *session) handleRSET(cmd command) {
_ = cmd
session.reset()
session.reply(250, "Go ahead")
return
}
func (session *session) handleNOOP(cmd command) {
_ = cmd
session.reply(250, "Go ahead")
return
}
func (session *session) handleQUIT(cmd command) {
_ = cmd
session.reply(221, "OK, bye")
session.close()
return

View file

@ -190,7 +190,7 @@ func (srv *Server) Serve(l net.Listener) error {
default:
}
if ne, ok := e.(net.Error); ok && ne.Temporary() {
if ne, ok := e.(net.Error); ok && ne.Timeout() {
time.Sleep(time.Second)
continue
}

View file

@ -14,7 +14,7 @@ import (
"testing"
"time"
"github.com/chrj/smtpd"
"git.jmbit.de/jmb/smtpd"
)
var localhostCert = []byte(`-----BEGIN CERTIFICATE-----