diff --git a/security/nss/Makefile b/security/nss/Makefile index 845208a3e64d..b7d44ebf6392 100644 --- a/security/nss/Makefile +++ b/security/nss/Makefile @@ -89,6 +89,7 @@ else $(NSINSTALL) -L ../../dist include $(DIST) $(NSINSTALL) -L ../../dist lib $(DIST) cp $(DIST)/lib/libmozdbm_s.a $(DIST)/lib/libdbm.a + cp $(DIST)/lib/libmozdbm_s.$(LIB_SUFFIX) $(DIST)/lib/libdbm.$(LIB_SUFFIX) endif nsm:: all diff --git a/security/nss/cmd/Makefile b/security/nss/cmd/Makefile index 7265e3919f97..dd012940ed77 100644 --- a/security/nss/cmd/Makefile +++ b/security/nss/cmd/Makefile @@ -100,34 +100,34 @@ US_FLAGS = -DEXPORT_VERSION EXPORT_FLAGS = -DEXPORT_VERSION BASE_LIBS = \ - $(DIST)/lib/libdbm.a \ - $(DIST)/lib/libxp.a \ - $(DIST)/lib/libnspr.a \ + $(DIST)/lib/libdbm.$(LIB_SUFFIX) \ + $(DIST)/lib/libxp.$(LIB_SUFFIX) \ + $(DIST)/lib/libnspr.$(LIB_SUFFIX) \ $(NULL) -# $(DIST)/lib/libpurenspr.a \ +# $(DIST)/lib/libpurenspr.$(LIB_SUFFIX) \ #There is a circular dependancy in security/lib, and here is a gross fix SEC_LIBS = \ - $(DIST)/lib/libsecnav.a \ - $(DIST)/lib/libssl.a \ - $(DIST)/lib/libpkcs7.a \ - $(DIST)/lib/libcert.a \ - $(DIST)/lib/libkey.a \ - $(DIST)/lib/libsecmod.a \ - $(DIST)/lib/libcrypto.a \ - $(DIST)/lib/libsecutil.a \ - $(DIST)/lib/libssl.a \ - $(DIST)/lib/libpkcs7.a \ - $(DIST)/lib/libcert.a \ - $(DIST)/lib/libkey.a \ - $(DIST)/lib/libsecmod.a \ - $(DIST)/lib/libcrypto.a \ - $(DIST)/lib/libsecutil.a \ - $(DIST)/lib/libhash.a \ + $(DIST)/lib/libsecnav.$(LIB_SUFFIX) \ + $(DIST)/lib/libssl.$(LIB_SUFFIX) \ + $(DIST)/lib/libpkcs7.$(LIB_SUFFIX) \ + $(DIST)/lib/libcert.$(LIB_SUFFIX) \ + $(DIST)/lib/libkey.$(LIB_SUFFIX) \ + $(DIST)/lib/libsecmod.$(LIB_SUFFIX) \ + $(DIST)/lib/libcrypto.$(LIB_SUFFIX) \ + $(DIST)/lib/libsecutil.$(LIB_SUFFIX) \ + $(DIST)/lib/libssl.$(LIB_SUFFIX) \ + $(DIST)/lib/libpkcs7.$(LIB_SUFFIX) \ + $(DIST)/lib/libcert.$(LIB_SUFFIX) \ + $(DIST)/lib/libkey.$(LIB_SUFFIX) \ + $(DIST)/lib/libsecmod.$(LIB_SUFFIX) \ + $(DIST)/lib/libcrypto.$(LIB_SUFFIX) \ + $(DIST)/lib/libsecutil.$(LIB_SUFFIX) \ + $(DIST)/lib/libhash.$(LIB_SUFFIX) \ $(NULL) -MYLIB = lib/$(OBJDIR)/libsectool.a +MYLIB = lib/$(OBJDIR)/libsectool.$(LIB_SUFFIX) US_LIBS = $(MYLIB) $(SEC_LIBS) $(BASE_LIBS) $(MYLIB) $(BASE_LIBS) EX_LIBS = $(MYLIB) $(SEC_LIBS) $(BASE_LIBS) $(MYLIB) $(BASE_LIBS) diff --git a/security/nss/cmd/certutil/keystuff.c b/security/nss/cmd/certutil/keystuff.c index 5b023f27e5e3..b39c589361d0 100644 --- a/security/nss/cmd/certutil/keystuff.c +++ b/security/nss/cmd/certutil/keystuff.c @@ -41,7 +41,7 @@ #include #endif -#if defined(XP_WIN) +#if defined(XP_WIN) || defined (XP_PC) #include #include #endif diff --git a/security/nss/cmd/crmf-cgi/Makefile b/security/nss/cmd/crmf-cgi/Makefile index e9b03eaf15b0..29f3357c306d 100644 --- a/security/nss/cmd/crmf-cgi/Makefile +++ b/security/nss/cmd/crmf-cgi/Makefile @@ -67,7 +67,7 @@ endif ifeq ($(OS_ARCH), WINNT) EXTRA_LIBS += $(DIST)/lib/crmf.lib else -EXTRA_LIBS += $(DIST)/lib/libcrmf.a +EXTRA_LIBS += $(DIST)/lib/libcrmf.$(LIB_SUFFIX) endif include ../platlibs.mk diff --git a/security/nss/cmd/crmftest/Makefile b/security/nss/cmd/crmftest/Makefile index 3c393e58dd39..9eae3715aea7 100644 --- a/security/nss/cmd/crmftest/Makefile +++ b/security/nss/cmd/crmftest/Makefile @@ -66,7 +66,7 @@ endif ifeq ($(OS_ARCH), WINNT) EXTRA_LIBS += $(DIST)/lib/crmf.lib else -EXTRA_LIBS += $(DIST)/lib/libcrmf.a +EXTRA_LIBS += $(DIST)/lib/libcrmf.$(LIB_SUFFIX) endif include ../platlibs.mk diff --git a/security/nss/cmd/pk12util/Makefile b/security/nss/cmd/pk12util/Makefile index 183d8a607c1f..4b1e82238b87 100644 --- a/security/nss/cmd/pk12util/Makefile +++ b/security/nss/cmd/pk12util/Makefile @@ -67,8 +67,8 @@ EXTRA_LIBS = \ else EXTRA_LIBS += \ - $(DIST)/lib/libpkcs12.a \ - $(DIST)/lib/libpkcs7.a \ + $(DIST)/lib/libpkcs12.$(LIB_SUFFIX) \ + $(DIST)/lib/libpkcs7.$(LIB_SUFFIX) \ $(NULL) endif diff --git a/security/nss/cmd/platlibs.mk b/security/nss/cmd/platlibs.mk index 63e20680695f..f88c289e6dfb 100644 --- a/security/nss/cmd/platlibs.mk +++ b/security/nss/cmd/platlibs.mk @@ -76,33 +76,33 @@ else # $(PROGRAM) has explicit dependencies on $(EXTRA_LIBS) ifdef MOZILLA_SECURITY_BUILD - CRYPTOLIB=$(DIST)/lib/libcrypto.a + CRYPTOLIB=$(DIST)/lib/libcrypto.$(LIB_SUFFIX) endif ifdef MOZILLA_BSAFE_BUILD - CRYPTOLIB=$(DIST)/lib/libbsafe.a + CRYPTOLIB=$(DIST)/lib/libbsafe.$(LIB_SUFFIX) endif EXTRA_LIBS += \ - $(DIST)/lib/libsmime.a \ - $(DIST)/lib/libssl.a \ - $(DIST)/lib/libjar.a \ - $(DIST)/lib/libzlib.a \ - $(DIST)/lib/libnss.a \ - $(DIST)/lib/libssl.a \ - $(DIST)/lib/libsectool.a \ - $(DIST)/lib/libpkcs7.a \ - $(DIST)/lib/libcerthi.a \ - $(DIST)/lib/libpk11wrap.a \ - $(DIST)/lib/libcryptohi.a \ - $(DIST)/lib/libcerthi.a \ - $(DIST)/lib/libpk11wrap.a \ - $(DIST)/lib/libsoftoken.a \ - $(DIST)/lib/libcertdb.a \ - $(DIST)/lib/libswfci.a \ - $(DIST)/lib/libfreebl.a \ + $(DIST)/lib/libsmime.$(LIB_SUFFIX) \ + $(DIST)/lib/libssl.$(LIB_SUFFIX) \ + $(DIST)/lib/libjar.$(LIB_SUFFIX) \ + $(DIST)/lib/libzlib.$(LIB_SUFFIX) \ + $(DIST)/lib/libnss.$(LIB_SUFFIX) \ + $(DIST)/lib/libssl.$(LIB_SUFFIX) \ + $(DIST)/lib/libsectool.$(LIB_SUFFIX) \ + $(DIST)/lib/libpkcs7.$(LIB_SUFFIX) \ + $(DIST)/lib/libcerthi.$(LIB_SUFFIX) \ + $(DIST)/lib/libpk11wrap.$(LIB_SUFFIX) \ + $(DIST)/lib/libcryptohi.$(LIB_SUFFIX) \ + $(DIST)/lib/libcerthi.$(LIB_SUFFIX) \ + $(DIST)/lib/libpk11wrap.$(LIB_SUFFIX) \ + $(DIST)/lib/libsoftoken.$(LIB_SUFFIX) \ + $(DIST)/lib/libcertdb.$(LIB_SUFFIX) \ + $(DIST)/lib/libswfci.$(LIB_SUFFIX) \ + $(DIST)/lib/libfreebl.$(LIB_SUFFIX) \ $(CRYPTOLIB) \ - $(DIST)/lib/libfreebl.a \ - $(DIST)/lib/libsecutil.a \ - $(DIST)/lib/libdbm.a \ + $(DIST)/lib/libfreebl.$(LIB_SUFFIX) \ + $(DIST)/lib/libsecutil.$(LIB_SUFFIX) \ + $(DIST)/lib/libdbm.$(LIB_SUFFIX) \ $(NULL) # $(PROGRAM) has NO explicit dependencies on $(EXTRA_SHARED_LIBS) diff --git a/security/nss/cmd/signtool/Makefile b/security/nss/cmd/signtool/Makefile index 966fafd6f1e3..a5e8f46ef56e 100644 --- a/security/nss/cmd/signtool/Makefile +++ b/security/nss/cmd/signtool/Makefile @@ -69,8 +69,8 @@ EXTRA_LIBS = \ else EXTRA_LIBS += \ - $(DIST)/lib/libjar.a \ - $(DIST)/lib/libzlib.a \ + $(DIST)/lib/libjar.$(LIB_SUFFIX) \ + $(DIST)/lib/libzlib.$(LIB_SUFFIX) \ $(NULL) endif diff --git a/security/nss/cmd/swfort/Makefile b/security/nss/cmd/swfort/Makefile index a483a24636c7..a5b4350a6a3d 100644 --- a/security/nss/cmd/swfort/Makefile +++ b/security/nss/cmd/swfort/Makefile @@ -55,35 +55,35 @@ US_FLAGS = -DEXPORT_VERSION EXPORT_FLAGS = -DEXPORT_VERSION BASE_LIBS = \ - $(DIST)/lib/libdbm.a \ - $(DIST)/lib/libxp.a \ - $(DIST)/lib/libnspr.a \ + $(DIST)/lib/libdbm.$(LIB_SUFFIX) \ + $(DIST)/lib/libxp.$(LIB_SUFFIX) \ + $(DIST)/lib/libnspr.$(LIB_SUFFIX) \ $(NULL) -# $(DIST)/lib/libpurenspr.a \ +# $(DIST)/lib/libpurenspr.$(LIB_SUFFIX) \ #There are a circular dependancies in security/lib, and we deal with it by # double linking some libraries SEC_LIBS = \ - $(DIST)/lib/libsecnav.a \ - $(DIST)/lib/libssl.a \ - $(DIST)/lib/libpkcs7.a \ - $(DIST)/lib/libcert.a \ - $(DIST)/lib/libkey.a \ - $(DIST)/lib/libsecmod.a \ - $(DIST)/lib/libcrypto.a \ - $(DIST)/lib/libsecutil.a \ - $(DIST)/lib/libssl.a \ - $(DIST)/lib/libpkcs7.a \ - $(DIST)/lib/libcert.a \ - $(DIST)/lib/libkey.a \ - $(DIST)/lib/libsecmod.a \ - $(DIST)/lib/libcrypto.a \ - $(DIST)/lib/libsecutil.a \ - $(DIST)/lib/libhash.a \ + $(DIST)/lib/libsecnav.$(LIB_SUFFIX) \ + $(DIST)/lib/libssl.$(LIB_SUFFIX) \ + $(DIST)/lib/libpkcs7.$(LIB_SUFFIX) \ + $(DIST)/lib/libcert.$(LIB_SUFFIX) \ + $(DIST)/lib/libkey.$(LIB_SUFFIX) \ + $(DIST)/lib/libsecmod.$(LIB_SUFFIX) \ + $(DIST)/lib/libcrypto.$(LIB_SUFFIX) \ + $(DIST)/lib/libsecutil.$(LIB_SUFFIX) \ + $(DIST)/lib/libssl.$(LIB_SUFFIX) \ + $(DIST)/lib/libpkcs7.$(LIB_SUFFIX) \ + $(DIST)/lib/libcert.$(LIB_SUFFIX) \ + $(DIST)/lib/libkey.$(LIB_SUFFIX) \ + $(DIST)/lib/libsecmod.$(LIB_SUFFIX) \ + $(DIST)/lib/libcrypto.$(LIB_SUFFIX) \ + $(DIST)/lib/libsecutil.$(LIB_SUFFIX) \ + $(DIST)/lib/libhash.$(LIB_SUFFIX) \ $(NULL) -MYLIB = lib/$(OBJDIR)/libsectool.a +MYLIB = lib/$(OBJDIR)/libsectool.$(LIB_SUFFIX) US_LIBS = $(MYLIB) $(SEC_LIBS) $(BASE_LIBS) $(MYLIB) $(BASE_LIBS) EX_LIBS = $(MYLIB) $(SEC_LIBS) $(BASE_LIBS) $(MYLIB) $(BASE_LIBS) diff --git a/security/nss/cmd/swfort/newuser/Makefile b/security/nss/cmd/swfort/newuser/Makefile index 907b29e6f8ff..d65b21949145 100644 --- a/security/nss/cmd/swfort/newuser/Makefile +++ b/security/nss/cmd/swfort/newuser/Makefile @@ -60,7 +60,7 @@ EXTRA_LIBS = \ else EXTRA_LIBS += \ - ../../../lib/fortcrypt/$(OBJDIR)/cilib.a \ + ../../../lib/fortcrypt/$(OBJDIR)/cilib.$(LIB_SUFFIX) \ $(NULL) endif diff --git a/security/nss/lib/fortcrypt/fpkmem.h b/security/nss/lib/fortcrypt/fpkmem.h index f0530dbcb9db..c35370be0e9b 100644 --- a/security/nss/lib/fortcrypt/fpkmem.h +++ b/security/nss/lib/fortcrypt/fpkmem.h @@ -41,7 +41,7 @@ #define NUM_SLOTS 32 -#if !defined (XP_UNIX) && !defined (_WINDOWS) +#if !defined (XP_UNIX) && !defined (_WINDOWS) && !defined(XP_OS2) #define XP_MAC 1 /*Make sure we get this define in for Mac builds*/ #endif diff --git a/security/nss/lib/fortcrypt/swfort/pkcs11/Makefile b/security/nss/lib/fortcrypt/swfort/pkcs11/Makefile index 9595d91fe2e5..af6311bee175 100644 --- a/security/nss/lib/fortcrypt/swfort/pkcs11/Makefile +++ b/security/nss/lib/fortcrypt/swfort/pkcs11/Makefile @@ -71,22 +71,22 @@ else # ifneq ($(OS_ARCH), OSF1) -CRYPTO_LIBS = $(DIST)/lib/libfreebl.a +CRYPTO_LIBS = $(DIST)/lib/libfreebl.$(LIB_SUFFIX) ifdef MOZILLA_SECURITY_BUILD -CRYPTO_LIBS += $(DIST)/lib/libcrypto.a +CRYPTO_LIBS += $(DIST)/lib/libcrypto.$(LIB_SUFFIX) endif ifdef MOZILLA_BSAFE_BUILD -CRYPTO_LIBS += $(DIST)/lib/libbsafe.a +CRYPTO_LIBS += $(DIST)/lib/libbsafe.$(LIB_SUFFIX) endif EXTRA_LIBS += \ - $(DIST)/lib/libswfci.a \ - $(DIST)/lib/libsoftoken.a \ + $(DIST)/lib/libswfci.$(LIB_SUFFIX) \ + $(DIST)/lib/libsoftoken.$(LIB_SUFFIX) \ $(CRYPTO_LIBS) \ - $(DIST)/lib/libsecutil.a \ - $(DIST)/lib/libplc4.a \ - $(DIST)/lib/libplds4.a \ + $(DIST)/lib/libsecutil.$(LIB_SUFFIX) \ + $(DIST)/lib/libplc4.$(LIB_SUFFIX) \ + $(DIST)/lib/libplds4.$(LIB_SUFFIX) \ $(NULL) endif diff --git a/security/nss/lib/fortcrypt/swfort/swfutl.c b/security/nss/lib/fortcrypt/swfort/swfutl.c index 740444c3acaa..db5a97b67d49 100644 --- a/security/nss/lib/fortcrypt/swfort/swfutl.c +++ b/security/nss/lib/fortcrypt/swfort/swfutl.c @@ -44,6 +44,9 @@ #include "maci.h" #include "secport.h" #include "secrng.h" +#ifdef XP_OS2 +#include /* Needed for OS/2 emx */ +#endif #ifdef XP_WIN #include @@ -395,10 +398,19 @@ fort_GenerateRandom(unsigned char *buf, int bytes) /* * NOTE: that MAC is missing below. */ +#if defined (XP_UNIX) || defined (XP_OS2) #ifdef XP_UNIX #define NS_PATH_SEP ':' #define NS_DIR_SEP '/' #define NS_DEFAULT_PATH ".:/bin/netscape:/etc/netscape/:/etc" +#endif + +#ifdef XP_OS2 /* for OS/2 */ +#define NS_PATH_SEP ';' +#define NS_DIR_SEP '\\' +#define NS_DEFAULT_PATH ".:\\bin\\netscape:\\etc\\netscape\\:\\etc" +#endif + PRInt32 local_getFileInfo(const char *fn, PRFileInfo *info) { @@ -428,7 +440,8 @@ local_getFileInfo(const char *fn, PRFileInfo *info) } return rv; } -#endif +#endif /* UNIX & OS/2 */ + #ifdef XP_WIN #define NS_PATH_SEP ';' #define NS_DIR_SEP '\\' @@ -609,7 +622,8 @@ local_getFileInfo(const char *fn, PRFileInfo *info) return 0; } -#endif +#endif /* XP_WIN */ + #ifdef XP_MAC #error Need to write fort_FindFileInPath for Mac #define NS_PATH_SEP ',' diff --git a/security/nss/lib/freebl/Makefile b/security/nss/lib/freebl/Makefile index 3d2d37e2add5..adcc029a40db 100644 --- a/security/nss/lib/freebl/Makefile +++ b/security/nss/lib/freebl/Makefile @@ -149,7 +149,7 @@ ifdef MOZILLA_BSAFE_BUILD ifeq ($(OS_ARCH),WINNT) libbsafe=bsafe41.lib else -libbsafe=libbsafe.a +libbsafe=libbsafe.$(LIB_SUFFIX) endif private_export:: diff --git a/security/nss/lib/ssl/Makefile b/security/nss/lib/ssl/Makefile index 577dc8ac6fb7..421eb355f30d 100644 --- a/security/nss/lib/ssl/Makefile +++ b/security/nss/lib/ssl/Makefile @@ -59,8 +59,12 @@ include config.mk ifeq ($(OS_ARCH),WINNT) CSRCS += win32err.c else +ifeq ($(OS_ARCH),OS2) +CSRCS += os2err.c +else CSRCS += unix_err.c endif +endif ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # diff --git a/security/nss/lib/ssl/os2_err.c b/security/nss/lib/ssl/os2_err.c new file mode 100644 index 000000000000..32bf1a8e8a61 --- /dev/null +++ b/security/nss/lib/ssl/os2_err.c @@ -0,0 +1,310 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * This file essentially replicates NSPR's source for the functions that + * map system-specific error codes to NSPR error codes. We would use + * NSPR's functions, instead of duplicating them, but they're private. + * As long as SSL's server session cache code must do platform native I/O + * to accomplish its job, and NSPR's error mapping functions remain private, + * this code will continue to need to be replicated. + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1994-2000 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + * + * $Id: os2_err.c,v 1.2 2000/09/20 17:07:19 relyea%netscape.com Exp $ + */ + +#include "prerror.h" +#include "prlog.h" +#include + + +/* + * Based on win32err.c + * OS2TODO Stub everything for now to build. HCT + */ + +/* forward declaration. */ +void nss_MD_os2_map_default_error(PRInt32 err); + +void nss_MD_os2_map_opendir_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_closedir_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_readdir_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_delete_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +/* The error code for stat() is in errno. */ +void nss_MD_os2_map_stat_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_fstat_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_rename_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +/* The error code for access() is in errno. */ +void nss_MD_os2_map_access_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_mkdir_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_rmdir_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_read_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_transmitfile_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_write_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_lseek_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_fsync_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +/* + * For both CloseHandle() and closesocket(). + */ +void nss_MD_os2_map_close_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_socket_error(PRInt32 err) +{ +// PR_ASSERT(err != WSANOTINITIALISED); + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_recv_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_recvfrom_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_send_error(PRInt32 err) +{ + PRErrorCode prError; + switch (err) { +// case WSAEMSGSIZE: prError = PR_INVALID_ARGUMENT_ERROR; break; + default: nss_MD_os2_map_default_error(err); return; + } + PR_SetError(prError, err); +} + +void nss_MD_os2_map_sendto_error(PRInt32 err) +{ + PRErrorCode prError; + switch (err) { +// case WSAEMSGSIZE: prError = PR_INVALID_ARGUMENT_ERROR; break; + default: nss_MD_os2_map_default_error(err); return; + } + PR_SetError(prError, err); +} + +void nss_MD_os2_map_accept_error(PRInt32 err) +{ + PRErrorCode prError; + switch (err) { +// case WSAEOPNOTSUPP: prError = PR_NOT_TCP_SOCKET_ERROR; break; +// case WSAEINVAL: prError = PR_INVALID_STATE_ERROR; break; + default: nss_MD_os2_map_default_error(err); return; + } + PR_SetError(prError, err); +} + +void nss_MD_os2_map_acceptex_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_connect_error(PRInt32 err) +{ + PRErrorCode prError; + switch (err) { +// case WSAEWOULDBLOCK: prError = PR_IN_PROGRESS_ERROR; break; +// case WSAEINVAL: prError = PR_ALREADY_INITIATED_ERROR; break; +// case WSAETIMEDOUT: prError = PR_IO_TIMEOUT_ERROR; break; + default: nss_MD_os2_map_default_error(err); return; + } + PR_SetError(prError, err); +} + +void nss_MD_os2_map_bind_error(PRInt32 err) +{ + PRErrorCode prError; + switch (err) { +// case WSAEINVAL: prError = PR_SOCKET_ADDRESS_IS_BOUND_ERROR; break; + default: nss_MD_os2_map_default_error(err); return; + } + PR_SetError(prError, err); +} + +void nss_MD_os2_map_listen_error(PRInt32 err) +{ + PRErrorCode prError; + switch (err) { +// case WSAEOPNOTSUPP: prError = PR_NOT_TCP_SOCKET_ERROR; break; +// case WSAEINVAL: prError = PR_INVALID_STATE_ERROR; break; + default: nss_MD_os2_map_default_error(err); return; + } + PR_SetError(prError, err); +} + +void nss_MD_os2_map_shutdown_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_getsockname_error(PRInt32 err) +{ + PRErrorCode prError; + switch (err) { +// case WSAEINVAL: prError = PR_INVALID_STATE_ERROR; break; + default: nss_MD_os2_map_default_error(err); return; + } + PR_SetError(prError, err); +} + +void nss_MD_os2_map_getpeername_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_getsockopt_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_setsockopt_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_open_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +void nss_MD_os2_map_gethostname_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + +/* Win32 select() only works on sockets. So in this +** context, WSAENOTSOCK is equivalent to EBADF on Unix. +*/ +void nss_MD_os2_map_select_error(PRInt32 err) +{ + PRErrorCode prError; + switch (err) { +// case WSAENOTSOCK: prError = PR_BAD_DESCRIPTOR_ERROR; break; + default: nss_MD_os2_map_default_error(err); return; + } + PR_SetError(prError, err); +} + +void nss_MD_os2_map_lockf_error(PRInt32 err) +{ + nss_MD_os2_map_default_error(err); +} + + + +void nss_MD_os2_map_default_error(PRInt32 err) +{ + PRErrorCode prError; + + switch (err) { +// case ENOENT: prError = PR_FILE_NOT_FOUND_ERROR; break; +// case ERROR_ACCESS_DENIED: prError = PR_NO_ACCESS_RIGHTS_ERROR; break; +// case ERROR_ALREADY_EXISTS: prError = PR_FILE_EXISTS_ERROR; break; +// case ERROR_DISK_CORRUPT: prError = PR_IO_ERROR; break; +// case ERROR_DISK_FULL: prError = PR_NO_DEVICE_SPACE_ERROR; break; +// case ERROR_DISK_OPERATION_FAILED: prError = PR_IO_ERROR; break; +// case ERROR_DRIVE_LOCKED: prError = PR_FILE_IS_LOCKED_ERROR; break; +// case ERROR_FILENAME_EXCED_RANGE: prError = PR_NAME_TOO_LONG_ERROR; break; +// case ERROR_FILE_CORRUPT: prError = PR_IO_ERROR; break; +// case ERROR_FILE_EXISTS: prError = PR_FILE_EXISTS_ERROR; break; +// case ERROR_FILE_INVALID: prError = PR_BAD_DESCRIPTOR_ERROR; break; +#if ERROR_FILE_NOT_FOUND != ENOENT +// case ERROR_FILE_NOT_FOUND: prError = PR_FILE_NOT_FOUND_ERROR; break; +#endif + default: prError = PR_UNKNOWN_ERROR; break; + } + PR_SetError(prError, err); +} + diff --git a/security/nss/lib/ssl/os2_err.h b/security/nss/lib/ssl/os2_err.h new file mode 100644 index 000000000000..ddfc22ea74cd --- /dev/null +++ b/security/nss/lib/ssl/os2_err.h @@ -0,0 +1,83 @@ +/* + * This file essentially replicates NSPR's source for the functions that + * map system-specific error codes to NSPR error codes. We would use + * NSPR's functions, instead of duplicating them, but they're private. + * As long as SSL's server session cache code must do platform native I/O + * to accomplish its job, and NSPR's error mapping functions remain private, + * This code will continue to need to be replicated. + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1994-2000 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + * + * $Id: os2_err.h,v 1.2 2000/09/20 17:07:20 relyea%netscape.com Exp $ + */ + +/* NSPR doesn't make these functions public, so we have to duplicate +** them in NSS. +*/ + +//HCT Based on Win32err.h +extern void nss_MD_os2_map_accept_error(PRInt32 err); +extern void nss_MD_os2_map_acceptex_error(PRInt32 err); +extern void nss_MD_os2_map_access_error(PRInt32 err); +extern void nss_MD_os2_map_bind_error(PRInt32 err); +extern void nss_MD_os2_map_close_error(PRInt32 err); +extern void nss_MD_os2_map_closedir_error(PRInt32 err); +extern void nss_MD_os2_map_connect_error(PRInt32 err); +extern void nss_MD_os2_map_default_error(PRInt32 err); +extern void nss_MD_os2_map_delete_error(PRInt32 err); +extern void nss_MD_os2_map_fstat_error(PRInt32 err); +extern void nss_MD_os2_map_fsync_error(PRInt32 err); +extern void nss_MD_os2_map_gethostname_error(PRInt32 err); +extern void nss_MD_os2_map_getpeername_error(PRInt32 err); +extern void nss_MD_os2_map_getsockname_error(PRInt32 err); +extern void nss_MD_os2_map_getsockopt_error(PRInt32 err); +extern void nss_MD_os2_map_listen_error(PRInt32 err); +extern void nss_MD_os2_map_lockf_error(PRInt32 err); +extern void nss_MD_os2_map_lseek_error(PRInt32 err); +extern void nss_MD_os2_map_mkdir_error(PRInt32 err); +extern void nss_MD_os2_map_open_error(PRInt32 err); +extern void nss_MD_os2_map_opendir_error(PRInt32 err); +extern void nss_MD_os2_map_read_error(PRInt32 err); +extern void nss_MD_os2_map_readdir_error(PRInt32 err); +extern void nss_MD_os2_map_recv_error(PRInt32 err); +extern void nss_MD_os2_map_recvfrom_error(PRInt32 err); +extern void nss_MD_os2_map_rename_error(PRInt32 err); +extern void nss_MD_os2_map_rmdir_error(PRInt32 err); +extern void nss_MD_os2_map_select_error(PRInt32 err); +extern void nss_MD_os2_map_send_error(PRInt32 err); +extern void nss_MD_os2_map_sendto_error(PRInt32 err); +extern void nss_MD_os2_map_setsockopt_error(PRInt32 err); +extern void nss_MD_os2_map_shutdown_error(PRInt32 err); +extern void nss_MD_os2_map_socket_error(PRInt32 err); +extern void nss_MD_os2_map_stat_error(PRInt32 err); +extern void nss_MD_os2_map_transmitfile_error(PRInt32 err); +extern void nss_MD_os2_map_write_error(PRInt32 err); diff --git a/security/nss/lib/util/manifest.mn b/security/nss/lib/util/manifest.mn index 0dd2f3d7e8ff..1ff25e6a459a 100644 --- a/security/nss/lib/util/manifest.mn +++ b/security/nss/lib/util/manifest.mn @@ -86,7 +86,7 @@ CSRCS = \ utf8.c \ $(NULL) -ifeq ($(subst /,_,$(shell uname -s)),OS2) +ifeq ($(subst /,,$(shell uname -s)),OS2) CSRCS += os2_rand.c endif diff --git a/security/nss/lib/util/os2_rand.c b/security/nss/lib/util/os2_rand.c index cbe20a2056ac..7ee06f854a39 100644 --- a/security/nss/lib/util/os2_rand.c +++ b/security/nss/lib/util/os2_rand.c @@ -36,6 +36,9 @@ #include #include #include +#include +#include +#include static BOOL clockTickTime(unsigned long *phigh, unsigned long *plow) { diff --git a/security/nss/lib/util/secport.c b/security/nss/lib/util/secport.c index ebc7b1e5dffe..f35743ca06ea 100644 --- a/security/nss/lib/util/secport.c +++ b/security/nss/lib/util/secport.c @@ -38,7 +38,7 @@ * * NOTE - These are not public interfaces * - * $Id: secport.c,v 1.3 2000/05/12 18:43:25 dougt%netscape.com Exp $ + * $Id: secport.c,v 1.4 2000/09/20 17:07:22 relyea%netscape.com Exp $ */ #include "seccomon.h" @@ -58,7 +58,7 @@ #include "prthread.h" #endif /* THREADMARK */ -#if defined(XP_UNIX) || defined(XP_MAC) +#if defined(XP_UNIX) || defined(XP_MAC) || defined(XP_OS2) #include #else #include "wtypes.h"