mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
fix the cpuworker circ-had-vanished bug (maybe)
still several (many) tls-related bugs outstanding. svn:r454
This commit is contained in:
+2
-1
@@ -421,7 +421,7 @@ tor_tls_verify(tor_tls *tls)
|
||||
time_t now;
|
||||
crypto_pk_env_t *r = NULL;
|
||||
if (!(cert = SSL_get_peer_certificate(tls->ssl)))
|
||||
return 0;
|
||||
return NULL;
|
||||
|
||||
now = time(NULL);
|
||||
if (X509_cmp_time(X509_get_notBefore(cert), &now) > 0)
|
||||
@@ -453,3 +453,4 @@ tor_tls_verify(tor_tls *tls)
|
||||
RSA_free(rsa);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,21 @@ int write_all(int fd, const void *buf, size_t count) {
|
||||
return count;
|
||||
}
|
||||
|
||||
/* a wrapper for read(2) that makes sure to read all count bytes.
|
||||
* Only use if fd is a blocking socket. */
|
||||
int read_all(int fd, void *buf, size_t count) {
|
||||
int numread = 0;
|
||||
int result;
|
||||
|
||||
while(numread != count) {
|
||||
result = read(fd, buf+numread, count-numread);
|
||||
if(result<=0)
|
||||
return -1;
|
||||
numread += result;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void set_socket_nonblocking(int socket)
|
||||
{
|
||||
#ifdef MS_WINDOWS
|
||||
|
||||
@@ -52,6 +52,7 @@ void tv_add(struct timeval *a, struct timeval *b);
|
||||
int tv_cmp(struct timeval *a, struct timeval *b);
|
||||
|
||||
int write_all(int fd, const void *buf, size_t count);
|
||||
int read_all(int fd, void *buf, size_t count);
|
||||
|
||||
void set_socket_nonblocking(int socket);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user