CVS: rdesktop scard.c,1.11,1.12

Michael Gernoth <[email protected]> Fri, 03 Nov 2006 10:57:11 -0800
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv28555

Modified Files:
	scard.c 
Log Message:
reset padding to 8, as it did not fix the disconnects
enable sendControl mutex, as the rest of rdesktop is not threadsafe and
parallel access to rdpdr_send_completion might very likely result in
these disconnects


Index: scard.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/scard.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** scard.c	3 Nov 2006 14:28:09 -0000	1.11
--- scard.c	3 Nov 2006 18:57:09 -0000	1.12
***************
*** 55,59 ****
  static pthread_mutex_t queueEmpty;
  static pthread_mutex_t hcardAccess;
! /* static pthread_mutex_t sendControl; */
  
  static PMEM_HANDLE threadListHandle = NULL;
--- 55,59 ----
  static pthread_mutex_t queueEmpty;
  static pthread_mutex_t hcardAccess;
! static pthread_mutex_t sendControl;
  
  static PMEM_HANDLE threadListHandle = NULL;
***************
*** 153,157 ****
  	}
  
- #if 0
  	if (0 != pthread_mutex_init(&sendControl, NULL))
  	{
--- 153,156 ----
***************
*** 159,164 ****
  		return 0;
  	}
- #endif
- 
  
  	if (0 !=
--- 158,161 ----
***************
*** 494,504 ****
  outForceAlignment(STREAM out, unsigned int seed)
  {
- #if 0
  	SERVER_DWORD add = (seed - (out->p - out->data) % seed) % seed;
  	if (add > 0)
  		out_uint8s(out, add);
- #else
- 	out_uint8s(out, seed);
- #endif
  }
  
--- 491,497 ----
***************
*** 693,697 ****
  	}
  
! 	outForceAlignment(out, 16);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
--- 686,690 ----
  	}
  
! 	outForceAlignment(out, 8);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
***************
*** 766,770 ****
  	out->p = pend;
  
! 	outForceAlignment(out, 16);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
--- 759,763 ----
  	out->p = pend;
  
! 	outForceAlignment(out, 8);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
***************
*** 841,845 ****
  	out_uint32_le(out, hCard);
  
! 	outForceAlignment(out, 16);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
--- 834,838 ----
  	out_uint32_le(out, hCard);
  
! 	outForceAlignment(out, 8);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
***************
*** 884,888 ****
  	}
  
! 	outForceAlignment(out, 16);
  	out_uint32_le(out, (SERVER_DWORD) dwActiveProtocol);
  	return rv;
--- 877,881 ----
  	}
  
! 	outForceAlignment(out, 8);
  	out_uint32_le(out, (SERVER_DWORD) dwActiveProtocol);
  	return rv;
***************
*** 940,944 ****
  	}
  
! 	outForceAlignment(out, 16);
  	return rv;
  }
--- 933,937 ----
  	}
  
! 	outForceAlignment(out, 8);
  	return rv;
  }
***************
*** 1197,1201 ****
  			   sizeof(SERVER_SCARD_READERSTATE_A) - 2 * sizeof(unsigned char *));
  	}
! 	outForceAlignment(out, 16);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
--- 1190,1194 ----
  			   sizeof(SERVER_SCARD_READERSTATE_A) - 2 * sizeof(unsigned char *));
  	}
! 	outForceAlignment(out, 8);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
***************
*** 1221,1225 ****
  		DEBUG_SCARD(("<--SUCCESS SCardCancel-->\n"));
  	}
! 	outForceAlignment(out, 16);
  	return rv;
  }
--- 1214,1218 ----
  		DEBUG_SCARD(("<--SUCCESS SCardCancel-->\n"));
  	}
! 	outForceAlignment(out, 8);
  	return rv;
  }
***************
*** 1326,1330 ****
  	}
  
! 	outForceAlignment(out, 16);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
--- 1319,1323 ----
  	}
  
! 	outForceAlignment(out, 8);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
***************
*** 1352,1356 ****
  		DEBUG_SCARD(("<--SUCCESS SCardBeginTransaction-->\n"));
  	}
! 	outForceAlignment(out, 16);
  	return rv;
  }
--- 1345,1349 ----
  		DEBUG_SCARD(("<--SUCCESS SCardBeginTransaction-->\n"));
  	}
! 	outForceAlignment(out, 8);
  	return rv;
  }
***************
*** 1383,1387 ****
  		DEBUG_SCARD(("<--SUCCESS SCardEndTransaction-->\n"));
  	}
! 	outForceAlignment(out, 16);
  	return rv;
  }
--- 1376,1380 ----
  		DEBUG_SCARD(("<--SUCCESS SCardEndTransaction-->\n"));
  	}
! 	outForceAlignment(out, 8);
  	return rv;
  }
***************
*** 1626,1630 ****
  		outBufferFinish(out, (char *) recvBuf, cbRecvLength);
  	}
! 	outForceAlignment(out, 16);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
--- 1619,1623 ----
  		outBufferFinish(out, (char *) recvBuf, cbRecvLength);
  	}
! 	outForceAlignment(out, 8);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
***************
*** 1742,1746 ****
  		out->p = psave;
  	}
! 	outForceAlignment(out, 16);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
--- 1735,1739 ----
  		out->p = psave;
  	}
! 	outForceAlignment(out, 8);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
***************
*** 1836,1840 ****
  		outRepos(out, dwAtrLen);
  	}
! 	outForceAlignment(out, 16);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
--- 1829,1833 ----
  		outRepos(out, dwAtrLen);
  	}
! 	outForceAlignment(out, 8);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
***************
*** 1889,1893 ****
  	out_uint32_le(out, 0x00000000);
  
! 	outForceAlignment(out, 16);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
--- 1882,1886 ----
  	out_uint32_le(out, 0x00000000);
  
! 	outForceAlignment(out, 8);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
***************
*** 1990,1994 ****
  		out_uint32_le(out, 0x00000000);
  	}
! 	outForceAlignment(out, 16);
  	return rv;
  }
--- 1983,1987 ----
  		out_uint32_le(out, 0x00000000);
  	}
! 	outForceAlignment(out, 8);
  	return rv;
  }
***************
*** 2043,2047 ****
  	out_uint32_le(out, 0x00000000);
  	out_uint32_le(out, 0x00000000);
! 	outForceAlignment(out, 16);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
--- 2036,2040 ----
  	out_uint32_le(out, 0x00000000);
  	out_uint32_le(out, 0x00000000);
! 	outForceAlignment(out, 8);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
***************
*** 2156,2160 ****
  	}
  
! 	outForceAlignment(out, 16);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
--- 2149,2153 ----
  	}
  
! 	outForceAlignment(out, 8);
  	SC_xfreeallmemory(&lcHandle);
  	return rv;
***************
*** 2505,2515 ****
  	scard_device_control(data->handle, data->request, data->in, data->out);
  	buffer_len = (size_t) data->out->p - (size_t) data->out->data;
- #if 0
  	pthread_mutex_lock(&sendControl);
- #endif
  	rdpdr_send_completion(data->device, data->id, 0, buffer_len, data->out->data, buffer_len);
- #if 0
  	pthread_mutex_unlock(&sendControl);
- #endif
  	SC_destroyThreadData(data);
  }
--- 2498,2504 ----


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642