[Python-checkins] python/dist/src/Modules _ssl.c,1.4,1.5

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
Tue, 02 Jul 2002 11:25:03 -0700


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

Modified Files:
	_ssl.c 
Log Message:
Repair badly formatted code.


Index: _ssl.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_ssl.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** _ssl.c	13 Jun 2002 20:32:47 -0000	1.4
--- _ssl.c	2 Jul 2002 18:25:00 -0000	1.5
***************
*** 88,107 ****
  	case SSL_ERROR_ZERO_RETURN:
  		errstr = "TLS/SSL connection has been closed";
! 		p=PY_SSL_ERROR_ZERO_RETURN;
  		break;
  	case SSL_ERROR_WANT_READ:
  		errstr = "The operation did not complete (read)";
! 		p=PY_SSL_ERROR_WANT_READ;
  		break;
  	case SSL_ERROR_WANT_WRITE:
! 		p=PY_SSL_ERROR_WANT_WRITE;
  		errstr = "The operation did not complete (write)";
  		break;
  	case SSL_ERROR_WANT_X509_LOOKUP:
! 		p=PY_SSL_ERROR_WANT_X509_LOOKUP;
  		errstr = "The operation did not complete (X509 lookup)";
  		break;
  	case SSL_ERROR_WANT_CONNECT:
! 		p=PY_SSL_ERROR_WANT_CONNECT;
  		errstr = "The operation did not complete (connect)";
  		break;
--- 88,107 ----
  	case SSL_ERROR_ZERO_RETURN:
  		errstr = "TLS/SSL connection has been closed";
! 		p = PY_SSL_ERROR_ZERO_RETURN;
  		break;
  	case SSL_ERROR_WANT_READ:
  		errstr = "The operation did not complete (read)";
! 		p = PY_SSL_ERROR_WANT_READ;
  		break;
  	case SSL_ERROR_WANT_WRITE:
! 		p = PY_SSL_ERROR_WANT_WRITE;
  		errstr = "The operation did not complete (write)";
  		break;
  	case SSL_ERROR_WANT_X509_LOOKUP:
! 		p = PY_SSL_ERROR_WANT_X509_LOOKUP;
  		errstr = "The operation did not complete (X509 lookup)";
  		break;
  	case SSL_ERROR_WANT_CONNECT:
! 		p = PY_SSL_ERROR_WANT_CONNECT;
  		errstr = "The operation did not complete (connect)";
  		break;
***************
*** 109,125 ****
  	{
  		unsigned long e = ERR_get_error();
! 		if(e==0){
! 			if(ret==0){
! 				p=PY_SSL_ERROR_EOF;
  				errstr = "EOF occurred in violation of protocol";
! 			}else if(ret==-1){
  				/* the underlying BIO reported an I/O error */
  				return obj->Socket->errorhandler();
! 			}else{  /* possible? */
! 				p=PY_SSL_ERROR_SYSCALL;
  				errstr = "Some I/O error occurred";
  			}
  		} else {
! 			p=PY_SSL_ERROR_SYSCALL;
  			/* XXX Protected by global interpreter lock */
  			errstr = ERR_error_string(e, NULL);
--- 109,125 ----
  	{
  		unsigned long e = ERR_get_error();
! 		if (e == 0) {
! 			if (ret == 0) {
! 				p = PY_SSL_ERROR_EOF;
  				errstr = "EOF occurred in violation of protocol";
! 			} else if (ret == -1) {
  				/* the underlying BIO reported an I/O error */
  				return obj->Socket->errorhandler();
! 			} else {  /* possible? */
! 				p = PY_SSL_ERROR_SYSCALL;
  				errstr = "Some I/O error occurred";
  			}
  		} else {
! 			p = PY_SSL_ERROR_SYSCALL;
  			/* XXX Protected by global interpreter lock */
  			errstr = ERR_error_string(e, NULL);
***************
*** 130,144 ****
  	{
  		unsigned long e = ERR_get_error();
! 		p=PY_SSL_ERROR_SSL;
! 		if (e !=0) {
  			/* XXX Protected by global interpreter lock */
  			errstr = ERR_error_string(e, NULL);
! 		} else { /* possible? */
! 			errstr="A failure in the SSL library occurred";
  		}
  		break;
  	}
  	default:
! 		p=PY_SSL_ERROR_INVALID_ERROR_CODE;
  		errstr = "Invalid error code";
  	}
--- 130,144 ----
  	{
  		unsigned long e = ERR_get_error();
! 		p = PY_SSL_ERROR_SSL;
! 		if (e != 0) 
  			/* XXX Protected by global interpreter lock */
  			errstr = ERR_error_string(e, NULL);
! 		else { /* possible? */
! 			errstr = "A failure in the SSL library occurred";
  		}
  		break;
  	}
  	default:
! 		p = PY_SSL_ERROR_INVALID_ERROR_CODE;
  		errstr = "Invalid error code";
  	}
***************
*** 163,167 ****
  }
  
- /* This is a C function to be called for new object initialization */
  static PySSLObject *
  newPySSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file)
--- 163,166 ----
***************
*** 239,243 ****
  }
  
- /* This is the Python function called for new object initialization */
  static PyObject *
  PySocket_ssl(PyObject *self, PyObject *args)
--- 238,241 ----