[openssl.org #1107] NetWare patch for 0.9.8-beta4

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[openssl.org #1107] NetWare patch for 0.9.8-beta4

Rich Salz via RT

diff -cr openssl-0.9.8-beta4.clean/apps/s_socket.c openssl-0.9.8-beta4/apps/s_socket.c
*** openssl-0.9.8-beta4.clean/apps/s_socket.c Tue Apr 26 17:43:52 2005
--- openssl-0.9.8-beta4/apps/s_socket.c Thu Jun 09 20:02:39 2005
***************
*** 87,94 ****
 
  #ifndef OPENSSL_NO_SOCK
 
  static struct hostent *GetHostByName(char *name);
! #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_NETWARE)
  static void ssl_sock_cleanup(void);
  #endif
  static int ssl_sock_init(void);
--- 87,98 ----
 
  #ifndef OPENSSL_NO_SOCK
 
+ #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_BSDSOCK)
+ #include "netdb.h"
+ #endif
+
  static struct hostent *GetHostByName(char *name);
! #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK))
  static void ssl_sock_cleanup(void);
  #endif
  static int ssl_sock_init(void);
***************
*** 104,110 ****
  #define SOCKET_PROTOCOL IPPROTO_TCP
  #endif
 
! #ifdef OPENSSL_SYS_NETWARE
  static int wsa_init_done=0;
  #endif
 
--- 108,114 ----
  #define SOCKET_PROTOCOL IPPROTO_TCP
  #endif
 
! #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
  static int wsa_init_done=0;
  #endif
 
***************
*** 156,162 ****
  WSACleanup();
  }
  }
! #elif defined(OPENSSL_SYS_NETWARE)
  static void sock_cleanup(void)
      {
      if (wsa_init_done)
--- 160,166 ----
  WSACleanup();
  }
  }
! #elif defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
  static void sock_cleanup(void)
      {
      if (wsa_init_done)
***************
*** 199,205 ****
  SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopHookProc);
  #endif /* OPENSSL_SYS_WIN16 */
  }
! #elif defined(OPENSSL_SYS_NETWARE)
     WORD wVerReq;
     WSADATA wsaData;
     int err;
--- 203,209 ----
  SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopHookProc);
  #endif /* OPENSSL_SYS_WIN16 */
  }
! #elif defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
     WORD wVerReq;
     WSADATA wsaData;
     int err;
***************
*** 398,404 ****
  ret=accept(acc_sock,(struct sockaddr *)&from,(void *)&len);
  if (ret == INVALID_SOCKET)
  {
! #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_NETWARE)
  i=WSAGetLastError();
  BIO_printf(bio_err,"accept error %d\n",i);
  #else
--- 402,408 ----
  ret=accept(acc_sock,(struct sockaddr *)&from,(void *)&len);
  if (ret == INVALID_SOCKET)
  {
! #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK))
  i=WSAGetLastError();
  BIO_printf(bio_err,"accept error %d\n",i);
  #else
diff -cr openssl-0.9.8-beta4.clean/Configure openssl-0.9.8-beta4/Configure
*** openssl-0.9.8-beta4.clean/Configure Sun Jun 05 22:19:34 2005
--- openssl-0.9.8-beta4/Configure Fri Jun 10 16:53:19 2005
***************
*** 486,492 ****
--- 486,495 ----
  # netware-clib => legacy CLib c-runtime support
  "netware-clib", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
  # netware-libc => LibC/NKS support
+ # NetWare defaults socket bio to WinSock sockets. However, the LibC build can be
+ # configured to use BSD sockets instead.
  "netware-libc", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
+ "netware-libc-bsdsock", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
  "netware-libc-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -I/ndk/libc/include/winsock -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::",
 
  # DJGPP
***************
*** 530,536 ****
 
  my @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
     VC-NT VC-CE VC-WIN32
!    BC-32 OS2-EMX netware-clib netware-libc);
 
  my $idx = 0;
  my $idx_cc = $idx++;
--- 533,539 ----
 
  my @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
     VC-NT VC-CE VC-WIN32
!    BC-32 OS2-EMX netware-clib netware-libc netware-libc-bsdsock);
 
  my $idx = 0;
  my $idx_cc = $idx++;
diff -cr openssl-0.9.8-beta4.clean/crypto/bio/b_sock.c openssl-0.9.8-beta4/crypto/bio/b_sock.c
*** openssl-0.9.8-beta4.clean/crypto/bio/b_sock.c Sat Dec 27 14:40:12 2003
--- openssl-0.9.8-beta4/crypto/bio/b_sock.c Thu Jun 09 19:58:44 2005
***************
*** 62,67 ****
--- 62,70 ----
  #define USE_SOCKETS
  #include "cryptlib.h"
  #include <openssl/bio.h>
+ #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_BSDSOCK)
+ #include "netdb.h"
+ #endif
 
  #ifndef OPENSSL_NO_SOCK
 
***************
*** 79,85 ****
  #define MAX_LISTEN  32
  #endif
 
! #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_NETWARE)
  static int wsa_init_done=0;
  #endif
 
--- 82,88 ----
  #define MAX_LISTEN  32
  #endif
 
! #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK))
  static int wsa_init_done=0;
  #endif
 
***************
*** 474,480 ****
  return (-1);
  #endif
 
! #if defined(OPENSSL_SYS_NETWARE)
      WORD wVerReq;
      WSADATA wsaData;
      int err;
--- 477,483 ----
  return (-1);
  #endif
 
! #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
      WORD wVerReq;
      WSADATA wsaData;
      int err;
***************
*** 512,518 ****
  #endif
  WSACleanup();
  }
! #elif defined(OPENSSL_SYS_NETWARE)
     if (wsa_init_done)
          {
          wsa_init_done=0;
--- 515,521 ----
  #endif
  WSACleanup();
  }
! #elif defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
     if (wsa_init_done)
          {
          wsa_init_done=0;
diff -cr openssl-0.9.8-beta4.clean/e_os.h openssl-0.9.8-beta4/e_os.h
*** openssl-0.9.8-beta4.clean/e_os.h Sun Jun 05 21:46:56 2005
--- openssl-0.9.8-beta4/e_os.h Fri Jun 10 20:26:56 2005
***************
*** 182,191 ****
--- 182,199 ----
  #define readsocket(s,b,n)    read((s),(b),(n))
  #define writesocket(s,b,n)    write((s),(char *)(b),(n))
  #elif defined(OPENSSL_SYS_NETWARE)
+ #if defined(NETWARE_BSDSOCK)
+ #define get_last_socket_error() errno
+ #define clear_socket_error()    errno=0
+ #define closesocket(s)          close(s)
+ #define readsocket(s,b,n)       recv((s),(b),(n),0)
+ #define writesocket(s,b,n)      send((s),(b),(n),0)
+ #else
  #define get_last_socket_error() WSAGetLastError()
  #define clear_socket_error() WSASetLastError(0)
  #define readsocket(s,b,n) recv((s),(b),(n),0)
  #define writesocket(s,b,n) send((s),(b),(n),0)
+ #endif
  #else
  #define get_last_socket_error() errno
  #define clear_socket_error() errno=0
***************
*** 436,444 ****
  #    define SHUTDOWN2(fd) MacSocket_close(fd)
 
  #  elif defined(OPENSSL_SYS_NETWARE)
!          /* NetWare uses the WinSock2 interfaces
           */
! #      include <novsock2.h>
  #      define SSLeay_Write(a,b,c)   send((a),(b),(c),0)
  #      define SSLeay_Read(a,b,c) recv((a),(b),(c),0)
  #      define SHUTDOWN(fd)    { shutdown((fd),0); closesocket(fd); }
--- 444,460 ----
  #    define SHUTDOWN2(fd) MacSocket_close(fd)
 
  #  elif defined(OPENSSL_SYS_NETWARE)
!          /* NetWare uses the WinSock2 interfaces by default, but can be configured for BSD
           */
! #      if defined(NETWARE_BSDSOCK)
! #        include <sys/socket.h>
! #        include <netinet/in.h>
! #        include <sys/time.h>
! #        include <sys/select.h>
! #        define INVALID_SOCKET (int)(~0)
! #      else
! #        include <novsock2.h>
! #      endif
  #      define SSLeay_Write(a,b,c)   send((a),(b),(c),0)
  #      define SSLeay_Read(a,b,c) recv((a),(b),(c),0)
  #      define SHUTDOWN(fd)    { shutdown((fd),0); closesocket(fd); }
diff -cr openssl-0.9.8-beta4.clean/INSTALL.NW openssl-0.9.8-beta4/INSTALL.NW
*** openssl-0.9.8-beta4.clean/INSTALL.NW Sun Jun 05 21:46:56 2005
--- openssl-0.9.8-beta4/INSTALL.NW Fri Jun 10 21:28:28 2005
***************
*** 32,37 ****
--- 32,41 ----
  NetWare 5.x versions will require updates in order to run the OpenSSL LibC
  build.
 
+ As of June 2005, the LibC build can be configured to use BSD sockets instead
+ of WinSock sockets. Call Configure (usually through netware\build.bat) using
+ a target of "netware-libc-bsdsock" instead of "netware-libc".
+
 
  REQUIRED TOOLS:
  ---------------
***************
*** 126,132 ****
           
           NOTE: The LibC SDK includes the necessary WinSock2 support.  It
           It is not necessary to download the WinSock2 Developer when building
!          for LibC.
 
 
  BUILDING:
--- 130,137 ----
           
           NOTE: The LibC SDK includes the necessary WinSock2 support.  It
           It is not necessary to download the WinSock2 Developer when building
!          for LibC. The LibC SDK also includes the appropriate BSD socket support
!          if configuring to use BSD sockets.
 
 
  BUILDING:
***************
*** 177,184 ****
 
     netware\build [target] [debug opts] [assembly opts] [configure opts]
 
!       target        - "netware-clib" - CLib NetWare build
!                     - "netware-libc" - LibC NetWare build
   
        debug opts    - "debug"  - build debug
 
--- 182,190 ----
 
     netware\build [target] [debug opts] [assembly opts] [configure opts]
 
!       target        - "netware-clib" - CLib NetWare build (WinSock Sockets)
!                     - "netware-libc" - LibC NetWare build (WinSock Sockets)
!                     - "netware-libc-bsdsock" - LibC NetWare build (BSD Sockets)
   
        debug opts    - "debug"  - build debug
 
***************
*** 197,221 ****
        LibC build, non-debug, using NASM assembly:
           netware\build.bat netware-libc nw-nasm
 
  Running build.bat generates a make file to be processed by your make
  tool (gmake or nmake):
 
!    CLIB ex: gmake -f netware\nlm_clib.mak
     LibC ex: gmake -f netware\nlm_libc.mak
 
 
  You can also run the build scripts manually if you do not want to use the
  build.bat file.  Run the following scripts in the "\openssl"
  subdirectory (in the order listed below):
 
!    perl configure no-asm [other config opts] [netware-clib|netware-libc]
        configures no assembly build for specified netware environment
        (CLIB or LibC).
 
     perl util\mkfiles.pl >MINFO
        generates a listing of source files (used by mk1mf)
 
!    perl util\mk1mf.pl no-asm [other config opts] [netware-clib|netware-libc >netware\nlm.mak
        generates the makefile for NetWare
 
     gmake -f netware\nlm.mak
--- 203,231 ----
        LibC build, non-debug, using NASM assembly:
           netware\build.bat netware-libc nw-nasm
 
+       LibC build, BSD sockets, non-debug, without assembly:
+          netware\build.bat netware-libc-bsdsock no-asm
+
  Running build.bat generates a make file to be processed by your make
  tool (gmake or nmake):
 
!    CLIB ex: gmake -f netware\nlm_clib_dbg.mak
     LibC ex: gmake -f netware\nlm_libc.mak
+    LibC ex: gmake -f netware\nlm_libc_bsdsock.mak
 
 
  You can also run the build scripts manually if you do not want to use the
  build.bat file.  Run the following scripts in the "\openssl"
  subdirectory (in the order listed below):
 
!    perl configure no-asm [other config opts] [netware-clib|netware-libc|netware-libc-bsdsock]
        configures no assembly build for specified netware environment
        (CLIB or LibC).
 
     perl util\mkfiles.pl >MINFO
        generates a listing of source files (used by mk1mf)
 
!    perl util\mk1mf.pl no-asm [other config opts] [netware-clib|netware-libc|netware-libc-bsdsock >netware\nlm.mak
        generates the makefile for NetWare
 
     gmake -f netware\nlm.mak
diff -cr openssl-0.9.8-beta4.clean/Netware/build.bat openssl-0.9.8-beta4/Netware/build.bat
*** openssl-0.9.8-beta4.clean/Netware/build.bat Fri Nov 28 13:10:56 2003
--- openssl-0.9.8-beta4/Netware/build.bat Fri Jun 10 20:21:51 2005
***************
*** 6,19 ****
  rem   usage:
  rem      build [target] [debug opts] [assembly opts] [configure opts]
  rem
! rem      target        - "netware-clib" - CLib NetWare build
! rem                    - "netware-libc" - LibC NKS NetWare build
  rem
  rem      debug opts    - "debug"  - build debug
  rem
  rem      assembly opts - "nw-mwasm" - use Metrowerks assembler
! rem      "nw-nasm"  - use NASM assembler
! rem      "no-asm"   - don't use assembly
  rem
  rem      configure opts- all unrecognized arguments are passed to the
  rem                       perl configure script
--- 6,20 ----
  rem   usage:
  rem      build [target] [debug opts] [assembly opts] [configure opts]
  rem
! rem      target        - "netware-clib" - CLib NetWare build (WinSock Sockets)
! rem                    - "netware-libc" - LibC NKS NetWare build (WinSock Sockets)
! rem                    - "netware-libc-bsdsock" - LibC NKS NetWare build (BSD Sockets)
  rem
  rem      debug opts    - "debug"  - build debug
  rem
  rem      assembly opts - "nw-mwasm" - use Metrowerks assembler
! rem                    - "nw-nasm"  - use NASM assembler
! rem                    - "no-asm"   - don't use assembly
  rem
  rem      configure opts- all unrecognized arguments are passed to the
  rem                       perl configure script
***************
*** 76,81 ****
--- 77,84 ----
  if "%1" == "netware-clib" set ARG_PROCESSED=YES
  if "%1" == "netware-libc" set BLD_TARGET=netware-libc
  if "%1" == "netware-libc" set ARG_PROCESSED=YES
+ if "%1" == "netware-libc-bsdsock" set BLD_TARGET=netware-libc-bsdsock
+ if "%1" == "netware-libc-bsdsock" set ARG_PROCESSED=YES
 
  rem   If we didn't recognize the argument, consider it an option for config
  if "%ARG_PROCESSED%" == "NO" set CONFIG_OPTS=%CONFIG_OPTS% %1
***************
*** 92,97 ****
--- 95,101 ----
  set NLM_MAKE=
  if "%BLD_TARGET%" == "netware-clib" set NLM_MAKE=netware\nlm_clib
  if "%BLD_TARGET%" == "netware-libc" set NLM_MAKE=netware\nlm_libc
+ if "%BLD_TARGET%" == "netware-libc-bsdsock" set NLM_MAKE=netware\nlm_libc_bsdsock
  if "%DEBUG%" == "" set NLM_MAKE=%NLM_MAKE%.mak
  if "%DEBUG%" == "debug" set NLM_MAKE=%NLM_MAKE%_dbg.mak
 
***************
*** 184,191 ****
  echo .
  echo .  usage: build [target] [debug opts] [assembly opts] [configure opts]
  echo .
! echo .     target        - "netware-clib" - CLib NetWare build
! echo .                   - "netware-libc" - LibC NKS NetWare build
  echo .
  echo .     debug opts    - "debug"  - build debug
  echo .
--- 188,196 ----
  echo .
  echo .  usage: build [target] [debug opts] [assembly opts] [configure opts]
  echo .
! echo .     target        - "netware-clib" - CLib NetWare build (WinSock Sockets)
! echo .                   - "netware-libc" - LibC NKS NetWare build (WinSock Sockets)
! echo .                   - "netware-libc-bsdsock" - LibC NKS NetWare build (BSD Sockets)
  echo .
  echo .     debug opts    - "debug"  - build debug
  echo .
diff -cr openssl-0.9.8-beta4.clean/util/mk1mf.pl openssl-0.9.8-beta4/util/mk1mf.pl
*** openssl-0.9.8-beta4.clean/util/mk1mf.pl Tue May 17 13:51:34 2005
--- openssl-0.9.8-beta4/util/mk1mf.pl Fri Jun 10 20:24:38 2005
***************
*** 33,40 ****
  "ultrix-mips","DEC mips ultrix",
  "FreeBSD","FreeBSD distribution",
  "OS2-EMX", "EMX GCC OS/2",
! "netware-clib", "CodeWarrior for NetWare - CLib",
! "netware-libc", "CodeWarrior for NetWare - LibC",
  "default","cc under unix",
  );
 
--- 33,41 ----
  "ultrix-mips","DEC mips ultrix",
  "FreeBSD","FreeBSD distribution",
  "OS2-EMX", "EMX GCC OS/2",
! "netware-clib", "CodeWarrior for NetWare - CLib - with WinSock Sockets",
! "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets",
! "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets",
  "default","cc under unix",
  );
 
***************
*** 163,171 ****
  $wc=1;
  require 'OS2-EMX.pl';
  }
! elsif (($platform eq "netware-clib") || ($platform eq "netware-libc"))
  {
!    $LIBC=1 if $platform eq "netware-libc";
  require 'netware.pl';
  }
  else
--- 164,174 ----
  $wc=1;
  require 'OS2-EMX.pl';
  }
! elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") ||
!        ($platform eq "netware-libc-bsdsock"))
  {
! $LIBC=1 if $platform eq "netware-libc" || $platform eq "netware-libc-bsdsock";
! $BSDSOCK=1 if $platform eq "netware-libc-bsdsock";
  require 'netware.pl';
  }
  else
diff -cr openssl-0.9.8-beta4.clean/util/pl/netware.pl openssl-0.9.8-beta4/util/pl/netware.pl
*** openssl-0.9.8-beta4.clean/util/pl/netware.pl Sun Jun 05 21:46:56 2005
--- openssl-0.9.8-beta4/util/pl/netware.pl Tue Jun 07 22:23:09 2005
***************
*** 2,20 ****
  #
 
  # The import files and other misc imports needed to link
  if ($LIBC)
  {
!    @import_files = ("libc.imp", "ws2nlm.imp");
     @module_files = ("libc");
  }
  else
  {
     # clib build
!    @import_files = ("clib.imp", "ws2nlm.imp");
     @module_files = ("clib");
  }
! @misc_imports = ("GetProcessSwitchCount", "RunningProcess",  
!                  "GetSuperHighResolutionTimer" );
 
  # The "IMPORTS" environment variable must be set and point to the location
  # where import files (*.imp) can be found.
--- 2,26 ----
  #
 
  # The import files and other misc imports needed to link
+ @misc_imports = ("GetProcessSwitchCount", "RunningProcess",  
+                  "GetSuperHighResolutionTimer");
  if ($LIBC)
  {
!    @import_files = ("libc.imp");
     @module_files = ("libc");
  }
  else
  {
     # clib build
!    @import_files = ("clib.imp");
     @module_files = ("clib");
+    push(@misc_imports, "_rt_modu64%16", "_rt_divu64%16");
  }
! if (!$BSDSOCK)
! {
!    push(@import_files, "ws2nlm.imp");
! }
!
 
  # The "IMPORTS" environment variable must be set and point to the location
  # where import files (*.imp) can be found.
***************
*** 120,125 ****
--- 126,137 ----
  {
     $cflags.=" -DNETWARE_CLIB";
     $lflags.=" -entry _Prelude -exit _Stop";
+ }
+
+ # If BSD Socket support is requested, set a define for the compiler
+ if ($BSDSOCK)
+ {
+    $cflags.=" -DNETWARE_BSDSOCK";
  }
 
 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]