mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 09:54:40 +03:00
add "mox localserve" subcommand, for running mox locally for email-related testing/developing
localserve creates a config for listening on localhost for imap/smtp/submission/http, on port numbers 1000 + the common service port numbers. all incoming email is accepted (if checks pass), and a few pattern in localparts are recognized and result in delivery errors.
This commit is contained in:
@ -111,11 +111,15 @@ func CleanupPassedSockets() {
|
||||
}
|
||||
}
|
||||
|
||||
// Make Listen listen immediately, regardless of running as root or other user, in
|
||||
// case ForkExecUnprivileged is not used.
|
||||
var ListenImmediate bool
|
||||
|
||||
// Listen returns a newly created network listener when starting as root, and
|
||||
// otherwise (not root) returns a network listener from a file descriptor that was
|
||||
// passed by the parent root process.
|
||||
func Listen(network, addr string) (net.Listener, error) {
|
||||
if os.Getuid() != 0 {
|
||||
if os.Getuid() != 0 && !ListenImmediate {
|
||||
f, ok := listens[addr]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("no file descriptor for listener %s", addr)
|
||||
|
Reference in New Issue
Block a user