Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/identd downgrade the accept error to a warning so th...



details:   https://anonhg.NetBSD.org/src/rev/6815caa3742d
branches:  trunk
changeset: 551978:6815caa3742d
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Sep 14 22:38:23 2003 +0000

description:
downgrade the accept error to a warning so that we don't exit if we are being
port scanned.

diffstat:

 libexec/identd/error.h  |  10 +++++++++-
 libexec/identd/identd.c |   8 +++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 77c54818ce9f -r 6815caa3742d libexec/identd/error.h
--- a/libexec/identd/error.h    Sun Sep 14 22:36:55 2003 +0000
+++ b/libexec/identd/error.h    Sun Sep 14 22:38:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: error.h,v 1.4 1997/10/08 07:07:46 mrg Exp $    */
+/*     $NetBSD: error.h,v 1.5 2003/09/14 22:38:23 christos Exp $       */
 
 /*
 ** error.h                                               Error handling macros
@@ -25,6 +25,14 @@
      fflush(stdout), fflush(stderr), exit(1), 0)
 
 
+#define WARNING1(fmt,v1) \
+    ((syslog_flag ? (syslog(LOG_INFO, fmt, v1),0) : 0), \
+     (debug_flag ? (fprintf(stderr, "%d , %d : WARNING : X-DBG : ", \
+                           lport, fport), \
+                   fprintf(stderr, fmt, v1), perror(": "), 0) : \
+      (printf("%d , %d : WARNING : UNKNOWN-WARNING\r\n", lport, fport), 0)), \
+     fflush(stdout), fflush(stderr), 0)
+
 #define ERROR1(fmt,v1) \
     ((syslog_flag ? (syslog(LOG_ERR, fmt, v1),0) : 0), \
      (debug_flag ? (fprintf(stderr, "%d , %d : ERROR : X-DBG : ", \
diff -r 77c54818ce9f -r 6815caa3742d libexec/identd/identd.c
--- a/libexec/identd/identd.c   Sun Sep 14 22:36:55 2003 +0000
+++ b/libexec/identd/identd.c   Sun Sep 14 22:38:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: identd.c,v 1.18 2003/05/17 21:24:38 itojun Exp $       */
+/*     $NetBSD: identd.c,v 1.19 2003/09/14 22:38:23 christos Exp $     */
 
 /*
 ** identd.c                       A TCP/IP link identification protocol server
@@ -728,8 +728,10 @@
            sadlen = sizeof(sad);
            errno = 0;
            fd = accept(0, &sad, &sadlen);
-           if (fd == -1)
-               ERROR1("main: accept. errno = %d", errno);
+           if (fd == -1) {
+               WARNING1("main: accept. errno = %d", errno);
+               continue;
+           }
       
            /*
            ** And fork, then close the fd if we are the parent.



Home | Main Index | Thread Index | Old Index