[2710] in Kerberos-V5-bugs

home help back first fref pref prev next nref lref last post

krb5-libs/408: Using non-blocking I/O on Windows, Win95, NT

daemon@ATHENA.MIT.EDU (deengert@anl.gov)
Mon Mar 31 15:19:26 1997

Resent-From: gnats@rt-11.MIT.EDU (GNATS Management)
Resent-To: krb5-unassigned@RT-11.MIT.EDU
Resent-Reply-To: krb5-bugs@MIT.EDU, deengert@anl.gov
Date: Mon, 31 Mar 1997 14:07:53 -0600
From: deengert@anl.gov
Reply-To: deengert@anl.gov
To: krb5-bugs@MIT.EDU
Cc: deengert@anl.gov


>Number:         408
>Category:       krb5-libs
>Synopsis:       Using non-blocking I/O on Windows, Win95, NT
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    krb5-unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   unknown
>Arrival-Date:   Mon Mar 31 15:10:01 EST 1997
>Last-Modified:
>Originator:     
>Organization:
 
 Douglas E. Engert  <DEEngert@anl.gov>
 Argonne National Laboratory
 9700 South Cass Avenue
 Argonne, Illinois  60439 
 (630) 252-5444
>Release:        1.0
>Environment:
	
	Windows, Windows, Windows NT
System: AIX pembroke 1 4 000300234600


>Description:
   net_read.c and net_write.c both expect to use blocking I/O,
   and will fail if a socket is set to non-blocking. The comments
   in the code "/* XXX must not use non-blocking I/O */" indicate
   that this is something which should be fixed. 

   This it very important when using Kerberos in a Windows 
   environment, where an application may pass on open socket 
   which is set to non-blocking to a Krb5 routine, such as 
   sendauth. 

	
>How-To-Repeat:
	
>Fix:
	
	The attached fix was designed and tested using Windows 95,
    (32-bit) were the read would fail without the change. The fix to 
    net_write.c was added for completness, but I did not see a 
    failure, since the test case did not overrun the output buffer.
    This could could be reworked to work in a UNIX environment
    as well. 

*** net_read.c.orig     Mon Mar 31 13:34:09 1997
--- net_read.c.dee      Mon Mar 31 13:42:09 1997
***************
*** 51,56 ****
--- 51,71 ----
            if (SOCKET_ERRNO == SOCKET_EINTR)
                continue;
  #if defined(_MSDOS) || (_WIN32)
+               /* check for non-blocking, and take action 
+                * this includes doing a select and let the 
+                * calling aplication's blocking hook routines
+                * or the winsock blocking hook routine
+                * dispatch other messages - DEE
+                */
+               if (SOCKET_ERRNO == WSAEWOULDBLOCK) {
+                  fd_set fdset;
+                  
+                  FD_ZERO(&fdset);
+                  FD_SET(fd, &fdset);
+                  cc = select(0, &fdset, NULL, NULL, NULL);
+                  if (cc != SOCKET_ERROR)
+                    continue;
+               }
              /* XXX this interface sucks! */
              errno = SOCKET_ERRNO;
  #endif            

*** net_write.c.orig    Mon Mar 31 13:34:24 1997
--- net_write.c.dee     Mon Mar 31 13:42:22 1997
***************
*** 50,55 ****
--- 50,71 ----
            if (SOCKET_ERRNO == SOCKET_EINTR)
                continue;
  #if defined(_MSDOS) || (_WIN32)
+               /* check for non-blocking, and take action 
+                * this includes doing a select and let the 
+                * calling aplication's blocking hook routines
+                * or the winsock blocking hook routine
+                * dispatch other messages - DEE 
+                */
+               if (SOCKET_ERRNO == WSAEWOULDBLOCK) {
+                  fd_set fdset;
+                  
+                  FD_ZERO(&fdset);
+                  FD_SET(fd, &fdset);
+                  cc = select(0, NULL, &fdset, NULL, NULL);
+                  if (cc != SOCKET_ERROR)
+                    continue;
+               }
+ 
              /* XXX this interface sucks! */
              errno = SOCKET_ERRNO;

>Audit-Trail:
>Unformatted:

K5-1.0 is unable to use non-blocking I/O 

home help back first fref pref prev next nref lref last post