X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/5c19dc3ae3bd8e40a9c028b0deddd50ff337692c..07691282a056c4efea71e1e505527601e8cc166b:/OSX/libsecurity_ssl/regressions/ssl-47-falsestart.c diff --git a/OSX/libsecurity_ssl/regressions/ssl-47-falsestart.c b/OSX/libsecurity_ssl/regressions/ssl-47-falsestart.c index 90e7d6c2..d7c43e00 100644 --- a/OSX/libsecurity_ssl/regressions/ssl-47-falsestart.c +++ b/OSX/libsecurity_ssl/regressions/ssl-47-falsestart.c @@ -81,35 +81,21 @@ static int SocketConnect(const char *hostName, int port) { struct sockaddr_in addr; struct in_addr host; - int sock; + int sock; int err; struct hostent *ent; - if (hostName[0] >= '0' && hostName[0] <= '9') - { + if (hostName[0] >= '0' && hostName[0] <= '9') { host.s_addr = inet_addr(hostName); - } - else { - unsigned dex; -#define GETHOST_RETRIES 5 - /* seeing a lot of soft failures here that I really don't want to track down */ - for(dex=0; dexh_addr, sizeof(struct in_addr)); } - sock = socket(AF_INET, SOCK_STREAM, 0); addr.sin_addr = host; addr.sin_port = htons((u_short)port); @@ -120,17 +106,15 @@ static int SocketConnect(const char *hostName, int port) if(err!=0) { perror("connect failed"); - return err; + return -1; } /* make non blocking */ fcntl(sock, F_SETFL, O_NONBLOCK); - return sock; } - static OSStatus SocketWrite(SSLConnectionRef conn, const void *data, size_t *length) { size_t len = *length; @@ -224,8 +208,9 @@ static OSStatus securetransport(ssl_test_handle * ssl) bool got_server_auth = false, got_client_cert_req = false; ortn = SSLHandshake(ctx); - //fprintf(stderr, "Fell out of SSLHandshake with error: %ld\n", (long)ortn); - + + require_action_quiet(ortn==errSSLWouldBlock, out, printf("SSLHandshake failed with err %ld\n", (long)ortn)); + size_t sent, received; const char *r=request; size_t l=sizeof(request); @@ -306,6 +291,7 @@ struct s_server { #define NSERVERS (int)(sizeof(servers)/sizeof(servers[0])) #define NLOOPS 1 +#define CONNECT_TRIES 3 static void tests(void) @@ -318,11 +304,13 @@ tests(void) for(fs=0;fs<2; fs++) { ssl_test_handle *client; - - int s; OSStatus r; + int s = -1; + + for(int try = 0; s<0 && try