]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Apply Otto's suggestions made during code review
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 13 Mar 2020 15:51:58 +0000 (16:51 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 17 Mar 2020 13:12:56 +0000 (14:12 +0100)
pdns/pdns_recursor.cc

index c65a62a14673b9fde8d16becf69e4ec588dd4ec4..088cad58e3bdd023a8a7d265e7a34985b53bedb7 100644 (file)
@@ -2068,7 +2068,8 @@ static void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
         return;
       }
 
-      /* check the real source */
+      /* Now that we have retrieved the address of the client, as advertised by the proxy
+         via the proxy protocol header, check that it is allowed by our ACL */
       /* note that if the proxy header used a 'LOCAL' command, the original source and destination are untouched so everything should be fine */
       if (t_allowFrom && !t_allowFrom->match(&conn->d_source)) {
         if (!g_quiet) {
@@ -2095,7 +2096,7 @@ static void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
       conn->bytesread=0;
       conn->state=TCPConnection::GETQUESTION;
     }
-    if(!bytes || bytes < 0) {
+    if (bytes <= 0) {
       handleTCPReadResult(fd, bytes);
       return;
     }
@@ -2109,7 +2110,7 @@ static void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
       conn->data.resize(conn->qlen);
       conn->bytesread=0;
     }
-    if(!bytes || bytes < 0) {
+    if (bytes <= 0) {
       if (!handleTCPReadResult(fd, bytes)) {
         if(g_logCommonErrors) {
           g_log<<Logger::Error<<"TCP client "<< conn->d_remote.toStringWithPort() <<" disconnected after first byte"<<endl;