]> granicus.if.org Git - apache/commitdiff
Axe most WIN32 stuff from Apache 1.3. In Apache 2.0 we either use APR
authorRalf S. Engelschall <rse@apache.org>
Sat, 5 May 2001 16:35:18 +0000 (16:35 +0000)
committerRalf S. Engelschall <rse@apache.org>
Sat, 5 May 2001 16:35:18 +0000 (16:35 +0000)
later for this or we don't do it at all. But we certainly no longer want
to see any platform specific things inside a module.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89018 13f79535-47bb-0310-9956-ffa450edef68

modules/ssl/mod_ssl.h
modules/ssl/ssl_engine_config.c
modules/ssl/ssl_engine_init.c
modules/ssl/ssl_engine_io.c
modules/ssl/ssl_engine_kernel.c
modules/ssl/ssl_engine_mutex.c
modules/ssl/ssl_util.c

index 59c40b776c10dca6f4c92899b170caec11593f22..5e9b48fdc357000531ca363186d446f374a640b1 100644 (file)
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <time.h>
-#ifndef WIN32
 #include <sys/time.h>
-#endif
-#ifdef WIN32
-#include <wincrypt.h>
-#include <winsock2.h>
-#endif
 
 /* OpenSSL headers */
 #include <openssl/ssl.h>
 #endif
 #if !defined(SSL_USE_FCNTL) && !defined(SSL_USE_FLOCK)
 #define SSL_USE_FLOCK 1
-#if !defined(MPE) && !defined(WIN32)
+#if !defined(MPE)
 #include <sys/file.h>
 #endif
 #ifndef LOCK_UN
 /*
  * Support for Mutex
  */
-#ifndef WIN32
 #define SSL_MUTEX_LOCK_MODE ( S_IRUSR|S_IWUSR )
-#else
-#define SSL_MUTEX_LOCK_MODE (_S_IREAD|_S_IWRITE )
-#endif
 #if defined(USE_SYSVSEM_SERIALIZED_ACCEPT) ||\
     (defined(__FreeBSD__) && defined(__FreeBSD_version) &&\
      __FreeBSD_version >= 300000) ||\
@@ -305,30 +295,16 @@ union ssl_ipc_semun {
     unsigned short int *array;
 };
 #endif
-#ifdef WIN32
-#define SSL_CAN_USE_SEM
-#define SSL_HAVE_W32SEM
-#include "multithread.h"
-#include <process.h>
-#endif
 
 /*
  * Support for MM library
  */
-#ifndef WIN32
 #define SSL_MM_FILE_MODE ( S_IRUSR|S_IWUSR )
-#else
-#define SSL_MM_FILE_MODE ( _S_IREAD|_S_IWRITE )
-#endif
 
 /*
  * Support for DBM library
  */
-#ifndef WIN32
 #define SSL_DBM_FILE_MODE ( S_IRUSR|S_IWUSR )
-#else
-#define SSL_DBM_FILE_MODE ( _S_IREAD|_S_IWRITE )
-#endif
 
 #if !defined(SSL_DBM_FILE_SUFFIX_DIR) && !defined(SSL_DBM_FILE_SUFFIX_PAG)
 #if defined(DBM_SUFFIX)
index 538c900a0ceec86050582708b058da6243b808cd..8725a37dede9be66639bcbf98f6cf811c6126a7d 100644 (file)
@@ -342,14 +342,10 @@ const char *ssl_cmd_SSLMutex(
         mc->nMutexMode  = SSL_MUTEXMODE_NONE;
     }
     else if (strlen(arg) > 5 && strcEQn(arg, "file:", 5)) {
-#ifndef WIN32
         mc->nMutexMode  = SSL_MUTEXMODE_FILE;
         mc->szMutexFile = ap_psprintf(mc->pPool, "%s.%lu",
                                       ap_server_root_relative(cmd->pool, "mutex", arg+5),
                                       (unsigned long)getpid());
-#else
-        return "SSLMutex: Lockfiles not available on this platform";
-#endif
     }
     else if (strcEQ(arg, "sem")) {
 #ifdef SSL_CAN_USE_SEM
index 3d542a635e0a5e354d187c4feca21acafd08c874..777662cb371f781827de13778e48f19542615d1b 100644 (file)
@@ -127,11 +127,6 @@ void ssl_init_Module(server_rec *s, pool *p)
                 SERVER_BASEVERSION,
                 ssl_var_lookup(p, NULL, NULL, NULL, "SSL_VERSION_INTERFACE"),
                 ssl_var_lookup(p, NULL, NULL, NULL, "SSL_VERSION_LIBRARY"));
-#ifdef WIN32
-        ssl_log(s, SSL_LOG_WARN, "You are using mod_ssl under Win32. " 
-                "This combination is *NOT* officially supported. "
-                "Use it at your own risk!");
-#endif
     }
 
     /*
@@ -194,9 +189,7 @@ void ssl_init_Module(server_rec *s, pool *p)
     if (mc->nInitCount == 1) {
         ssl_pphrase_Handle(s, p);
         ssl_init_TmpKeysHandle(SSL_TKP_GEN, s, p);
-#ifndef WIN32
         return;
-#endif
     }
 
     /*
index e56901415e0b90389bff88ccacbbaf5bedaef115..c747208afcce4d131697c41ffc8bb8541390d575 100644 (file)
@@ -80,10 +80,6 @@ static int ssl_io_hook_write(BUFF *fb, char *buf, int len);
 #ifndef NO_WRITEV
 static int ssl_io_hook_writev(BUFF *fb, const struct iovec *iov, int iovcnt);
 #endif
-#ifdef WIN32
-static int ssl_io_hook_recvwithtimeout(BUFF *fb, char *buf, int len);
-static int ssl_io_hook_sendwithtimeout(BUFF *fb, const char *buf, int len);
-#endif /* WIN32 */
 
 void ssl_io_register(void)
 {
@@ -91,12 +87,6 @@ void ssl_io_register(void)
     ap_hook_register("ap::buff::write",  ssl_io_hook_write, AP_HOOK_NOCTX);
 #ifndef NO_WRITEV
     ap_hook_register("ap::buff::writev", ssl_io_hook_writev, AP_HOOK_NOCTX);
-#endif
-#ifdef WIN32
-    ap_hook_register("ap::buff::recvwithtimeout",
-                     ssl_io_hook_recvwithtimeout, AP_HOOK_NOCTX);
-    ap_hook_register("ap::buff::sendwithtimeout",
-                     ssl_io_hook_sendwithtimeout, AP_HOOK_NOCTX);
 #endif
     return;
 }
@@ -107,10 +97,6 @@ void ssl_io_unregister(void)
     ap_hook_unregister("ap::buff::write",  ssl_io_hook_write);
 #ifndef NO_WRITEV
     ap_hook_unregister("ap::buff::writev", ssl_io_hook_writev);
-#endif
-#ifdef WIN32
-    ap_hook_unregister("ap::buff::recvwithtimeout", ssl_io_hook_recvwithtimeout);
-    ap_hook_unregister("ap::buff::sendwithtimeout", ssl_io_hook_sendwithtimeout);
 #endif
     return;
 }
@@ -218,173 +204,12 @@ static int ssl_io_hook_writev(BUFF *fb, const struct iovec *iov, int iovcnt)
 }
 #endif
 
-#ifdef WIN32
-
-/* these two functions are exported from buff.c under WIN32 */
-API_EXPORT(int) sendwithtimeout(int sock, const char *buf, int len, int flags);
-API_EXPORT(int) recvwithtimeout(int sock, char *buf, int len, int flags);
-
-/* and the prototypes for our SSL_xxx variants */
-static int SSL_sendwithtimeout(BUFF *fb, const char *buf, int len);
-static int SSL_recvwithtimeout(BUFF *fb, char *buf, int len);
-
-static int ssl_io_hook_recvwithtimeout(BUFF *fb, char *buf, int len)
-{
-    SSL *ssl;
-    int rc;
-
-    if ((ssl = ap_ctx_get(fb->ctx, "ssl")) != NULL)
-        rc = SSL_recvwithtimeout(fb, buf, len);
-    else
-        rc = recvwithtimeout(fb->fd, buf, len, 0);
-    return rc;
-}
-
-static int ssl_io_hook_sendwithtimeout(BUFF *fb, const char *buf, int len)
-{
-    SSL *ssl;
-    int rc;
-
-    if ((ssl = ap_ctx_get(fb->ctx, "ssl")) != NULL)
-        rc = SSL_sendwithtimeout(fb, buf, len);
-    else
-        rc = sendwithtimeout(fb->fd, buf, len, 0);
-    return rc;
-}
-
-#endif /* WIN32 */
-
 /*  _________________________________________________________________
 **
 **  Special Functions for OpenSSL
 **  _________________________________________________________________
 */
 
-#ifdef WIN32
-
-static int SSL_sendwithtimeout(BUFF *fb, const char *buf, int len)
-{
-    int iostate = 1;
-    fd_set fdset;
-    struct timeval tv;
-    int err = WSAEWOULDBLOCK;
-    int rv;
-    int retry;
-    int sock = fb->fd;
-    SSL *ssl;
-
-    ssl = ap_ctx_get(fb->ctx, "ssl");
-
-    if (!(tv.tv_sec = ap_check_alarm()))
-        return (SSL_write(ssl, (char*)buf, len));
-
-    rv = ioctlsocket(sock, FIONBIO, &iostate);
-    iostate = 0;
-    if (rv) {
-        err = WSAGetLastError();
-        ap_assert(0);
-    }
-    rv = SSL_write(ssl, (char*)buf, len);
-    if (rv <= 0) {
-        if (BIO_sock_should_retry(rv)) {
-            do {
-                retry = 0;
-                FD_ZERO(&fdset);
-                FD_SET((unsigned int)sock, &fdset);
-                tv.tv_usec = 0;
-                rv = select(FD_SETSIZE, NULL, &fdset, NULL, &tv);
-                if (rv == SOCKET_ERROR)
-                    err = WSAGetLastError();
-                else if (rv == 0) {
-                    ioctlsocket(sock, FIONBIO, &iostate);
-                    if(ap_check_alarm() < 0) {
-                        WSASetLastError(EINTR); /* Simulate an alarm() */
-                        return (SOCKET_ERROR);
-                    }
-                }
-                else {
-                    rv = SSL_write(ssl, (char*)buf, len);
-                    if (BIO_sock_should_retry(rv)) {
-                        ap_log_error(APLOG_MARK,APLOG_DEBUG, NULL,
-                                     "select claimed we could write, "
-                                     "but in fact we couldn't. "
-                                     "This is a bug in Windows.");
-                        retry = 1;
-                        Sleep(100);
-                    }
-                }
-            } while(retry);
-        }
-    }
-    ioctlsocket(sock, FIONBIO, &iostate);
-    if (rv == SOCKET_ERROR)
-        WSASetLastError(err);
-    return (rv);
-}
-
-static int SSL_recvwithtimeout(BUFF *fb, char *buf, int len)
-{
-    int iostate = 1;
-    fd_set fdset;
-    struct timeval tv;
-    int err = WSAEWOULDBLOCK;
-    int rv;
-    int sock = fb->fd_in;
-    SSL *ssl;
-    int retry;
-
-    ssl = ap_ctx_get(fb->ctx, "ssl");
-
-    if (!(tv.tv_sec = ap_check_alarm()))
-        return (SSL_read(ssl, buf, len));
-
-    rv = ioctlsocket(sock, FIONBIO, &iostate);
-    iostate = 0;
-    ap_assert(!rv);
-    rv = SSL_read(ssl, buf, len);
-    if (rv <= 0) {
-        if (BIO_sock_should_retry(rv)) {
-            do {
-                retry = 0;
-                FD_ZERO(&fdset);
-                FD_SET((unsigned int)sock, &fdset);
-                tv.tv_usec = 0;
-                rv = select(FD_SETSIZE, &fdset, NULL, NULL, &tv);
-                if (rv == SOCKET_ERROR)
-                    err = WSAGetLastError();
-                else if (rv == 0) {
-                    ioctlsocket(sock, FIONBIO, &iostate);
-                    ap_check_alarm();
-                    WSASetLastError(WSAEWOULDBLOCK);
-                    return (SOCKET_ERROR);
-                }
-                else {
-                    rv = SSL_read(ssl, buf, len);
-                    if (rv == SOCKET_ERROR) {
-                        if (BIO_sock_should_retry(rv)) {
-                          ap_log_error(APLOG_MARK,APLOG_DEBUG, NULL,
-                                       "select claimed we could read, "
-                                       "but in fact we couldn't. "
-                                       "This is a bug in Windows.");
-                          retry = 1;
-                          Sleep(100);
-                        }
-                        else {
-                            err = WSAGetLastError();
-                        }
-                    }
-                }
-            } while(retry);
-        }
-    }
-    ioctlsocket(sock, FIONBIO, &iostate);
-    if (rv == SOCKET_ERROR)
-        WSASetLastError(err);
-    return (rv);
-}
-
-#endif /*WIN32*/
-
 /*
  * There is no SSL_writev() provided by OpenSSL. The reason is mainly because
  * OpenSSL has to fragment the data itself again for the SSL record layer, so a
index 5566c9b64f86ca2212c0ff8a9e47536faeb9e7fe..c1b37126cb4e4b1cf19cfbf9ee33544aa1ef0fd5 100644 (file)
@@ -359,12 +359,8 @@ void ssl_hook_NewConnection(conn_rec *conn)
     /*
      * Improve I/O throughput by using
      * OpenSSL's read-ahead functionality
-     * (don't used under Win32, because
-     * there we use select())
      */
-#ifndef WIN32
     SSL_set_read_ahead(ssl, TRUE);
-#endif
     return;
 }
 
index afd4c512b3af6df5f31ddf6cdbaef686c69b37c4..d2ac555e3862a1eeaca569b729ad074bfbc3c386 100644 (file)
@@ -140,7 +140,6 @@ void ssl_mutex_kill(server_rec *s)
 
 void ssl_mutex_file_create(server_rec *s, pool *p)
 {
-#ifndef WIN32
     SSLModConfigRec *mc = myModConfig();
 
     /* create the lockfile */
@@ -168,13 +167,11 @@ void ssl_mutex_file_create(server_rec *s, pool *p)
                 mc->szMutexFile);
         ssl_die();
     }
-#endif
     return;
 }
 
 void ssl_mutex_file_open(server_rec *s, pool *p)
 {
-#ifndef WIN32
     SSLModConfigRec *mc = myModConfig();
 
     /* open the lockfile (once per child) to get a unique fd */
@@ -185,32 +182,26 @@ void ssl_mutex_file_open(server_rec *s, pool *p)
                 mc->szMutexFile);
         ssl_die();
     }
-#endif
     return;
 }
 
 void ssl_mutex_file_remove(void *data)
 {
-#ifndef WIN32
     SSLModConfigRec *mc = myModConfig();
 
     /* remove the mutex lockfile */
     unlink(mc->szMutexFile);
-#endif
     return;
 }
 
-#ifndef WIN32
 #ifdef SSL_USE_FCNTL
 static struct flock   lock_it;
 static struct flock unlock_it;
 #endif
-#endif
 
 BOOL ssl_mutex_file_acquire(void)
 {
     int rc = -1;
-#ifndef WIN32
     SSLModConfigRec *mc = myModConfig();
 
 #ifdef SSL_USE_FCNTL
@@ -228,7 +219,6 @@ BOOL ssl_mutex_file_acquire(void)
     while (   ((rc = flock(mc->nMutexFD, LOCK_EX)) < 0)
            && (errno == EINTR)                         )
         ;
-#endif
 #endif
 
     if (rc < 0)
@@ -240,7 +230,6 @@ BOOL ssl_mutex_file_acquire(void)
 BOOL ssl_mutex_file_release(void)
 {
     int rc = -1;
-#ifndef WIN32
     SSLModConfigRec *mc = myModConfig();
 
 #ifdef SSL_USE_FCNTL
@@ -258,7 +247,6 @@ BOOL ssl_mutex_file_release(void)
     while (   (rc = flock(mc->nMutexFD, LOCK_UN)) < 0
            && (errno == EINTR)                       ) 
         ;
-#endif
 #endif
 
     if (rc < 0)
index c8ff17e9677e9e58f5adf03a77c4673cede764a7..3b23075cf9aa74066a821a550fae9065b5c66d3a 100644 (file)
@@ -168,39 +168,7 @@ int ssl_util_ppopen_child(void *cmd, child_info *pinfo)
     /*
      * Exec() the child program
      */
-#if defined(WIN32)
-    /* MS Windows */
-    {
-        char pCommand[MAX_STRING_LEN];
-        STARTUPINFO si;
-        PROCESS_INFORMATION pi;
-
-        ap_snprintf(pCommand, sizeof(pCommand), "%s /C %s", SHELL_PATH, cmd);
-
-        memset(&si, 0, sizeof(si));
-        memset(&pi, 0, sizeof(pi));
-
-        si.cb          = sizeof(si);
-        si.dwFlags     = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
-        si.wShowWindow = SW_HIDE;
-        si.hStdInput   = pinfo->hPipeInputRead;
-        si.hStdOutput  = pinfo->hPipeOutputWrite;
-        si.hStdError   = pinfo->hPipeErrorWrite;
-
-        if (CreateProcess(NULL, pCommand, NULL, NULL, TRUE, 0,
-                          environ, NULL, &si, &pi)) {
-            CloseHandle(pi.hProcess);
-            CloseHandle(pi.hThread);
-            child_pid = pi.dwProcessId;
-        }
-    }
-#elif defined(OS2)
-    /* IBM OS/2 */
-    spawnl(P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
-#else
-    /* Standard Unix */
     execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);
-#endif
     return (child_pid);
 }