handle sigpipe better for server security
authorAndrew Tridgell <tridge@samba.org>
Wed, 21 Aug 1996 12:36:01 +0000 (12:36 +0000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 21 Aug 1996 12:36:01 +0000 (12:36 +0000)
(This used to be commit d87fdb3ee95b6640d5deef823f22e8d98350ca33)

source3/smbd/server.c

index 683d63e7aaa65723f5e362b88974013ca6ef9c65..0e0a524f166b4293efb4be53f128191adee7ebe4 100644 (file)
@@ -1618,6 +1618,20 @@ static int sig_cld()
   **************************************************************************/
 static int sig_pipe()
 {
+  extern int password_client;
+  BlockSignals(True,SIGPIPE);
+
+  if (password_client != -1) {
+    DEBUG(3,("lost connection to password server\n"));
+    close(password_client);
+    password_client = -1;
+#ifndef DONT_REINSTALL_SIG
+    signal(SIGPIPE, SIGNAL_CAST sig_pipe);
+#endif
+    BlockSignals(False,SIGPIPE);
+    return 0;
+  }
+
   exit_server("Got sigpipe\n");
   return(0);
 }