(cc'ing tech@)
Jason Mader writes:
[...]
> Feb 23 18:06:11 dns2 identd[11069]: main: accept. errno = 53
[...]
If that is a real problem for you, run identd under inetd.
Here's a patch that attempts to fix your problem (and more):
- in bg mode, don't exit if accept() errors out with ECONNABORTED or
EINTR, and sleep 1 second if no fd is available ; if another error
happens, print a human-readable string, not only errno
- sync comment and manpage with reality (identd doesn't fallback to user
nobody)
I noticed that /etc/rc.d/identd starts identd with the "-elo" flags,
while inetd uses only "-el". Shouldn't that be synced too?
Thoughts?
Index: identd.8
===
RCS file: /cvs/src/libexec/identd/identd.8,v
retrieving revision 1.28
diff -u -p -r1.28 identd.8
--- identd.86 Jun 2010 07:05:40 - 1.28
+++ identd.828 Feb 2013 11:49:17 -
@@ -175,11 +175,7 @@ TCP/IP port if running as a stand-alone
.Nm
runs as user
.Qq _identd
-by default and falls back to
-.Qq nobody
-if the
-.Qq _identd
-user does not exist.
+by default.
.It Fl v
Log every request to syslog if
.Fl l
Index: identd.c
===
RCS file: /cvs/src/libexec/identd/identd.c,v
retrieving revision 1.50
diff -u -p -r1.50 identd.c
--- identd.c4 Dec 2012 02:24:47 - 1.50
+++ identd.c28 Feb 2013 11:46:12 -
@@ -162,7 +162,7 @@ main(int argc, char *argv[])
openlog(__progname, LOG_PID, LOG_DAEMON);
- /* runs as _identd if possible, fallback to "nobody" */
+ /* runs as _identd by default */
if (getuid() == 0) {
if ((pwd = getpwnam(DEFAULT_UID)) == NULL)
error("no such user %s", DEFAULT_UID);
@@ -426,8 +426,14 @@ main(int argc, char *argv[])
* Accept the new client
*/
fd = accept(pfds[i].fd, NULL, NULL);
- if (fd == -1)
- error("main: accept. errno = %d",
errno);
+ if (fd == -1) {
+ if (errno == EMFILE || errno == ENFILE)
+ sleep(1);
+ else if (errno != EINTR
+ && errno != ECONNABORTED)
+ error("main: accept: %s",
+ strerror(errno));
+ }
/*
* Fork a child, parent continues