*** ./lib/X/XOpenDis.c	1993/06/15 03:45:24	1.1
--- ./lib/X/XOpenDis.c	1993/08/13 04:57:50
***************
*** 64,69 ****
--- 64,70 ----
  	char *fullname = NULL;		/* expanded name of display */
  	int idisplay;			/* display number */
  	int iscreen;			/* screen number */
+ 	int prefixread = 0;             /* setup prefix already read? */
  	union {
  		xConnSetup *setup;
  		char *failure;
***************
*** 231,243 ****
  	    Xfree ((char *)dpy);
  	    UnlockMutex(&lock);
  	    return(NULL);
! 	}	    
  	if (conn_auth_name) Xfree(conn_auth_name);
  	if (conn_auth_data) Xfree(conn_auth_data);
  /*
   * Now see if connection was accepted...
   */
! 	_XRead (dpy, (char *)&prefix,(long)SIZEOF(xConnSetupPrefix));
  
  	if (prefix.majorVersion < X_PROTOCOL) {
  	    fprintf (stderr,
--- 232,261 ----
  	    Xfree ((char *)dpy);
  	    UnlockMutex(&lock);
  	    return(NULL);
! 	}
! #ifdef K5AUTH
! 	if (conn_auth_namelen == 13 &&
! 	    !strncmp(conn_auth_name, "KERBEROS-V5-1", 13))
! 	{
! 	    i = k5_clientauth(dpy, &prefix);
! 	    if (i > 0)		/* We got a prefix before we're supposed to */
! 		prefixread = 1;
! 	    if (i < 0)		/* Something bombed.  Let's get outta here */
! 	    {
! 		_XDisconnectDisplay(dpy->fd);
! 		Xfree((char*)dpy);
! 		UnlockMutex(&lock);
! 		return(NULL);
! 	    }
! 	}
! #endif
  	if (conn_auth_name) Xfree(conn_auth_name);
  	if (conn_auth_data) Xfree(conn_auth_data);
  /*
   * Now see if connection was accepted...
   */
! 	if (!prefixread)
! 	    _XRead (dpy, (char *)&prefix,(long)SIZEOF(xConnSetupPrefix));
  
  	if (prefix.majorVersion < X_PROTOCOL) {
  	    fprintf (stderr,
