[Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.128,1.128.2.1

Moshe Zadka moshez@users.sourceforge.net
Fri, 30 Mar 2001 23:13:32 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv32117/Modules

Modified Files:
      Tag: release20-maint
	socketmodule.c 
Log Message:
- #125981 -- socketmodule.c --  closing sockets was not thread-safe.

- Use openssl/*.h to include the OpenSSL header files

- Patch #103636: Allow writing strings containing null bytes to an SSL socket


Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.128
retrieving revision 1.128.2.1
diff -C2 -r1.128 -r1.128.2.1
*** socketmodule.c	2000/10/06 15:37:06	1.128
--- socketmodule.c	2001/03/31 07:13:29	1.128.2.1
***************
*** 157,166 ****
  
  #ifdef USE_SSL
! #include "rsa.h"
! #include "crypto.h"
! #include "x509.h"
! #include "pem.h"
! #include "ssl.h"
! #include "err.h"
  #endif /* USE_SSL */
  
--- 157,166 ----
  
  #ifdef USE_SSL
! #include "openssl/rsa.h"
! #include "openssl/crypto.h"
! #include "openssl/x509.h"
! #include "openssl/pem.h"
! #include "openssl/ssl.h"
! #include "openssl/err.h"
  #endif /* USE_SSL */
  
***************
*** 899,910 ****
  PySocketSock_close(PySocketSockObject *s, PyObject *args)
  {
  	if (!PyArg_ParseTuple(args, ":close"))
  		return NULL;
! 	if (s->sock_fd != -1) {
  		Py_BEGIN_ALLOW_THREADS
! 		(void) SOCKETCLOSE(s->sock_fd);
  		Py_END_ALLOW_THREADS
  	}
- 	s->sock_fd = -1;
  	Py_INCREF(Py_None);
  	return Py_None;
--- 899,911 ----
  PySocketSock_close(PySocketSockObject *s, PyObject *args)
  {
+ 	SOCKET_T fd;
  	if (!PyArg_ParseTuple(args, ":close"))
  		return NULL;
! 	if ((fd = s->sock_fd) != -1) {
! 		s->sock_fd = -1;
  		Py_BEGIN_ALLOW_THREADS
! 		(void) SOCKETCLOSE(fd);
  		Py_END_ALLOW_THREADS
  	}
  	Py_INCREF(Py_None);
  	return Py_None;
***************
*** 2133,2137 ****
  	size_t len = 0;
    
! 	if (!PyArg_ParseTuple(args, "s|i:write", &data, &len))
  		return NULL;
    
--- 2134,2138 ----
  	size_t len = 0;
    
! 	if (!PyArg_ParseTuple(args, "s#|i:write", &data, &len))
  		return NULL;