1N/A * Copyright (c) 1999-2007 Sendmail, Inc. and its suppliers. 1N/A * All rights reserved. 1N/A * By using this file, you agree to the terms and conditions set 1N/A * forth in the LICENSE file which can be found at the top level of 1N/A * the sendmail distribution. 1N/A#
endif /* NETINET || NETINET6 */ 1N/A#
endif /* SM_CONF_POLL */ 1N/A#
endif /* !_FFR_WORKERS_POOL */ 1N/A** MI_OPENSOCKET -- create the socket where this filter and the MTA will meet 1N/A** conn -- connection description 1N/A** backlog -- listen backlog 1N/A** dbg -- debug level 1N/A** rmsocket -- if true, try to unlink() the socket first 1N/A** (UNIX domain sockets only) 1N/A** smfi -- filter structure to use 1N/A "%s: Opening listen socket on conn %s",
1N/A "%s: Unable to create listening socket on conn %s",
1N/A** MI_MILTEROPEN -- setup socket to listen on 1N/A** conn -- connection description 1N/A** backlog -- listen backlog 1N/A** rmsocket -- if true, try to unlink() the socket first 1N/A** (UNIX domain sockets only) 1N/A** name -- name for logging 1N/A** socket upon success, error code otherwise. 1N/A** sets sockpath if UNIX socket. 1N/A /* protocol:filename or protocol:port@host */ 1N/A /* default to AF_UNIX */ 1N/A /* default to AF_INET */ 1N/A /* default to AF_INET6 */ 1N/A#
else /* NETINET6 */ 1N/A /* no protocols available */ 1N/A "%s: no valid socket protocols available",
1N/A#
endif /* NETINET6 */ 1N/A#
endif /* NETINET */ 1N/A#
endif /* NETINET6 */ 1N/A /* default to AF_UNIX */ 1N/A /* default to AF_INET */ 1N/A /* default to AF_INET6 */ 1N/A#
else /* NETINET6 */ 1N/A#
endif /* NETINET6 */ 1N/A#
endif /* NETINET */ 1N/A /* if not safe, don't create */ 1N/A "%s: UNIX socket name %s unsafe",
1N/A#
endif /* NETINET */ 1N/A#
endif /* NETINET && NETINET6 */ 1N/A#
endif /* NETINET6 */ 1N/A /* Parse port@host */ 1N/A#
endif /* NETINET */ 1N/A#
endif /* NETINET6 */ 1N/A#
else /* NO_GETSERVBYNAME */ 1N/A "%s: unknown port name %s",
1N/A#
endif /* NO_GETSERVBYNAME */ 1N/A#
endif /* NETINET */ 1N/A#
endif /* NETINET6 */ 1N/A#
endif /* NETINET */ 1N/A#
endif /* NETINET6 */ 1N/A "%s: Invalid numeric domain spec \"%s\"",
1N/A "%s: Invalid numeric domain spec \"%s\"",
1N/A "%s: Unknown host name %s",
1N/A#
endif /* NETINET */ 1N/A#
endif /* NETINET6 */ 1N/A "%s: Unknown protocol for %s (%d)",
1N/A#
endif /* NETINET6 */ 1N/A#
endif /* NETINET */ 1N/A#
endif /* NETINET6 */ 1N/A#
endif /* NETINET || NETINET6 */ 1N/A "%s: Unable to create new socket: %s",
1N/A "%s: Unable to set close-on-exec: %s",
name,
1N/A "%s: set reuseaddr failed (%s)",
name,
1N/A "%s: Unable to stat() %s: %s",
1N/A "%s: %s is not a UNIX domain socket",
1N/A "%s: Unable to remove %s: %s",
1N/A "%s: Unable to bind to port %s: %s",
1N/A "%s: listen call failed: %s",
name,
1N/A ** Set global variable sockpath so the UNIX socket can be 1N/A ** unlink()ed at exit. 1N/A "%s: can't malloc(%d) for sockpath: %s",
1N/A** MI_THREAD_HANDLE_WRAPPER -- small wrapper to handle session 1N/A** arg -- argument to pass to mi_handle_session() 1N/A** results from mi_handle_session() 1N/A ** Note: on some systems this generates a compiler warning: 1N/A ** cast to pointer from integer of different size 1N/A ** You can safely ignore this warning as the result of this function 1N/A ** is not used anywhere. 1N/A#
endif /* _FFR_WORKERS_POOL */ 1N/A** MI_CLOSENER -- close listen socket 1N/A#
endif /* S_ISSOCK */ 1N/A /* XXX sleep() some time before doing this? */ 1N/A#
endif /* S_ISSOCK */ 1N/A#
endif /* S_ISSOCK */ 1N/A** MI_LISTENER -- Generic listener harness 1N/A** Open up listen port 1N/A** Wait for connections 1N/A** conn -- connection description 1N/A** dbg -- debug level 1N/A** smfi -- filter structure to use 1N/A** backlog -- listen queue backlog size 1N/A** MI_SUCCESS -- Exited normally 1N/A** (session finished or we were told to exit) 1N/A** MI_FAILURE -- Network initialization failed. 1N/A** Solaris 2.6, perhaps others, gets an internal threads library panic 1N/A** when sleep() is used: 1N/A** thread_create() failed, returned 11 (EINVAL) 1N/A** co_enable, thr_create() returned error = 24 1N/A** libthread panic: co_enable failed (PID: 17793 LWP 1) 1N/A "MI_SLEEP(): select() returned non-zero result %d, errno = %d", \
1N/A#
else /* BROKEN_PTHREAD_SLEEP */ 1N/A#
endif /* BROKEN_PTHREAD_SLEEP */ 1N/A#
endif /* _FFR_DUP_FD */ 1N/A int mcnt = 0;
/* error count for malloc() failures */ 1N/A int tcnt = 0;
/* error count for thread_create() failures */ 1N/A int acnt = 0;
/* error count for accept() failures */ 1N/A int scnt = 0;
/* error count for select() failures */ 1N/A#
endif /* !_FFR_WORKERS_POOL */ 1N/A#
endif /* _FFR_WORKERS_POOL */ 1N/A "%s: listenfd=%d corrupted, terminating, errno=%d",
1N/A /* select on interface ports */ 1N/A if (r == 0)
/* timeout */ 1N/A continue;
/* just check mi_stop() */ 1N/A "%s: %s() failed (%s), %s",
1N/A /* some error: just stop for now... */ 1N/A "%s: %s() returned exception for socket, abort",
1N/A scnt = 0;
/* reset error counter for select() */ 1N/A ** If remote side closes before accept() finishes, 1N/A ** sockaddr might not be fully filled in. 1N/A#
endif /* BSD4_4_SOCKADDR */ 1N/A /* check if acceptable for select() */ 1N/A#
endif /* ECONNABORTED */ 1N/A#
endif /* EWOULDBLOCK */ 1N/A "%s: accept() returned invalid socket (%s), %s",
1N/A acnt = 0;
/* reset error counter for accept() */ 1N/A#
endif /* _FFR_DUP_FD */ 1N/A "%s: set keepalive failed (%s)",
1N/A /* XXX: continue? */ 1N/A mcnt = 0;
/* reset error counter for malloc() */ 1N/A#
else /* _FFR_WORKERS_POOL */ 1N/A#
endif /* _FFR_WORKERS_POOL */