Validation fixes

This commit is contained in:
Neil Alexander
2021-07-08 22:38:18 +01:00
parent 73ec35d5fa
commit f9ae101d38
4 changed files with 15 additions and 4 deletions

View File

@@ -63,11 +63,12 @@ func (b *Backend) AnonymousLogin(state *smtp.ConnectionState) (smtp.Session, err
if err != nil {
return nil, fmt.Errorf("hex.DecodeString: %w", err)
}
if state.Hostname != base62.EncodeToString(pks) {
remote := base62.EncodeToString(pks)
if state.Hostname != remote {
return nil, fmt.Errorf("You are not who you claim to be")
}
b.Log.Println("Incoming SMTP session from", state.RemoteAddr.String())
b.Log.Println("Incoming SMTP session from", remote)
return &SessionRemote{
backend: b,
state: state,