255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#endif
switch (err) {
case SSL_ERROR_NONE:
dprintBuffer(buf, bytesRead);
break;
case SSL_ERROR_SSL:
dprintf("SSL negotiation error, indicating that the connection has been aborted");
Tls_Error(statePtr, TCLTLS_SSL_ERROR(statePtr->ssl, bytesRead));
*errorCodePtr = ECONNABORTED;
bytesRead = -1;
break;
case SSL_ERROR_SYSCALL:
backingError = ERR_get_error();
if (backingError == 0 && bytesRead == 0) {
dprintf("EOF reached")
*errorCodePtr = 0;
bytesRead = 0;
} else if (backingError == 0 && bytesRead == -1) {
dprintf("I/O error occured (errno = %lu)", (unsigned long) Tcl_GetErrno());
*errorCodePtr = Tcl_GetErrno();
bytesRead = -1;
} else {
dprintf("I/O error occured (backingError = %lu)", backingError);
*errorCodePtr = backingError;
bytesRead = -1;
}
break;
case SSL_ERROR_ZERO_RETURN:
dprintf("Got SSL_ERROR_ZERO_RETURN, this means an EOF has been reached");
bytesRead = 0;
*errorCodePtr = 0;
break;
default:
dprintf("Unknown error (err = %i), mapping to EOF", err);
*errorCodePtr = 0;
bytesRead = 0;
break;
}
dprintf("Input(%d) -> %d [%d]", bufSize, bytesRead, *errorCodePtr);
return(bytesRead);
}
|
385
386
387
388
389
390
391
392
393
394
395
396
397
398
|
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
|
+
|
break;
case SSL_ERROR_WANT_X509_LOOKUP:
dprintf(" write X BLOCK");
break;
case SSL_ERROR_ZERO_RETURN:
dprintf(" closed");
written = 0;
*errorCodePtr = 0;
break;
case SSL_ERROR_SYSCALL:
backingError = ERR_get_error();
if (backingError == 0 && written == 0) {
dprintf("EOF reached")
*errorCodePtr = 0;
|