]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
make sure we don't trip over disconnects on the controlsocket
authorBert Hubert <bert.hubert@netherlabs.nl>
Mon, 14 Feb 2011 12:50:05 +0000 (12:50 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Mon, 14 Feb 2011 12:50:05 +0000 (12:50 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2014 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/dynlistener.cc

index 7d28cdfb1e18b976410c5a1bdcd4978da8f03f15..e36dfa7d6a58bc826a935ba5bf571a4a9b810f31 100644 (file)
@@ -187,7 +187,8 @@ string DynListener::getLine()
         continue;
       }
 
-      if(!d_tcp && d_tcprange.match(&remote)) {
+      if(d_tcp && !d_tcprange.match(&remote)) { // ????
+        L<<Logger::Error<<"Access denied to remote "<<remote.toString()<<" because not allowed"<<endl;
         writen2(d_client, "Access denied to "+remote.toString()+"\n");
         close(d_client);
         continue;
@@ -227,7 +228,7 @@ string DynListener::getLine()
   else {
     if(isatty(0))
       write(1, "% ", 2);
-    if((len= read(0, &mesg[0], mesg.size())) < 0) 
+    if((len=read(0, &mesg[0], mesg.size())) < 0) 
       throw AhuException("Reading from the control pipe: "+stringerror());
     else if(len==0)
       throw AhuException("Guardian exited - going down as well");
@@ -280,6 +281,7 @@ void DynListener::theListener()
 {
   try {
     map<string,string> parameters;
+    signal(SIGPIPE,SIG_IGN);
 
     for(int n=0;;++n) {
       //      cerr<<"Reading new line, "<<d_client<<endl;