remove the openssl_fdset wrapper, and a variety of VMS'ism's like
authorderaadt <deraadt@openbsd.org>
Sat, 19 Apr 2014 16:46:08 +0000 (16:46 +0000)
committerderaadt <deraadt@openbsd.org>
Sat, 19 Apr 2014 16:46:08 +0000 (16:46 +0000)
crazy (void *) casts all over the place
ok beck jsing

lib/libssl/src/apps/apps.h
lib/libssl/src/apps/ocsp.c
lib/libssl/src/apps/s_client.c
lib/libssl/src/apps/s_server.c
lib/libssl/src/apps/s_socket.c
lib/libssl/src/apps/s_time.c

index eae0f47..9a5b77f 100644 (file)
@@ -170,8 +170,6 @@ extern BIO *bio_err;
 #  endif
 #endif
 
-#  define openssl_fdset(a,b) FD_SET(a, b)
-
 typedef struct args_st {
        char **data;
        int count;
index 91e5b8c..5b296a9 100644 (file)
@@ -1131,10 +1131,10 @@ query_responder(BIO * err, BIO * cbio, char *path,
        }
        if (req_timeout != -1 && rv <= 0) {
                FD_ZERO(&confds);
-               openssl_fdset(fd, &confds);
+               FD_SET(fd, &confds);
                tv.tv_usec = 0;
                tv.tv_sec = req_timeout;
-               rv = select(fd + 1, NULL, (void *) &confds, NULL, &tv);
+               rv = select(fd + 1, NULL, &confds, NULL, &tv);
                if (rv == 0) {
                        BIO_puts(err, "Timeout on connect\n");
                        return NULL;
@@ -1160,13 +1160,13 @@ query_responder(BIO * err, BIO * cbio, char *path,
                if (req_timeout == -1)
                        continue;
                FD_ZERO(&confds);
-               openssl_fdset(fd, &confds);
+               FD_SET(fd, &confds);
                tv.tv_usec = 0;
                tv.tv_sec = req_timeout;
                if (BIO_should_read(cbio))
-                       rv = select(fd + 1, (void *) &confds, NULL, NULL, &tv);
+                       rv = select(fd + 1, &confds, NULL, NULL, &tv);
                else if (BIO_should_write(cbio))
-                       rv = select(fd + 1, NULL, (void *) &confds, NULL, &tv);
+                       rv = select(fd + 1, NULL, &confds, NULL, &tv);
                else {
                        BIO_puts(err, "Unexpected retry condition\n");
                        goto err;
index fada082..94f02e8 100644 (file)
@@ -1432,29 +1432,23 @@ re_start:
 
                ssl_pending = read_ssl && SSL_pending(con);
 
+               /* XXX should add tests for fd_set overflow */
+
                if (!ssl_pending) {
                        if (tty_on) {
                                if (read_tty)
-                                       openssl_fdset(fileno(stdin), &readfds);
+                                       FD_SET(fileno(stdin), &readfds);
                                if (write_tty)
-                                       openssl_fdset(fileno(stdout), &writefds);
+                                       FD_SET(fileno(stdout), &writefds);
                        }
                        if (read_ssl)
-                               openssl_fdset(SSL_get_fd(con), &readfds);
+                               FD_SET(SSL_get_fd(con), &readfds);
                        if (write_ssl)
-                               openssl_fdset(SSL_get_fd(con), &writefds);
+                               FD_SET(SSL_get_fd(con), &writefds);
 /*                     printf("mode tty(%d %d%d) ssl(%d%d)\n",
                                tty_on,read_tty,write_tty,read_ssl,write_ssl);*/
 
-                       /*
-                        * Note: under VMS with SOCKETSHR the second
-                        * parameter is currently of type (int *) whereas
-                        * under other systems it is (void *) if you don't
-                        * have a cast it will choke the compiler: if you do
-                        * have a cast then you can either go for (int *) or
-                        * (void *).
-                        */
-                       i = select(width, (void *) &readfds, (void *) &writefds,
+                       i = select(width, &readfds, &writefds,
                            NULL, timeoutp);
                        if (i < 0) {
                                BIO_printf(bio_err, "bad select %d\n",
index 1082ee5..b5c6c2f 100644 (file)
@@ -1773,23 +1773,15 @@ sv_body(char *hostname, int s, unsigned char *context)
 
                if (!read_from_sslcon) {
                        FD_ZERO(&readfds);
-                       openssl_fdset(fileno(stdin), &readfds);
-                       openssl_fdset(s, &readfds);
-                       /*
-                        * Note: under VMS with SOCKETSHR the second
-                        * parameter is currently of type (int *) whereas
-                        * under other systems it is (void *) if you don't
-                        * have a cast it will choke the compiler: if you do
-                        * have a cast then you can either go for (int *) or
-                        * (void *).
-                        */
+                       FD_SET(fileno(stdin), &readfds);
+                       FD_SET(s, &readfds);
                        if ((SSL_version(con) == DTLS1_VERSION) &&
                            DTLSv1_get_timeout(con, &timeout))
                                timeoutp = &timeout;
                        else
                                timeoutp = NULL;
 
-                       i = select(width, (void *) &readfds, NULL, NULL, timeoutp);
+                       i = select(width, &readfds, NULL, NULL, timeoutp);
 
                        if ((SSL_version(con) == DTLS1_VERSION) && DTLSv1_handle_timeout(con) > 0) {
                                BIO_printf(bio_err, "TIMEOUT occured\n");
index 01257a5..a44dddb 100644 (file)
@@ -245,7 +245,7 @@ do_accept(int acc_sock, int *sock, char **host)
        int ret;
        struct hostent *h1, *h2;
        static struct sockaddr_in from;
-       int len;
+       socklen_t len;
 /*     struct linger ling; */
 
        if (!ssl_sock_init())
@@ -255,13 +255,7 @@ redoit:
 
        memset((char *) &from, 0, sizeof(from));
        len = sizeof(from);
-       /*
-        * Note: under VMS with SOCKETSHR the fourth parameter is currently
-        * of type (int *) whereas under other systems it is (void *) if you
-        * don't have a cast it will choke the compiler: if you do have a
-        * cast then you can either go for (int *) or (void *).
-        */
-       ret = accept(acc_sock, (struct sockaddr *) & from, (void *) &len);
+       ret = accept(acc_sock, (struct sockaddr *) & from, &len);
        if (ret == -1) {
                if (errno == EINTR) {
                        /* check_timeout(); */
index 169a9d7..d8f7294 100644 (file)
@@ -598,15 +598,8 @@ doConnection(SSL * scon)
                        i = SSL_get_fd(serverCon);
                        width = i + 1;
                        FD_ZERO(&readfds);
-                       openssl_fdset(i, &readfds);
-                       /*
-                        * Note: under VMS with SOCKETSHR the 2nd parameter
-                        * is currently of type (int *) whereas under other
-                        * systems it is (void *) if you don't have a cast it
-                        * will choke the compiler: if you do have a cast
-                        * then you can either go for (int *) or (void *).
-                        */
-                       select(width, (void *) &readfds, NULL, NULL, NULL);
+                       FD_SET(i, &readfds);
+                       select(width, &readfds, NULL, NULL, NULL);
                        continue;
                }
                break;