eras        14/05/15 05:45:32

  Added:                cyrus-sasl-2.1.26-fix_dovecot_authentication.patch
  Log:
  Fix authentication loop - bug #510320
  
  (Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key 
0x77F1F175586A3B1F)

Revision  Changes    Path
1.1                  
dev-libs/cyrus-sasl/files/cyrus-sasl-2.1.26-fix_dovecot_authentication.patch

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/cyrus-sasl/files/cyrus-sasl-2.1.26-fix_dovecot_authentication.patch?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/cyrus-sasl/files/cyrus-sasl-2.1.26-fix_dovecot_authentication.patch?rev=1.1&content-type=text/plain

Index: cyrus-sasl-2.1.26-fix_dovecot_authentication.patch
===================================================================
Bug #510320
--- saslauthd/auth_rimap.c      2012-10-12 14:05:48.000000000 +0000
+++ saslauthd/auth_rimap.c      2014-05-15 05:23:02.000000000 +0000
@@ -371,7 +371,7 @@
     if ( rc>0 ) {
         /* check if there is more to read */
         fd_set         perm;
-        int            fds, ret;
+        int            fds, ret, loopc;
         struct timeval timeout;
 
         FD_ZERO(&perm);
@@ -380,6 +380,7 @@
 
         timeout.tv_sec  = 1;
         timeout.tv_usec = 0;
+        loopc = 0;
         while( select (fds, &perm, NULL, NULL, &timeout ) >0 ) {
            if ( FD_ISSET(s, &perm) ) {
               ret = read(s, rbuf+rc, sizeof(rbuf)-rc);
@@ -387,6 +388,14 @@
                  rc = ret;
                  break;
               } else {
+                 if (ret == 0) {
+                   loopc += 1;
+                 } else {
+                   loopc = 0;
+                 }
+                 if (loopc > sizeof(rbuf)) { // arbitrary chosen value
+                   break;
+                 }
                  rc += ret;
               }
            }
@@ -484,7 +493,7 @@
     if ( rc>0 ) {
         /* check if there is more to read */
         fd_set         perm;
-        int            fds, ret;
+        int            fds, ret, loopc;
         struct timeval timeout;
 
         FD_ZERO(&perm);
@@ -493,6 +502,7 @@
 
         timeout.tv_sec  = 1;
         timeout.tv_usec = 0;
+        loopc = 0;
         while( select (fds, &perm, NULL, NULL, &timeout ) >0 ) {
            if ( FD_ISSET(s, &perm) ) {
               ret = read(s, rbuf+rc, sizeof(rbuf)-rc);
@@ -500,6 +510,14 @@
                  rc = ret;
                  break;
               } else {
+                 if (ret == 0) {
+                   loopc += 1;
+                 } else {
+                   loopc = 0;
+                 }
+                 if (loopc > sizeof(rbuf)) { // arbitrary chosen value
+                   break;
+                 }
                  rc += ret;
               }
            }
--- lib/checkpw.c       2012-01-27 23:31:36.000000000 +0000
+++ lib/checkpw.c       2014-05-15 05:19:35.000000000 +0000
@@ -587,16 +587,14 @@
            /* Timeout. */
            errno = ETIMEDOUT;
            return -1;
-       case +1:
-           if (FD_ISSET(fd, &rfds)) {
-               /* Success, file descriptor is readable. */
-               return 0;
-           }
-           return -1;
        case -1:
            if (errno == EINTR || errno == EAGAIN)
                continue;
        default:
+            if (FD_ISSET(fd, &rfds)) {
+                /* Success, file descriptor is readable. */
+                return 0;
+            }
            /* Error catch-all. */
            return -1;
        }




Reply via email to