New Upstream Release - tomcat-native
Ready changes
Summary
Merged new upstream version: 2.0.4 (was: 2.0.2).
Resulting package
Built on 2023-07-08T13:07 (took 5m49s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-releases libtcnative-1-dbgsymapt install -t fresh-releases libtcnative-1
Diff
diff --git a/.gitignore b/.gitignore
index 5239107..3bb76e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,13 @@
/native/tcnative.pc
/native/tcnative.spec
+/native/srclib/apr/*
+!/native/srclib/apr/NMAKEmakefile
+
+/native/srclib/openssl/*
+!/native/srclib/openssl/openssl-mscvrt*
+
+/native/*RELEASE
/tomcat-native-*
/tomcat-native-*/
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 7511001..0d22740 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,368 +1,57 @@
Preface
- This is the Changelog for Tomcat Native 1.2.
+ This is the Changelog for Apache Tomcat Native 2.0.x. The Tomcat Native
+ 2.0.x branch started from the 1.2.33 tag.
- Changes in 1.2.35
+ Changes in 2.0.4
- * Docs: Document the TLS rengotiation behaviour. (markt)
- * Docs: Add HOWTO-RELEASE.txt that describes the release process.
- (markt)
- * Update: Update recommended OpenSSL version to 1.1.1q or later. (markt)
-
- Changes in 1.2.34
-
- * Code: Refactor library initialization so it is compatible with Tomcat
- 10.1.x onwards where a number of Java classes have been removed.
+ * Update: Update the recommended minimum version of APR to 1.7.4.
(markt)
- * Add: Map the OpenSSL 3.x FIPS behaviour to the OpenSSL 1.x API to
- allow clients to determine if the FIPS provider is being used when
- Tomcat Native is compiled against OpenSSL 3.x. (markt)
-
- Changes in 1.2.33
-
- * Fix: 66035: Fix crash when attempting to read TLS session ID after a
- handshake failure. (schultz/markt)
- * Fix: Enable download_deps.sh to be called from any directory. Pull
- request #12 provided by Dimitrios Soumis. (markt)
- * Update: Update recommended OpenSSL version to 1.1.1o or later. (markt)
-
- Changes in 1.2.32
-
- * Update: Update recommended OpenSSL version to 1.1.1n or later. (markt)
- * Fix: Fix release script so it works with the current git layout.
+ * Update: Update the recommended minimum version of OpenSSL to 3.0.9.
(markt)
- Changes in 1.2.31
-
- * Fix: 65441: Correct previous fix that enabled building to continue
- with OpenSSL 3.x. Patch provided by lzsiga. (markt)
- * Fix: 65659: Remove remaining reference to pkg-config which is no
- longer included in the Tomcat Native distribution. (markt)
-
- Changes in 1.2.30
-
- * Add: 65181: Additional changes required to provided support for using
- OpenSSL Engines that use proprietary key formats. Based on a patch
- provided by Edin Hodzic. (markt)
- * Fix: 65329: Correct handling of WINVER in make file to use correct
- constant for Windows 7. Add constants for Windows 8, Windows 8.1 and
- Windows 10. Rename WINNT to WIN2k as it is used for Windows 2000
- upwards, not Windows NT upwards. (markt)
-
- Changes in 1.2.29 (not released)
-
- * Fix: Add a patch for APR that fixes an issue where some Windows
- systems in some configurations would only listen on IPv6 addresses on
- dual stack systems even though configured to listen on both IPv6 and
- IPv4 addresses. (michaelo)
-
- Changes in 1.2.28
-
- * Fix: Correct a regression in the fix for 65181 that prevented an error
- message from being displayed if an invalid key file was provided and
- no OpenSSL Engine was configured. (markt)
-
- Changes in 1.2.27
+ Changes in 2.0.3
- * Add: 65181: Improve support for using OpenSSL Engines that use
- proprietary key formats. Patch provided by Edin Hodzic. (markt)
- * Update: Update recommended OpenSSL version to 1.1.1k or later. (markt)
-
- Changes in 1.2.26
-
- * Fix: Enable building to continue against OpenSSL 3.x and 1.1.1.
+ * Update: Update the recommended minimum version of APR to 1.7.2.
(markt)
- * Add: 64942: Expose support for Unix Domain Sockets in APR v1.6 and up.
- (minfrin)
- * Update: Update recommended OpenSSL version to 1.1.1i or later. (markt)
-
- Changes in 1.2.25
-
- * Fix: Incomplete name mangling fix for C++ compilers in tcn_api.h.
- (michaelo)
- * Update: Improve OS-specific header include for native thread id.
- (michaelo)
- * Fix: Disable keylog callback support for LibreSSL. (michaelo)
- * Add: Add support for SSLContext.addChainCertificateRaw() with LibreSSL
- 2.9.1 and up. (michaelo)
- * Add: Add support for HP-UX's _lwp_self() in our ssl_thread_id(void).
- (michaelo) Remove default option passed for rpath to linker on HP-UX.
- (michaelo)
- * Add: Add an option to allow the OCSP responder check to be bypassed.
- Note that if OCSP is enabled, a missing responder is now treated as an
- error. (jfclere)
- * Fix: 64429: Fix compilation with LibreSSL. (markt)
-
- Changes in 1.2.24
-
- * Fix: 63671: libtcnative does not compile with OpenSSL < 1.1.0 and APR
- w/o threading support. (michaelo)
- * Fix: Correct configure message for OpenSSL libdir. (michaelo)
- * Update: 64260: Clean up install target. (michaelo)
- * Fix: 64315: configure output for OpenSSL wrong/incomplete sometimes.
- (michaelo)
- * Update: Drop obsolete build time workarounds for HP-UX. (michaelo)
- * Add: Add support for FreeBSD's pthread_getthreadid_np() in our
- ssl_thread_id(void). (michaelo)
- * Update: 63701: Use new OpenSSL initialisation process when building
- with OpenSSL 1.1.0 onwards. (mturk)
- * Add: 64316: Introduce tcn_get_thread_id(void) to reduce code
- duplication. (michaelo)
- * Fix: Fix linking against OpenSSL in non-standard locations on FreeBSD.
- (michaelo)
-
- Changes in 1.2.23
-
- * Fix: Make file fixes to enable building with APR 1.7.x. (markt)
- * Fix: Switch to Windows 7 as the default target. (markt)
- * Update: Update minimum OpenSSL version to 1.0.2r. (markt)
-
- Changes in 1.2.22
-
- * Fix: 63159: Unable to complete build when build directory is outside
- of the source tree. Patch provided by Bob Huemmer. (markt)
- * Fix: 63356: Fix client certificate authentication when a certificate
- contains an AIA extension without an OCSP URI. Patch provided by
- Milind Takawale. (markt)
- * Fix: 63500: Fix JVM crash on Connector start when a certificate
- revocation file or path is specified for OpenSSL. (markt)
- * Add: Add support for TLS key logging when using OpenSSL 1.1.1 or
- later. If the environment variable SSLKEYLOGFILE is set then the TLS
- keys will be logged to that file. Patch provided by John Kelly.
+ * Update: Update the recommended minimum version of OpenSSL to 3.0.8.
(markt)
- * Fix: Update build script after migration of soucre repository from
- Subversion to Git. (markt)
-
- Changes in 1.2.21
-
- * Fix: Correct a possible JVM crash during shutdown caused by a bug in
- the fix for the per connection memory leak included in 1.2.20. (rjung)
-
- Changes in 1.2.20
-
- * Fix: Update includedir name to tomcat-native instead of apr.
- (csutherl)
- * Fix: Fix a minor memory leak. It occurred every time a TLS connector
- was started so the impact was very unlikely to be noticed. (markt)
- * Fix: Fix some minor memory leaks that could occur after error
- conditions during TLS connector initialisation. (markt)
- * Fix: Fix a per connection memory leak when using OpenSSL BIO. This is
- typically used when OpenSSL is providing the TLS support for NIO or
- NIO2. (markt)
-
- Changes in 1.2.19
-
- * Fix: 62892: Fix memory leaks in OCSP handling. (jfclere)
- * Fix: 62944: Fix copy/paste error that prevented TLS 1.0 and TLS 1.1
- from being used if TLS 1.3 was available. Patch provided by Dean
- Rasheed. (markt)
- * Fix: Include OpenSSL licensing information in the Tomcat Native
- binaries for Windows that are built with OpenSSL. (markt)
- * Update: Update recommended OpenSSL version to 1.0.2q or later. (markt)
-
- Changes in 1.2.18
- * Fix: 62641: libtool invocations should use --tag=CC. (michaelo)
- * Code: Remove support for Netware as there has not been a supported
- Netware platform for a number of years. (markt)
- * Add: 62748: Add support for TLS 1.3 when built with OpenSSL 1.1.1 or
- equivalent. (schultz/markt)
- * Add: Expose the API necessary for CLIENT-CERT authentication to be
- correctly supported when using Tomcat's JSSE implementation backed by
- OpenSSL. (markt)
+ Changes in 2.0.2
- Changes in 1.2.17
+ * Update: Update the minimum supported version of LibreSSL to 3.5.2.
+ Based on pull request #13 provided by orbea. (markt)
+ * Fix: Fix build when building with rlibtool. Pull request #14 provided
+ by orbea. (markt)
- * Fix: 62094: Certificate verification using CRL with Tomcat APR
- connector does not work. (jfclere)
- * Fix: 62122: undefined symbol: SSL_COMP_free_compression_methods.
- (jfclere)
- * Fix: 62221: OCSP response processing uses always the first entry in
- the response. (jfclere)
- * Fix: Further clean-up in the OCSP extension logic. (jfclere)
+ Changes in 2.0.1
- Changes in 1.2.16
+ * Update: Update recommended OpenSSL version to 3.0.5 or later. (markt)
- * Fix: Further clean-up in the parsing of the OCSP extension. (markt)
+ Changes in 2.0.0
- Changes in 1.2.15
-
- * Update: Update recommended OpenSSL version to 1.0.2m. (markt)
- * Fix: Correctly calculate field lengths when parsing the OCSP extension
- so that longer values are read correctly. (markt)
- * Update: Update the recommended APR version to 1.6.3 or later. (markt)
-
- Changes in 1.2.14
-
- * Fix: Fix a small memory leak during certificate initialization.
- (rjung)
- * Fix: Replace use of deprecated ASN1_STRING_data with
- ASN1_STRING_get0_data when building against OpenSSL 1.1.0 and newer.
- (rjung)
- * Fix: Fix a thread local key leak. Only relevant when doing
- SSL.initialize() and Library.terminate() a lot of times. (rjung)
-
- Changes in 1.2.13
-
- * Fix: Add missing source files to Visual Studio project files. (wrowe)
- * Add: Add support for the OpenSSL SSL_CONF API. (rjung)
- * Add: Add SSLContext.getCiphers(). (rjung)
- * Add: Add method to add a single CA certificate to the list of CA
- certificates which are accepted as issuers of client certificates.
- (rjung)
- * Fix: Fix an error not announcing the correct CA list for client
- certificates during TLS handshake. (rjung)
- * Fix: Fix renegotiation to obtain a client certificate from a user
- agent. (markt)
- * Fix: 58434: Allow Tomcat Native to be compiled with LibreSSL. Note
- that some features may not be available when using LibreSSL. (markt)
- * Fix: 60290: When building Tomcat Native, don't ignore the value of CC
- if explicitly set. Patch provided by Michael Osipov. (markt)
- * Fix: 60301: When building Tomcat Native, allow the user to override
- the libtool specified by APR by setting the LIBTOOL environment
- variable. (markt)
- * Update: Update build to use APR 1.6.x, with 1.6.2 recommended. (markt)
- * Update: Update recommended OpenSSL version to 1.0.2l. (markt)
-
- Changes in 1.2.12
-
- * Fix: Correct a regression in the fix for 59797 that triggered a JVM
- crash on shutdown in some Tomcat unit tests when using the APR/native
- connector. (markt)
-
- Changes in 1.2.11
-
- * Fix: 52627: Prevent a crash in File.infoGet() caused by the use of
- uninitialised variables. Based on patch by Ilya Maykov. (markt)
- * Fix: 55113: Document the process for creating a static tc-native
- library with a FIPS-enabled OpenSSL and update the nmake make file to
- support the process. (markt)
- * Fix: 55114: Clean up building instructions for the native component
- and expand the instructions for building for Windows platforms.
- (markt)
- * Fix: 55938: Resolve remaining clang-analyzer warnings. Note that the
- use of -1 to indicate the full array in File.(read|write)[Full] has
- been removed since it was only partially implemented and the
- implementation was faulty. (markt)
- * Fix: 58082: Update unit tests to use JUnit 4. Refactor unit tests into
- separate tests and use an external to reference them in the same way
- an external is used to reference the main code. (markt)
- * Fix: 59797: Ensure that the per thread error hash maintained by
- OpenSSL is cleaned up as individual threads exit to ensure it does not
- grow too large. Patch provided by Nate Clark. (markt)
- * Fix: 59996: Correctly handle building tc-native on a 64-bit system
- when using an OpenSSL distribution that is not in /usr. (csutherl)
- * Fix: 60388: The --disable-maintainer-mode option of the configure
- script no longer enables the maintainer mode. (ebourg)
- * Update: Update minimum recommended OpenSSL version to 1.0.2k. (markt)
-
- Changes in 1.2.10
-
- * Update: Update minimum recommended OpenSSL version to 1.0.2j. (markt)
-
- Changes in 1.2.9
-
- * Update: Update minimum recommended OpenSSL version to 1.0.2i. (markt)
-
- Changes in 1.2.8
-
- * Fix: 59616: Correct the Windows build files so that OCSP is correctly
- enabled and disabled in the respective Windows binaries. (markt)
- * Fix: Correctly handle OS level EAGAIN return codes during non-blocking
- TLS I/O. (markt)
- * Fix: Correct a potential performance problem identified by Nate Clark
- due to Tomcat Native providing OpenSSL with thread identifiers poorly
- suited to the hash function used by OpenSSL when selecting a bucket
- for the hash that holds the per thread error data. Tomcat Native on
- Windows and on Solaris were not affected. A fix has been applied for
- OSX and Linux. Other platforms may still be affected. (markt/rjung)
-
- Changes in 1.2.7
-
- * Update: Update minimum recommended OpenSSL version to 1.0.2h. (markt)
-
- Changes in 1.2.6
-
- * Update: Change the OpenSSL version check in configure to be fatal.
- (rjung)
- * Update: Use new OpenSSL 1.1.0 protocol version max and min API when
- creating a new SSL context. (rjung)
- * Update: Improve renegotiation code and make it compatible with OpenSSL
- 1.1.0. (rjung)
- * Code: OpenSSL 1.1.0 compatibility updates. (rjung)
- * Fix: Fix some compiler warnings in native ssl code. (rjung)
- * Add: Add support for using Java keystores for certificate chains.
+ * Update: Update the minimum required version of OpenSSL to 3.0.0 and
+ make it a madatory dependency. (markt)
+ * Update: Update the minimum required version of APR to 1.7.0. (markt)
+ * Design: Remove NPN support as NPN was never standardised and browser
+ support was removed in 2019. (markt)
+ * Add: Add support for using OpenSSL when the FIPS provider is
+ configured as the default provider. (markt)
+ * Design: Remove all API methods (and supporting code) that are not used
+ by Tomcat 10.1.x to support the use of OpenSSL as a replacement for
+ JSSE to provide TLS functionality. (markt)
+ * Docs: Document the TLS rengotiation behaviour. (markt)
+ * Update: Update the minimum required Java version to Java 11. (markt)
+ * Update: Remove support for Windows 2000, Windows XP, Windows Server
+ 2003, Windows Vista and Windows Server 2008. The minimum Windows
+ version is now Windows 7 / Windows Server 2008 R2. (markt)
+ * Docs: Add HOWTO-RELEASE.txt that describes the release process.
(markt)
- * Update: Remove the explicit CRL check when verifying certificates. The
- checks were already part of the internal certification verification
- since OpenSSL 0.9.7. Backport from mod_ssl. (rjung)
-
- Changes in 1.2.5
-
- * Update: Enable OpenSSL version check in configure by default. It can
- be turned off using --disable-openssl-version-check. (rjung)
- * Fix: 59024: Native function versionString() and for OpenSSL 1.1.0 also
- version() (both in in ssl.c) now return the OpenSSL run time version,
- not the compile time version. (rjung)
- * Code: Track changes in the OpenSSL master branch so it is possible to
- build Tomcat Native with that branch. (billbarker)
-
- Changes in 1.2.4
+ * Fix: Fix the autoconf warnings when creating a release. (markt)
- * Fix: SSL.getHandshakeCount(), which was unused, now returns the
- handshake completed count rather than the handshake started count.
- (remm)
+ Changes in 1.2.x
- Changes in 1.2.3
-
- * Fix: Remove Java classes that do not have C implementation code for
- their native methods in the current library. They were used for NPN
- support which is superseded by ALPN support in the current code.
- (kkolinko)
- * Fix: Fix typo in declaration of a stub method used when the library is
- compiled without OpenSSL support. (kkolinko)
- * Fix: Fix the signature of the implementation of the native SSL method
- newSSL() in the case when OPENSSL is not available. (rjung)
- * Fix: Fix the signature of the implementation of the native SSLSocket
- method getInfoB() to return jbyteArray instead of jobject. This is
- consistent with what it actually returns and how the native Java
- method is declared. (rjung)
- * Add: Add support for using Java keystores for certificates and keys.
- (jfclere)
- * Code: Remove code that performs a read after a renegotiation that
- appears to be unnecessary with OpenSSL 1.0.2. (billbarker)
- * Add: Expose SSL_renegotiate to the Java API. (remm)
-
- Changes in 1.2.2
-
- * Fix: Fix broken debug and maintainer mode build. (rjung)
- * Fix: Forward port additional fixes to the OpenSSL I/O to align it with
- non-OpenSSL I/O. (markt)
-
- Changes in 1.2.1
-
- * Fix: 58566: Enable Tomcat Native 1.2.x to work with Tomcat releases
- that do not have the necessary Java code to support SNI. (markt)
- * Update: Minor rework of "buildconf" script. (rjung)
- * Fix: Fix APR dependency version expression in RPM spec file. (rjung)
- * Fix: Fix major library version number in Windows build files, RPM spec
- file and build description. (rjung)
- * Fix: Remove files "KEYS" and "download_deps.sh" from Windows (zip)
- source distribution. (rjung)
- * Fix: Fix "unused variable" compiler warning. (rjung)
-
- Changes in 1.2.0
-
- * Add: Add support for TLS extension ALPN. (markt)
- * Add: Add support for TLS extension SNI (Server Name Indication).
- (markt)
- * Add: Add support for OpenSSL BIO. (jfclere)
- * Add: Support wakeable pollsets and add Poll.interrupt() API. (mturk)
- * Add: Add Pool.unmanaged() API. (mturk)
- * Update: APIs SSL.generateRSATempKey() and SSL.loadDSATempKey() have
- been removed. (rjung)
- * Update: The minimum required APR version is 1.4.3.
- * Update: The minimum required OpenSSL version is 1.0.2.
+ Please see the 1.2.x changelog.
Changes in 1.1.x
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5db4ca1..0191ace 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,7 +42,7 @@ include_directories (${TOMCAT_JNI_SOURCE_DIR}/native/include
set (SSL_C_FLAGS "-DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -DL_ENDIAN -DTERMIO -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM ")
-set (CMAKE_C_FLAGS "-pthread -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -DHAVE_OPENSSL -fPIC -DOPENSSL_PIC -m64 -O3 -Wall ${SSL_C_FLAGS}")
+set (CMAKE_C_FLAGS "-pthread -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -fPIC -DOPENSSL_PIC -m64 -O3 -Wall ${SSL_C_FLAGS}")
set (OPENSSL_SRC ${DEPS}/openssl)
diff --git a/HOWTO-RELEASE.txt b/HOWTO-RELEASE.txt
index b88349c..0c3e7c1 100644
--- a/HOWTO-RELEASE.txt
+++ b/HOWTO-RELEASE.txt
@@ -21,9 +21,9 @@ How to do a Tomcat Native release
Requirements
------------
-Java 8
+Java 11
Apache Ant 1.9 or later
-Apache APR 1.4.3 or later source (1.7.0 or later recommended)
+Apache APR 1.7.0 or later source
Preparation
@@ -38,12 +38,12 @@ Ensure dates and/or version numbers are up to date:
- build.properties.default
- native/build/rpm/tcnative.spec.in
- native/include/tcn_version.h
-- native/os/win32/libtcnative.rc
+- native/os/win32/libtcnative.rc x3
- xdocs/miscellaneous/changelog.xml
-Run the release script to check the Java code is aligned with the current 9.0.x
+Run the release script to check the Java code is aligned with the current 10.1.x
source.
-./jnirelease.sh --ver=1.2.x --with-apr=/path/to/apr/source
+./jnirelease.sh --ver=main --with-apr=/path/to/apr/source
Switch back to the main branch
git checkout main
@@ -63,9 +63,9 @@ git status
git diff
# Tag (modify version as appropriate)
-git commit -a -m "Tag 1.2.35"
-git tag 1.2.35
-git push origin 1.2.35
+git commit -a -m "Tag 2.0.0"
+git tag 2.0.0
+git push origin 2.0.0
# Reset main
git reset --hard HEAD~1
@@ -75,7 +75,7 @@ Create the source release
-------------------------
# Modify version as appropriate
-./jnirelease.sh --ver=1.2.35 --with-apr=/path/to/apr/source
+./jnirelease.sh --ver=2.0.0 --with-apr=/path/to/apr/source
# Switch back to the main branch
git checkout main
diff --git a/README.txt b/README.txt
index 8ba008f..ca5213f 100644
--- a/README.txt
+++ b/README.txt
@@ -5,10 +5,9 @@
What is it?
-----------
-The Apache Tomcat Native Library provides portable API for features
-not found in contemporary JDK's. It uses Apache Portable Runtime as
-operating system abstraction layer and OpenSSL for SSL networking and
-allows optimal performance in production environments.
+The Apache Tomcat Native Library is an optional component for use with
+Apache Tomcat that allows Tomcat to use OpenSSL as a replacement for JSSE
+to support TLS connections.
Licensing
@@ -30,15 +29,11 @@ included in HTML format in the docs directory.
The most up-to-date documentation can be found at
http://tomcat.apache.org/native-doc/
-Documentation about the Tomcat APR connector which is based
-on this library can be found at
-http://tomcat.apache.org/tomcat-9.0-doc/apr.html.
-
Building
--------
-To build the Java API. Note that Java 1.8 is required to build the Java API.
+To build the Java API. Note that Java 11 is required to build the Java API.
> ant
To build the native part see native/BUILDING.
@@ -55,24 +50,6 @@ or overwrite it in a new file build.properties.
Now run "ant test".
-Running the examples
---------------------
-
-Before running the examples you may have to set LD_LIBRARY_PATH, something like
-LD_LIBRARY_PATH=/opt/SMAWoIS/openssl/lib; export LD_LIBRARY_PATH
-
-1) echo example:
- - Choose some free port in
- dist/classes/examples/org/apache/tomcat/jni/Echo.properties
- - run: ant run-echo
-
-2) ssl server example:
- - Change parameters in dist/classes/examples/org/apache/tomcat/jni/SSL.properties
- according to your needs. The certificate and key should be in
- dist/classes/examples.
- - run: ant run-ssl-server
-
-
Cryptographic Software Notice
-----------------------------
diff --git a/TODO.txt b/TODO.txt
deleted file mode 100644
index ea9c629..0000000
--- a/TODO.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-================================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-================================================================================
-
-
- Apache Tomcat Native Library
-
- TODO
-
-
-Java Tests and Examples
------------------------
-
-- "ant run-echo": what is the expected behaviour of this example.
- I couldn't get it to do something understandable.
- Document the example in the README.txt.
-
-- "ant run-ssl-server": Could't we include a test certificate in the
- distribution?
-
-- "ant run-ssl-server": What should the test produce, if run successfully?
- Document the example in the README.txt.
-
-- "ant run-local-server": Creates a unix socket "\\.\PIPE\test" in the
- examples directory, then waits. How is the test expected to work?
- And the file name doesn't seem to be appropriate for Unix.
- Document the example in the README.txt.
-
-
-Java Classes Source Distribution
---------------------------------
-
-Check on how to handle the test and examples classes.
-I think they have no other home.
-
-
-Releasing
----------
-
-- ZIP download seems to have group write permissions set
- (at least after I extract it on Solaris).
- It's a bit strange that permissions differ between the
- tar and zip archives.
diff --git a/build.properties.default b/build.properties.default
index d8a585a..7e6a8b0 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -16,9 +16,9 @@
#
# ----- Version Control Flags -----
-version.major=1
-version.minor=2
-version.build=35
+version.major=2
+version.minor=0
+version.build=4
version.patch=0
version.suffix=
@@ -30,8 +30,8 @@ base.path=/usr/share/java
#base.path=C:/path/to/the/repository
#base.path=/usr/local
-compile.source=1.8
-compile.target=1.8
+compile.source=11
+compile.target=11
compile.debug=off
compile.deprecation=on
compile.optimize=on
diff --git a/build.xml b/build.xml
index afd1dfa..c511fc4 100644
--- a/build.xml
+++ b/build.xml
@@ -30,7 +30,9 @@
<property name="project" value="tomcat-native" />
<property name="name" value="Tomcat Native" />
<property name="title" value="Tomcat Native Library"/>
- <property name="year" value="2022" />
+ <tstamp>
+ <format property="year" pattern="yyyy" locale="en" timezone="UTC"/>
+ </tstamp>
<property name="test.runner" value="junit.textui.TestRunner"/>
@@ -49,7 +51,6 @@
<property name="docs.src" value="./xdocs"/>
<property name="docs.dest" value="${dist.root}/doc"/>
<property name="test.dir" value="${build.dest}/test"/>
- <property name="examples.dir" value="${build.dest}/examples"/>
<property name="tc.library.path" value="${basedir}/native/.libs"/>
@@ -72,12 +73,6 @@
<pathelement location="${hamcrest.jar}"/>
</path>
- <!-- Examples classpath -->
- <path id="examples.classpath">
- <pathelement location="${build.dest}/java"/>
- <pathelement location="${build.dest}/examples"/>
- </path>
-
<!-- =================================================================== -->
<!-- prints the environment -->
<!-- =================================================================== -->
@@ -280,78 +275,4 @@ limitations under the License.-->">
</junit>
</target>
- <!-- =================================================================== -->
- <!-- Compiles the examples directory -->
- <!-- =================================================================== -->
- <target name="compile-examples" depends="compile" description="Compile example Java classes">
- <mkdir dir="${build.dest}"/>
- <mkdir dir="${build.dest}/examples"/>
- <mkdir dir="${build.src}"/>
- <mkdir dir="${build.src}/examples"/>
- <tstamp>
- <format property="TODAY" pattern="MMM d yyyy" locale="en"/>
- <format property="TSTAMP" pattern="hh:mm:ss"/>
- </tstamp>
- <!-- Copy static resource files -->
- <filter token="VERSION" value="${version}"/>
- <filter token="VERSION_NUMBER" value="${version.number}"/>
- <filter token="VERSION_BUILT" value="${TODAY} ${TSTAMP}"/>
- <copy todir="${build.src}/examples" filtering="yes" encoding="ISO-8859-1">
- <fileset dir="${src.dir}/examples">
- <include name="**/*.java"/>
- <include name="**/*.xml"/>
- <include name="**/*.properties"/>
- </fileset>
- </copy>
- <javac srcdir="${build.src}/examples"
- destdir="${build.dest}/examples"
- source="${compile.source}"
- target="${compile.target}"
- debug="${compile.debug}"
- deprecation="${compile.deprecation}"
- optimize="${compile.optimize}"
- encoding="ISO-8859-1">
- <classpath refid="examples.classpath"/>
- </javac>
- <copy todir="${build.dest}/examples" filtering="yes" encoding="ISO-8859-1">
- <fileset dir="${build.src}/examples">
- <include name="**/*.xml"/>
- <include name="**/*.properties"/>
- </fileset>
- </copy>
- </target>
-
- <!-- =================================================================== -->
- <!-- executes the examples -->
- <!-- =================================================================== -->
- <target name="run-echo" depends="compile-examples" description="Run the Echo example">
- <echo message="Running Tomcat Native Echo example ..."/>
- <java dir="${examples.dir}" classname="org.apache.tomcat.jni.Echo"
- fork="yes" failonerror="${test.failonerror}">
- <classpath refid="examples.classpath"/>
- <env key="PATH" path="${tc.library.path}:${java.library.path}"/>
- <env key="Path" path="${tc.library.path}:${java.library.path}"/>
- <jvmarg value="-Djava.library.path=${tc.library.path}"/>
- </java>
- </target>
- <target name="run-ssl-server" depends="compile-examples" description="Run the SSL Server example">
- <echo message="Running Tomcat Native SSL Server example ..."/>
- <java dir="${examples.dir}" classname="org.apache.tomcat.jni.SSLServer"
- fork="yes" failonerror="${test.failonerror}">
- <env key="PATH" path="${tc.library.path}:${java.library.path}"/>
- <env key="Path" path="${tc.library.path}:${java.library.path}"/>
- <classpath refid="examples.classpath"/>
- <jvmarg value="-Djava.library.path=${tc.library.path}"/>
- </java>
- </target>
- <target name="run-local-server" depends="compile-examples" description="Run the Local Server example">
- <echo message="Running Tomcat Native Local Server example ..."/>
- <java dir="${examples.dir}" classname="org.apache.tomcat.jni.LocalServer"
- fork="yes" failonerror="${test.failonerror}">
- <classpath refid="examples.classpath"/>
- <env key="PATH" path="${tc.library.path}:${java.library.path}"/>
- <env key="Path" path="${tc.library.path}:${java.library.path}"/>
- <jvmarg value="-Djava.library.path=${tc.library.path}"/>
- </java>
- </target>
</project>
diff --git a/debian/changelog b/debian/changelog
index 9c1e0d1..189516b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+tomcat-native (2.0.4-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+ * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk> Sat, 08 Jul 2023 13:02:06 -0000
+
tomcat-native (1.2.35-1) unstable; urgency=medium
* Team upload.
diff --git a/docs/index.html b/docs/index.html
index 05fe6b1..57f64bb 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1,37 +1,19 @@
<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="./images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="./images/style.css" rel="stylesheet" type="text/css"><title>Apache Tomcat Native Library - Documentation Index</title><meta name="author" content="Jean-Frederic Clere"></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="./images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="./images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>Apache Tomcat Native Library</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="miscellaneous/changelog.html">Changelog</a></li><li><a href="miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="news/2022.html">2022</a></li><li><a href="news/2021.html">2021</a></li><li><a href="news/2020.html">2020</a></li><li><a href="news/2019.html">2019</a></li><li><a href="news/2018.html">2018</a></li><li><a href="news/2017.html">2017</a></li><li><a href="news/2016.html">2016</a></li><li><a href="news/2015.html">2015</a></li><li><a href="news/2014.html">2014</a></li><li><a href="news/2013.html">2013</a></li><li><a href="news/2012.html">2012</a></li><li><a href="news/2011.html">2011</a></li><li><a href="news/2010.html">2010</a></li><li><a href="news/2009.html">2009</a></li><li><a href="news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>Documentation Index</h2><h3 id="Introduction">Introduction</h3><div class="text">
+<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="./images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="./images/style.css" rel="stylesheet" type="text/css"><title>Apache Tomcat Native Library - Documentation Index</title><meta name="author" content="Jean-Frederic Clere"></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="./images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="./images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>Apache Tomcat Native Library</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="miscellaneous/changelog.html">Changelog</a></li><li><a href="miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="news/2022.html">2022</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>Documentation Index</h2><h3 id="Introduction">Introduction</h3><div class="text">
<p>
The Apache Tomcat Native Library is an optional component for use with
- Apache Tomcat that allows Tomcat to use certain native resources
- for performance, compatibility, etc.
+ Apache Tomcat that allows Tomcat to use OpenSSL as a replacement for JSSE
+ to support TLS connections.
</p>
- <p>
- Specifically, the Apache Tomcat Native Library gives Tomcat access to
- the Apache Portable Runtime (APR) library's network connection (socket)
- implementation and random-number generator.
- See the Apache Tomcat documentation for more information on how to
- configure Tomcat to use the APR connector.
- </p>
-
- <p>
- Features of the APR connector:
- </p>
- <ul>
- <li>Non-blocking I/O for Keep-Alive requests (between requests)</li>
- <li>Uses OpenSSL for TLS/SSL capabilities (if supported by linked APR library)</li>
- <li>FIPS 140-2 support for TLS/SSL (if supported by linked OpenSSL library)</li>
- <li>Support for IPv4, IPv6 and Unix Domain Sockets</li>
- </ul>
-
</div><h3 id="Headlines">Headlines</h3><div class="text">
<ul>
-<li><a href="news/2022.html#20220614">14 June 2022 - <b>TC-Native-1.2.34
+<li><a href="news/2023.html#20230213">13 February 2023 - <b>TC-Native-2.0.3
released</b></a>
<p>The Apache Tomcat team is proud to announce the immediate availability of
-Tomcat Native 1.2.34 Stable.</p>
+Tomcat Native 2.0.3 Stable.</p>
<p>
The sources and the binaries for selected platforms are available from the
<a href="../download-native.cgi">Download page</a>.
@@ -78,20 +60,20 @@ list of changes.
<p>
to create the includes and makefiles to be able to build tc-native.<br>
Where:<br>
- <code>$HOME/APR</code> is something like /usr/bin/apr-1-config or the path where apr is
- installed.<br>
- <code>$JAVA_HOME</code> is something /home/jfclere/JAVA/jdk1.7.0_80 path to a JDK
- installation. Any JDK should work but it is advisable to use the same
- JVM version the JVM you use with Tomcat.<br>
+ <code>$HOME/APR</code> is something like /usr/bin/apr-1-config or the path
+ where apr is installed.<br>
+ <code>$JAVA_HOME</code> is something like /home/jfclere/JAVA/jdk11 or the
+ path to a JDK installation. Any JDK should work but it is advisable to use
+ the same JVM version the JVM you use with Tomcat.<br>
<code>$HOME/OPENSSL</code> is the path where OpenSSL is installed.<br>
<code>$CATALINA_HOME</code> is the path where the produced libraries will be
- installed. Something like $HOME/apache-tomcat-8.0.47/<br>
+ installed. Something like $HOME/apache-tomcat-10.1.0<br>
<br>
The configure is able to guess most of OpenSSL standard installations.
So most of the time the following will be enough:
</p>
<div class="codeBox"><pre><code>./configure --with-apr=/usr/bin/apr-1-config \
- --with-java-home=/home/jfclere/JAVA/jdk1.7.0_80/ \
+ --with-java-home=/home/jfclere/JAVA/jdk11 \
--with-ssl=yes \
--prefix=$CATALINA_HOME</code></pre></div>
<p>
@@ -135,13 +117,6 @@ list of changes.
Please see the Apache Tomcat documentation for configuration specifics.
</p>
- <p>
- When using Unix Domain Sockets a cleanup is registered to delete the
- socket on destruction of the socket, or shutdown of the application.
- Should the application terminate abnormally, the socket deletion will
- need to be handled by the caller or by the administrator.
- </p>
-
</div></div>
<div class="subsection"><h4 id="Install_and_tests/UNIX">UNIX</h4><div class="text">
@@ -152,20 +127,16 @@ list of changes.
<div class="codeBox"><pre><code>LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CATALINA_HOME/lib
export LD_LIBRARY_PATH</code></pre></div>
<p>
- Start tomcat and check for the messages like this ones:
+ Start tomcat and check for the messages like these ones:
</p>
- <div class="codeBox"><pre class="wrap"><code>Nov 29, 2020 12:27:41 PM org.apache.catalina.core.AprLifecycleListener init
-INFO: Loaded APR based Apache Tomcat Native library 1.x.y.
-Nov 29, 2020 12:27:41 PM org.apache.catalina.core.AprLifecycleListener init
-INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true], UDS [true].
-Nov 29, 2020 12:27:41 PM org.apache.coyote.http11.Http11AprProtocol init
-INFO: Initializing Coyote HTTP/1.1 on http-8080</code></pre></div>
+ <div class="codeBox"><pre class="wrap"><code>15-Jun-2022 11:06:23.274 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [2.0.0-dev] using APR version [1.7.0]
+15-Jun-2022 11:06:23.298 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 3.0.4-dev 3 May 2022]</code></pre></div>
<p>
Refer to the tomcat documentation to configure the connectors (See
- <a href="http://tomcat.apache.org/tomcat-10.0-doc/apr.html">Tomcat 10.0.x</a>,
- <a href="http://tomcat.apache.org/tomcat-9.0-doc/apr.html">Tomcat 9.0.x</a> and
- <a href="http://tomcat.apache.org/tomcat-8.5-doc/apr.html">Tomcat 8.5.x</a>)
+ <a href="https://tomcat.apache.org/tomcat-10.1-doc/config/http.html">Tomcat 10.1.x</a>,
+ <a href="https://tomcat.apache.org/tomcat-9.0-doc/config/http.html">Tomcat 9.0.x</a> and
+ <a href="https://tomcat.apache.org/tomcat-8.5-doc/config/http.html">Tomcat 8.5.x</a>)
</p>
</div></div>
@@ -177,14 +148,10 @@ INFO: Initializing Coyote HTTP/1.1 on http-8080</code></pre></div>
<div class="codeBox"><pre class="wrap"><code>set PATH=%PATH;C:\cygwin\home\support\tomcat-native-current-win32-src\jni\native\Debug;C:\cygwin\home\support\tomcat-native-current-win32-src\jni\apr\Debug;C:\OpenSSL\lib\VC</code></pre></div>
<p>
- Start tomcat and check for the messages like this ones:
+ Start tomcat and check for the messages like these ones:
</p>
- <div class="codeBox"><pre class="wrap"><code>Nov 29, 2020 2:48:17 PM org.apache.catalina.core.AprLifecycleListener init
-INFO: Loaded APR based Apache Tomcat Native library 1.x.y.
-Nov 29, 2020 2:48:17 PM org.apache.catalina.core.AprLifecycleListener init
-INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true], UDS [false].
-Nov 29, 2020 2:48:18 PM org.apache.coyote.http11.Http11AprProtocol init
-INFO: Initializing Coyote HTTP/1.1 on http-8080</code></pre></div>
+ <div class="codeBox"><pre class="wrap"><code>15-Jun-2022 11:06:23.274 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [2.0.0-dev] using APR version [1.7.0]
+15-Jun-2022 11:06:23.298 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 3.0.4-dev 3 May 2022]</code></pre></div>
</div></div>
diff --git a/docs/miscellaneous/changelog.html b/docs/miscellaneous/changelog.html
index 5121268..3972860 100644
--- a/docs/miscellaneous/changelog.html
+++ b/docs/miscellaneous/changelog.html
@@ -1,622 +1,87 @@
<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - Miscellaneous Documentation - </title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - Miscellaneous Documentation</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2></h2><h3 id="Preface">Preface</h3><div class="text">
+<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - Miscellaneous Documentation - </title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - Miscellaneous Documentation</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2></h2><h3 id="Preface">Preface</h3><div class="text">
<p>
- This is the Changelog for Tomcat Native 1.2.
+ This is the Changelog for Apache Tomcat Native 2.0.x. The Tomcat Native 2.0.x
+ branch started from the 1.2.33 tag.
</p>
-</div><h3 id="Changes_in_1.2.35">Changes in 1.2.35</h3><div class="text">
+</div><h3 id="Changes_in_2.0.4">Changes in 2.0.4</h3><div class="text">
<ul class="changelog">
- <li><img alt="Docs: " class="icon" src="../images/docs.gif">
- Document the TLS rengotiation behaviour. (markt)
- </li>
- <li><img alt="Docs: " class="icon" src="../images/docs.gif">
- Add HOWTO-RELEASE.txt that describes the release process. (markt)
- </li>
<li><img alt="Update: " class="icon" src="../images/update.gif">
- Update recommended OpenSSL version to 1.1.1q or later. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.34">Changes in 1.2.34</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Code: " class="icon" src="../images/code.gif">
- Refactor library initialization so it is compatible with Tomcat 10.1.x
- onwards where a number of Java classes have been removed. (markt)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Map the OpenSSL 3.x FIPS behaviour to the OpenSSL 1.x API to allow clients
- to determine if the FIPS provider is being used when Tomcat Native is
- compiled against OpenSSL 3.x. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.33">Changes in 1.2.33</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=66035">66035</a>: Fix crash when attempting to read TLS session ID after a
- handshake failure. (schultz/markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Enable <code>download_deps.sh</code> to be called from any directory. Pull
- request <a href="https://github.com/apache/tomcat-native/pull/12">#12</a> provided by Dimitrios Soumis. (markt)
+ Update the recommended minimum version of APR to 1.7.4. (markt)
</li>
<li><img alt="Update: " class="icon" src="../images/update.gif">
- Update recommended OpenSSL version to 1.1.1o or later. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.32">Changes in 1.2.32</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Update recommended OpenSSL version to 1.1.1n or later. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix release script so it works with the current git layout. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.31">Changes in 1.2.31</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=65441">65441</a>: Correct previous fix that enabled building to continue
- with OpenSSL 3.x. Patch provided by lzsiga. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=65659">65659</a>: Remove remaining reference to <code>pkg-config</code>
- which is no longer included in the Tomcat Native distribution. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.30">Changes in 1.2.30</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=65181">65181</a>: Additional changes required to provided support for
- using OpenSSL Engines that use proprietary key formats. Based on a patch
- provided by Edin Hodzic. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=65329">65329</a>: Correct handling of <code>WINVER</code> in make file to
- use correct constant for Windows 7. Add constants for Windows 8,
- Windows 8.1 and Windows 10. Rename <code>WINNT</code> to
- <code>WIN2k</code> as it is used for Windows 2000 upwards, not Windows NT
- upwards. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.29_(not_released)">Changes in 1.2.29 (not released)</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Add a patch for APR that fixes an issue where some Windows systems in some
- configurations would only listen on IPv6 addresses on dual stack systems
- even though configured to listen on both IPv6 and IPv4 addresses.
- (michaelo)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.28">Changes in 1.2.28</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Correct a regression in the fix for <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=65181">65181</a> that prevented an
- error message from being displayed if an invalid key file was provided
- and no OpenSSL Engine was configured. (markt)
+ Update the recommended minimum version of OpenSSL to 3.0.9. (markt)
</li>
</ul>
-</div><h3 id="Changes_in_1.2.27">Changes in 1.2.27</h3><div class="text">
+</div><h3 id="Changes_in_2.0.3">Changes in 2.0.3</h3><div class="text">
<ul class="changelog">
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=65181">65181</a>: Improve support for using OpenSSL Engines that use
- proprietary key formats. Patch provided by Edin Hodzic. (markt)
- </li>
<li><img alt="Update: " class="icon" src="../images/update.gif">
- Update recommended OpenSSL version to 1.1.1k or later. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.26">Changes in 1.2.26</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Enable building to continue against OpenSSL 3.x and 1.1.1. (markt)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=64942">64942</a>: Expose support for Unix Domain Sockets in APR v1.6 and up. (minfrin)
+ Update the recommended minimum version of APR to 1.7.2. (markt)
</li>
<li><img alt="Update: " class="icon" src="../images/update.gif">
- Update recommended OpenSSL version to 1.1.1i or later. (markt)
+ Update the recommended minimum version of OpenSSL to 3.0.8. (markt)
</li>
</ul>
-</div><h3 id="Changes_in_1.2.25">Changes in 1.2.25</h3><div class="text">
+</div><h3 id="Changes_in_2.0.2">Changes in 2.0.2</h3><div class="text">
<ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Incomplete name mangling fix for C++ compilers in tcn_api.h. (michaelo)
- </li>
<li><img alt="Update: " class="icon" src="../images/update.gif">
- Improve OS-specific header include for native thread id. (michaelo)
+ Update the minimum supported version of LibreSSL to 3.5.2. Based on pull
+ request <a href="https://github.com/apache/tomcat-native/pull/13">#13</a> provided by orbea. (markt)
</li>
<li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Disable keylog callback support for LibreSSL. (michaelo)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add support for <code>SSLContext.addChainCertificateRaw()</code> with
- LibreSSL 2.9.1 and up. (michaelo)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add support for HP-UX's _lwp_self() in our
- ssl_thread_id(void). (michaelo)
- </li>
- <remove>
- Remove default option passed for rpath to linker on HP-UX. (michaelo)
- </remove>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add an option to allow the OCSP responder check to be bypassed. Note that
- if OCSP is enabled, a missing responder is now treated as an error.
- (jfclere)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=64429">64429</a>: Fix compilation with LibreSSL. (markt)
+ Fix build when building with rlibtool. Pull request <a href="https://github.com/apache/tomcat-native/pull/14">#14</a> provided
+ by orbea. (markt)
</li>
</ul>
-</div><h3 id="Changes_in_1.2.24">Changes in 1.2.24</h3><div class="text">
+</div><h3 id="Changes_in_2.0.1">Changes in 2.0.1</h3><div class="text">
<ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=63671">63671</a>: libtcnative does not compile with OpenSSL < 1.1.0
- and APR w/o threading support. (michaelo)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Correct configure message for OpenSSL libdir. (michaelo)
- </li>
<li><img alt="Update: " class="icon" src="../images/update.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=64260">64260</a>: Clean up install target. (michaelo)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=64315">64315</a>: configure output for OpenSSL wrong/incomplete sometimes.
- (michaelo)
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Drop obsolete build time workarounds for HP-UX. (michaelo)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add support for FreeBSD's pthread_getthreadid_np() in our
- ssl_thread_id(void). (michaelo)
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=63701">63701</a>: Use new OpenSSL initialisation process when building with
- OpenSSL 1.1.0 onwards. (mturk)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=64316">64316</a>: Introduce tcn_get_thread_id(void) to reduce code
- duplication. (michaelo)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix linking against OpenSSL in non-standard locations on FreeBSD.
- (michaelo)
+ Update recommended OpenSSL version to 3.0.5 or later. (markt)
</li>
</ul>
-</div><h3 id="Changes_in_1.2.23">Changes in 1.2.23</h3><div class="text">
+</div><h3 id="Changes_in_2.0.0">Changes in 2.0.0</h3><div class="text">
<ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Make file fixes to enable building with APR 1.7.x. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Switch to Windows 7 as the default target. (markt)
- </li>
<li><img alt="Update: " class="icon" src="../images/update.gif">
- Update minimum OpenSSL version to 1.0.2r. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.22">Changes in 1.2.22</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=63159">63159</a>: Unable to complete build when build directory is
- outside of the source tree. Patch provided by Bob Huemmer. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=63356">63356</a>: Fix client certificate authentication when a certificate
- contains an AIA extension without an OCSP URI. Patch provided by Milind
- Takawale. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=63500">63500</a>: Fix JVM crash on Connector start when a certificate
- revocation file or path is specified for OpenSSL. (markt)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add support for TLS key logging when using OpenSSL 1.1.1 or later. If the
- environment variable SSLKEYLOGFILE is set then the TLS keys will be logged
- to that file. Patch provided by John Kelly. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Update build script after migration of soucre repository from Subversion
- to Git. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.21">Changes in 1.2.21</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Correct a possible JVM crash during shutdown caused by a bug in the fix
- for the per connection memory leak included in 1.2.20. (rjung)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.20">Changes in 1.2.20</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Update includedir name to tomcat-native instead of apr. (csutherl)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix a minor memory leak. It occurred every time a TLS connector was
- started so the impact was very unlikely to be noticed. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix some minor memory leaks that could occur after error conditions during
- TLS connector initialisation. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix a per connection memory leak when using OpenSSL BIO. This is typically
- used when OpenSSL is providing the TLS support for NIO or NIO2. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.19">Changes in 1.2.19</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=62892">62892</a>: Fix memory leaks in OCSP handling. (jfclere)
+ Update the minimum required version of OpenSSL to 3.0.0 and make it a
+ madatory dependency. (markt)
</li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=62944">62944</a>: Fix copy/paste error that prevented TLS 1.0 and TLS 1.1
- from being used if TLS 1.3 was available. Patch provided by Dean Rasheed.
- (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Include OpenSSL licensing information in the Tomcat Native binaries for
- Windows that are built with OpenSSL. (markt)
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Update recommended OpenSSL version to 1.0.2q or later. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.18">Changes in 1.2.18</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=62641">62641</a>: libtool invocations should use --tag=CC. (michaelo)
- </li>
- <li><img alt="Code: " class="icon" src="../images/code.gif">
- Remove support for Netware as there has not been a supported Netware
- platform for a number of years. (markt)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=62748">62748</a>: Add support for TLS 1.3 when built with OpenSSL 1.1.1 or
- equivalent. (schultz/markt)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Expose the API necessary for CLIENT-CERT authentication to be correctly
- supported when using Tomcat's JSSE implementation backed by OpenSSL.
- (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.17">Changes in 1.2.17</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=62094">62094</a>: Certificate verification using CRL with
- Tomcat APR connector does not work. (jfclere)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=62122">62122</a>: undefined symbol: SSL_COMP_free_compression_methods. (jfclere)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=62221">62221</a>: OCSP response processing uses always the first
- entry in the response. (jfclere)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Further clean-up in the OCSP extension logic. (jfclere)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.16">Changes in 1.2.16</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Further clean-up in the parsing of the OCSP extension. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.15">Changes in 1.2.15</h3><div class="text">
- <ul class="changelog">
<li><img alt="Update: " class="icon" src="../images/update.gif">
- Update recommended OpenSSL version to 1.0.2m. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Correctly calculate field lengths when parsing the OCSP extension so
- that longer values are read correctly. (markt)
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Update the recommended APR version to 1.6.3 or later. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.14">Changes in 1.2.14</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix a small memory leak during certificate initialization. (rjung)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Replace use of deprecated <code>ASN1_STRING_data</code> with
- <code>ASN1_STRING_get0_data</code> when building against
- OpenSSL 1.1.0 and newer. (rjung)
+ Update the minimum required version of APR to 1.7.0. (markt)
</li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix a thread local key leak. Only relevant when doing
- SSL.initialize() and Library.terminate() a lot of times. (rjung)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.13">Changes in 1.2.13</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Add missing source files to Visual Studio project files. (wrowe)
+ <li><img alt="Design: " class="icon" src="../images/design.gif">
+ Remove NPN support as NPN was never standardised and browser support was
+ removed in 2019. (markt)
</li>
<li><img alt="Add: " class="icon" src="../images/add.gif">
- Add support for the OpenSSL SSL_CONF API. (rjung)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add SSLContext.getCiphers(). (rjung)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add method to add a single CA certificate to the list of CA certificates
- which are accepted as issuers of client certificates. (rjung)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix an error not announcing the correct CA list for client certificates
- during TLS handshake. (rjung)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix renegotiation to obtain a client certificate from a user agent.
- (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=58434">58434</a>: Allow Tomcat Native to be compiled with LibreSSL. Note
- that some features may not be available when using LibreSSL. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=60290">60290</a>: When building Tomcat Native, don't ignore the value of
- <code>CC</code> if explicitly set. Patch provided by Michael Osipov.
- (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=60301">60301</a>: When building Tomcat Native, allow the user to override
- the libtool specified by APR by setting the <code>LIBTOOL</code>
- environment variable. (markt)
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Update build to use APR 1.6.x, with 1.6.2 recommended. (markt)
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Update recommended OpenSSL version to 1.0.2l. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.12">Changes in 1.2.12</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Correct a regression in the fix for <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=59797">59797</a> that triggered a JVM
- crash on shutdown in some Tomcat unit tests when using the APR/native
- connector. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.11">Changes in 1.2.11</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=52627">52627</a>: Prevent a crash in <code>File.infoGet()</code> caused by
- the use of uninitialised variables. Based on patch by Ilya Maykov. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=55113">55113</a>: Document the process for creating a static tc-native
- library with a FIPS-enabled OpenSSL and update the nmake make file to
- support the process. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=55114">55114</a>: Clean up building instructions for the native component
- and expand the instructions for building for Windows platforms. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=55938">55938</a>: Resolve remaining clang-analyzer warnings. Note that the
- use of <code>-1</code> to indicate the full array in
- <code>File.(read|write)[Full]</code> has been removed since it was only
- partially implemented and the implementation was faulty. (markt)
+ Add support for using OpenSSL when the FIPS provider is configured as the
+ default provider. (markt)
</li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=58082">58082</a>: Update unit tests to use JUnit 4. Refactor unit tests
- into separate tests and use an external to reference them in the same way
- an external is used to reference the main code. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=59797">59797</a>: Ensure that the per thread error hash maintained by
- OpenSSL is cleaned up as individual threads exit to ensure it does not
- grow too large. Patch provided by Nate Clark. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=59996">59996</a>: Correctly handle building tc-native on a 64-bit system
- when using an OpenSSL distribution that is not in <code>/usr</code>.
- (csutherl)
+ <li><img alt="Design: " class="icon" src="../images/design.gif">
+ Remove all API methods (and supporting code) that are not used by Tomcat
+ 10.1.x to support the use of OpenSSL as a replacement for JSSE to provide
+ TLS functionality. (markt)
</li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=60388">60388</a>: The --disable-maintainer-mode option of the configure
- script no longer enables the maintainer mode. (ebourg)
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Update minimum recommended OpenSSL version to 1.0.2k. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.10">Changes in 1.2.10</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Update minimum recommended OpenSSL version to 1.0.2j. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.9">Changes in 1.2.9</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Update minimum recommended OpenSSL version to 1.0.2i. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.8">Changes in 1.2.8</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=59616">59616</a>: Correct the Windows build files so that OCSP is
- correctly enabled and disabled in the respective Windows binaries. (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Correctly handle OS level EAGAIN return codes during non-blocking TLS I/O.
- (markt)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Correct a potential performance problem identified by Nate Clark due to
- Tomcat Native providing OpenSSL with thread identifiers poorly suited to
- the hash function used by OpenSSL when selecting a bucket for the hash
- that holds the per thread error data. Tomcat Native on Windows and on
- Solaris were not affected. A fix has been applied for OSX and Linux. Other
- platforms may still be affected. (markt/rjung)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.7">Changes in 1.2.7</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Update minimum recommended OpenSSL version to 1.0.2h. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.6">Changes in 1.2.6</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Change the OpenSSL version check in <code>configure</code>
- to be fatal. (rjung)
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Use new OpenSSL 1.1.0 protocol version max and min API
- when creating a new SSL context. (rjung)
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Improve renegotiation code and make it compatible with
- OpenSSL 1.1.0. (rjung)
- </li>
- <li><img alt="Code: " class="icon" src="../images/code.gif">
- OpenSSL 1.1.0 compatibility updates. (rjung)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix some compiler warnings in native ssl code. (rjung)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add support for using Java keystores for certificate chains. (markt)
+ <li><img alt="Docs: " class="icon" src="../images/docs.gif">
+ Document the TLS rengotiation behaviour. (markt)
</li>
<li><img alt="Update: " class="icon" src="../images/update.gif">
- Remove the explicit CRL check when verifying certificates.
- The checks were already part of the internal certification
- verification since OpenSSL 0.9.7. Backport from mod_ssl.
- (rjung)
+ Update the minimum required Java version to Java 11. (markt)
</li>
- </ul>
-</div><h3 id="Changes_in_1.2.5">Changes in 1.2.5</h3><div class="text">
- <ul class="changelog">
<li><img alt="Update: " class="icon" src="../images/update.gif">
- Enable OpenSSL version check in <code>configure</code> by
- default. It can be turned off using
- <code>--disable-openssl-version-check</code>. (rjung)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=59024">59024</a>: Native function <code>versionString()</code> and
- for OpenSSL 1.1.0 also <code>version()</code> (both in in ssl.c) now
- return the OpenSSL run time version, not the compile time version.
- (rjung)
+ Remove support for Windows 2000, Windows XP, Windows Server 2003, Windows
+ Vista and Windows Server 2008. The minimum Windows version is now Windows
+ 7 / Windows Server 2008 R2. (markt)
</li>
- <li><img alt="Code: " class="icon" src="../images/code.gif">
- Track changes in the OpenSSL master branch so it is possible to build
- Tomcat Native with that branch. (billbarker)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.4">Changes in 1.2.4</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- SSL.getHandshakeCount(), which was unused, now returns the handshake
- completed count rather than the handshake started count. (remm)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.3">Changes in 1.2.3</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Remove Java classes that do not have C implementation code
- for their native methods in the current library. They were
- used for NPN support which is superseded by ALPN support
- in the current code. (kkolinko)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix typo in declaration of a stub method used when the library is
- compiled without OpenSSL support. (kkolinko)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix the signature of the implementation of the native SSL method
- newSSL() in the case when OPENSSL is not available. (rjung)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix the signature of the implementation of the native SSLSocket
- method getInfoB() to return jbyteArray instead of jobject.
- This is consistent with what it actually returns and how
- the native Java method is declared. (rjung)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add support for using Java keystores for certificates and keys. (jfclere)
- </li>
- <li><img alt="Code: " class="icon" src="../images/code.gif">
- Remove code that performs a read after a renegotiation that appears to be
- unnecessary with OpenSSL 1.0.2. (billbarker)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Expose <code>SSL_renegotiate</code> to the Java API. (remm)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.2">Changes in 1.2.2</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix broken debug and maintainer mode build. (rjung)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Forward port additional fixes to the OpenSSL I/O to align it with
- non-OpenSSL I/O. (markt)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.1">Changes in 1.2.1</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=58566">58566</a>: Enable Tomcat Native 1.2.x to work with Tomcat releases
- that do not have the necessary Java code to support SNI. (markt)
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- Minor rework of "buildconf" script. (rjung)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix APR dependency version expression in RPM spec file. (rjung)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix major library version number in Windows build files, RPM spec file
- and build description. (rjung)
- </li>
- <li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Remove files "KEYS" and "download_deps.sh" from Windows (zip)
- source distribution. (rjung)
+ <li><img alt="Docs: " class="icon" src="../images/docs.gif">
+ Add HOWTO-RELEASE.txt that describes the release process. (markt)
</li>
<li><img alt="Fix: " class="icon" src="../images/fix.gif">
- Fix "unused variable" compiler warning. (rjung)
- </li>
- </ul>
-</div><h3 id="Changes_in_1.2.0">Changes in 1.2.0</h3><div class="text">
- <ul class="changelog">
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add support for TLS extension ALPN. (markt)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add support for TLS extension SNI (Server Name Indication).
- (markt)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add support for OpenSSL BIO. (jfclere)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Support wakeable pollsets and add Poll.interrupt() API.
- (mturk)
- </li>
- <li><img alt="Add: " class="icon" src="../images/add.gif">
- Add Pool.unmanaged() API. (mturk)
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- APIs SSL.generateRSATempKey() and SSL.loadDSATempKey()
- have been removed. (rjung)
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- The minimum required APR version is 1.4.3.
- </li>
- <li><img alt="Update: " class="icon" src="../images/update.gif">
- The minimum required OpenSSL version is 1.0.2.
+ Fix the autoconf warnings when creating a release. (markt)
</li>
</ul>
+</div><h3 id="Changes_in_1.2.x">Changes in 1.2.x</h3><div class="text">
+<p>Please see the <a href="../../native-1.2-doc/miscellaneous/changelog.html">1.2.x
+ changelog</a>.</p>
</div><h3 id="Changes_in_1.1.x">Changes in 1.1.x</h3><div class="text">
<p>Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">1.1.x
changelog</a>.</p>
diff --git a/docs/miscellaneous/tls-renegotiation.html b/docs/miscellaneous/tls-renegotiation.html
index 29449fd..f120d38 100644
--- a/docs/miscellaneous/tls-renegotiation.html
+++ b/docs/miscellaneous/tls-renegotiation.html
@@ -1,5 +1,5 @@
<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - Miscellaneous Documentation - </title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - Miscellaneous Documentation</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2></h2><h3 id="Introduction">Introduction</h3><div class="text">
+<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - Miscellaneous Documentation - </title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - Miscellaneous Documentation</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2></h2><h3 id="Introduction">Introduction</h3><div class="text">
<p>
Historically there have been security issues associated with TLS
renegotiation. This page describes the renegotiation behaviour of the Tomcat
diff --git a/docs/news/2008.html b/docs/news/2008.html
deleted file mode 100644
index 98ed014..0000000
--- a/docs/news/2008.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2008 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2008 News and Status</h2><h3 id="2008_News_&_Status">2008 News & Status</h3><div class="text">
-<div class="subsection"><h4 id="20081118.1">18 November - TC-Native-1.1.16 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.16. This is a stable release adding some bug fixes.
-</p>
-</div></div>
-<div class="subsection"><h4 id="20080911.1">11 September - TC-Native-1.1.15 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.15. This is a stable release adding some bug fixes.
-</p>
-</div></div>
-<div class="subsection"><h4 id="20080704.1">4 July - TC-Native-1.1.14 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.14. This is a stable release adding some bug fixes.
-</p>
-</div></div>
-<div class="subsection"><h4 id="20080115.1">15 February - TC-Native-1.1.13 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.13. This is a stable release adding few new features
-and some bug fixes.
-</p><p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2009.html b/docs/news/2009.html
deleted file mode 100644
index e5b8639..0000000
--- a/docs/news/2009.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2009 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2009 News and Status</h2><h3 id="2009_News_&_Status">2009 News & Status</h3><div class="text">
-<div class="subsection"><h4 id="20091123.1">23 November - TC-Native-1.1.18 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.18. This is a stable release adding some bug fixes.
-</p><p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2010.html b/docs/news/2010.html
deleted file mode 100644
index a977f06..0000000
--- a/docs/news/2010.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2010 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2010 News and Status</h2><h3 id="2010_News_&_Status">2010 News & Status</h3><div class="text">
-<div class="subsection"><h4 id="20100217.1">17 February - TC-Native-1.1.20 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.20. This is a stable release adding some bug fixes.
-</p>
-</div></div>
-<div class="subsection"><h4 id="20100108.1">8 January - TC-Native-1.1.19 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.19. This is a stable release adding some bug fixes.
-</p><p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2011.html b/docs/news/2011.html
deleted file mode 100644
index 092d0fc..0000000
--- a/docs/news/2011.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2011 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2011 News and Status</h2><h3 id="2011_News_&_Status">2011 News & Status</h3><div class="text">
-<div class="subsection"><h4 id="20110808.1">08 August - TC-Native-1.1.22 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.22. This is a stable release adding some bug fixes.
-</p>
-<p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2012.html b/docs/news/2012.html
deleted file mode 100644
index 2f0ced1..0000000
--- a/docs/news/2012.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2012 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2012 News and Status</h2><h3 id="2012_News_&_Status">2012 News & Status</h3><div class="text">
-<div class="subsection"><h4 id="20120613.1">13 June - TC-Native-1.1.24 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.24. This is a feature-add release adding support for
-per-socket Poller timeouts.
-</p>
-<p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</div></div>
-<div class="subsection"><h4 id="20120302.1">02 March - TC-Native-1.1.23 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.23. This is a stable release adding some bug fixes and
-experimental support for OCSP and PKCS12 certificates.
-</p>
-<p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2013.html b/docs/news/2013.html
deleted file mode 100644
index 249ad6f..0000000
--- a/docs/news/2013.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2013 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2013 News and Status</h2><h3 id="2013_News_&_Status">2013 News & Status</h3><div class="text">
-<div class="subsection"><h4 id="20131015.1">15 October - TC-Native-1.1.29 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.29. This is a bug fixing release.
-</p>
-</div></div>
-<div class="subsection"><h4 id="20130916.1">16 September - TC-Native-1.1.28 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.28. This is a bug fixing release.
-</p>
-<p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</div></div>
-<div class="subsection"><h4 id="20130212.1">12 February - TC-Native-1.1.27 released</h4><div class="text">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.27. This is a bug fixing release.
-</p>
-<p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2014.html b/docs/news/2014.html
deleted file mode 100644
index fbfbb6d..0000000
--- a/docs/news/2014.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2014 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2014 News and Status</h2><h3 id="2014_News_&_Status">2014 News & Status</h3><div class="text">
- <div class="subsection"><h4 id="20141023.1">23 October 2014 - TC-Native-1.1.32 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.1.32. This release add support for TLSv1.1 and TLSv1.2 and
- includes Windows binaries built with OpenSSL 1.0.1j and APR 1.5.1.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20140707.1">7 July 2014 - TC-Native-1.1.31 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.1.31. This is a bug fixing release and includes Windows
- binaries built with OpenSSL 1.0.1h.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20140415.1">15 April - TC-Native-1.1.30 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.1.30. This is a bug fixing release with added support for
- EC ciphers if supported by OpenSSL.
- </p>
- </div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2015.html b/docs/news/2015.html
deleted file mode 100644
index 2e17788..0000000
--- a/docs/news/2015.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2015 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2015 News and Status</h2><h3 id="2015_News_&_Status">2015 News & Status</h3><div class="text">
- <div class="subsection"><h4 id="20151215">12 Dec 2015 - TC-Native-1.2.3 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.3. This is a bug fix release and includes Windows
- binaries built with OpenSSL 1.0.2e and APR 1.5.1.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20151109">9 Nov 2015 - TC-Native-1.2.2 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.2. This is a bug fix release and includes Windows
- binaries built with OpenSSL 1.0.2d and APR 1.5.1.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20151028">28 Oct 2015 - TC-Native-1.2.0 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.0. This is the first release of the 1.2.x series that
- provides ALPN, SNI and OpenSSl BIO support. It includes Windows binaries built
- with OpenSSL 1.0.2d and APR 1.5.1.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20150323.1">23 March 2015 - TC-Native-1.1.33 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.1.33. This is a bug fixing release and includes Windows
- binaries built with OpenSSL 1.0.1m and APR 1.5.1.
- </p>
- </div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2016.html b/docs/news/2016.html
deleted file mode 100644
index b178f89..0000000
--- a/docs/news/2016.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2016 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2016 News and Status</h2><h3 id="2016_News_&_Status">2016 News & Status</h3><div class="text">
- <div class="subsection"><h4 id="20161005">5 October 2016 - TC-Native-1.2.10 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.10. This is a release to update dependencies for the
- Windows binaries and includes Windows binaries built with OpenSSL 1.0.2j and
- APR 1.5.2.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20160702">2 July 2016 - TC-Native-1.2.8 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.8. This is a bug fix release release and includes Windows
- binaries built with OpenSSL 1.0.2h and APR 1.5.2.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20160508">8 May 2016 - TC-Native-1.2.7 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.7. This is a release to update dependencies for the
- Windows binaries and includes Windows binaries built with OpenSSL 1.0.2h and
- APR 1.5.2.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20160426">26 Apr 2016 - TC-Native-1.2.6 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.6. This is a bug fix release and includes Windows
- binaries built with OpenSSL 1.0.2g and APR 1.5.2.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20160307">7 Mar 2016 - TC-Native-1.2.5 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.5. This is a bug fix release and includes Windows
- binaries built with OpenSSL 1.0.2g and APR 1.5.1.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20160111">11 Jan 2016 - TC-Native-1.2.4 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.4. This is a bug fix release and includes Windows
- binaries built with OpenSSL 1.0.2e and APR 1.5.1.
- </p>
- </div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2017.html b/docs/news/2017.html
deleted file mode 100644
index 283c9ef..0000000
--- a/docs/news/2017.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2017 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2017 News and Status</h2><h3 id="2017_News_&_Status">2017 News & Status</h3><div class="text">
- <div class="subsection"><h4 id="20171120">20 Nov 2017 - TC-Native-1.2.16 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.16. This is a bugfix release that also updates the
- dependencies for the Windows binaries and includes Windows binaries built with
- OpenSSL 1.0.2m and APR 1.6.3.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20170904">4 Sep 2017 - TC-Native-1.2.14 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.14. This is a bugfix release that also updates the
- dependencies for the Windows binaries and includes Windows binaries built with
- OpenSSL 1.0.2l and APR 1.6.2.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20170221">21 Feb 2017 - TC-Native-1.2.12 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.12. This is a release to update dependencies for the
- Windows binaries and includes Windows binaries built with OpenSSL 1.0.2k and
- APR 1.5.2.
- </p>
- </div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2018.html b/docs/news/2018.html
deleted file mode 100644
index f14dd66..0000000
--- a/docs/news/2018.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2018 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2018 News and Status</h2><h3 id="2018_News_&_Status">2018 News & Status</h3><div class="text">
- <div class="subsection"><h4 id="20181204">4 Dec 2018 - TC-Native-1.2.19 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.19. This is a bugfix release that also updates the
- dependencies for the Windows binaries and includes Windows binaries built
- with OpenSSL 1.0.2q/APR 1.6.5 and 1.1.1a/APR 1.6.5.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20181020">20 Oct 2018 - TC-Native-1.2.18 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.18. This is a feature and bugfix release that adds TLSv1.3
- support when built with OpenSSL 1.1.1. It also includes Windows binaries built
- with OpenSSL 1.0.2p/APR 1.6.5 and 1.1.1/APR 1.6.5.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20180613">13 Jun 2018 - TC-Native-1.2.17 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.17. This is a bugfix release that also updates the
- dependencies for the Windows binaries and includes Windows binaries built with
- OpenSSL 1.0.2o and APR 1.6.3.
- </p>
- </div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2019.html b/docs/news/2019.html
deleted file mode 100644
index 903da37..0000000
--- a/docs/news/2019.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2019 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2019 News and Status</h2><h3 id="2019_News_&_Status">2019 News & Status</h3><div class="text">
- <div class="subsection"><h4 id="20190702">07 Jul 2019 - TC-Native-1.2.23 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.23. This is a bugfix release.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20190131">31 Jan 2019 - TC-Native-1.2.21 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.21. This is a bugfix release.
- </p>
- </div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2020.html b/docs/news/2020.html
deleted file mode 100644
index d11927e..0000000
--- a/docs/news/2020.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2020 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2020 News and Status</h2><h3 id="2020_News_&_Status">2020 News & Status</h3><div class="text">
- <div class="subsection"><h4 id="20201221">21 Dec 2020 - TC-Native-1.2.26 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.26. This is a bugfix release.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20200903">3 Sep 2020 - TC-Native-1.2.25 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.25. This is a bugfix release.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20200429">29 Apr 2020 - TC-Native-1.2.24 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.24. This is a bugfix release.
- </p>
- </div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2021.html b/docs/news/2021.html
deleted file mode 100644
index 020512e..0000000
--- a/docs/news/2021.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2021 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2021 News and Status</h2><h3 id="2021_News_&_Status">2021 News & Status</h3><div class="text">
- <div class="subsection"><h4 id="20210901">1 Sep 2021 - TC-Native-1.2.31 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.31. This is a bugfix release.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20210604">4 Jun 2021 - TC-Native-1.2.30 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.30. This is a bugfix release.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20210406">6 Apr 2021 - TC-Native-1.2.28 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.28. This is a bugfix release.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20210329">29 Mar 2021 - TC-Native-1.2.27 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.27. This is a bugfix release.
- </p>
- </div></div>
-</div></div></div></div></div><footer><div id="footer">
- Copyright © 2008-2022, The Apache Software Foundation
- </div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2022.html b/docs/news/2022.html
index c9511f5..a1f1241 100644
--- a/docs/news/2022.html
+++ b/docs/news/2022.html
@@ -1,20 +1,17 @@
<!DOCTYPE html SYSTEM "about:legacy-compat">
-<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2022 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2022.html">2022</a></li><li><a href="../news/2021.html">2021</a></li><li><a href="../news/2020.html">2020</a></li><li><a href="../news/2019.html">2019</a></li><li><a href="../news/2018.html">2018</a></li><li><a href="../news/2017.html">2017</a></li><li><a href="../news/2016.html">2016</a></li><li><a href="../news/2015.html">2015</a></li><li><a href="../news/2014.html">2014</a></li><li><a href="../news/2013.html">2013</a></li><li><a href="../news/2012.html">2012</a></li><li><a href="../news/2011.html">2011</a></li><li><a href="../news/2010.html">2010</a></li><li><a href="../news/2009.html">2009</a></li><li><a href="../news/2008.html">2008</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2022 News and Status</h2><h3 id="2022_News_&_Status">2022 News & Status</h3><div class="text">
- <div class="subsection"><h4 id="20220614">14 June 2022 - TC-Native-1.2.34 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.34. This is a bugfix release.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20220509">5 May 2022 - TC-Native-1.2.33 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.33. This is a bugfix release.
- </p>
- </div></div>
- <div class="subsection"><h4 id="20220322">22 Mar 2022 - TC-Native-1.2.32 released</h4><div class="text">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.32. This is a bugfix release.
- </p>
- </div></div>
-</div></div></div></div></div><footer><div id="footer">
+<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2022 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2023.html">2023</a></li><li><a href="../news/2022.html">2022</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2022 News and Status</h2><h3 id="2022_News_&_Status">2022 News & Status</h3><div class="text">
+
+ <div class="subsection"><h4 id="20220811">11 November 2022 - TC-Native-2.0.2 released</h4><div class="text">
+ <p>The Apache Tomcat team is proud to announce the immediate
+ availability of Tomcat Native 2.0.2.</p>
+ </div></div>
+
+ <div class="subsection"><h4 id="20220712">12 July 2022 - TC-Native-2.0.1 released</h4><div class="text">
+ <p>The Apache Tomcat team is proud to announce the immediate
+ availability of Tomcat Native 2.0.1. This is the first release of the
+ 2.0.x branch.</p>
+ </div></div>
+
+ </div></div></div></div></div><footer><div id="footer">
Copyright © 2008-2022, The Apache Software Foundation
</div></footer></div></body></html>
\ No newline at end of file
diff --git a/docs/news/2023.html b/docs/news/2023.html
new file mode 100644
index 0000000..79c9418
--- /dev/null
+++ b/docs/news/2023.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html SYSTEM "about:legacy-compat">
+<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><link href="../images/style.css" rel="stylesheet" type="text/css"><title>The Apache Tomcat Native - News - 2023 News and Status</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="http://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="http://www.apache.org/" target="_blank"><img src="../images/asf-feather.png" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>The Apache Tomcat Native - News</h1><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2><strong>Links</strong></h2><ul><li><a href="../index.html">Docs Home</a></li></ul></div><div><h2><strong>Miscellaneous Documentation</strong></h2><ul><li><a href="../miscellaneous/changelog.html">Changelog</a></li><li><a href="../miscellaneous/tls-renegotiation.html">TLS renegotiation</a></li></ul></div><div><h2><strong>News</strong></h2><ul><li><a href="../news/2023.html">2023</a></li><li><a href="../news/2022.html">2022</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>2023 News and Status</h2><h3 id="2023_News_&_Status">2023 News & Status</h3><div class="text">
+
+ <div class="subsection"><h4 id="20230213">13 February 2023 - TC-Native-2.0.3 released</h4><div class="text">
+ <p>The Apache Tomcat team is proud to announce the immediate
+ availability of Tomcat Native 2.0.3.</p>
+ </div></div>
+
+ </div></div></div></div></div><footer><div id="footer">
+ Copyright © 2008-2022, The Apache Software Foundation
+ </div></footer></div></body></html>
\ No newline at end of file
diff --git a/examples/mkcerts b/examples/mkcerts
deleted file mode 100644
index a611ca9..0000000
--- a/examples/mkcerts
+++ /dev/null
@@ -1,216 +0,0 @@
-#!/bin/sh
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (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.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-# This is the configuration file to treate the CA certificate of the
-# _DEMONSTRATION ONLY_ 'Coyote' Certificate Authority.
-# This CA is used to sign the localhost.crt and user.crt
-# because self-signed server certificates are not accepted by all browsers.
-# NEVER USE THIS CA YOURSELF FOR REAL LIFE! INSTEAD EITHER USE A PUBLICALLY
-# KNOWN CA OR CREATE YOUR OWN CA!
-
-if [ -z "$OPENSSL" ]; then OPENSSL=openssl; fi
-
-PASSPHRASE="pass:secret"
-# Encrypt all keys
-GENRSA="$OPENSSL genrsa -des3"
-# Uncomment for no key encryption
-# GENRSA="$OPENSSL genrsa"
-REQ="$OPENSSL req -new"
-CA="$OPENSSL ca"
-X509="$OPENSSL x509"
-
-$OPENSSL rand -out .rnd 8192
-$GENRSA -passout $PASSPHRASE -out ca.key -rand .rnd 1024
-
-cat >ca.cfg <<EOT
-[ ca ]
-default_ca = default_db
-[ default_db ]
-dir = .
-certs = .
-new_certs_dir = ca.certs
-database = ca.index
-serial = ca.serial
-RANDFILE = .rnd
-certificate = ca.crt
-private_key = ca.key
-default_days = 365
-default_crl_days = 30
-default_md = md5
-preserve = no
-name_opt = ca_default
-cert_opt = ca_default
-unique_subject = no
-[ server_policy ]
-countryName = supplied
-stateOrProvinceName = supplied
-localityName = supplied
-organizationName = supplied
-organizationalUnitName = supplied
-commonName = supplied
-emailAddress = supplied
-[ server_cert ]
-subjectKeyIdentifier = hash
-authorityKeyIdentifier = keyid:always
-extendedKeyUsage = serverAuth,clientAuth,msSGC,nsSGC
-basicConstraints = critical,CA:false
-[ user_policy ]
-commonName = supplied
-emailAddress = supplied
-[ user_cert ]
-subjectAltName = email:copy
-basicConstraints = critical,CA:false
-authorityKeyIdentifier = keyid:always
-extendedKeyUsage = clientAuth,emailProtection
-
-[ req ]
-default_bits = 1024
-default_keyfile = ca.key
-distinguished_name = default_ca
-x509_extensions = extensions
-string_mask = nombstr
-req_extensions = req_extensions
-input_password = secret
-output_password = secret
-[ default_ca ]
-countryName = Country Code
-countryName_value = US
-countryName_min = 2
-countryName_max = 2
-stateOrProvinceName = State Name
-stateOrProvinceName_value = Delaware
-localityName = Locality Name
-localityName_value = Wilmington
-organizationName = Organization Name
-organizationName_value = Apache Software Foundation
-organizationalUnitName = Organizational Unit Name
-organizationalUnitName_value = Apache Tomcat
-commonName = Common Name
-commonName_value = Apache Tomcat demo root CA
-commonName_max = 64
-emailAddress = Email Address
-emailAddress_value = coyote@tomcat.apache.org
-emailAddress_max = 40
-[ extensions ]
-subjectKeyIdentifier = hash
-authorityKeyIdentifier = keyid:always
-basicConstraints = critical,CA:true
-[ req_extensions ]
-nsCertType = objsign,email,server
-EOT
-
-$REQ -x509 -days 3650 -batch -config ca.cfg -key ca.key -out ca.crt
-
-# Create cabundle.crt that can be used for CAfile
-cat >cabundle.crt <<EOT
-Tomcat Demo Root CA
-=========================================
-`$X509 -noout -fingerprint -in ca.crt`
-PEM Data:
-`$X509 -in ca.crt`
-`$X509 -noout -text -in ca.crt`
-EOT
-
-$GENRSA -passout $PASSPHRASE -out localhost.key -rand .rnd 1024
-
-cat >localhost.cfg <<EOT
-[ req ]
-default_bits = 1024
-distinguished_name = localhost
-string_mask = nombstr
-req_extensions = extensions
-input_password = secret
-output_password = secret
-[ localhost ]
-countryName = Country Code
-countryName_value = US
-countryName_min = 2
-countryName_max = 2
-stateOrProvinceName = State Name
-stateOrProvinceName_value = Delaware
-localityName = Locality Name
-localityName_value = Wilmington
-organizationName = Organization Name
-organizationName_value = Apache Software Foundation
-organizationalUnitName = Organizational Unit Name
-organizationalUnitName_value = Apache Tomcat
-commonName = Common Name
-commonName_value = Apache Tomcat localhost secure demo server
-commonName_max = 64
-emailAddress = Email Address
-emailAddress_value = tomcat@localhost.edu
-emailAddress_max = 40
-[ extensions ]
-nsCertType = server
-basicConstraints = critical,CA:false
-EOT
-
-$REQ -passin $PASSPHRASE -batch -config localhost.cfg -key localhost.key -out localhost.csr
-rm -f localhost.cfg
-
-# make sure environment exists
-if [ ! -d ca.certs ]; then
- mkdir ca.certs
- echo '01' >ca.serial
- cp /dev/null ca.index
-fi
-
-$CA -passin $PASSPHRASE -batch -config ca.cfg -extensions server_cert -policy server_policy -out x.crt -infiles localhost.csr
-$X509 -in x.crt -out localhost.crt
-rm -f x.crt
-# Create PKCS12 localhost certificate
-$OPENSSL pkcs12 -export -passout $PASSPHRASE -passin $PASSPHRASE -in localhost.crt -inkey localhost.key -certfile ca.crt -out localhost.p12
-
-$GENRSA -passout $PASSPHRASE -out user.key -rand .rnd 1024
-
-cat >user.cfg <<EOT
-[ req ]
-default_bits = 1024
-distinguished_name = admin
-string_mask = nombstr
-req_extensions = extensions
-input_password = secret
-output_password = secret
-[ admin ]
-commonName = User Name
-commonName_value = Localhost Administrator
-commonName_max = 64
-emailAddress = Email Address
-emailAddress_value = admin@localhost.edu
-emailAddress_max = 40
-[ extensions ]
-nsCertType = client,email
-basicConstraints = critical,CA:false
-EOT
-
-$REQ -passin $PASSPHRASE -batch -config user.cfg -key user.key -out user.csr
-rm -f user.cfg
-$CA -passin $PASSPHRASE -batch -config ca.cfg -extensions user_cert -policy user_policy -out x.crt -infiles user.csr
-$X509 -in x.crt -out user.crt
-rm -f x.crt
-
-# $OPENSSL verify -CAfile ca.crt localhost.crt
-# $OPENSSL verify -CAfile ca.crt user.crt
-
-# Create PKCS12 user certificate
-$OPENSSL pkcs12 -export -passout $PASSPHRASE -passin $PASSPHRASE -in user.crt -inkey user.key -certfile ca.crt -out user.p12
-
-rm -f ca.cfg
-rm -f *.old
-rm -f ca.index.attr
-rm -f .rnd
diff --git a/examples/org/apache/tomcat/jni/Echo.java b/examples/org/apache/tomcat/jni/Echo.java
deleted file mode 100644
index 0a49608..0000000
--- a/examples/org/apache/tomcat/jni/Echo.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tomcat.jni;
-
-import java.io.InputStream;
-import java.util.Properties;
-
-/**
- * Echo server example
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Echo {
-
- public static String echoEcho = null;
- public static String echoAddr = null;
- public static int echoPort = 0;
- public static int echoNmax = 0;
- public static int echoNrun = 0;
- public static long echoPool = 0;
-
- private static Poller echoPoller = null;
- private static Acceptor echoAcceptor = null;
-
- private static Object threadLock = new Object();
-
- static {
-
- try {
- InputStream is = Echo.class.getResourceAsStream
- ("/org/apache/tomcat/jni/Echo.properties");
- Properties props = new Properties();
- props.load(is);
- is.close();
- echoAddr = props.getProperty("echo.ip", "127.0.0.1");
- echoPort = Integer.decode(props.getProperty("echo.port", "8023")).intValue();
- echoNmax = Integer.decode(props.getProperty("echo.max", "1")).intValue();
- }
- catch (Throwable t) {
- // NO-OP
- }
- }
-
- /* Acceptor thread. Listens for new connections */
- private class Acceptor extends java.lang.Thread {
- private long serverSock = 0;
- private long inetAddress = 0;
- private long pool = 0;
- public Acceptor() throws Exception {
- try {
-
- pool = Pool.create(Echo.echoPool);
- System.out.println("Accepting: " + Echo.echoAddr + ":" +
- Echo.echoPort);
- inetAddress = Address.info(Echo.echoAddr, Socket.APR_INET,
- Echo.echoPort, 0,
- pool);
- serverSock = Socket.create(Socket.APR_INET, Socket.SOCK_STREAM,
- Socket.APR_PROTO_TCP, pool);
- long sa = Address.get(Socket.APR_LOCAL, serverSock);
- Sockaddr addr = new Sockaddr();
- if (Address.fill(addr, sa)) {
- System.out.println("Host: " + addr.hostname);
- System.out.println("Server: " + addr.servname);
- System.out.println("IP: " + Address.getip(sa) +
- ":" + addr.port);
- }
- int rc = Socket.bind(serverSock, inetAddress);
- if (rc != 0) {
- throw(new Exception("Can't create Acceptor: bind: " + Error.strerror(rc)));
- }
- Socket.listen(serverSock, 5);
- }
- catch( Exception ex ) {
- ex.printStackTrace();
- throw(new Exception("Can't create Acceptor"));
- }
- }
-
- @Override
- public void run() {
- int i = 0;
- try {
- while (true) {
- long clientSock = Socket.accept(serverSock);
- System.out.println("Accepted id: " + i);
-
- try {
- long sa = Address.get(Socket.APR_REMOTE, clientSock);
- Sockaddr raddr = new Sockaddr();
- if (Address.fill(raddr, sa)) {
- System.out.println("Remote Host: " + Address.getnameinfo(sa, 0));
- System.out.println("Remote IP: " + Address.getip(sa) +
- ":" + raddr.port);
- }
- sa = Address.get(Socket.APR_LOCAL, clientSock);
- Sockaddr laddr = new Sockaddr();
- if (Address.fill(laddr, sa)) {
- System.out.println("Local Host: " + laddr.hostname);
- System.out.println("Local Server: " + Address.getnameinfo(sa, 0));
- System.out.println("Local IP: " + Address.getip(sa) +
- ":" + laddr.port);
- }
-
- } catch (Exception e) {
- // Ignore
- e.printStackTrace();
- }
-
- Socket.timeoutSet(clientSock, 10000000);
- Worker worker = new Worker(clientSock, i++,
- this.getClass().getName());
- Echo.incThreads();
- worker.start();
- }
- }
- catch( Exception ex ) {
- ex.printStackTrace();
- }
- }
- }
-
- /* Poller thread. Listens for new recycled connections */
- private class Poller extends java.lang.Thread {
- private long serverPollset = 0;
- private long pool = 0;
- private int nsocks = 0;
- public Poller() {
- try {
-
- pool = Pool.create(Echo.echoPool);
- serverPollset = Poll.create(16, pool, 0, 10000000);
- }
- catch( Exception ex ) {
- ex.printStackTrace();
- }
- }
-
- public void add(long socket) {
- int rv = Poll.add(serverPollset, socket,
- Poll.APR_POLLIN);
- if (rv == Status.APR_SUCCESS) {
- System.out.println("Added worker to pollset");
- nsocks++;
- }
- }
-
- public void remove(long socket) {
- int rv = Poll.remove(serverPollset, socket);
- if (rv == Status.APR_SUCCESS) {
- nsocks--;
- System.out.println("Removed worker from pollset");
- }
- else {
- System.out.println("Failed removing worker from pollset");
- }
- }
-
- @Override
- public void run() {
- while (true) {
- try {
- if (nsocks < 1) {
- java.lang.Thread.sleep(1);
- continue;
- }
- /* Two times size then created pollset */
- long [] desc = new long[64];
- /* USe 1 second poll timeout */
- int rv = Poll.poll(serverPollset, 1000000, desc, false);
- if (rv > 0) {
- for (int n = 0; n < rv; n++) {
- long clientSock = desc[n*2+1];
- System.out.println("Poll flags " + desc[n*2]);
- remove(clientSock);
- Worker worker = new Worker(clientSock, n,
- this.getClass().getName());
- Echo.incThreads();
- worker.start();
- }
- }
- else {
- if (Status.APR_STATUS_IS_TIMEUP(-rv))
- System.out.println("Timeup");
- else {
- System.out.println("Error " + (-rv));
- }
- }
- }
- /* XXX: JFC quick hack
- catch(Error err ) {
- if (Status.APR_STATUS_IS_TIMEUP(err.getError())) {
- /0 TODO: deal with timeout 0/
- }
- else {
- err.printStackTrace();
- break;
- }
- }
- */
- catch( Exception ex ) {
- ex.printStackTrace();
- break;
- }
- }
- }
- }
-
- private class Worker extends java.lang.Thread {
- private int workerId = 0;
- private long clientSock = 0;
- private byte [] wellcomeMsg = null;
- public Worker(long clientSocket, int workerId, String from) {
- this.clientSock = clientSocket;
- this.workerId = workerId;
- wellcomeMsg = ("Echo server id: " + this.workerId + " from " +
- from + "\r\n").getBytes();
- }
-
- @Override
- public void run() {
- boolean doClose = false;
- try {
- Socket.send(clientSock, wellcomeMsg, 0, wellcomeMsg.length);
- /* Do a blocking read byte at a time */
- byte [] buf = new byte[1];
- while (Socket.recv(clientSock, buf, 0, 1) == 1) {
- if (buf[0] == '\n')
- break;
- else if (buf[0] == '!') {
- doClose = true;
- break;
- }
- }
- if (doClose) {
- try {
- byte [] msg = ("Bye from worker: " + workerId + "\r\n").getBytes();
- Socket.send(clientSock, msg, 0, msg.length);
- } catch(Exception e) { }
-
- Socket.close(clientSock);
- }
- else {
- try {
- byte [] msg = ("Recycling worker: " + workerId + "\r\n").getBytes();
- Socket.send(clientSock, msg, 0, msg.length);
- } catch(Exception e) { }
- /* Put the socket to the keep-alive poll */
- Echo.echoPoller.add(clientSock);
- }
- } catch (Exception e) {
- Socket.close(clientSock);
- e.printStackTrace();
- }
- Echo.decThreads();
- System.out.println("Worker: " + workerId + " finished");
- }
- }
-
- public Echo()
- {
- echoPool = Pool.create(0);
- try {
- echoAcceptor = new Acceptor();
- echoAcceptor.start();
- echoPoller = new Poller();
- echoPoller.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- public static void incThreads() {
- synchronized(threadLock) {
- echoNrun++;
- }
- }
-
- public static void decThreads() {
- synchronized(threadLock) {
- echoNrun--;
- }
- }
-
- public static void main(String [] args) {
- try {
- Library.initialize(null);
- long [] inf = new long[16];
- System.out.println("Info ...");
- System.out.println(" Native " + Library.versionString());
- System.out.println(" APR " + Library.aprVersionString());
- OS.info(inf);
- System.out.println("OS Info ...");
- System.out.println(" Physical " + inf[0]);
- System.out.println(" Avail " + inf[1]);
- System.out.println(" Swap " + inf[2]);
- System.out.println(" Swap free " + inf[3]);
- System.out.println(" Shared " + inf[4]);
- System.out.println(" Buffers size " + inf[5]);
- System.out.println(" Load " + inf[6]);
-
- System.out.println(" Idle " + inf[7]);
- System.out.println(" Kernel " + inf[8]);
- System.out.println(" User " + inf[9]);
-
- System.out.println(" Proc creation " + inf[10]);
- System.out.println(" Proc kernel " + inf[11]);
- System.out.println(" Proc user " + inf[12]);
- System.out.println(" Curr working " + inf[13]);
- System.out.println(" Peak working " + inf[14]);
- System.out.println(" Page faults " + inf[15]);
-
- SSL.initialize(null);
- System.out.println("OpenSSL ...");
- System.out.println(" version " + SSL.versionString());
- System.out.println(" number " + SSL.version());
-
- System.out.println("Starting Native Echo server example on port " +
- echoAddr + ":" + echoPort);
- @SuppressWarnings("unused")
- Echo echo = new Echo();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-}
diff --git a/examples/org/apache/tomcat/jni/Echo.properties b/examples/org/apache/tomcat/jni/Echo.properties
deleted file mode 100644
index 34d7727..0000000
--- a/examples/org/apache/tomcat/jni/Echo.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (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.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Test port used for echo server
-echo.port=8023
diff --git a/examples/org/apache/tomcat/jni/Local.properties b/examples/org/apache/tomcat/jni/Local.properties
deleted file mode 100644
index 0551f98..0000000
--- a/examples/org/apache/tomcat/jni/Local.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (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.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Local properties
-local.max=10
-
-# For NT Pipes use something like
-local.path=\\\\.\\PIPE\\test
-
-# For Unix Sockets use
-# local.path=/tmp/testsock
diff --git a/examples/org/apache/tomcat/jni/LocalServer.java b/examples/org/apache/tomcat/jni/LocalServer.java
deleted file mode 100644
index eb2bf4e..0000000
--- a/examples/org/apache/tomcat/jni/LocalServer.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-import java.io.InputStream;
-import java.util.Properties;
-
-/**
- * Local Socket server example
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class LocalServer {
-
- public static String serverAddr = null;
- public static int serverNmax = 0;
- public static int serverNrun = 0;
- public static long serverPool = 0;
-
- private static Acceptor serverAcceptor = null;
-
- private static Object threadLock = new Object();
-
- static {
-
- try {
- InputStream is = LocalServer.class.getResourceAsStream
- ("/org/apache/tomcat/jni/Local.properties");
- Properties props = new Properties();
- props.load(is);
- is.close();
- serverAddr = props.getProperty("local.path", null);
- serverNmax = Integer.decode(props.getProperty("local.max", "0")).intValue();
- }
- catch (Throwable t) {
- // NO-OP
- }
- }
-
- public LocalServer()
- {
- serverPool = Pool.create(0);
- try {
- serverAcceptor = new Acceptor();
- serverAcceptor.start();
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
- public static void incThreads() {
- synchronized(threadLock) {
- serverNrun++;
- }
- }
-
- public static void decThreads() {
- synchronized(threadLock) {
- serverNrun--;
- }
- }
-
- /* Acceptor thread. Listens for new connections */
- private class Acceptor extends java.lang.Thread {
- private long serverSock = 0;
- private long inetAddress = 0;
- private long pool = 0;
- public Acceptor() throws Exception {
- try {
-
- pool = Pool.create(LocalServer.serverPool);
- System.out.println("Accepting: " + LocalServer.serverAddr);
- serverSock = Local.create(LocalServer.serverAddr, pool);
- int rc = Local.bind(serverSock, inetAddress);
- if (rc != 0) {
- throw(new Exception("Can't create Acceptor: bind: " + Error.strerror(rc)));
- }
- Local.listen(serverSock, LocalServer.serverNmax);
- }
- catch( Exception ex ) {
- ex.printStackTrace();
- throw(new Exception("Can't create Acceptor"));
- }
- }
-
- @Override
- public void run() {
- int i = 0;
- try {
- while (true) {
- long clientSock = Local.accept(serverSock);
- System.out.println("Accepted id: " + i);
-
- Socket.timeoutSet(clientSock, 10000000);
- Worker worker = new Worker(clientSock, i++,
- this.getClass().getName());
- LocalServer.incThreads();
- worker.start();
- }
- }
- catch( Exception ex ) {
- ex.printStackTrace();
- }
- }
- }
-
- private class Worker extends java.lang.Thread {
- private int workerId = 0;
- private long clientSock = 0;
- private byte [] wellcomeMsg = null;
-
- public Worker(long clientSocket, int workerId, String from) {
- this.clientSock = clientSocket;
- this.workerId = workerId;
- wellcomeMsg = ("LocalServer server id: " + this.workerId + " from " +
- from).getBytes();
- }
-
- @Override
- public void run() {
- boolean doClose = false;
- try {
- Socket.send(clientSock, wellcomeMsg, 0, wellcomeMsg.length);
- while (!doClose) {
- /* Do a blocking read byte at a time */
- byte [] buf = new byte[1];
- byte [] msg = new byte[256];
- int p = 0;
- while (Socket.recv(clientSock, buf, 0, 1) == 1) {
- if (buf[0] == '\n')
- break;
- else if (buf[0] == '!') {
- doClose = true;
- break;
- }
- if (p > 250)
- break;
- msg[p++] = buf[0];
- }
- if (doClose) {
- try {
- byte [] snd = ("Bye from worker: " + workerId).getBytes();
- Socket.send(clientSock, snd, 0, snd.length);
- } catch(Exception e) { }
-
- Socket.close(clientSock);
- }
- else
- Socket.send(clientSock, msg, 0, p);
- }
- } catch (Exception e) {
- Socket.destroy(clientSock);
- e.printStackTrace();
- }
- LocalServer.decThreads();
- System.out.println("Worker: " + workerId + " finished");
- }
- }
-
-
- public static void main(String [] args) {
- try {
- Library.initialize(null);
-
- @SuppressWarnings("unused")
- LocalServer server = new LocalServer();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
diff --git a/examples/org/apache/tomcat/jni/SSL.properties b/examples/org/apache/tomcat/jni/SSL.properties
deleted file mode 100644
index 1ecf411..0000000
--- a/examples/org/apache/tomcat/jni/SSL.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (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.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# SSL Server and client properties
-server.port=4443
-server.cert=localhost.crt
-server.key=localhost.key
-server.password=secret
-server.ciphers=ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
-server.verify=none
\ No newline at end of file
diff --git a/examples/org/apache/tomcat/jni/SSLServer.java b/examples/org/apache/tomcat/jni/SSLServer.java
deleted file mode 100644
index 677a744..0000000
--- a/examples/org/apache/tomcat/jni/SSLServer.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-import java.io.InputStream;
-import java.util.Properties;
-
-/**
- * SSL Server server example
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class SSLServer {
-
- public static String serverAddr = null;
- public static int serverPort = 0;
- public static int serverNmax = 0;
- public static int serverNrun = 0;
- public static long serverCtx = 0;
- public static long serverPool = 0;
- public static String serverCert = null;
- public static String serverKey = null;
- public static String serverCiphers = null;
- public static String serverPassword = null;
- public static String serverCAFile = null;
-
- private static Acceptor serverAcceptor = null;
-
- private static Object threadLock = new Object();
-
- static {
-
- try {
- InputStream is = SSLServer.class.getResourceAsStream
- ("/org/apache/tomcat/jni/SSL.properties");
- Properties props = new Properties();
- props.load(is);
- is.close();
- serverAddr = props.getProperty("server.ip", "127.0.0.1");
- serverPort = Integer.decode(props.getProperty("server.port", "4443")).intValue();
- serverNmax = Integer.decode(props.getProperty("server.max", "1")).intValue();
- serverCert = props.getProperty("server.cert", "server.pem");
- serverKey = props.getProperty("server.key", null);
- serverCAFile = props.getProperty("server.cacertificate", null);
- serverCiphers = props.getProperty("server.ciphers", "ALL");
- serverPassword = props.getProperty("server.password", null);
- }
- catch (Throwable t) {
- // NO-OP
- }
- }
-
- public SSLServer()
- {
- serverPool = Pool.create(0);
- try {
- /* Create SSL Context, one for each Virtual Host */
- serverCtx = SSLContext.make(serverPool, SSL.SSL_PROTOCOL_SSLV2 | SSL.SSL_PROTOCOL_SSLV3, SSL.SSL_MODE_SERVER);
- /* List the ciphers that the client is permitted to negotiate. */
- SSLContext.setCipherSuite(serverCtx, serverCiphers);
- /* Load Server key and certificate */
- SSLContext.setCertificate(serverCtx, serverCert, serverKey, serverPassword, SSL.SSL_AIDX_RSA);
- SSLContext.setVerify(serverCtx, SSL.SSL_CVERIFY_NONE, 10);
- serverAcceptor = new Acceptor();
- serverAcceptor.start();
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
- public static void incThreads() {
- synchronized(threadLock) {
- serverNrun++;
- }
- }
-
- public static void decThreads() {
- synchronized(threadLock) {
- serverNrun--;
- }
- }
-
- /* Acceptor thread. Listens for new connections */
- private class Acceptor extends java.lang.Thread {
- private long serverSock = 0;
- private long inetAddress = 0;
- private long pool = 0;
- public Acceptor() throws Exception {
- try {
-
- pool = Pool.create(SSLServer.serverPool);
- System.out.println("Accepting: " + SSLServer.serverAddr + ":" +
- SSLServer.serverPort);
- inetAddress = Address.info(SSLServer.serverAddr, Socket.APR_INET,
- SSLServer.serverPort, 0,
- pool);
- serverSock = Socket.create(Socket.APR_INET, Socket.SOCK_STREAM,
- Socket.APR_PROTO_TCP, pool);
- int rc = Socket.bind(serverSock, inetAddress);
- if (rc != 0) {
- throw(new Exception("Can't create Acceptor: bind: " + Error.strerror(rc)));
- }
- Socket.listen(serverSock, 5);
- }
- catch( Exception ex ) {
- ex.printStackTrace();
- throw(new Exception("Can't create Acceptor"));
- }
- }
-
- @Override
- public void run() {
- int i = 0;
- try {
- while (true) {
- long clientSock = Socket.accept(serverSock);
- System.out.println("Accepted id: " + i);
-
- try {
- long sa = Address.get(Socket.APR_REMOTE, clientSock);
- Sockaddr raddr = new Sockaddr();
- if (Address.fill(raddr, sa)) {
- System.out.println("Remote Host: " + Address.getnameinfo(sa, 0));
- System.out.println("Remote IP: " + Address.getip(sa) +
- ":" + raddr.port);
- }
- sa = Address.get(Socket.APR_LOCAL, clientSock);
- Sockaddr laddr = new Sockaddr();
- if (Address.fill(laddr, sa)) {
- System.out.println("Local Host: " + laddr.hostname);
- System.out.println("Local Server: " + Address.getnameinfo(sa, 0));
- System.out.println("Local IP: " + Address.getip(sa) +
- ":" + laddr.port);
- }
-
- } catch (Exception e) {
- // Ignore
- e.printStackTrace();
- }
-
- Socket.timeoutSet(clientSock, 10000000);
- SSLSocket.attach(SSLServer.serverCtx, clientSock);
- i = SSLSocket.handshake(clientSock);
- if (i == 0) {
-
- Worker worker = new Worker(clientSock, i++,
- this.getClass().getName());
- SSLServer.incThreads();
- worker.start();
-
- }
- else {
- System.out.println("Handshake error: " + SSL.getLastError());
- Socket.destroy(clientSock);
- }
- }
- }
- catch( Exception ex ) {
- ex.printStackTrace();
- }
- }
- }
-
- private class Worker extends java.lang.Thread {
- private int workerId = 0;
- private long clientSock = 0;
- private byte [] wellcomeMsg = null;
-
- public Worker(long clientSocket, int workerId, String from) {
- this.clientSock = clientSocket;
- this.workerId = workerId;
- wellcomeMsg = ("SSLServer server id: " + this.workerId + " from " +
- from + "\r\n").getBytes();
- }
-
- @Override
- public void run() {
- boolean doClose = false;
- try {
- Socket.send(clientSock, wellcomeMsg, 0, wellcomeMsg.length);
- while (!doClose) {
- /* Do a blocking read byte at a time */
- byte [] buf = new byte[1];
- int ret;
- ret = Socket.recv(clientSock, buf, 0, 1);
- if (ret != 1)
- throw(new Exception("Socket.recv failed"));
-
- if (buf[0] == '\n')
- continue;
- else if (buf[0] == '!') {
- doClose = true;
- }
- Socket.send(clientSock, buf, 0, 1);
-
- if (doClose) {
- try {
- byte [] msg = ("Bye from worker: " + workerId + "\r\n").getBytes();
- Socket.send(clientSock, msg, 0, msg.length);
- } catch(Exception e) { }
-
- Socket.close(clientSock);
- }
- }
- } catch (Exception e) {
- Socket.destroy(clientSock);
- e.printStackTrace();
- }
- Echo.decThreads();
- System.out.println("Worker: " + workerId + " finished");
- }
- }
-
-
- public static void main(String [] args) {
- try {
- Library.initialize(null);
- SSL.initialize(null);
-
- @SuppressWarnings("unused")
- SSLServer server = new SSLServer();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
diff --git a/java/org/apache/tomcat/Apr.java b/java/org/apache/tomcat/Apr.java
deleted file mode 100644
index 71db199..0000000
--- a/java/org/apache/tomcat/Apr.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat;
-
-/**
- * @deprecated This will be removed in 1.3.x
- */
-@Deprecated
-public class Apr {
-}
diff --git a/java/org/apache/tomcat/jni/Address.java b/java/org/apache/tomcat/jni/Address.java
deleted file mode 100644
index acac800..0000000
--- a/java/org/apache/tomcat/jni/Address.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Address
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Address {
-
- public static final String APR_ANYADDR = "0.0.0.0";
- /**
- * Fill the Sockaddr class from apr_sockaddr_t
- * @param info Sockaddr class to fill
- * @param sa Structure pointer
- * @return <code>true</code> if the operation was successful
- */
- public static native boolean fill(Sockaddr info, long sa);
-
- /**
- * Create the Sockaddr object from apr_sockaddr_t
- * @param sa Structure pointer
- * @return the socket address
- */
- public static native Sockaddr getInfo(long sa);
-
- /**
- * Create apr_sockaddr_t from hostname, address family, and port.
- * @param hostname The hostname or numeric address string to resolve/parse, the
- * path of the Unix Domain Socket, or NULL to build an address
- * that corresponds to 0.0.0.0 or ::
- * @param family The address family to use, or APR_UNSPEC if the system should
- * decide.
- * @param port The port number.
- * @param flags Special processing flags:
- * <PRE>
- * APR_IPV4_ADDR_OK first query for IPv4 addresses; only look
- * for IPv6 addresses if the first query failed;
- * only valid if family is APR_UNSPEC and hostname
- * isn't NULL; mutually exclusive with
- * APR_IPV6_ADDR_OK
- * APR_IPV6_ADDR_OK first query for IPv6 addresses; only look
- * for IPv4 addresses if the first query failed;
- * only valid if family is APR_UNSPEC and hostname
- * isn't NULL and APR_HAVE_IPV6; mutually exclusive
- * with APR_IPV4_ADDR_OK
- * </PRE>
- * @param p The pool for the apr_sockaddr_t and associated storage.
- * @return The new apr_sockaddr_t.
- * @throws Exception Operation failed
- */
- public static native long info(String hostname, int family,
- int port, int flags, long p)
- throws Exception;
- /**
- * Look up the host name from an apr_sockaddr_t.
- * @param sa The apr_sockaddr_t.
- * @param flags Special processing flags.
- * @return The hostname.
- */
- public static native String getnameinfo(long sa, int flags);
-
- /**
- * Return the IP address (in numeric address string format) in
- * an APR socket address. APR will allocate storage for the IP address
- * string from the pool of the apr_sockaddr_t.
- * @param sa The socket address to reference.
- * @return The IP address.
- */
- public static native String getip(long sa);
-
- /**
- * Given an apr_sockaddr_t and a service name, set the port for the service
- * @param sockaddr The apr_sockaddr_t that will have its port set
- * @param servname The name of the service you wish to use
- * @return APR status code.
- */
- public static native int getservbyname(long sockaddr, String servname);
-
- /**
- * Return an apr_sockaddr_t from an apr_socket_t
- * @param which Which interface do we want the apr_sockaddr_t for?
- * @param sock The socket to use
- * @return The returned apr_sockaddr_t.
- * @throws Exception An error occurred
- */
- public static native long get(int which, long sock)
- throws Exception;
-
- /**
- * See if the IP addresses in two APR socket addresses are
- * equivalent. Appropriate logic is present for comparing
- * IPv4-mapped IPv6 addresses with IPv4 addresses.
- *
- * @param a One of the APR socket addresses.
- * @param b The other APR socket address.
- * @return <code>true</code> if the addresses are equal
- */
- public static native boolean equal(long a, long b);
-
-}
diff --git a/java/org/apache/tomcat/jni/BIOCallback.java b/java/org/apache/tomcat/jni/BIOCallback.java
deleted file mode 100644
index ea9ccff..0000000
--- a/java/org/apache/tomcat/jni/BIOCallback.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Open SSL BIO Callback Interface
- *
- * @author Mladen Turk
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
-@Deprecated
-public interface BIOCallback {
-
- /**
- * Write data
- * @param buf containing the bytes to write.
- * @return Number of characters written.
- */
- public int write(byte [] buf);
-
- /**
- * Read data
- * @param buf buffer to store the read bytes.
- * @return number of bytes read.
- */
- public int read(byte [] buf);
-
- /**
- * Puts string
- * @param data String to write
- * @return Number of characters written
- */
- public int puts(String data);
-
- /**
- * Read string up to the len or CLRLF
- * @param len Maximum number of characters to read
- * @return String with up to len bytes read
- */
- public String gets(int len);
-
-}
diff --git a/java/org/apache/tomcat/jni/Buffer.java b/java/org/apache/tomcat/jni/Buffer.java
index a9d29ed..15ce569 100644
--- a/java/org/apache/tomcat/jni/Buffer.java
+++ b/java/org/apache/tomcat/jni/Buffer.java
@@ -24,73 +24,6 @@ import java.nio.ByteBuffer;
*/
public class Buffer {
- /**
- * Allocate a new ByteBuffer from memory
- * @param size The amount of memory to allocate
- * @return The ByteBuffer with allocated memory
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native ByteBuffer malloc(int size);
-
- /**
- * Allocate a new ByteBuffer from memory and set all of the memory to 0
- * @param num Number of elements.
- * @param size Length in bytes of each element.
- * @return The ByteBuffer with allocated memory
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native ByteBuffer calloc(int num, int size);
-
- /**
- * Allocate a new ByteBuffer from a pool
- * @param p The pool to allocate from
- * @param size The amount of memory to allocate
- * @return The ByteBuffer with allocated memory
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native ByteBuffer palloc(long p, int size);
-
- /**
- * Allocate a new ByteBuffer from a pool and set all of the memory to 0
- * @param p The pool to allocate from
- * @param size The amount of memory to allocate
- * @return The ByteBuffer with allocated memory
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native ByteBuffer pcalloc(long p, int size);
-
- /**
- * Allocate a new ByteBuffer from already allocated memory.
- * <br>Allocated memory must be provided from call to the
- * Stdlib.alloc or Stdlib.calloc methods.
- * @param mem The memory to use
- * @param size The amount of memory to use
- * @return The ByteBuffer with attached memory
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native ByteBuffer create(long mem, int size);
-
- /**
- * Deallocates or frees a memory block used by ByteBuffer
- * <br><b>Warning :</b> Call this method only on ByteBuffers
- * that were created by calling Buffer.alloc or Buffer.calloc.
- * @param buf Previously allocated ByteBuffer to be freed.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void free(ByteBuffer buf);
-
/**
* Returns the memory address of the ByteBuffer.
*
@@ -99,15 +32,4 @@ public class Buffer {
* @return the memory address
*/
public static native long address(ByteBuffer buf);
-
- /**
- * Returns the allocated memory size of the ByteBuffer.
- * @param buf Previously allocated ByteBuffer.
- * @return the size
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native long size(ByteBuffer buf);
-
}
diff --git a/java/org/apache/tomcat/jni/Directory.java b/java/org/apache/tomcat/jni/Directory.java
deleted file mode 100644
index 473b87b..0000000
--- a/java/org/apache/tomcat/jni/Directory.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Directory
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Directory {
-
- /**
- * Create a new directory on the file system.
- * @param path the path for the directory to be created. (use / on all systems)
- * @param perm Permissions for the new directory.
- * @param pool the pool to use.
- * @return the operation result
- */
- public static native int make(String path, int perm, long pool);
-
- /**
- * Creates a new directory on the file system, but behaves like
- * 'mkdir -p'. Creates intermediate directories as required. No error
- * will be reported if PATH already exists.
- * @param path the path for the directory to be created. (use / on all systems)
- * @param perm Permissions for the new directory.
- * @param pool the pool to use.
- * @return the operation result
- */
- public static native int makeRecursive(String path, int perm, long pool);
-
- /**
- * Remove directory from the file system.
- * @param path the path for the directory to be removed. (use / on all systems)
- * @param pool the pool to use.
- * @return the operation result
- */
- public static native int remove(String path, long pool);
-
- /**
- * Find an existing directory suitable as a temporary storage location.
- * @param pool The pool to use for any necessary allocations.
- * @return The temp directory.
- *
- * This function uses an algorithm to search for a directory that an
- * an application can use for temporary storage. Once such a
- * directory is found, that location is cached by the library. Thus,
- * callers only pay the cost of this algorithm once if that one time
- * is successful.
- */
- public static native String tempGet(long pool);
-
- /**
- * Open the specified directory.
- * @param dirname The full path to the directory (use / on all systems)
- * @param pool The pool to use.
- * @return The opened directory descriptor.
- * @throws Error An error occurred
- */
- public static native long open(String dirname, long pool)
- throws Error;
-
- /**
- * close the specified directory.
- * @param thedir the directory descriptor to close.
- * @return the operation result
- */
- public static native int close(long thedir);
-
- /**
- * Rewind the directory to the first entry.
- * @param thedir the directory descriptor to rewind.
- * @return the operation result
- */
- public static native int rewind(long thedir);
-
-
- /**
- * Read the next entry from the specified directory.
- * @param finfo the file info structure and filled in by apr_dir_read
- * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
- * @param thedir the directory descriptor returned from apr_dir_open
- * No ordering is guaranteed for the entries read.
- * @return the operation result
- */
- public static native int read(FileInfo finfo, int wanted, long thedir);
-
-}
diff --git a/java/org/apache/tomcat/jni/Error.java b/java/org/apache/tomcat/jni/Error.java
deleted file mode 100644
index a72cc15..0000000
--- a/java/org/apache/tomcat/jni/Error.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Error
- *
- * @author Mladen Turk
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
-@Deprecated
-public class Error extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * APR error type.
- */
- private final int error;
-
- /**
- * A description of the problem.
- */
- private final String description;
-
- /**
- * Construct an APRException.
- *
- * @param error one of the value in Error
- * @param description error message
- */
- private Error(int error, String description)
- {
- super(error + ": " + description);
- this.error = error;
- this.description = description;
- }
-
- /**
- * Get the APR error code of the exception.
- *
- * @return error of the Exception
- */
- public int getError()
- {
- return error;
- }
-
- /**
- * Get the APR description of the exception.
- *
- * @return description of the Exception
- */
- public String getDescription()
- {
- return description;
- }
-
- /**
- * Get the last platform error.
- * @return apr_status_t the last platform error, folded into apr_status_t, on most platforms
- * This retrieves errno, or calls a GetLastError() style function, and
- * folds it with APR_FROM_OS_ERROR. Some platforms (such as OS2) have no
- * such mechanism, so this call may be unsupported. Do NOT use this
- * call for socket errors from socket, send, recv etc!
- */
- public static native int osError();
-
- /**
- * Get the last platform socket error.
- * @return the last socket error, folded into apr_status_t, on all platforms
- * This retrieves errno or calls a GetLastSocketError() style function,
- * and folds it with APR_FROM_OS_ERROR.
- */
- public static native int netosError();
-
- /**
- * Return a human readable string describing the specified error.
- * @param statcode The error code the get a string for.
- * @return The error string.
- */
- public static native String strerror(int statcode);
-
-}
diff --git a/java/org/apache/tomcat/jni/File.java b/java/org/apache/tomcat/jni/File.java
deleted file mode 100644
index 3e0c3b1..0000000
--- a/java/org/apache/tomcat/jni/File.java
+++ /dev/null
@@ -1,751 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-/* Import needed classes */
-import java.nio.ByteBuffer;
-
-/** File
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class File {
-
- /** Open the file for reading */
- public static final int APR_FOPEN_READ = 0x00001;
- /** Open the file for writing */
- public static final int APR_FOPEN_WRITE = 0x00002;
- /** Create the file if not there */
- public static final int APR_FOPEN_CREATE = 0x00004;
- /** Append to the end of the file */
- public static final int APR_FOPEN_APPEND = 0x00008;
- /** Open the file and truncate to 0 length */
- public static final int APR_FOPEN_TRUNCATE = 0x00010;
- /** Open the file in binary mode */
- public static final int APR_FOPEN_BINARY = 0x00020;
- /** Open should fail if APR_CREATE and file exists. */
- public static final int APR_FOPEN_EXCL = 0x00040;
- /** Open the file for buffered I/O */
- public static final int APR_FOPEN_BUFFERED = 0x00080;
- /** Delete the file after close */
- public static final int APR_FOPEN_DELONCLOSE = 0x00100;
- /** Platform dependent tag to open the file for
- * use across multiple threads
- */
- public static final int APR_FOPEN_XTHREAD = 0x00200;
- /** Platform dependent support for higher level locked read/write
- * access to support writes across process/machines
- */
- public static final int APR_FOPEN_SHARELOCK = 0x00400;
- /** Do not register a cleanup when the file is opened */
- public static final int APR_FOPEN_NOCLEANUP = 0x00800;
- /** Advisory flag that this file should support
- * apr_socket_sendfile operation
- */
- public static final int APR_FOPEN_SENDFILE_ENABLED = 0x01000;
- /** Platform dependent flag to enable large file support;
- * <br><b>Warning :</b> The APR_LARGEFILE flag only has effect on some platforms
- * where sizeof(apr_off_t) == 4. Where implemented, it allows opening
- * and writing to a file which exceeds the size which can be
- * represented by apr_off_t (2 gigabytes). When a file's size does
- * exceed 2Gb, apr_file_info_get() will fail with an error on the
- * descriptor, likewise apr_stat()/apr_lstat() will fail on the
- * filename. apr_dir_read() will fail with APR_INCOMPLETE on a
- * directory entry for a large file depending on the particular
- * APR_FINFO_* flags. Generally, it is not recommended to use this
- * flag.
- */
- public static final int APR_FOPEN_LARGEFILE = 0x04000;
-
- /** Set the file position */
- public static final int APR_SET = 0;
- /** Current */
- public static final int APR_CUR = 1;
- /** Go to end of file */
- public static final int APR_END = 2;
-
- /* flags for apr_file_attrs_set */
-
- /** File is read-only */
- public static final int APR_FILE_ATTR_READONLY = 0x01;
- /** File is executable */
- public static final int APR_FILE_ATTR_EXECUTABLE = 0x02;
- /** File is hidden */
- public static final int APR_FILE_ATTR_HIDDEN = 0x04;
-
-
- /* File lock types/flags */
-
- /** Shared lock. More than one process or thread can hold a shared lock
- * at any given time. Essentially, this is a "read lock", preventing
- * writers from establishing an exclusive lock.
- */
- public static final int APR_FLOCK_SHARED = 1;
-
- /** Exclusive lock. Only one process may hold an exclusive lock at any
- * given time. This is analogous to a "write lock".
- */
- public static final int APR_FLOCK_EXCLUSIVE = 2;
- /** mask to extract lock type */
- public static final int APR_FLOCK_TYPEMASK = 0x000F;
- /** do not block while acquiring the file lock */
- public static final int APR_FLOCK_NONBLOCK = 0x0010;
-
- /* apr_filetype_e values for the filetype member of the
- * apr_file_info_t structure
- * <br><b>Warning :</b>: Not all of the filetypes below can be determined.
- * For example, a given platform might not correctly report
- * a socket descriptor as APR_SOCK if that type isn't
- * well-identified on that platform. In such cases where
- * a filetype exists but cannot be described by the recognized
- * flags below, the filetype will be APR_UNKFILE. If the
- * filetype member is not determined, the type will be APR_NOFILE.
- */
-
- /** no file type determined */
- public static final int APR_NOFILE = 0;
- /** a regular file */
- public static final int APR_REG = 1;
- /** a directory */
- public static final int APR_DIR = 2;
- /** a character device */
- public static final int APR_CHR = 3;
- /** a block device */
- public static final int APR_BLK = 4;
- /** a FIFO / pipe */
- public static final int APR_PIPE = 5;
- /** a symbolic link */
- public static final int APR_LNK = 6;
- /** a [unix domain] socket */
- public static final int APR_SOCK = 7;
- /** a file of some other unknown type */
- public static final int APR_UNKFILE = 127;
-
-
- /*
- * apr_file_permissions File Permissions flags
- */
-
- public static final int APR_FPROT_USETID = 0x8000; /** Set user id */
- public static final int APR_FPROT_UREAD = 0x0400; /** Read by user */
- public static final int APR_FPROT_UWRITE = 0x0200; /** Write by user */
- public static final int APR_FPROT_UEXECUTE = 0x0100; /** Execute by user */
-
- public static final int APR_FPROT_GSETID = 0x4000; /** Set group id */
- public static final int APR_FPROT_GREAD = 0x0040; /** Read by group */
- public static final int APR_FPROT_GWRITE = 0x0020; /** Write by group */
- public static final int APR_FPROT_GEXECUTE = 0x0010; /** Execute by group */
-
- public static final int APR_FPROT_WSTICKY = 0x2000; /** Sticky bit */
- public static final int APR_FPROT_WREAD = 0x0004; /** Read by others */
- public static final int APR_FPROT_WWRITE = 0x0002; /** Write by others */
- public static final int APR_FPROT_WEXECUTE = 0x0001; /** Execute by others */
- public static final int APR_FPROT_OS_DEFAULT = 0x0FFF; /** use OS's default permissions */
-
-
- public static final int APR_FINFO_LINK = 0x00000001; /** Stat the link not the file itself if it is a link */
- public static final int APR_FINFO_MTIME = 0x00000010; /** Modification Time */
- public static final int APR_FINFO_CTIME = 0x00000020; /** Creation or inode-changed time */
- public static final int APR_FINFO_ATIME = 0x00000040; /** Access Time */
- public static final int APR_FINFO_SIZE = 0x00000100; /** Size of the file */
- public static final int APR_FINFO_CSIZE = 0x00000200; /** Storage size consumed by the file */
- public static final int APR_FINFO_DEV = 0x00001000; /** Device */
- public static final int APR_FINFO_INODE = 0x00002000; /** Inode */
- public static final int APR_FINFO_NLINK = 0x00004000; /** Number of links */
- public static final int APR_FINFO_TYPE = 0x00008000; /** Type */
- public static final int APR_FINFO_USER = 0x00010000; /** User */
- public static final int APR_FINFO_GROUP = 0x00020000; /** Group */
- public static final int APR_FINFO_UPROT = 0x00100000; /** User protection bits */
- public static final int APR_FINFO_GPROT = 0x00200000; /** Group protection bits */
- public static final int APR_FINFO_WPROT = 0x00400000; /** World protection bits */
- public static final int APR_FINFO_ICASE = 0x01000000; /** if dev is case insensitive */
- public static final int APR_FINFO_NAME = 0x02000000; /** ->name in proper case */
-
- public static final int APR_FINFO_MIN = 0x00008170; /** type, mtime, ctime, atime, size */
- public static final int APR_FINFO_IDENT = 0x00003000; /** dev and inode */
- public static final int APR_FINFO_OWNER = 0x00030000; /** user and group */
- public static final int APR_FINFO_PROT = 0x00700000; /** all protections */
- public static final int APR_FINFO_NORM = 0x0073b170; /** an atomic unix apr_stat() */
- public static final int APR_FINFO_DIRENT = 0x02000000; /** an atomic unix apr_dir_read() */
-
-
-
- /**
- * Open the specified file.
- * @param fname The full path to the file (using / on all systems)
- * @param flag Or'ed value of:
- * <PRE>
- * APR_FOPEN_READ open for reading
- * APR_FOPEN_WRITE open for writing
- * APR_FOPEN_CREATE create the file if not there
- * APR_FOPEN_APPEND file ptr is set to end prior to all writes
- * APR_FOPEN_TRUNCATE set length to zero if file exists
- * APR_FOPEN_BINARY not a text file (This flag is ignored on
- * UNIX because it has no meaning)
- * APR_FOPEN_BUFFERED buffer the data. Default is non-buffered
- * APR_FOPEN_EXCL return error if APR_CREATE and file exists
- * APR_FOPEN_DELONCLOSE delete the file after closing.
- * APR_FOPEN_XTHREAD Platform dependent tag to open the file
- * for use across multiple threads
- * APR_FOPEN_SHARELOCK Platform dependent support for higher
- * level locked read/write access to support
- * writes across process/machines
- * APR_FOPEN_NOCLEANUP Do not register a cleanup with the pool
- * passed in on the <EM>pool</EM> argument (see below).
- * The apr_os_file_t handle in apr_file_t will not
- * be closed when the pool is destroyed.
- * APR_FOPEN_SENDFILE_ENABLED Open with appropriate platform semantics
- * for sendfile operations. Advisory only,
- * apr_socket_sendfile does not check this flag.
- * </PRE>
- * @param perm Access permissions for file.
- * @param pool The pool to use.
- * If perm is APR_OS_DEFAULT and the file is being created,
- * appropriate default permissions will be used.
- * @return The opened file descriptor.
- * @throws Error An error occurred
- */
- public static native long open(String fname, int flag, int perm, long pool)
- throws Error;
-
- /**
- * Close the specified file.
- * @param file The file descriptor to close.
- * @return the operation status
- */
- public static native int close(long file);
-
- /**
- * Flush the file's buffer.
- * @param thefile The file descriptor to flush
- * @return the operation status
- */
- public static native int flush(long thefile);
-
- /**
- * Open a temporary file
- * @param templ The template to use when creating a temp file.
- * @param flags The flags to open the file with. If this is zero,
- * the file is opened with
- * APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | APR_DELONCLOSE
- * @param pool The pool to allocate the file out of.
- * @return The apr file to use as a temporary file.
- *
- * This function generates a unique temporary file name from template.
- * The last six characters of template must be XXXXXX and these are replaced
- * with a string that makes the filename unique. Since it will be modified,
- * template must not be a string constant, but should be declared as a character
- * array.
- * @throws Error An error occurred
- */
- public static native long mktemp(String templ, int flags, long pool)
- throws Error;
-
- /**
- * Delete the specified file.
- * @param path The full path to the file (using / on all systems)
- * @param pool The pool to use.
- * If the file is open, it won't be removed until all
- * instances are closed.
- * @return the operation status
- */
- public static native int remove(String path, long pool);
-
- /**
- * Rename the specified file.
- * <br><b>Warning :</b> If a file exists at the new location, then it will be
- * overwritten. Moving files or directories across devices may not be
- * possible.
- * @param fromPath The full path to the original file (using / on all systems)
- * @param toPath The full path to the new file (using / on all systems)
- * @param pool The pool to use.
- * @return the operation status
- */
- public static native int rename(String fromPath, String toPath, long pool);
-
- /**
- * Copy the specified file to another file.
- * The new file does not need to exist, it will be created if required.
- * <br><b>Warning :</b> If the new file already exists, its contents will be overwritten.
- * @param fromPath The full path to the original file (using / on all systems)
- * @param toPath The full path to the new file (using / on all systems)
- * @param perms Access permissions for the new file if it is created.
- * In place of the usual or'd combination of file permissions, the
- * value APR_FILE_SOURCE_PERMS may be given, in which case the source
- * file's permissions are copied.
- * @param pool The pool to use.
- * @return the operation status
- */
- public static native int copy(String fromPath, String toPath, int perms, long pool);
-
- /**
- * Append the specified file to another file.
- * The new file does not need to exist, it will be created if required.
- * @param fromPath The full path to the source file (use / on all systems)
- * @param toPath The full path to the destination file (use / on all systems)
- * @param perms Access permissions for the destination file if it is created.
- * In place of the usual or'd combination of file permissions, the
- * value APR_FILE_SOURCE_PERMS may be given, in which case the source
- * file's permissions are copied.
- * @param pool The pool to use.
- * @return the operation status
- */
- public static native int append(String fromPath, String toPath, int perms, long pool);
-
- /**
- * Write the string into the specified file.
- * @param str The string to write. Must be NUL terminated!
- * @param thefile The file descriptor to write to
- * @return the operation status
- */
- public static native int puts(byte [] str, long thefile);
-
- /**
- * Move the read/write file offset to a specified byte within a file.
- * @param thefile The file descriptor
- * @param where How to move the pointer, one of:
- * <PRE>
- * APR_SET -- set the offset to offset
- * APR_CUR -- add the offset to the current position
- * APR_END -- add the offset to the current file size
- * </PRE>
- * @param offset The offset to move the pointer to.
- * @return Offset the pointer was actually moved to.
- * @throws Error If an error occurs reading the file
- */
- public static native long seek(long thefile, int where, long offset)
- throws Error;
-
- /**
- * Write a character into the specified file.
- * @param ch The character to write.
- * @param thefile The file descriptor to write to
- * @return the operation status
- */
- public static native int putc(byte ch, long thefile);
-
- /**
- * Put a character back onto a specified stream.
- * @param ch The character to write.
- * @param thefile The file descriptor to write to
- * @return the operation status
- */
- public static native int ungetc(byte ch, long thefile);
-
- /**
- * Write data to the specified file.
- *
- * Write will write up to the specified number of
- * bytes, but never more. If the OS cannot write that many bytes, it
- * will write as many as it can. The third argument is modified to
- * reflect the * number of bytes written.
- *
- * It is possible for both bytes to be written and an error to
- * be returned. APR_EINTR is never returned.
- * @param thefile The file descriptor to write to.
- * @param buf The buffer which contains the data.
- * @param offset Start offset in buf
- * @param nbytes The number of bytes to write
- * @return The number of bytes written.
- */
- public static native int write(long thefile, byte[] buf, int offset, int nbytes);
-
- /**
- * Write data to the specified file.
- *
- * Write will write up to the specified number of
- * bytes, but never more. If the OS cannot write that many bytes, it
- * will write as many as it can. The third argument is modified to
- * reflect the * number of bytes written.
- *
- * It is possible for both bytes to be written and an error to
- * be returned. APR_EINTR is never returned.
- * @param thefile The file descriptor to write to.
- * @param buf The direct Byte buffer which contains the data.
- * @param offset Start offset in buf
- * @param nbytes The number of bytes to write
- * @return The number of bytes written.
- */
- public static native int writeb(long thefile, ByteBuffer buf, int offset, int nbytes);
-
- /**
- * Write data to the specified file, ensuring that all of the data is
- * written before returning.
- *
- * Write will write up to the specified number of
- * bytes, but never more. If the OS cannot write that many bytes, the
- * process/thread will block until they can be written. Exceptional
- * error such as "out of space" or "pipe closed" will terminate with
- * an error.
- *
- * It is possible for both bytes to be written and an error to
- * be returned. And if *bytes_written is less than nbytes, an
- * accompanying error is _always_ returned.
- *
- * APR_EINTR is never returned.
- * @param thefile The file descriptor to write to.
- * @param buf The buffer which contains the data.
- * @param offset Start offset in buf
- * @param nbytes The number of bytes to write
- * @return The number of bytes written.
- */
- public static native int writeFull(long thefile, byte[] buf, int offset, int nbytes);
-
- /**
- * Write data to the specified file, ensuring that all of the data is
- * written before returning.
- *
- * Write will write up to the specified number of
- * bytes, but never more. If the OS cannot write that many bytes, the
- * process/thread will block until they can be written. Exceptional
- * error such as "out of space" or "pipe closed" will terminate with
- * an error.
- *
- * It is possible for both bytes to be written and an error to
- * be returned. And if *bytes_written is less than nbytes, an
- * accompanying error is _always_ returned.
- *
- * APR_EINTR is never returned.
- * @param thefile The file descriptor to write to.
- * @param buf The direct ByteBuffer which contains the data.
- * @param offset Start offset in buf
- * @param nbytes The number of bytes to write.
- * @return The number of bytes written.
- */
- public static native int writeFullb(long thefile, ByteBuffer buf, int offset, int nbytes);
-
- /**
- * Write data from array of byte arrays to the specified file.
- *
- * It is possible for both bytes to be written and an error to
- * be returned. APR_EINTR is never returned.
- *
- * apr_file_writev is available even if the underlying
- * operating system doesn't provide writev().
- * @param thefile The file descriptor to write to.
- * @param vec The array from which to get the data to write to the file.
- * @return The number of bytes written.
- */
- public static native int writev(long thefile, byte[][] vec);
-
- /**
- * Write data from array of byte arrays to the specified file,
- * ensuring that all of the data is written before returning.
- *
- * writevFull is available even if the underlying
- * operating system doesn't provide writev().
- * @param thefile The file descriptor to write to.
- * @param vec The array from which to get the data to write to the file.
- * @return The number of bytes written.
- */
- public static native int writevFull(long thefile, byte[][] vec);
-
- /**
- * Read data from the specified file.
- *
- * apr_file_read will read up to the specified number of
- * bytes, but never more. If there isn't enough data to fill that
- * number of bytes, all of the available data is read. The third
- * argument is modified to reflect the number of bytes read. If a
- * char was put back into the stream via ungetc, it will be the first
- * character returned.
- *
- * It is not possible for both bytes to be read and an APR_EOF
- * or other error to be returned. APR_EINTR is never returned.
- * @param thefile The file descriptor to read from.
- * @param buf The buffer to store the data to.
- * @param offset Start offset in buf
- * @param nbytes The number of bytes to read
- * @return the number of bytes read.
- */
- public static native int read(long thefile, byte[] buf, int offset, int nbytes);
-
- /**
- * Read data from the specified file.
- *
- * apr_file_read will read up to the specified number of
- * bytes, but never more. If there isn't enough data to fill that
- * number of bytes, all of the available data is read. The third
- * argument is modified to reflect the number of bytes read. If a
- * char was put back into the stream via ungetc, it will be the first
- * character returned.
- *
- * It is not possible for both bytes to be read and an APR_EOF
- * or other error to be returned. APR_EINTR is never returned.
- * @param thefile The file descriptor to read from.
- * @param buf The direct Byte buffer to store the data to.
- * @param offset Start offset in buf
- * @param nbytes The number of bytes to read.
- * @return the number of bytes read.
- */
- public static native int readb(long thefile, ByteBuffer buf, int offset, int nbytes);
-
- /**
- * Read data from the specified file, ensuring that the buffer is filled
- * before returning.
- *
- * Read will read up to the specified number of
- * bytes, but never more. If there isn't enough data to fill that
- * number of bytes, then the process/thread will block until it is
- * available or EOF is reached. If a char was put back into the
- * stream via ungetc, it will be the first character returned.
- *
- * It is possible for both bytes to be read and an error to be
- * returned. And if *bytes_read is less than nbytes, an accompanying
- * error is _always_ returned.
- *
- * APR_EINTR is never returned.
- * @param thefile The file descriptor to read from.
- * @param buf The buffer to store the data to.
- * @param offset Start offset in buf
- * @param nbytes The number of bytes to read
- * @return the number of bytes read.
- */
- public static native int readFull(long thefile, byte[] buf, int offset, int nbytes);
-
- /**
- * Read data from the specified file, ensuring that the buffer is filled
- * before returning.
- *
- * Read will read up to the specified number of
- * bytes, but never more. If there isn't enough data to fill that
- * number of bytes, then the process/thread will block until it is
- * available or EOF is reached. If a char was put back into the
- * stream via ungetc, it will be the first character returned.
- *
- * It is possible for both bytes to be read and an error to be
- * returned. And if *bytes_read is less than nbytes, an accompanying
- * error is _always_ returned.
- *
- * APR_EINTR is never returned.
- * @param thefile The file descriptor to read from.
- * @param buf The direct ByteBuffer to store the data to.
- * @param offset Start offset in buf
- * @param nbytes The number of bytes to read.
- * @return the number of bytes read.
- */
- public static native int readFullb(long thefile, ByteBuffer buf, int offset, int nbytes);
-
- /**
- * Read a string from the specified file.
- * The buffer will be NUL-terminated if any characters are stored.
- * @param buf The buffer to store the string in.
- * @param offset Start offset in buf
- * @param thefile The file descriptor to read from
- * @return the number of bytes read.
- */
- public static native int gets(byte[] buf, int offset, long thefile);
-
-
- /**
- * Read a character from the specified file.
- * @param thefile The file descriptor to read from
- * @return The read character
- * @throws Error If an error occurs reading the file
- */
- public static native int getc(long thefile)
- throws Error;
-
- /**
- * Are we at the end of the file
- * @param fptr The apr file we are testing.
- * @return Returns APR_EOF if we are at the end of file, APR_SUCCESS otherwise.
- */
- public static native int eof(long fptr);
-
- /**
- * Return the file name of the current file.
- * @param thefile The currently open file.
- * @return the name
- */
- public static native String nameGet(long thefile);
-
- /**
- * Set the specified file's permission bits.
- * <br><b>Warning :</b> Some platforms may not be able to apply all of the
- * available permission bits; APR_INCOMPLETE will be returned if some
- * permissions are specified which could not be set.
- * <br><b>Warning :</b> Platforms which do not implement this feature will return
- * APR_ENOTIMPL.
- * @param fname The file (name) to apply the permissions to.
- * @param perms The permission bits to apply to the file.
- * @return the operation status
- */
- public static native int permsSet(String fname, int perms);
-
- /**
- * Set attributes of the specified file.
- * This function should be used in preference to explicit manipulation
- * of the file permissions, because the operations to provide these
- * attributes are platform specific and may involve more than simply
- * setting permission bits.
- * <br><b>Warning :</b> Platforms which do not implement this feature will return
- * APR_ENOTIMPL.
- * @param fname The full path to the file (using / on all systems)
- * @param attributes Or'd combination of
- * <PRE>
- * APR_FILE_ATTR_READONLY - make the file readonly
- * APR_FILE_ATTR_EXECUTABLE - make the file executable
- * APR_FILE_ATTR_HIDDEN - make the file hidden
- * </PRE>
- * @param mask Mask of valid bits in attributes.
- * @param pool the pool to use.
- * @return the operation status
- */
- public static native int attrsSet(String fname, int attributes, int mask, long pool);
-
- /**
- * Set the mtime of the specified file.
- * <br><b>Warning :</b> Platforms which do not implement this feature will return
- * APR_ENOTIMPL.
- * @param fname The full path to the file (using / on all systems)
- * @param mtime The mtime to apply to the file in microseconds
- * @param pool The pool to use.
- * @return the operation status
- */
- public static native int mtimeSet(String fname, long mtime, long pool);
-
- /**
- * Establish a lock on the specified, open file. The lock may be advisory
- * or mandatory, at the discretion of the platform. The lock applies to
- * the file as a whole, rather than a specific range. Locks are established
- * on a per-thread/process basis; a second lock by the same thread will not
- * block.
- * @param thefile The file to lock.
- * @param type The type of lock to establish on the file.
- * @return the operation status
- */
- public static native int lock(long thefile, int type);
-
- /**
- * Remove any outstanding locks on the file.
- * @param thefile The file to unlock.
- * @return the operation status
- */
- public static native int unlock(long thefile);
-
- /**
- * Retrieve the flags that were passed into apr_file_open()
- * when the file was opened.
- * @param file The file to retrieve flags.
- * @return the flags
- */
- public static native int flagsGet(long file);
-
- /**
- * Truncate the file's length to the specified offset
- * @param fp The file to truncate
- * @param offset The offset to truncate to.
- * @return the operation status
- */
- public static native int trunc(long fp, long offset);
-
- /**
- * Create an anonymous pipe.
- * @param io io[0] The file descriptors to use as input to the pipe.
- * io[1] The file descriptor to use as output from the pipe.
- * @param pool The pool to operate on.
- * @return the operation status
- */
- public static native int pipeCreate(long [] io, long pool);
-
- /**
- * Get the timeout value for a pipe or manipulate the blocking state.
- * @param thepipe The pipe we are getting a timeout for.
- * @return The current timeout value in microseconds.
- * @throws Error If an error occurs
- */
- public static native long pipeTimeoutGet(long thepipe)
- throws Error;
-
- /**
- * Set the timeout value for a pipe or manipulate the blocking state.
- * @param thepipe The pipe we are setting a timeout on.
- * @param timeout The timeout value in microseconds. Values < 0 mean
- * wait forever, 0 means do not wait at all.
- * @return the operation status
- */
- public static native int pipeTimeoutSet(long thepipe, long timeout);
-
- /**
- * Duplicate the specified file descriptor.
- * @param newFile The file to duplicate.
- * newFile must point to a valid apr_file_t, or point to NULL.
- * @param oldFile The file to duplicate.
- * @param pool The pool to use for the new file.
- * @return Duplicated file structure.
- * @throws Error If an error occurs reading the file descriptor
- */
- public static native long dup(long newFile, long oldFile, long pool)
- throws Error;
-
- /**
- * Duplicate the specified file descriptor and close the original.
- * @param newFile The old file that is to be closed and reused.
- * newFile MUST point at a valid apr_file_t. It cannot be NULL.
- * @param oldFile The file to duplicate.
- * @param pool The pool to use for the new file.
- * @return the operation status
- */
- public static native int dup2(long newFile, long oldFile, long pool);
-
- /**
- * Get the specified file's stats. The file is specified by filename,
- * instead of using a pre-opened file.
- * @param finfo Where to store the information about the file, which is
- * never touched if the call fails.
- * @param fname The name of the file to stat.
- * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
- * @param pool the pool to use to allocate the new file.
- * @return the operation status
- */
- public static native int stat(FileInfo finfo, String fname, int wanted, long pool);
-
- /**
- * Get the specified file's stats. The file is specified by filename,
- * instead of using a pre-opened file.
- * @param fname The name of the file to stat.
- * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
- * @param pool the pool to use to allocate the new file.
- * @return FileInfo object.
- */
- public static native FileInfo getStat(String fname, int wanted, long pool);
-
- /**
- * Get the specified file's stats.
- * @param finfo Where to store the information about the file.
- * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
- * @param thefile The file to get information about.
- * @return the operation status
- */
- public static native int infoGet(FileInfo finfo, int wanted, long thefile);
-
-
- /**
- * Get the specified file's stats.
- * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
- * @param thefile The file to get information about.
- * @return FileInfo object.
- */
- public static native FileInfo getInfo(int wanted, long thefile);
-
-}
diff --git a/java/org/apache/tomcat/jni/FileInfo.java b/java/org/apache/tomcat/jni/FileInfo.java
index 34b67ff..ff807e4 100644
--- a/java/org/apache/tomcat/jni/FileInfo.java
+++ b/java/org/apache/tomcat/jni/FileInfo.java
@@ -16,55 +16,15 @@
*/
package org.apache.tomcat.jni;
-/** Fileinfo
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
+/**
+ * Tomcat Native 1.2.33 and earlier won't initialise unless this class is
+ * present. This dummy class ensures initialisation gets as far as being able to
+ * check the version of the Tomcat Native library and reporting a version error
+ * if 1.2.33 or earlier is present.
*/
-@Deprecated
public class FileInfo {
- /** Allocates memory and closes lingering handles in the specified pool */
- public long pool;
- /** The bitmask describing valid fields of this apr_finfo_t structure
- * including all available 'wanted' fields and potentially more */
- public int valid;
- /** The access permissions of the file. Mimics Unix access rights. */
- public int protection;
- /** The type of file. One of APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE,
- * APR_LNK or APR_SOCK. If the type is undetermined, the value is APR_NOFILE.
- * If the type cannot be determined, the value is APR_UNKFILE.
- */
- public int filetype;
- /** The user id that owns the file */
- public int user;
- /** The group id that owns the file */
- public int group;
- /** The inode of the file. */
- public int inode;
- /** The id of the device the file is on. */
- public int device;
- /** The number of hard links to the file. */
- public int nlink;
- /** The size of the file */
- public long size;
- /** The storage size consumed by the file */
- public long csize;
- /** The time the file was last accessed */
- public long atime;
- /** The time the file was last modified */
- public long mtime;
- /** The time the file was created, or the inode was last changed */
- public long ctime;
- /** The pathname of the file (possibly unrooted) */
- public String fname;
- /** The file's name (no path) in filesystem case */
- public String name;
- /** The file's handle, if accessed (can be submitted to apr_duphandle) */
- public long filehand;
-
+ private FileInfo() {
+ // Hide default constructor
+ }
}
diff --git a/java/org/apache/tomcat/jni/Global.java b/java/org/apache/tomcat/jni/Global.java
deleted file mode 100644
index 7da6740..0000000
--- a/java/org/apache/tomcat/jni/Global.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Global
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Global {
-
- /**
- * Create and initialize a mutex that can be used to synchronize both
- * processes and threads. Note: There is considerable overhead in using
- * this API if only cross-process or cross-thread mutual exclusion is
- * required. See apr_proc_mutex.h and apr_thread_mutex.h for more
- * specialized lock routines.
- * <br><b>Warning :</b> Check APR_HAS_foo_SERIALIZE defines to see if the platform supports
- * APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
- * @param fname A file name to use if the lock mechanism requires one. This
- * argument should always be provided. The lock code itself will
- * determine if it should be used.
- * @param mech The mechanism to use for the interprocess lock, if any; one of
- * <PRE>
- * APR_LOCK_FCNTL
- * APR_LOCK_FLOCK
- * APR_LOCK_SYSVSEM
- * APR_LOCK_POSIXSEM
- * APR_LOCK_PROC_PTHREAD
- * APR_LOCK_DEFAULT pick the default mechanism for the platform
- * </PRE>
- * @param pool the pool from which to allocate the mutex.
- * @return Newly created mutex.
- * @throws Error If an error occurred
- */
- public static native long create(String fname, int mech, long pool)
- throws Error;
-
- /**
- * Re-open a mutex in a child process.
- * @param fname A file name to use if the mutex mechanism requires one. This
- * argument should always be provided. The mutex code itself will
- * determine if it should be used. This filename should be the
- * same one that was passed to apr_proc_mutex_create().
- * @param pool The pool to operate on.
- * This function must be called to maintain portability, even
- * if the underlying lock mechanism does not require it.
- * @return Newly opened mutex.
- * @throws Error If an error occurred
- */
- public static native long childInit(String fname, long pool)
- throws Error;
-
- /**
- * Acquire the lock for the given mutex. If the mutex is already locked,
- * the current thread will be put to sleep until the lock becomes available.
- * @param mutex the mutex on which to acquire the lock.
- * @return the operation status
- */
- public static native int lock(long mutex);
-
- /**
- * Attempt to acquire the lock for the given mutex. If the mutex has already
- * been acquired, the call returns immediately with APR_EBUSY. Note: it
- * is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine
- * if the return value was APR_EBUSY, for portability reasons.
- * @param mutex the mutex on which to attempt the lock acquiring.
- * @return the operation status
- */
- public static native int trylock(long mutex);
-
- /**
- * Release the lock for the given mutex.
- * @param mutex the mutex from which to release the lock.
- * @return the operation status
- */
- public static native int unlock(long mutex);
-
- /**
- * Destroy the mutex and free the memory associated with the lock.
- * @param mutex the mutex to destroy.
- * @return the operation status
- */
- public static native int destroy(long mutex);
-
-}
diff --git a/java/org/apache/tomcat/jni/Library.java b/java/org/apache/tomcat/jni/Library.java
index b7febeb..2fa3b07 100644
--- a/java/org/apache/tomcat/jni/Library.java
+++ b/java/org/apache/tomcat/jni/Library.java
@@ -18,14 +18,12 @@ package org.apache.tomcat.jni;
import java.io.File;
-/** Library
- *
- * @author Mladen Turk
- */
public final class Library {
/* Default library names */
private static final String [] NAMES = {"tcnative-2", "libtcnative-2", "tcnative-1", "libtcnative-1"};
+ /* System property used to define CATALINA_HOME */
+ private static final String CATALINA_HOME_PROP = "catalina.home";
/*
* A handle to the unique Library singleton instance.
*/
@@ -34,13 +32,13 @@ public final class Library {
private Library() throws Exception {
boolean loaded = false;
StringBuilder err = new StringBuilder();
- File binLib = new File(System.getProperty("catalina.home"), "bin");
+ File binLib = new File(System.getProperty(CATALINA_HOME_PROP), "bin");
for (int i = 0; i < NAMES.length; i++) {
File library = new File(binLib, System.mapLibraryName(NAMES[i]));
try {
System.load(library.getAbsolutePath());
loaded = true;
- } catch (ThreadDeath | VirtualMachineError t) {
+ } catch (VirtualMachineError t) {
throw t;
} catch (Throwable t) {
if (library.exists()) {
@@ -63,7 +61,7 @@ public final class Library {
try {
System.loadLibrary(value);
loaded = true;
- } catch (ThreadDeath | VirtualMachineError t) {
+ } catch (VirtualMachineError t) {
throw t;
} catch (Throwable t) {
String name = System.mapLibraryName(value);
@@ -108,11 +106,7 @@ public final class Library {
*/
public static native void terminate();
/* Internal function for loading APR Features */
- private static native boolean has(int what);
- /* Internal function for loading APR Features */
private static native int version(int what);
- /* Internal function for loading APR sizes */
- private static native int size(int what);
/* TCN_MAJOR_VERSION */
public static int TCN_MAJOR_VERSION = 0;
@@ -136,88 +130,6 @@ public final class Library {
/* APR_VERSION_STRING */
public static native String aprVersionString();
- /* APR Feature Macros */
- @Deprecated
- public static boolean APR_HAVE_IPV6 = false;
- @Deprecated
- public static boolean APR_HAS_SHARED_MEMORY = false;
- @Deprecated
- public static boolean APR_HAS_THREADS = false;
- @Deprecated
- public static boolean APR_HAS_SENDFILE = false;
- @Deprecated
- public static boolean APR_HAS_MMAP = false;
- @Deprecated
- public static boolean APR_HAS_FORK = false;
- @Deprecated
- public static boolean APR_HAS_RANDOM = false;
- @Deprecated
- public static boolean APR_HAS_OTHER_CHILD = false;
- @Deprecated
- public static boolean APR_HAS_DSO = false;
- @Deprecated
- public static boolean APR_HAS_SO_ACCEPTFILTER = false;
- @Deprecated
- public static boolean APR_HAS_UNICODE_FS = false;
- @Deprecated
- public static boolean APR_HAS_PROC_INVOKED = false;
- @Deprecated
- public static boolean APR_HAS_USER = false;
- @Deprecated
- public static boolean APR_HAS_LARGE_FILES = false;
- @Deprecated
- public static boolean APR_HAS_XTHREAD_FILES = false;
- @Deprecated
- public static boolean APR_HAS_OS_UUID = false;
- /* Are we big endian? */
- @Deprecated
- public static boolean APR_IS_BIGENDIAN = false;
- /* APR sets APR_FILES_AS_SOCKETS to 1 on systems where it is possible
- * to poll on files/pipes.
- */
- @Deprecated
- public static boolean APR_FILES_AS_SOCKETS = false;
- /* This macro indicates whether or not EBCDIC is the native character set.
- */
- @Deprecated
- public static boolean APR_CHARSET_EBCDIC = false;
- /* Is the TCP_NODELAY socket option inherited from listening sockets?
- */
- @Deprecated
- public static boolean APR_TCP_NODELAY_INHERITED = false;
- /* Is the O_NONBLOCK flag inherited from listening sockets?
- */
- @Deprecated
- public static boolean APR_O_NONBLOCK_INHERITED = false;
- /* Poll operations are interruptable by apr_pollset_wakeup().
- */
- @Deprecated
- public static boolean APR_POLLSET_WAKEABLE = false;
- /* Support for Unix Domain Sockets.
- */
- @Deprecated
- public static boolean APR_HAVE_UNIX = false;
-
-
- @Deprecated
- public static int APR_SIZEOF_VOIDP;
- @Deprecated
- public static int APR_PATH_MAX;
- @Deprecated
- public static int APRMAXHOSTLEN;
- @Deprecated
- public static int APR_MAX_IOVEC_SIZE;
- @Deprecated
- public static int APR_MAX_SECS_TO_LINGER;
- @Deprecated
- public static int APR_MMAP_THRESHOLD;
- @Deprecated
- public static int APR_MMAP_LIMIT;
-
- /* return global TCN's APR pool */
- @Deprecated
- public static native long globalPool();
-
/**
* Setup any APR internal data structures. This MUST be the first function
* called for any APR library.
@@ -244,88 +156,11 @@ public final class Library {
APR_PATCH_VERSION = version(0x13);
APR_IS_DEV_VERSION = version(0x14);
- APR_SIZEOF_VOIDP = size(1);
- APR_PATH_MAX = size(2);
- APRMAXHOSTLEN = size(3);
- APR_MAX_IOVEC_SIZE = size(4);
- APR_MAX_SECS_TO_LINGER = size(5);
- APR_MMAP_THRESHOLD = size(6);
- APR_MMAP_LIMIT = size(7);
-
- APR_HAVE_IPV6 = has(0);
- APR_HAS_SHARED_MEMORY = has(1);
- APR_HAS_THREADS = has(2);
- APR_HAS_SENDFILE = has(3);
- APR_HAS_MMAP = has(4);
- APR_HAS_FORK = has(5);
- APR_HAS_RANDOM = has(6);
- APR_HAS_OTHER_CHILD = has(7);
- APR_HAS_DSO = has(8);
- APR_HAS_SO_ACCEPTFILTER = has(9);
- APR_HAS_UNICODE_FS = has(10);
- APR_HAS_PROC_INVOKED = has(11);
- APR_HAS_USER = has(12);
- APR_HAS_LARGE_FILES = has(13);
- APR_HAS_XTHREAD_FILES = has(14);
- APR_HAS_OS_UUID = has(15);
- APR_IS_BIGENDIAN = has(16);
- APR_FILES_AS_SOCKETS = has(17);
- APR_CHARSET_EBCDIC = has(18);
- APR_TCP_NODELAY_INHERITED = has(19);
- APR_O_NONBLOCK_INHERITED = has(20);
- APR_POLLSET_WAKEABLE = has(21);
- APR_HAVE_UNIX = has(22);
if (APR_MAJOR_VERSION < 1) {
throw new UnsatisfiedLinkError("Unsupported APR Version (" +
aprVersionString() + ")");
}
- if (!APR_HAS_THREADS) {
- throw new UnsatisfiedLinkError("Missing threading support from APR");
- }
}
return initialize();
}
-
- /**
- * Calls System.load(filename). System.load() associates the
- * loaded library with the class loader of the class that called
- * the System method. A native library may not be loaded by more
- * than one class loader, so calling the System method from a class that
- * was loaded by a Webapp class loader will make it impossible for
- * other Webapps to load it.
- *
- * Using this method will load the native library via a shared class
- * loader (typically the Common class loader, but may vary in some
- * configurations), so that it can be loaded by multiple Webapps.
- *
- * @param filename - absolute path of the native library
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1.x
- */
- @Deprecated
- public static void load(String filename){
- System.load(filename);
- }
-
- /**
- * Calls System.loadLibrary(libname). System.loadLibrary() associates the
- * loaded library with the class loader of the class that called
- * the System method. A native library may not be loaded by more
- * than one class loader, so calling the System method from a class that
- * was loaded by a Webapp class loader will make it impossible for
- * other Webapps to load it.
- *
- * Using this method will load the native library via a shared class
- * loader (typically the Common class loader, but may vary in some
- * configurations), so that it can be loaded by multiple Webapps.
- *
- * @param libname - the name of the native library
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1.x
- */
- @Deprecated
- public static void loadLibrary(String libname){
- System.loadLibrary(libname);
- }
-
}
diff --git a/java/org/apache/tomcat/jni/LibraryNotFoundError.java b/java/org/apache/tomcat/jni/LibraryNotFoundError.java
index ab8a030..ede1ee1 100644
--- a/java/org/apache/tomcat/jni/LibraryNotFoundError.java
+++ b/java/org/apache/tomcat/jni/LibraryNotFoundError.java
@@ -23,7 +23,6 @@ public class LibraryNotFoundError extends UnsatisfiedLinkError {
private final String libraryNames;
/**
- *
* @param libraryNames A list of the file names of the native libraries that
* failed to load
* @param errors A list of the error messages received when trying to load
diff --git a/java/org/apache/tomcat/jni/Local.java b/java/org/apache/tomcat/jni/Local.java
deleted file mode 100644
index fd0f3bb..0000000
--- a/java/org/apache/tomcat/jni/Local.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/**
- * Local socket.
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Local {
-
- /**
- * Create a socket.
- * @param path The address of the new socket.
- * @param cont The parent pool to use
- * @return The new socket that has been set up.
- * @throws Exception If socket creation failed
- */
- public static native long create(String path, long cont)
- throws Exception;
-
- /**
- * Bind the socket to its associated port
- * @param sock The socket to bind
- * @param sa The socket address to bind to
- * This may be where we will find out if there is any other process
- * using the selected port.
- * @return the operation status
- */
- public static native int bind(long sock, long sa);
-
- /**
- * Listen to a bound socket for connections.
- * @param sock The socket to listen on
- * @param backlog The number of outstanding connections allowed in the sockets
- * listen queue. If this value is less than zero, for NT pipes
- * the number of instances is unlimited.
- * @return the operation status
- */
- public static native int listen(long sock, int backlog);
-
- /**
- * Accept a new connection request
- * @param sock The socket we are listening on.
- * @return A copy of the socket that is connected to the socket that
- * made the connection request. This is the socket which should
- * be used for all future communication.
- * @throws Exception If accept failed
- */
- public static native long accept(long sock)
- throws Exception;
-
- /**
- * Issue a connection request to a socket either on the same machine
- * or a different one.
- * @param sock The socket we wish to use for our side of the connection
- * @param sa The address of the machine we wish to connect to.
- * Unused for NT Pipes.
- * @return the operation status
- */
- public static native int connect(long sock, long sa);
-
-}
diff --git a/java/org/apache/tomcat/jni/Lock.java b/java/org/apache/tomcat/jni/Lock.java
deleted file mode 100644
index 9803197..0000000
--- a/java/org/apache/tomcat/jni/Lock.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Lock
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Lock {
-
- /**
- * Enumerated potential types for APR process locking methods
- * <br><b>Warning :</b> Check APR_HAS_foo_SERIALIZE defines to see if the platform supports
- * APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
- */
-
- public static final int APR_LOCK_FCNTL = 0; /** fcntl() */
- public static final int APR_LOCK_FLOCK = 1; /** flock() */
- public static final int APR_LOCK_SYSVSEM = 2; /** System V Semaphores */
- public static final int APR_LOCK_PROC_PTHREAD = 3; /** POSIX pthread process-based locking */
- public static final int APR_LOCK_POSIXSEM = 4; /** POSIX semaphore process-based locking */
- public static final int APR_LOCK_DEFAULT = 5; /** Use the default process lock */
-
- /**
- * Create and initialize a mutex that can be used to synchronize processes.
- * <br><b>Warning :</b> Check APR_HAS_foo_SERIALIZE defines to see if the platform supports
- * APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
- * @param fname A file name to use if the lock mechanism requires one. This
- * argument should always be provided. The lock code itself will
- * determine if it should be used.
- * @param mech The mechanism to use for the interprocess lock, if any; one of
- * <PRE>
- * APR_LOCK_FCNTL
- * APR_LOCK_FLOCK
- * APR_LOCK_SYSVSEM
- * APR_LOCK_POSIXSEM
- * APR_LOCK_PROC_PTHREAD
- * APR_LOCK_DEFAULT pick the default mechanism for the platform
- * </PRE>
- * @param pool the pool from which to allocate the mutex.
- * @return Newly created mutex.
- * @throws Error An error occurred
- */
- public static native long create(String fname, int mech, long pool)
- throws Error;
-
- /**
- * Re-open a mutex in a child process.
- * This function must be called to maintain portability, even
- * if the underlying lock mechanism does not require it.
- * @param fname A file name to use if the mutex mechanism requires one. This
- * argument should always be provided. The mutex code itself will
- * determine if it should be used. This filename should be the
- * same one that was passed to apr_proc_mutex_create().
- * @param pool The pool to operate on.
- * @return Newly opened mutex.
- * @throws Error An error occurred
- */
- public static native long childInit(String fname, long pool)
- throws Error;
-
- /**
- * Acquire the lock for the given mutex. If the mutex is already locked,
- * the current thread will be put to sleep until the lock becomes available.
- * @param mutex the mutex on which to acquire the lock.
- * @return the operation status
- */
- public static native int lock(long mutex);
-
- /**
- * Attempt to acquire the lock for the given mutex. If the mutex has already
- * been acquired, the call returns immediately with APR_EBUSY. Note: it
- * is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine
- * if the return value was APR_EBUSY, for portability reasons.
- * @param mutex the mutex on which to attempt the lock acquiring.
- * @return the operation status
- */
- public static native int trylock(long mutex);
-
- /**
- * Release the lock for the given mutex.
- * @param mutex the mutex from which to release the lock.
- * @return the operation status
- */
- public static native int unlock(long mutex);
-
- /**
- * Destroy the mutex and free the memory associated with the lock.
- * @param mutex the mutex to destroy.
- * @return the operation status
- */
- public static native int destroy(long mutex);
-
- /**
- * Return the name of the lockfile for the mutex, or NULL
- * if the mutex doesn't use a lock file
- * @param mutex the name of the mutex
- * @return the name of the lock file
- */
- public static native String lockfile(long mutex);
-
- /**
- * Display the name of the mutex, as it relates to the actual method used.
- * This matches the valid options for Apache's AcceptMutex directive
- * @param mutex the name of the mutex
- * @return the name of the mutex
- */
- public static native String name(long mutex);
-
- /**
- * Display the name of the default mutex: APR_LOCK_DEFAULT
- * @return the default name
- */
- public static native String defname();
-
-}
diff --git a/java/org/apache/tomcat/jni/Mmap.java b/java/org/apache/tomcat/jni/Mmap.java
deleted file mode 100644
index 16a88a1..0000000
--- a/java/org/apache/tomcat/jni/Mmap.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Mmap
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Mmap {
- /** MMap opened for reading */
- public static final int APR_MMAP_READ = 1;
- /** MMap opened for writing */
- public static final int APR_MMAP_WRITE = 2;
-
-
- /**
- * Create a new mmap'ed file out of an existing APR file.
- * @param file The file turn into an mmap.
- * @param offset The offset into the file to start the data pointer at.
- * @param size The size of the file
- * @param flag bit-wise or of:
- * <PRE>
- * APR_MMAP_READ MMap opened for reading
- * APR_MMAP_WRITE MMap opened for writing
- * </PRE>
- * @param pool The pool to use when creating the mmap.
- * @return The newly created mmap'ed file.
- * @throws Error Error creating memory mapping
- */
- public static native long create(long file, long offset, long size, int flag, long pool)
- throws Error;
-
- /**
- * Duplicate the specified MMAP.
- * @param mmap The mmap to duplicate.
- * @param pool The pool to use for new_mmap.
- * @return Duplicated mmap'ed file.
- * @throws Error Error duplicating memory mapping
- */
- public static native long dup(long mmap, long pool)
- throws Error;
-
- /**
- * Remove a mmap'ed.
- * @param mm The mmap'ed file.
- * @return the operation status
- */
- public static native int delete(long mm);
-
- /**
- * Move the pointer into the mmap'ed file to the specified offset.
- * @param mm The mmap'ed file.
- * @param offset The offset to move to.
- * @return The pointer to the offset specified.
- * @throws Error Error reading file
- */
- public static native long offset(long mm, long offset)
- throws Error;
-
-}
diff --git a/java/org/apache/tomcat/jni/Multicast.java b/java/org/apache/tomcat/jni/Multicast.java
deleted file mode 100644
index fd090fd..0000000
--- a/java/org/apache/tomcat/jni/Multicast.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Multicast
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Multicast {
-
- /**
- * Join a Multicast Group
- * @param sock The socket to join a multicast group
- * @param join The address of the multicast group to join
- * @param iface Address of the interface to use. If NULL is passed, the
- * default multicast interface will be used. (OS Dependent)
- * @param source Source Address to accept transmissions from (non-NULL
- * implies Source-Specific Multicast)
- * @return the operation status
- */
- public static native int join(long sock, long join,
- long iface, long source);
-
- /**
- * Leave a Multicast Group. All arguments must be the same as
- * apr_mcast_join.
- * @param sock The socket to leave a multicast group
- * @param addr The address of the multicast group to leave
- * @param iface Address of the interface to use. If NULL is passed, the
- * default multicast interface will be used. (OS Dependent)
- * @param source Source Address to accept transmissions from (non-NULL
- * implies Source-Specific Multicast)
- * @return the operation status
- */
- public static native int leave(long sock, long addr,
- long iface, long source);
-
- /**
- * Set the Multicast Time to Live (ttl) for a multicast transmission.
- * @param sock The socket to set the multicast ttl
- * @param ttl Time to live to Assign. 0-255, default=1
- * <br><b>Remark :</b> If the TTL is 0, packets will only be seen
- * by sockets on the local machine,
- * and only when multicast loopback is enabled.
- * @return the operation status
- */
- public static native int hops(long sock, int ttl);
-
- /**
- * Toggle IP Multicast Loopback
- * @param sock The socket to set multicast loopback
- * @param opt false=disable, true=enable
- * @return the operation status
- */
- public static native int loopback(long sock, boolean opt);
-
-
- /**
- * Set the Interface to be used for outgoing Multicast Transmissions.
- * @param sock The socket to set the multicast interface on
- * @param iface Address of the interface to use for Multicast
- * @return the operation status
- */
- public static native int ointerface(long sock, long iface);
-
-}
diff --git a/java/org/apache/tomcat/jni/OS.java b/java/org/apache/tomcat/jni/OS.java
deleted file mode 100644
index 48f7192..0000000
--- a/java/org/apache/tomcat/jni/OS.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** OS
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class OS {
-
- /* OS Enums */
- private static final int UNIX = 1;
- private static final int WIN32 = 3;
- private static final int WIN64 = 4;
- private static final int LINUX = 5;
- private static final int SOLARIS = 6;
- private static final int BSD = 7;
- private static final int MACOSX = 8;
-
- public static final int LOG_EMERG = 1;
- public static final int LOG_ERROR = 2;
- public static final int LOG_NOTICE = 3;
- public static final int LOG_WARN = 4;
- public static final int LOG_INFO = 5;
- public static final int LOG_DEBUG = 6;
-
- /**
- * Check for OS type.
- * @param type OS type to test.
- */
- private static native boolean is(int type);
-
- public static final boolean IS_UNIX = is(UNIX);
- /**
- * @deprecated Hard-coded to false since there has not been a supported
- * Netware platform for many years.
- * This will be removed in Tomcat 10 onwards
- */
- @Deprecated
- public static final boolean IS_NETWARE = false;
- public static final boolean IS_WIN32 = is(WIN32);
- public static final boolean IS_WIN64 = is(WIN64);
- public static final boolean IS_LINUX = is(LINUX);
- public static final boolean IS_SOLARIS = is(SOLARIS);
- public static final boolean IS_BSD = is(BSD);
- public static final boolean IS_MACOSX = is(MACOSX);
-
- /**
- * Get the name of the system default character set.
- * @param pool the pool to allocate the name from, if needed
- * @return the encoding
- */
- public static native String defaultEncoding(long pool);
-
- /**
- * Get the name of the current locale character set.
- * Defers to apr_os_default_encoding if the current locale's
- * data can't be retrieved on this system.
- * @param pool the pool to allocate the name from, if needed
- * @return the encoding
- */
- public static native String localeEncoding(long pool);
-
- /**
- * Generate random bytes.
- * @param buf Buffer to fill with random bytes
- * @param len Length of buffer in bytes
- * @return the operation status
- */
- public static native int random(byte [] buf, int len);
-
- /**
- * Gather system info.
- * <PRE>
- * On exit the inf array will be filled with:
- * inf[0] - Total usable main memory size
- * inf[1] - Available memory size
- * inf[2] - Total page file/swap space size
- * inf[3] - Page file/swap space still available
- * inf[4] - Amount of shared memory
- * inf[5] - Memory used by buffers
- * inf[6] - Memory Load
- *
- * inf[7] - Idle Time in microseconds
- * inf[8] - Kernel Time in microseconds
- * inf[9] - User Time in microseconds
- *
- * inf[10] - Process creation time (apr_time_t)
- * inf[11] - Process Kernel Time in microseconds
- * inf[12] - Process User Time in microseconds
- *
- * inf[13] - Current working set size.
- * inf[14] - Peak working set size.
- * inf[15] - Number of page faults.
- * </PRE>
- * @param inf array that will be filled with system information.
- * Array length must be at least 16.
- * @return the operation status
- */
- public static native int info(long [] inf);
-
- /**
- * Expand environment variables.
- * @param str String to expand
- * @return Expanded string with replaced environment variables.
- */
- public static native String expand(String str);
-
- /**
- * Initialize system logging.
- * @param domain String that will be prepended to every message
- */
- public static native void sysloginit(String domain);
-
- /**
- * Log message.
- * @param level Log message severity. See LOG_XXX enums.
- * @param message Message to log
- */
- public static native void syslog(int level, String message);
-
-}
diff --git a/java/org/apache/tomcat/jni/PasswordCallback.java b/java/org/apache/tomcat/jni/PasswordCallback.java
deleted file mode 100644
index 5c579dd..0000000
--- a/java/org/apache/tomcat/jni/PasswordCallback.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** PasswordCallback Interface
- *
- * @author Mladen Turk
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
-@Deprecated
-public interface PasswordCallback {
-
- /**
- * Called when the password is required
- * @param prompt Password prompt
- * @return Valid password or null
- */
- public String callback(String prompt);
-}
diff --git a/java/org/apache/tomcat/jni/Poll.java b/java/org/apache/tomcat/jni/Poll.java
deleted file mode 100644
index 54f4221..0000000
--- a/java/org/apache/tomcat/jni/Poll.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Poll
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Poll {
-
- /**
- * Poll return values
- */
- /** Can read without blocking */
- public static final int APR_POLLIN = 0x001;
- /** Priority data available */
- public static final int APR_POLLPRI = 0x002;
- /** Can write without blocking */
- public static final int APR_POLLOUT = 0x004;
- /** Pending error */
- public static final int APR_POLLERR = 0x010;
- /** Hangup occurred */
- public static final int APR_POLLHUP = 0x020;
- /** Descriptor invalid */
- public static final int APR_POLLNVAL = 0x040;
-
- /**
- * Pollset Flags
- */
- /** Adding or Removing a Descriptor is thread safe */
- public static final int APR_POLLSET_THREADSAFE = 0x001;
-
-
- /** Used in apr_pollfd_t to determine what the apr_descriptor is
- * apr_datatype_e enum
- */
- public static final int APR_NO_DESC = 0; /** nothing here */
- public static final int APR_POLL_SOCKET = 1; /** descriptor refers to a socket */
- public static final int APR_POLL_FILE = 2; /** descriptor refers to a file */
- public static final int APR_POLL_LASTDESC = 3; /** descriptor is the last one in the list */
-
- /**
- * Setup a pollset object.
- * If flags equals APR_POLLSET_THREADSAFE, then a pollset is
- * created on which it is safe to make concurrent calls to
- * apr_pollset_add(), apr_pollset_remove() and apr_pollset_poll() from
- * separate threads. This feature is only supported on some
- * platforms; the apr_pollset_create() call will fail with
- * APR_ENOTIMPL on platforms where it is not supported.
- * @param size The maximum number of descriptors that this pollset can hold
- * @param p The pool from which to allocate the pollset
- * @param flags Optional flags to modify the operation of the pollset.
- * @param ttl Maximum time to live for a particular socket.
- * @return The pointer in which to return the newly created object
- * @throws Error Pollset creation failed
- */
- public static native long create(int size, long p, int flags, long ttl)
- throws Error;
- /**
- * Destroy a pollset object
- * @param pollset The pollset to destroy
- * @return the operation status
- */
- public static native int destroy(long pollset);
-
- /**
- * Add a socket to a pollset with the default timeout.
- * @param pollset The pollset to which to add the socket
- * @param sock The sockets to add
- * @param reqevents requested events
- * @return the operation status
- */
- public static native int add(long pollset, long sock,
- int reqevents);
-
- /**
- * Add a socket to a pollset with a specific timeout.
- * @param pollset The pollset to which to add the socket
- * @param sock The sockets to add
- * @param reqevents requested events
- * @param timeout requested timeout in microseconds (-1 for infinite)
- * @return the operation status
- */
- public static native int addWithTimeout(long pollset, long sock,
- int reqevents, long timeout);
-
- /**
- * Remove a descriptor from a pollset
- * @param pollset The pollset from which to remove the descriptor
- * @param sock The socket to remove
- * @return the operation status
- */
- public static native int remove(long pollset, long sock);
-
- /**
- * Block for activity on the descriptor(s) in a pollset
- * @param pollset The pollset to use
- * @param timeout Timeout in microseconds
- * @param descriptors Array of signaled descriptors (output parameter)
- * The descriptor array must be two times the size of pollset.
- * and are populated as follows:
- * <PRE>
- * descriptors[2n + 0] -> returned events
- * descriptors[2n + 1] -> socket
- * </PRE>
- * @param remove Remove signaled descriptors from pollset
- * @return Number of signaled descriptors (output parameter)
- * or negative APR error code.
- */
- public static native int poll(long pollset, long timeout,
- long [] descriptors, boolean remove);
-
- /**
- * Maintain on the descriptor(s) in a pollset
- * @param pollset The pollset to use
- * @param descriptors Array of signaled descriptors (output parameter)
- * The descriptor array must be the size of pollset.
- * and are populated as follows:
- * <PRE>
- * descriptors[n] -> socket
- * </PRE>
- * @param remove Remove signaled descriptors from pollset
- * @return Number of signaled descriptors (output parameter)
- * or negative APR error code.
- */
- public static native int maintain(long pollset, long [] descriptors,
- boolean remove);
-
- /**
- * Set the socket time to live.
- * @param pollset The pollset to use
- * @param ttl Timeout in microseconds
- */
- public static native void setTtl(long pollset, long ttl);
-
- /**
- * Get the socket time to live.
- * @param pollset The pollset to use
- * @return Timeout in microseconds
- */
- public static native long getTtl(long pollset);
-
- /**
- * Return all descriptor(s) in a pollset
- * @param pollset The pollset to use
- * @param descriptors Array of descriptors (output parameter)
- * The descriptor array must be two times the size of pollset.
- * and are populated as follows:
- * <PRE>
- * descriptors[2n + 0] -> returned events
- * descriptors[2n + 1] -> socket
- * </PRE>
- * @return Number of descriptors (output parameter) in the Poll
- * or negative APR error code.
- */
- public static native int pollset(long pollset, long [] descriptors);
-
- /**
- * Make poll() return.
- *
- * @param pollset The pollset to use
- * @return Negative APR error code
- */
- public static native int interrupt(long pollset);
-
- /**
- * Check if interrupt() is allowed.
- *
- * @param pollset The pollset to use
- * @return <code>true</code> if {@link #interrupt(long)} is allowed, else
- * <code>false</code>
- */
- public static native boolean wakeable(long pollset);
-}
diff --git a/java/org/apache/tomcat/jni/Pool.java b/java/org/apache/tomcat/jni/Pool.java
index 3668a50..062c713 100644
--- a/java/org/apache/tomcat/jni/Pool.java
+++ b/java/org/apache/tomcat/jni/Pool.java
@@ -16,8 +16,6 @@
*/
package org.apache.tomcat.jni;
-import java.nio.ByteBuffer;
-
/**
* Provides access to APR memory pools which are used to manage memory
* allocations for natively created instances.
@@ -36,18 +34,6 @@ public class Pool {
*/
public static native long create(long parent);
- /**
- * Clear all memory in the pool and run all the cleanups. This also destroys all
- * subpools.
- * @param pool The pool to clear
- * This does not actually free the memory, it just allows the pool
- * to re-use this memory for the next allocation.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void clear(long pool);
-
/**
* Destroy the pool. This takes similar action as apr_pool_clear() and then
* frees all the memory. This will actually free the memory.
@@ -55,143 +41,4 @@ public class Pool {
* @param pool The pool to destroy
*/
public static native void destroy(long pool);
-
- /**
- * Get the parent pool of the specified pool.
- * @param pool The pool for retrieving the parent pool.
- * @return The parent of the given pool.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native long parentGet(long pool);
-
- /**
- * Determine if pool a is an ancestor of pool b
- * @param a The pool to search
- * @param b The pool to search for
- * @return True if a is an ancestor of b, NULL is considered an ancestor
- * of all pools.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native boolean isAncestor(long a, long b);
-
-
- /*
- * Cleanup
- *
- * Cleanups are performed in the reverse order they were registered. That is:
- * Last In, First Out. A cleanup function can safely allocate memory from
- * the pool that is being cleaned up. It can also safely register additional
- * cleanups which will be run LIFO, directly after the current cleanup
- * terminates. Cleanups have to take caution in calling functions that
- * create subpools. Subpools, created during cleanup will NOT automatically
- * be cleaned up. In other words, cleanups are to clean up after themselves.
- */
-
- /**
- * Register a function to be called when a pool is cleared or destroyed
- * @param pool The pool register the cleanup with
- * @param o The object to call when the pool is cleared
- * or destroyed
- * @return The cleanup handler.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native long cleanupRegister(long pool, Object o);
-
- /**
- * Remove a previously registered cleanup function
- * @param pool The pool remove the cleanup from
- * @param data The cleanup handler to remove from cleanup
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void cleanupKill(long pool, long data);
-
- /**
- * Register a process to be killed when a pool dies.
- * @param a The pool to use to define the processes lifetime
- * @param proc The process to register
- * @param how How to kill the process, one of:
- * <PRE>
- * APR_KILL_NEVER -- process is never sent any signals
- * APR_KILL_ALWAYS -- process is sent SIGKILL on apr_pool_t cleanup
- * APR_KILL_AFTER_TIMEOUT -- SIGTERM, wait 3 seconds, SIGKILL
- * APR_JUST_WAIT -- wait forever for the process to complete
- * APR_KILL_ONLY_ONCE -- send SIGTERM and then wait
- * </PRE>
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void noteSubprocess(long a, long proc, int how);
-
- /**
- * Allocate a block of memory from a pool
- * @param p The pool to allocate from
- * @param size The amount of memory to allocate
- * @return The ByteBuffer with allocated memory
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native ByteBuffer alloc(long p, int size);
-
- /**
- * Allocate a block of memory from a pool and set all of the memory to 0
- * @param p The pool to allocate from
- * @param size The amount of memory to allocate
- * @return The ByteBuffer with allocated memory
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native ByteBuffer calloc(long p, int size);
-
- /*
- * User data management
- */
-
- /**
- * Set the data associated with the current pool
- * @param data The user data associated with the pool.
- * @param key The key to use for association
- * @param pool The current pool
- * <br><b>Warning :</b>
- * The data to be attached to the pool should have a life span
- * at least as long as the pool it is being attached to.
- * Object attached to the pool will be globally referenced
- * until the pool is cleared or dataSet is called with the null data.
- * @return APR Status code.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native int dataSet(long pool, String key, Object data);
-
- /**
- * Return the data associated with the current pool.
- * @param key The key for the data to retrieve
- * @param pool The current pool.
- * @return the data
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native Object dataGet(long pool, String key);
-
- /**
- * Run all of the child_cleanups, so that any unnecessary files are
- * closed because we are about to exec a new program
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void cleanupForExec();
-
}
diff --git a/java/org/apache/tomcat/jni/PoolCallback.java b/java/org/apache/tomcat/jni/PoolCallback.java
deleted file mode 100644
index c709979..0000000
--- a/java/org/apache/tomcat/jni/PoolCallback.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** PoolCallback Interface
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public interface PoolCallback {
-
- /**
- * Called when the pool is destroyed or cleared
- * @return Function must return APR_SUCCESS
- */
- public int callback();
-}
diff --git a/java/org/apache/tomcat/jni/Proc.java b/java/org/apache/tomcat/jni/Proc.java
deleted file mode 100644
index 4ea678b..0000000
--- a/java/org/apache/tomcat/jni/Proc.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Proc
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Proc {
-
- /*
- * apr_cmdtype_e enum
- */
- public static final int APR_SHELLCM = 0; /** use the shell to invoke the program */
- public static final int APR_PROGRAM = 1; /** invoke the program directly, no copied env */
- public static final int APR_PROGRAM_ENV = 2; /** invoke the program, replicating our environment */
- public static final int APR_PROGRAM_PATH = 3; /** find program on PATH, use our environment */
- public static final int APR_SHELLCMD_ENV = 4; /** use the shell to invoke the program,
- * replicating our environment
- */
-
- /*
- * apr_wait_how_e enum
- */
- public static final int APR_WAIT = 0; /** wait for the specified process to finish */
- public static final int APR_NOWAIT = 1; /** do not wait -- just see if it has finished */
-
- /*
- * apr_exit_why_e enum
- */
- public static final int APR_PROC_EXIT = 1; /** process exited normally */
- public static final int APR_PROC_SIGNAL = 2; /** process exited due to a signal */
- public static final int APR_PROC_SIGNAL_CORE = 4; /** process exited and dumped a core file */
-
- public static final int APR_NO_PIPE = 0;
- public static final int APR_FULL_BLOCK = 1;
- public static final int APR_FULL_NONBLOCK = 2;
- public static final int APR_PARENT_BLOCK = 3;
- public static final int APR_CHILD_BLOCK = 4;
-
- public static final int APR_LIMIT_CPU = 0;
- public static final int APR_LIMIT_MEM = 1;
- public static final int APR_LIMIT_NPROC = 2;
- public static final int APR_LIMIT_NOFILE = 3;
-
-
- /** child has died, caller must call unregister still */
- public static final int APR_OC_REASON_DEATH = 0;
- /** write_fd is unwritable */
- public static final int APR_OC_REASON_UNWRITABLE = 1;
- /** a restart is occurring, perform any necessary cleanup (including
- * sending a special signal to child)
- */
- public static final int APR_OC_REASON_RESTART = 2;
- /** unregister has been called, do whatever is necessary (including
- * kill the child)
- */
- public static final int APR_OC_REASON_UNREGISTER = 3;
- /** somehow the child exited without us knowing ... buggy os? */
- public static final int APR_OC_REASON_LOST = 4;
- /** a health check is occurring, for most maintenance functions
- * this is a no-op.
- */
- public static final int APR_OC_REASON_RUNNING = 5;
-
- /* apr_kill_conditions_e enumeration */
- /** process is never sent any signals */
- public static final int APR_KILL_NEVER = 0;
- /** process is sent SIGKILL on apr_pool_t cleanup */
- public static final int APR_KILL_ALWAYS = 1;
- /** SIGTERM, wait 3 seconds, SIGKILL */
- public static final int APR_KILL_AFTER_TIMEOUT = 2;
- /** wait forever for the process to complete */
- public static final int APR_JUST_WAIT = 3;
- /** send SIGTERM and then wait */
- public static final int APR_KILL_ONLY_ONCE = 4;
-
- public static final int APR_PROC_DETACH_FOREGROUND = 0; /** Do not detach */
- public static final int APR_PROC_DETACH_DAEMONIZE = 1; /** Detach */
-
- /* Maximum number of arguments for create process call */
- public static final int MAX_ARGS_SIZE = 1024;
- /* Maximum number of environment variables for create process call */
- public static final int MAX_ENV_SIZE = 1024;
-
- /**
- * Allocate apr_proc_t structure from pool
- * This is not an apr function.
- * @param cont The pool to use.
- * @return the pointer
- */
- public static native long alloc(long cont);
-
- /**
- * This is currently the only non-portable call in APR. This executes
- * a standard unix fork.
- * @param proc The resulting process handle.
- * @param cont The pool to use.
- * @return APR_INCHILD for the child, and APR_INPARENT for the parent
- * or an error.
- */
- public static native int fork(long [] proc, long cont);
-
- /**
- * Create a new process and execute a new program within that process.
- * This function returns without waiting for the new process to terminate;
- * use apr_proc_wait for that.
- * @param proc The process handle
- * @param progname The program to run
- * @param args The arguments to pass to the new program. The first
- * one should be the program name.
- * @param env The new environment table for the new process. This
- * should be a list of NULL-terminated strings. This argument
- * is ignored for APR_PROGRAM_ENV, APR_PROGRAM_PATH, and
- * APR_SHELLCMD_ENV types of commands.
- * @param attr The procattr we should use to determine how to create the new
- * process
- * @param pool The pool to use.
- * @return The resulting process handle.
- */
- public static native int create(long proc, String progname,
- String [] args, String [] env,
- long attr, long pool);
-
- /**
- * Wait for a child process to die
- * @param proc The process handle that corresponds to the desired child process
- * @param exit exit[0] The returned exit status of the child, if a child process
- * dies, or the signal that caused the child to die.
- * On platforms that don't support obtaining this information,
- * the status parameter will be returned as APR_ENOTIMPL.
- * exit[1] Why the child died, the bitwise or of:
- * <PRE>
- * APR_PROC_EXIT -- process terminated normally
- * APR_PROC_SIGNAL -- process was killed by a signal
- * APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
- * generated a core dump.
- * </PRE>
- * @param waithow How should we wait. One of:
- * <PRE>
- * APR_WAIT -- block until the child process dies.
- * APR_NOWAIT -- return immediately regardless of if the
- * child is dead or not.
- * </PRE>
- * @return The childs status is in the return code to this process. It is one of:
- * <PRE>
- * APR_CHILD_DONE -- child is no longer running.
- * APR_CHILD_NOTDONE -- child is still running.
- * </PRE>
- */
- public static native int wait(long proc, int [] exit, int waithow);
-
- /**
- * Wait for any current child process to die and return information
- * about that child.
- * @param proc Pointer to NULL on entry, will be filled out with child's
- * information
- * @param exit exit[0] The returned exit status of the child, if a child process
- * dies, or the signal that caused the child to die.
- * On platforms that don't support obtaining this information,
- * the status parameter will be returned as APR_ENOTIMPL.
- * exit[1] Why the child died, the bitwise or of:
- * <PRE>
- * APR_PROC_EXIT -- process terminated normally
- * APR_PROC_SIGNAL -- process was killed by a signal
- * APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
- * generated a core dump.
- * </PRE>
- * @param waithow How should we wait. One of:
- * <PRE>
- * APR_WAIT -- block until the child process dies.
- * APR_NOWAIT -- return immediately regardless of if the
- * child is dead or not.
- * </PRE>
- * @param pool Pool to allocate child information out of.
- * @return the operation status
- */
- public static native int waitAllProcs(long proc, int [] exit,
- int waithow, long pool);
-
- /**
- * Detach the process from the controlling terminal.
- * @param daemonize set to non-zero if the process should daemonize
- * and become a background process, else it will
- * stay in the foreground.
- * @return the operation status
- */
- public static native int detach(int daemonize);
-
- /**
- * Terminate a process.
- * @param proc The process to terminate.
- * @param sig How to kill the process.
- * @return the operation status
- */
- public static native int kill(long proc, int sig);
-
-}
diff --git a/java/org/apache/tomcat/jni/ProcErrorCallback.java b/java/org/apache/tomcat/jni/ProcErrorCallback.java
deleted file mode 100644
index a9421bc..0000000
--- a/java/org/apache/tomcat/jni/ProcErrorCallback.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** ProcErrorCallback Interface
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public interface ProcErrorCallback {
-
- /**
- * Called in the child process if APR encounters an error
- * in the child prior to running the specified program.
- * @param pool Pool associated with the apr_proc_t. If your child
- * error function needs user data, associate it with this
- * pool.
- * @param err APR error code describing the error
- * @param description Text description of type of processing which failed
- */
- public void callback(long pool, int err, String description);
-}
diff --git a/java/org/apache/tomcat/jni/Procattr.java b/java/org/apache/tomcat/jni/Procattr.java
deleted file mode 100644
index 40800d1..0000000
--- a/java/org/apache/tomcat/jni/Procattr.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Procattr
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Procattr {
-
- /**
- * Create and initialize a new procattr variable
- * @param cont The pool to use
- * @return The newly created procattr.
- * @throws Error An error occurred
- */
- public static native long create(long cont)
- throws Error;
-
- /**
- * Determine if any of stdin, stdout, or stderr should be linked to pipes
- * when starting a child process.
- * @param attr The procattr we care about.
- * @param in Should stdin be a pipe back to the parent?
- * @param out Should stdout be a pipe back to the parent?
- * @param err Should stderr be a pipe back to the parent?
- * @return the operation status
- */
- public static native int ioSet(long attr, int in, int out, int err);
-
- /**
- * Set the child_in and/or parent_in values to existing apr_file_t values.
- * <br>
- * This is NOT a required initializer function. This is
- * useful if you have already opened a pipe (or multiple files)
- * that you wish to use, perhaps persistently across multiple
- * process invocations - such as a log file. You can save some
- * extra function calls by not creating your own pipe since this
- * creates one in the process space for you.
- * @param attr The procattr we care about.
- * @param in apr_file_t value to use as child_in. Must be a valid file.
- * @param parent apr_file_t value to use as parent_in. Must be a valid file.
- * @return the operation status
- */
- public static native int childInSet(long attr, long in, long parent);
-
- /**
- * Set the child_out and parent_out values to existing apr_file_t values.
- * <br>
- * This is NOT a required initializer function. This is
- * useful if you have already opened a pipe (or multiple files)
- * that you wish to use, perhaps persistently across multiple
- * process invocations - such as a log file.
- * @param attr The procattr we care about.
- * @param out apr_file_t value to use as child_out. Must be a valid file.
- * @param parent apr_file_t value to use as parent_out. Must be a valid file.
- * @return the operation status
- */
- public static native int childOutSet(long attr, long out, long parent);
-
- /**
- * Set the child_err and parent_err values to existing apr_file_t values.
- * <br>
- * This is NOT a required initializer function. This is
- * useful if you have already opened a pipe (or multiple files)
- * that you wish to use, perhaps persistently across multiple
- * process invocations - such as a log file.
- * @param attr The procattr we care about.
- * @param err apr_file_t value to use as child_err. Must be a valid file.
- * @param parent apr_file_t value to use as parent_err. Must be a valid file.
- * @return the operation status
- */
- public static native int childErrSet(long attr, long err, long parent);
-
- /**
- * Set which directory the child process should start executing in.
- * @param attr The procattr we care about.
- * @param dir Which dir to start in. By default, this is the same dir as
- * the parent currently resides in, when the createprocess call
- * is made.
- * @return the operation status
- */
- public static native int dirSet(long attr, String dir);
-
- /**
- * Set what type of command the child process will call.
- * @param attr The procattr we care about.
- * @param cmd The type of command. One of:
- * <PRE>
- * APR_SHELLCMD -- Anything that the shell can handle
- * APR_PROGRAM -- Executable program (default)
- * APR_PROGRAM_ENV -- Executable program, copy environment
- * APR_PROGRAM_PATH -- Executable program on PATH, copy env
- * </PRE>
- * @return the operation status
- */
- public static native int cmdtypeSet(long attr, int cmd);
-
- /**
- * Determine if the child should start in detached state.
- * @param attr The procattr we care about.
- * @param detach Should the child start in detached state? Default is no.
- * @return the operation status
- */
- public static native int detachSet(long attr, int detach);
-
- /**
- * Specify that apr_proc_create() should do whatever it can to report
- * failures to the caller of apr_proc_create(), rather than find out in
- * the child.
- * @param attr The procattr describing the child process to be created.
- * @param chk Flag to indicate whether or not extra work should be done
- * to try to report failures to the caller.
- * <br>
- * This flag only affects apr_proc_create() on platforms where
- * fork() is used. This leads to extra overhead in the calling
- * process, but that may help the application handle such
- * errors more gracefully.
- * @return the operation status
- */
- public static native int errorCheckSet(long attr, int chk);
-
- /**
- * Determine if the child should start in its own address space or using the
- * current one from its parent
- * @param attr The procattr we care about.
- * @param addrspace Should the child start in its own address space?
- * Default is yes.
- * @return the operation status
- */
- public static native int addrspaceSet(long attr, int addrspace);
-
- /**
- * Specify an error function to be called in the child process if APR
- * encounters an error in the child prior to running the specified program.
- * @param attr The procattr describing the child process to be created.
- * @param pool The the pool to use.
- * @param o The Object to call in the child process.
- * <br>
- * At the present time, it will only be called from apr_proc_create()
- * on platforms where fork() is used. It will never be called on other
- * platforms, on those platforms apr_proc_create() will return the error
- * in the parent process rather than invoke the callback in the now-forked
- * child process.
- */
- public static native void errfnSet(long attr, long pool, Object o);
-
- /**
- * Set the username used for running process
- * @param attr The procattr we care about.
- * @param username The username used
- * @param password User password if needed. Password is needed on WIN32
- * or any other platform having
- * APR_PROCATTR_USER_SET_REQUIRES_PASSWORD set.
- * @return the operation status
- */
- public static native int userSet(long attr, String username, String password);
-
- /**
- * Set the group used for running process
- * @param attr The procattr we care about.
- * @param groupname The group name used
- * @return the operation status
- */
- public static native int groupSet(long attr, String groupname);
-
-}
diff --git a/java/org/apache/tomcat/jni/Registry.java b/java/org/apache/tomcat/jni/Registry.java
deleted file mode 100644
index 7a535f9..0000000
--- a/java/org/apache/tomcat/jni/Registry.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Windows Registry support
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Registry {
-
- /* Registry Enums */
- public static final int HKEY_CLASSES_ROOT = 1;
- public static final int HKEY_CURRENT_CONFIG = 2;
- public static final int HKEY_CURRENT_USER = 3;
- public static final int HKEY_LOCAL_MACHINE = 4;
- public static final int HKEY_USERS = 5;
-
- public static final int KEY_ALL_ACCESS = 0x0001;
- public static final int KEY_CREATE_LINK = 0x0002;
- public static final int KEY_CREATE_SUB_KEY = 0x0004;
- public static final int KEY_ENUMERATE_SUB_KEYS = 0x0008;
- public static final int KEY_EXECUTE = 0x0010;
- public static final int KEY_NOTIFY = 0x0020;
- public static final int KEY_QUERY_VALUE = 0x0040;
- public static final int KEY_READ = 0x0080;
- public static final int KEY_SET_VALUE = 0x0100;
- public static final int KEY_WOW64_64KEY = 0x0200;
- public static final int KEY_WOW64_32KEY = 0x0400;
- public static final int KEY_WRITE = 0x0800;
-
- public static final int REG_BINARY = 1;
- public static final int REG_DWORD = 2;
- public static final int REG_EXPAND_SZ = 3;
- public static final int REG_MULTI_SZ = 4;
- public static final int REG_QWORD = 5;
- public static final int REG_SZ = 6;
-
- /**
- * Create or open a Registry Key.
- * @param name Registry Subkey to open
- * @param root Root key, one of HKEY_*
- * @param sam Access mask that specifies the access rights for the key.
- * @param pool Pool used for native memory allocation
- * @return Opened Registry key
- * @throws Error An error occurred
- */
- public static native long create(int root, String name, int sam, long pool)
- throws Error;
-
- /**
- * Opens the specified Registry Key.
- * @param name Registry Subkey to open
- * @param root Root key, one of HKEY_*
- * @param sam Access mask that specifies the access rights for the key.
- * @param pool Pool used for native memory allocation
- * @return Opened Registry key
- * @throws Error An error occurred
- */
- public static native long open(int root, String name, int sam, long pool)
- throws Error;
-
- /**
- * Close the specified Registry key.
- * @param key The Registry key descriptor to close.
- * @return the operation status
- */
- public static native int close(long key);
-
- /**
- * Get the Registry key type.
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to query
- * @return Value type or negative error value
- */
- public static native int getType(long key, String name);
-
- /**
- * Get the Registry value for REG_DWORD
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to query
- * @return Registry key value
- * @throws Error An error occurred
- */
- public static native int getValueI(long key, String name)
- throws Error;
-
- /**
- * Get the Registry value for REG_QWORD or REG_DWORD
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to query
- * @return Registry key value
- * @throws Error An error occurred
- */
- public static native long getValueJ(long key, String name)
- throws Error;
-
- /**
- * Get the Registry key length.
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to query
- * @return Value size or negative error value
- */
- public static native int getSize(long key, String name);
-
- /**
- * Get the Registry value for REG_SZ or REG_EXPAND_SZ
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to query
- * @return Registry key value
- * @throws Error An error occurred
- */
- public static native String getValueS(long key, String name)
- throws Error;
-
- /**
- * Get the Registry value for REG_MULTI_SZ
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to query
- * @return Registry key value
- * @throws Error An error occurred
- */
- public static native String[] getValueA(long key, String name)
- throws Error;
-
- /**
- * Get the Registry value for REG_BINARY
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to query
- * @return Registry key value
- * @throws Error An error occurred
- */
- public static native byte[] getValueB(long key, String name)
- throws Error;
-
-
- /**
- * Set the Registry value for REG_DWORD
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to set
- * @param val The the value to set
- * @return If the function succeeds, the return value is 0
- */
- public static native int setValueI(long key, String name, int val);
-
- /**
- * Set the Registry value for REG_QWORD
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to set
- * @param val The the value to set
- * @return If the function succeeds, the return value is 0
- */
- public static native int setValueJ(long key, String name, long val);
-
- /**
- * Set the Registry value for REG_SZ
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to set
- * @param val The the value to set
- * @return If the function succeeds, the return value is 0
- */
- public static native int setValueS(long key, String name, String val);
-
- /**
- * Set the Registry value for REG_EXPAND_SZ
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to set
- * @param val The the value to set
- * @return If the function succeeds, the return value is 0
- */
- public static native int setValueE(long key, String name, String val);
-
- /**
- * Set the Registry value for REG_MULTI_SZ
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to set
- * @param val The the value to set
- * @return If the function succeeds, the return value is 0
- */
- public static native int setValueA(long key, String name, String[] val);
-
- /**
- * Set the Registry value for REG_BINARY
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to set
- * @param val The the value to set
- * @return If the function succeeds, the return value is 0
- */
- public static native int setValueB(long key, String name, byte[] val);
-
- /**
- * Enumerate the Registry subkeys
- * @param key The Registry key descriptor to use.
- * @return Array of all subkey names
- * @throws Error An error occurred
- */
- public static native String[] enumKeys(long key)
- throws Error;
-
- /**
- * Enumerate the Registry values
- * @param key The Registry key descriptor to use.
- * @return Array of all value names
- * @throws Error An error occurred
- */
- public static native String[] enumValues(long key)
- throws Error;
-
- /**
- * Delete the Registry value
- * @param key The Registry key descriptor to use.
- * @param name The name of the value to delete
- * @return If the function succeeds, the return value is 0
- */
- public static native int deleteValue(long key, String name);
-
- /**
- * Delete the Registry subkey
- * @param root Root key, one of HKEY_*
- * @param name Subkey to delete
- * @param onlyIfEmpty If true will not delete a key if
- * it contains any subkeys or values
- * @return If the function succeeds, the return value is 0
- */
- public static native int deleteKey(int root, String name,
- boolean onlyIfEmpty);
-
-
-}
diff --git a/java/org/apache/tomcat/jni/SSL.java b/java/org/apache/tomcat/jni/SSL.java
index 652921b..a276107 100644
--- a/java/org/apache/tomcat/jni/SSL.java
+++ b/java/org/apache/tomcat/jni/SSL.java
@@ -16,10 +16,6 @@
*/
package org.apache.tomcat.jni;
-/** SSL
- *
- * @author Mladen Turk
- */
public final class SSL {
/*
@@ -154,19 +150,6 @@ public final class SSL {
public static final int SSL_OP_NO_TICKET = 0x00004000;
- // SSL_OP_PKCS1_CHECK_1 and SSL_OP_PKCS1_CHECK_2 flags are unsupported
- // in the current version of OpenSSL library. See ssl.h changes in commit
- // 7409d7ad517650db332ae528915a570e4e0ab88b (30 Apr 2011) of OpenSSL.
- /**
- * @deprecated Unsupported in the current version of OpenSSL
- */
- @Deprecated
- public static final int SSL_OP_PKCS1_CHECK_1 = 0x08000000;
- /**
- * @deprecated Unsupported in the current version of OpenSSL
- */
- @Deprecated
- public static final int SSL_OP_PKCS1_CHECK_2 = 0x10000000;
public static final int SSL_OP_NETSCAPE_CA_DN_BUG = 0x20000000;
public static final int SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG = 0x40000000;
@@ -297,46 +280,6 @@ public final class SSL {
*/
public static native int fipsModeSet(int mode) throws Exception;
- /**
- * Add content of the file to the PRNG
- * @param filename Filename containing random data.
- * If null the default file will be tested.
- * The seed file is $RANDFILE if that environment variable is
- * set, $HOME/.rnd otherwise.
- * In case both files are unavailable builtin
- * random seed generator is used.
- * @return <code>true</code> if the operation was successful
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native boolean randLoad(String filename);
-
- /**
- * Writes a number of random bytes (currently 1024) to
- * file <code>filename</code> which can be used to initialize the PRNG
- * by calling randLoad in a later session.
- * @param filename Filename to save the data
- * @return <code>true</code> if the operation was successful
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native boolean randSave(String filename);
-
- /**
- * Creates random data to filename
- * @param filename Filename to save the data
- * @param len The length of random sequence in bytes
- * @param base64 Output the data in Base64 encoded format
- * @return <code>true</code> if the operation was successful
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native boolean randMake(String filename, int len,
- boolean base64);
-
/**
* Sets global random filename.
*
@@ -346,73 +289,6 @@ public final class SSL {
*/
public static native void randSet(String filename);
- /**
- * Initialize new BIO
- * @param pool The pool to use.
- * @param callback BIOCallback to use
- * @return New BIO handle
- * @throws Exception An error occurred
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native long newBIO(long pool, BIOCallback callback)
- throws Exception;
-
- /**
- * Close BIO and dereference callback object
- * @param bio BIO to close and destroy.
- * @return APR Status code
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native int closeBIO(long bio);
-
- /**
- * Set global Password callback for obtaining passwords.
- * @param callback PasswordCallback implementation to use.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void setPasswordCallback(PasswordCallback callback);
-
- /**
- * Set global Password for decrypting certificates and keys.
- * @param password Password to use.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void setPassword(String password);
-
- /**
- * Return last SSL error string
- * @return the error string
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native String getLastError();
-
- /**
- * Return true if all the requested SSL_OP_* are supported by OpenSSL.
- *
- * <i>Note that for versions of tcnative < 1.1.25, this method will
- * return <code>true</code> if and only if <code>op</code>=
- * {@link #SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION} and tcnative
- * supports that flag.</i>
- *
- * @param op Bitwise-OR of all SSL_OP_* to test.
- *
- * @return true if all SSL_OP_* are supported by OpenSSL library.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native boolean hasOp(int op);
-
/**
* Return the handshake completed count.
* @param ssl SSL pointer
@@ -446,28 +322,6 @@ public final class SSL {
*/
public static native long newSSL(long ctx, boolean server);
- /**
- * SSL_set_bio
- * @param ssl SSL pointer (SSL *)
- * @param rbio read BIO pointer (BIO *)
- * @param wbio write BIO pointer (BIO *)
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void setBIO(long ssl, long rbio, long wbio);
-
- /**
- * SSL_get_error
- * @param ssl SSL pointer (SSL *)
- * @param ret TLS/SSL I/O return value
- * @return the error status
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native int getError(long ssl, int ret);
-
/**
* BIO_ctrl_pending.
* @param bio BIO pointer (BIO *)
@@ -525,16 +379,6 @@ public final class SSL {
*/
public static native int getShutdown(long ssl);
- /**
- * SSL_set_shutdown
- * @param ssl the SSL instance (SSL *)
- * @param mode Shutdown mode
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void setShutdown(long ssl, int mode);
-
/**
* SSL_free
* @param ssl the SSL instance (SSL *)
@@ -630,16 +474,6 @@ public final class SSL {
*/
public static native int isInInit(long ssl);
- /**
- * SSL_get0_next_proto_negotiated
- * @param ssl the SSL instance (SSL *)
- * @return the NPN protocol negotiated
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1.x
- */
- @Deprecated
- public static native String getNextProtoNegotiated(long ssl);
-
/*
* End Twitter API Additions
*/
diff --git a/java/org/apache/tomcat/jni/SSLConf.java b/java/org/apache/tomcat/jni/SSLConf.java
index db855fc..2e429a5 100644
--- a/java/org/apache/tomcat/jni/SSLConf.java
+++ b/java/org/apache/tomcat/jni/SSLConf.java
@@ -16,8 +16,6 @@
*/
package org.apache.tomcat.jni;
-/** SSL Conf
- */
public final class SSLConf {
/**
diff --git a/java/org/apache/tomcat/jni/SSLContext.java b/java/org/apache/tomcat/jni/SSLContext.java
index 1363aea..730a38c 100644
--- a/java/org/apache/tomcat/jni/SSLContext.java
+++ b/java/org/apache/tomcat/jni/SSLContext.java
@@ -20,10 +20,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-/** SSL Context
- *
- * @author Mladen Turk
- */
public final class SSLContext {
public static final byte[] DEFAULT_SESSION_ID_CONTEXT =
@@ -65,40 +61,6 @@ public final class SSLContext {
*/
public static native int free(long ctx);
- /**
- * Set Session context id. Usually host:port combination.
- * @param ctx Context to use.
- * @param id String that uniquely identifies this context.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void setContextId(long ctx, String id);
-
- /**
- * Associate BIOCallback for input or output data capture.
- * <br>
- * First word in the output string will contain error
- * level in the form:
- * <PRE>
- * [ERROR] -- Critical error messages
- * [WARN] -- Warning messages
- * [INFO] -- Informational messages
- * [DEBUG] -- Debugging messaged
- * </PRE>
- * Callback can use that word to determine application logging level
- * by intercepting <b>write</b> call.
- * If the <b>bio</b> is set to 0 no error messages will be displayed.
- * Default is to use the stderr output stream.
- * @param ctx Server or Client context to use.
- * @param bio BIO handle to use, created with SSL.newBIO
- * @param dir BIO direction (1 for input 0 for output).
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void setBIO(long ctx, long bio, int dir);
-
/**
* Set OpenSSL Option.
* @param ctx Server or Client context to use.
@@ -127,30 +89,6 @@ public final class SSLContext {
*/
public static native String[] getCiphers(long ctx);
- /**
- * Sets the "quiet shutdown" flag for <b>ctx</b> to be
- * <b>mode</b>. SSL objects created from <b>ctx</b> inherit the
- * <b>mode</b> valid at the time and may be 0 or 1.
- * <br>
- * Normally when an SSL connection is finished, the parties must send out
- * "close notify" alert messages using L<SSL_shutdown(3)|SSL_shutdown(3)>
- * for a clean shutdown.
- * <br>
- * When setting the "quiet shutdown" flag to 1, <b>SSL.shutdown</b>
- * will set the internal flags to SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN.
- * (<b>SSL_shutdown</b> then behaves like called with
- * SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN.)
- * The session is thus considered to be shutdown, but no "close notify" alert
- * is sent to the peer. This behaviour violates the TLS standard.
- * The default is normal shutdown behaviour as described by the TLS standard.
- * @param ctx Server or Client context to use.
- * @param mode True to set the quiet shutdown.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void setQuietShutdown(long ctx, boolean mode);
-
/**
* Cipher Suite available for negotiation in SSL handshake.
* <br>
@@ -225,7 +163,7 @@ public final class SSLContext {
* Point setCertificateFile at a PEM encoded certificate. If
* the certificate is encrypted, then you will be prompted for a
* pass phrase. Note that a kill -HUP will prompt again. A test
- * certificate can be generated with `make certificate' under
+ * certificate can be generated with 'make certificate' under
* built time. Keep in mind that if you've both a RSA and a DSA
* certificate you can configure both in parallel (to also allow
* the use of DSA ciphers, etc.)
@@ -348,33 +286,6 @@ public final class SSLContext {
String path)
throws Exception;
- /**
- * Set file for randomness
- * @param ctx Server or Client context to use.
- * @param file random file.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void setRandom(long ctx, String file);
-
- /**
- * Set SSL connection shutdown type
- * <br>
- * The following levels are available for level:
- * <PRE>
- * SSL_SHUTDOWN_TYPE_STANDARD
- * SSL_SHUTDOWN_TYPE_UNCLEAN
- * SSL_SHUTDOWN_TYPE_ACCURATE
- * </PRE>
- * @param ctx Server or Client context to use.
- * @param type Shutdown type to use.
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void setShutdownType(long ctx, int type);
-
/**
* Set Type of Client Certificate verification and Maximum depth of CA Certificates
* in Client Certificate verification.
@@ -410,9 +321,6 @@ public final class SSLContext {
*/
public static native void setVerify(long ctx, int level, int depth);
- @Deprecated
- public static native int setALPN(long ctx, byte[] proto, int len);
-
/**
* When tc-native encounters a SNI extension in the TLS handshake it will
* call this method to determine which OpenSSL SSLContext to use for the
@@ -447,49 +355,12 @@ public final class SSLContext {
*/
private static final Map<Long,SNICallBack> sniCallBacks = new ConcurrentHashMap<>();
- /**
- * Register an OpenSSL SSLContext that will be used to initiate TLS
- * connections that may use the SNI extension with the component that will
- * be used to map the requested hostname to the correct OpenSSL SSLContext
- * for the remainder of the connection.
- *
- * @param defaultSSLContext The Java representation of a pointer to the
- * OpenSSL SSLContext that will be used to
- * initiate TLS connections
- * @param sniCallBack The component that will map SNI hosts names received
- * via connections initiated using
- * <code>defaultSSLContext</code> to the correct OpenSSL
- * SSLContext
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static void registerDefault(Long defaultSSLContext,
- SNICallBack sniCallBack) {
- sniCallBacks.put(defaultSSLContext, sniCallBack);
- }
-
- /**
- * Unregister an OpenSSL SSLContext that will no longer be used to initiate
- * TLS connections that may use the SNI extension.
- *
- * @param defaultSSLContext The Java representation of a pointer to the
- * OpenSSL SSLContext that will no longer be used
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static void unregisterDefault(Long defaultSSLContext) {
- sniCallBacks.remove(defaultSSLContext);
- }
-
-
/**
* Interface implemented by components that will receive the call back to
* select an OpenSSL SSLContext based on the host name requested by the
* client.
*/
- public static interface SNICallBack {
+ public interface SNICallBack {
/**
* This callback is made during the TLS handshake when the client uses
@@ -502,7 +373,7 @@ public final class SSLContext {
* SSLContext to use for the given host or zero if no SSLContext
* could be identified
*/
- public long getSslContext(String sniHostName);
+ long getSslContext(String sniHostName);
}
/**
@@ -514,30 +385,6 @@ public final class SSLContext {
*/
public static native void setCertVerifyCallback(long ctx, CertificateVerifier verifier);
- /**
- * Set next protocol for next protocol negotiation extension
- * @param ctx Server context to use.
- * @param nextProtos comma delimited list of protocols in priority order
- *
- * @deprecated use {@link #setNpnProtos(long, String[], int)}
- */
- @Deprecated
- public static void setNextProtos(long ctx, String nextProtos) {
- setNpnProtos(ctx, nextProtos.split(","), SSL.SSL_SELECTOR_FAILURE_CHOOSE_MY_LAST_PROTOCOL);
- }
-
- /**
- * Set next protocol for next protocol negotiation extension
- * @param ctx Server context to use.
- * @param nextProtos protocols in priority order
- * @param selectorFailureBehavior see {@link SSL#SSL_SELECTOR_FAILURE_NO_ADVERTISE}
- * and {@link SSL#SSL_SELECTOR_FAILURE_CHOOSE_MY_LAST_PROTOCOL}
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1.x
- */
- @Deprecated
- public static native void setNpnProtos(long ctx, String[] nextProtos, int selectorFailureBehavior);
-
/**
* Set application layer protocol for application layer protocol negotiation extension
* @param ctx Server context to use.
@@ -547,32 +394,6 @@ public final class SSLContext {
*/
public static native void setAlpnProtos(long ctx, String[] alpnProtos, int selectorFailureBehavior);
- /**
- * Set DH parameters
- * @param ctx Server context to use.
- * @param cert DH param file (can be generated from e.g. {@code openssl dhparam -rand - 2048 > dhparam.pem} -
- * see the <a href="https://www.openssl.org/docs/apps/dhparam.html">OpenSSL documentation</a>).
- * @throws Exception An error occurred
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void setTmpDH(long ctx, String cert)
- throws Exception;
-
- /**
- * Set ECDH elliptic curve by name
- * @param ctx Server context to use.
- * @param curveName the name of the elliptic curve to use
- * (available names can be obtained from {@code openssl ecparam -list_curves}).
- * @throws Exception An error occurred
- *
- * @deprecated Unused. Will be removed in Tomcat 10.1
- */
- @Deprecated
- public static native void setTmpECDHByCurveName(long ctx, String curveName)
- throws Exception;
-
/**
* Set the context within which session be reused (server side only)
* http://www.openssl.org/docs/ssl/SSL_CTX_set_session_id_context.html
diff --git a/java/org/apache/tomcat/jni/SSLSocket.java b/java/org/apache/tomcat/jni/SSLSocket.java
deleted file mode 100644
index 2e1b316..0000000
--- a/java/org/apache/tomcat/jni/SSLSocket.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** SSL Socket
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class SSLSocket {
-
- /**
- * Attach APR socket on an SSL connection.
- * @param ctx SSLContext to use.
- * @param sock APR Socket that already did physical connect or accept.
- * @return APR_STATUS code.
- * @throws Exception An error occurred
- */
- public static native int attach(long ctx, long sock)
- throws Exception;
-
- /**
- * Do an SSL handshake.
- * @param thesocket The socket to use
- * @return the handshake status
- */
- public static native int handshake(long thesocket);
-
- /**
- * Do an SSL renegotiation.
- * SSL supports per-directory re-configuration of SSL parameters.
- * This is implemented by performing an SSL renegotiation of the
- * re-configured parameters after the request is read, but before the
- * response is sent. In more detail: the renegotiation happens after the
- * request line and MIME headers were read, but _before_ the attached
- * request body is read. The reason simply is that in the HTTP protocol
- * usually there is no acknowledgment step between the headers and the
- * body (there is the 100-continue feature and the chunking facility
- * only), so Apache has no API hook for this step.
- *
- * @param thesocket The socket to use
- * @return the operation status
- */
- public static native int renegotiate(long thesocket);
-
- /**
- * Set Type of Client Certificate verification and Maximum depth of CA
- * Certificates in Client Certificate verification.
- * <br>
- * This is used to change the verification level for a connection prior to
- * starting a re-negotiation.
- * <br>
- * The following levels are available for level:
- * <PRE>
- * SSL_CVERIFY_NONE - No client Certificate is required at all
- * SSL_CVERIFY_OPTIONAL - The client may present a valid Certificate
- * SSL_CVERIFY_REQUIRE - The client has to present a valid
- * Certificate
- * SSL_CVERIFY_OPTIONAL_NO_CA - The client may present a valid Certificate
- * but it need not to be (successfully)
- * verifiable
- * </PRE>
- * <br>
- * @param sock The socket to change.
- * @param level Type of Client Certificate verification.
- * @param depth Maximum number of certificates to permit in chain from
- * client to trusted CA. Use a value of 0 or less to leave the
- * current value unchanged
- */
- public static native void setVerify(long sock, int level, int depth);
-
- /**
- * Return SSL Info parameter as byte array.
- *
- * @param sock The socket to read the data from.
- * @param id Parameter id.
- * @return Byte array containing info id value.
- * @throws Exception An error occurred
- */
- public static native byte[] getInfoB(long sock, int id)
- throws Exception;
-
- /**
- * Return SSL Info parameter as String.
- *
- * @param sock The socket to read the data from.
- * @param id Parameter id.
- * @return String containing info id value.
- * @throws Exception An error occurred
- */
- public static native String getInfoS(long sock, int id)
- throws Exception;
-
- /**
- * Return SSL Info parameter as integer.
- *
- * @param sock The socket to read the data from.
- * @param id Parameter id.
- * @return Integer containing info id value or -1 on error.
- * @throws Exception An error occurred
- */
- public static native int getInfoI(long sock, int id)
- throws Exception;
-
-
- /**
- * Obtain the name of the protocol negotiated via ALPN. Only valid after the
- * TLS handshake has completed.
- *
- * @param sock Socket
- * @param negotiatedProtocol Byte array in which to store agreed protocol
- *
- * @return Length of agreed protocol. Zero means no protocol agreed.
- */
- public static native int getALPN(long sock, byte[] negotiatedProtocol);
-
-}
diff --git a/java/org/apache/tomcat/jni/Shm.java b/java/org/apache/tomcat/jni/Shm.java
deleted file mode 100644
index f62d4aa..0000000
--- a/java/org/apache/tomcat/jni/Shm.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-import java.nio.ByteBuffer;
-
-/** Shm
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Shm {
-
- /**
- * Create and make accessible a shared memory segment.
- * <br>
- * A note about Anonymous vs. Named shared memory segments:<br>
- * Not all platforms support anonymous shared memory segments, but in
- * some cases it is preferred over other types of shared memory
- * implementations. Passing a NULL 'file' parameter to this function
- * will cause the subsystem to use anonymous shared memory segments.
- * If such a system is not available, APR_ENOTIMPL is returned.
- * <br>
- * A note about allocation sizes:<br>
- * On some platforms it is necessary to store some metainformation
- * about the segment within the actual segment. In order to supply
- * the caller with the requested size it may be necessary for the
- * implementation to request a slightly greater segment length
- * from the subsystem. In all cases, the apr_shm_baseaddr_get()
- * function will return the first usable byte of memory.
- * @param reqsize The desired size of the segment.
- * @param filename The file to use for shared memory on platforms that
- * require it.
- * @param pool the pool from which to allocate the shared memory
- * structure.
- * @return The created shared memory structure.
- * @throws Error An error occurred
- */
- public static native long create(long reqsize, String filename, long pool)
- throws Error;
-
- /**
- * Remove shared memory segment associated with a filename.
- * <br>
- * This function is only supported on platforms which support
- * name-based shared memory segments, and will return APR_ENOTIMPL on
- * platforms without such support.
- * @param filename The filename associated with shared-memory segment which
- * needs to be removed
- * @param pool The pool used for file operations
- * @return the operation status
- */
- public static native int remove(String filename, long pool);
-
- /**
- * Destroy a shared memory segment and associated memory.
- * @param m The shared memory segment structure to destroy.
- * @return the operation status
- */
- public static native int destroy(long m);
-
- /**
- * Attach to a shared memory segment that was created
- * by another process.
- * @param filename The file used to create the original segment.
- * (This MUST match the original filename.)
- * @param pool the pool from which to allocate the shared memory
- * structure for this process.
- * @return The created shared memory structure.
- * @throws Error An error occurred
- */
- public static native long attach(String filename, long pool)
- throws Error;
-
- /**
- * Detach from a shared memory segment without destroying it.
- * @param m The shared memory structure representing the segment
- * to detach from.
- * @return the operation status
- */
- public static native int detach(long m);
-
- /**
- * Retrieve the base address of the shared memory segment.
- * NOTE: This address is only usable within the callers address
- * space, since this API does not guarantee that other attaching
- * processes will maintain the same address mapping.
- * @param m The shared memory segment from which to retrieve
- * the base address.
- * @return address, aligned by APR_ALIGN_DEFAULT.
- */
- public static native long baseaddr(long m);
-
- /**
- * Retrieve the length of a shared memory segment in bytes.
- * @param m The shared memory segment from which to retrieve
- * the segment length.
- * @return the length of the segment
- */
- public static native long size(long m);
-
- /**
- * Retrieve new ByteBuffer base address of the shared memory segment.
- * NOTE: This address is only usable within the callers address
- * space, since this API does not guarantee that other attaching
- * processes will maintain the same address mapping.
- * @param m The shared memory segment from which to retrieve
- * the base address.
- * @return address, aligned by APR_ALIGN_DEFAULT.
- */
- public static native ByteBuffer buffer(long m);
-
-}
diff --git a/java/org/apache/tomcat/jni/Sockaddr.java b/java/org/apache/tomcat/jni/Sockaddr.java
index 9d138ec..20e73c8 100644
--- a/java/org/apache/tomcat/jni/Sockaddr.java
+++ b/java/org/apache/tomcat/jni/Sockaddr.java
@@ -16,30 +16,15 @@
*/
package org.apache.tomcat.jni;
-/** Sockaddr
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
+/**
+ * Tomcat Native 1.2.33 and earlier won't initialise unless this class is
+ * present. This dummy class ensures initialisation gets as far as being able to
+ * check the version of the Tomcat Native library and reporting a version error
+ * if 1.2.33 or earlier is present.
*/
-@Deprecated
public class Sockaddr {
- /** The pool to use... */
- public long pool;
- /** The hostname */
- public String hostname;
- /** Either a string of the port number or the service name for the port */
- public String servname;
- /** The numeric port */
- public int port;
- /** The family */
- public int family;
- /** If multiple addresses were found by apr_sockaddr_info_get(), this
- * points to a representation of the next address. */
- public long next;
-
+ private Sockaddr() {
+ // Hide default constructor
+ }
}
diff --git a/java/org/apache/tomcat/jni/Socket.java b/java/org/apache/tomcat/jni/Socket.java
deleted file mode 100644
index cbc2a01..0000000
--- a/java/org/apache/tomcat/jni/Socket.java
+++ /dev/null
@@ -1,635 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/* Import needed classes */
-import java.nio.ByteBuffer;
-
-/** Socket
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Socket {
-
- /* Standard socket defines */
- public static final int SOCK_STREAM = 0;
- public static final int SOCK_DGRAM = 1;
- /*
- * apr_sockopt Socket option definitions
- */
- public static final int APR_SO_LINGER = 1; /** Linger */
- public static final int APR_SO_KEEPALIVE = 2; /** Keepalive */
- public static final int APR_SO_DEBUG = 4; /** Debug */
- public static final int APR_SO_NONBLOCK = 8; /** Non-blocking IO */
- public static final int APR_SO_REUSEADDR = 16; /** Reuse addresses */
- public static final int APR_SO_SNDBUF = 64; /** Send buffer */
- public static final int APR_SO_RCVBUF = 128; /** Receive buffer */
- public static final int APR_SO_DISCONNECTED = 256; /** Disconnected */
- /** For SCTP sockets, this is mapped to STCP_NODELAY internally. */
- public static final int APR_TCP_NODELAY = 512;
- public static final int APR_TCP_NOPUSH = 1024; /** No push */
- /** This flag is ONLY set internally when we set APR_TCP_NOPUSH with
- * APR_TCP_NODELAY set to tell us that APR_TCP_NODELAY should be turned on
- * again when NOPUSH is turned off
- */
- public static final int APR_RESET_NODELAY = 2048;
- /** Set on non-blocking sockets (timeout != 0) on which the
- * previous read() did not fill a buffer completely. the next
- * apr_socket_recv() will first call select()/poll() rather than
- * going straight into read(). (Can also be set by an application to
- * force a select()/poll() call before the next read, in cases where
- * the app expects that an immediate read would fail.)
- */
- public static final int APR_INCOMPLETE_READ = 4096;
- /** like APR_INCOMPLETE_READ, but for write
- */
- public static final int APR_INCOMPLETE_WRITE = 8192;
- /** Don't accept IPv4 connections on an IPv6 listening socket.
- */
- public static final int APR_IPV6_V6ONLY = 16384;
- /** Delay accepting of new connections until data is available.
- */
- public static final int APR_TCP_DEFER_ACCEPT = 32768;
-
- /** Define what type of socket shutdown should occur.
- * apr_shutdown_how_e enum
- */
- public static final int APR_SHUTDOWN_READ = 0; /** no longer allow read request */
- public static final int APR_SHUTDOWN_WRITE = 1; /** no longer allow write requests */
- public static final int APR_SHUTDOWN_READWRITE = 2; /** no longer allow read or write requests */
-
- public static final int APR_IPV4_ADDR_OK = 0x01;
- public static final int APR_IPV6_ADDR_OK = 0x02;
-
- public static final int APR_UNSPEC = 0;
- public static final int APR_INET = 1;
- public static final int APR_INET6 = 2;
- public static final int APR_UNIX = 3;
-
- public static final int APR_PROTO_TCP = 6; /** TCP */
- public static final int APR_PROTO_UDP = 17; /** UDP */
- public static final int APR_PROTO_SCTP = 132; /** SCTP */
-
- /**
- * Enum to tell us if we're interested in remote or local socket
- * apr_interface_e
- */
- public static final int APR_LOCAL = 0;
- public static final int APR_REMOTE = 1;
-
- /* Socket.get types */
- public static final int SOCKET_GET_POOL = 0;
- public static final int SOCKET_GET_IMPL = 1;
- public static final int SOCKET_GET_APRS = 2;
- public static final int SOCKET_GET_TYPE = 3;
-
- /**
- * Create a socket.
- * @param family The address family of the socket (e.g., APR_INET).
- * @param type The type of the socket (e.g., SOCK_STREAM).
- * @param protocol The protocol of the socket (e.g., APR_PROTO_TCP).
- * @param cont The parent pool to use
- * @return The new socket that has been set up.
- * @throws Exception Error creating socket
- */
- public static native long create(int family, int type,
- int protocol, long cont)
- throws Exception;
-
-
- /**
- * Shutdown either reading, writing, or both sides of a socket.
- * <br>
- * This does not actually close the socket descriptor, it just
- * controls which calls are still valid on the socket.
- * @param thesocket The socket to close
- * @param how How to shutdown the socket. One of:
- * <PRE>
- * APR_SHUTDOWN_READ no longer allow read requests
- * APR_SHUTDOWN_WRITE no longer allow write requests
- * APR_SHUTDOWN_READWRITE no longer allow read or write requests
- * </PRE>
- * @return the operation status
- */
- public static native int shutdown(long thesocket, int how);
-
- /**
- * Close a socket.
- * @param thesocket The socket to close
- * @return the operation status
- */
- public static native int close(long thesocket);
-
- /**
- * Destroy a pool associated with socket
- * @param thesocket The destroy
- */
- public static native void destroy(long thesocket);
-
- /**
- * Bind the socket to its associated port
- * @param sock The socket to bind
- * @param sa The socket address to bind to
- * This may be where we will find out if there is any other process
- * using the selected port.
- * @return the operation status
- */
- public static native int bind(long sock, long sa);
-
- /**
- * Listen to a bound socket for connections.
- * @param sock The socket to listen on
- * @param backlog The number of outstanding connections allowed in the sockets
- * listen queue. If this value is less than zero, the listen
- * queue size is set to zero.
- * @return the operation status
- */
- public static native int listen(long sock, int backlog);
-
- /**
- * Accept a new connection request
- * @param sock The socket we are listening on.
- * @param pool The pool for the new socket.
- * @return A copy of the socket that is connected to the socket that
- * made the connection request. This is the socket which should
- * be used for all future communication.
- * @throws Exception Socket accept error
- */
- public static native long acceptx(long sock, long pool)
- throws Exception;
-
- /**
- * Accept a new connection request
- * @param sock The socket we are listening on.
- * @return A copy of the socket that is connected to the socket that
- * made the connection request. This is the socket which should
- * be used for all future communication.
- * @throws Exception Socket accept error
- */
- public static native long accept(long sock)
- throws Exception;
-
- /**
- * Set an OS level accept filter.
- * @param sock The socket to put the accept filter on.
- * @param name The accept filter
- * @param args Any extra args to the accept filter. Passing NULL here removes
- * the accept filter.
- * @return the operation status
- */
- public static native int acceptfilter(long sock, String name, String args);
-
- /**
- * Query the specified socket if at the OOB/Urgent data mark
- * @param sock The socket to query
- * @return <code>true</code> if socket is at the OOB/urgent mark,
- * otherwise <code>false</code>.
- */
- public static native boolean atmark(long sock);
-
- /**
- * Issue a connection request to a socket either on the same machine
- * or a different one.
- * @param sock The socket we wish to use for our side of the connection
- * @param sa The address of the machine we wish to connect to.
- * @return the operation status
- */
- public static native int connect(long sock, long sa);
-
- /**
- * Send data over a network.
- * <PRE>
- * This functions acts like a blocking write by default. To change
- * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
- * socket option.
- *
- * It is possible for both bytes to be sent and an error to be returned.
- *
- * APR_EINTR is never returned.
- * </PRE>
- * @param sock The socket to send the data over.
- * @param buf The buffer which contains the data to be sent.
- * @param offset Offset in the byte buffer.
- * @param len The number of bytes to write; (-1) for full array.
- * @return The number of bytes sent
- */
- public static native int send(long sock, byte[] buf, int offset, int len);
-
- /**
- * Send data over a network.
- * <PRE>
- * This functions acts like a blocking write by default. To change
- * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
- * socket option.
- *
- * It is possible for both bytes to be sent and an error to be returned.
- *
- * APR_EINTR is never returned.
- * </PRE>
- * @param sock The socket to send the data over.
- * @param buf The Byte buffer which contains the data to be sent.
- * @param offset The offset within the buffer array of the first buffer from
- * which bytes are to be retrieved; must be non-negative
- * and no larger than buf.length
- * @param len The maximum number of buffers to be accessed; must be non-negative
- * and no larger than buf.length - offset
- * @return The number of bytes sent
- */
- public static native int sendb(long sock, ByteBuffer buf,
- int offset, int len);
-
- /**
- * Send data over a network without retry
- * <PRE>
- * This functions acts like a blocking write by default. To change
- * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
- * socket option.
- *
- * It is possible for both bytes to be sent and an error to be returned.
- *
- * </PRE>
- * @param sock The socket to send the data over.
- * @param buf The Byte buffer which contains the data to be sent.
- * @param offset The offset within the buffer array of the first buffer from
- * which bytes are to be retrieved; must be non-negative
- * and no larger than buf.length
- * @param len The maximum number of buffers to be accessed; must be non-negative
- * and no larger than buf.length - offset
- * @return The number of bytes sent
- */
- public static native int sendib(long sock, ByteBuffer buf,
- int offset, int len);
-
- /**
- * Send data over a network using internally set ByteBuffer
- * @param sock The socket to send the data over.
- * @param offset The offset within the buffer array of the first buffer from
- * which bytes are to be retrieved; must be non-negative
- * and no larger than buf.length
- * @param len The maximum number of buffers to be accessed; must be non-negative
- * and no larger than buf.length - offset
- * @return The number of bytes sent
- */
- public static native int sendbb(long sock,
- int offset, int len);
-
- /**
- * Send data over a network using internally set ByteBuffer
- * without internal retry.
- * @param sock The socket to send the data over.
- * @param offset The offset within the buffer array of the first buffer from
- * which bytes are to be retrieved; must be non-negative
- * and no larger than buf.length
- * @param len The maximum number of buffers to be accessed; must be non-negative
- * and no larger than buf.length - offset
- * @return The number of bytes sent
- */
- public static native int sendibb(long sock,
- int offset, int len);
-
- /**
- * Send multiple packets of data over a network.
- * <PRE>
- * This functions acts like a blocking write by default. To change
- * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
- * socket option.
- * The number of bytes actually sent is stored in argument 3.
- *
- * It is possible for both bytes to be sent and an error to be returned.
- *
- * APR_EINTR is never returned.
- * </PRE>
- * @param sock The socket to send the data over.
- * @param vec The array from which to get the data to send.
- * @return The number of bytes sent
- */
- public static native int sendv(long sock, byte[][] vec);
-
- /**
- * @param sock The socket to send from
- * @param where The apr_sockaddr_t describing where to send the data
- * @param flags The flags to use
- * @param buf The data to send
- * @param offset Offset in the byte buffer.
- * @param len The length of the data to send
- * @return The number of bytes sent
- */
- public static native int sendto(long sock, long where, int flags,
- byte[] buf, int offset, int len);
-
- /**
- * Read data from a network.
- *
- * <PRE>
- * This functions acts like a blocking read by default. To change
- * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
- * socket option.
- * The number of bytes actually received is stored in argument 3.
- *
- * It is possible for both bytes to be received and an APR_EOF or
- * other error to be returned.
- *
- * APR_EINTR is never returned.
- * </PRE>
- * @param sock The socket to read the data from.
- * @param buf The buffer to store the data in.
- * @param offset Offset in the byte buffer.
- * @param nbytes The number of bytes to read (-1) for full array.
- * @return the number of bytes received.
- */
- public static native int recv(long sock, byte[] buf, int offset, int nbytes);
-
- /**
- * Read data from a network with timeout.
- *
- * <PRE>
- * This functions acts like a blocking read by default. To change
- * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
- * socket option.
- * The number of bytes actually received is stored in argument 3.
- *
- * It is possible for both bytes to be received and an APR_EOF or
- * other error to be returned.
- *
- * APR_EINTR is never returned.
- * </PRE>
- * @param sock The socket to read the data from.
- * @param buf The buffer to store the data in.
- * @param offset Offset in the byte buffer.
- * @param nbytes The number of bytes to read (-1) for full array.
- * @param timeout The socket timeout in microseconds.
- * @return the number of bytes received.
- */
- public static native int recvt(long sock, byte[] buf, int offset,
- int nbytes, long timeout);
-
- /**
- * Read data from a network.
- *
- * <PRE>
- * This functions acts like a blocking read by default. To change
- * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
- * socket option.
- * The number of bytes actually received is stored in argument 3.
- *
- * It is possible for both bytes to be received and an APR_EOF or
- * other error to be returned.
- *
- * APR_EINTR is never returned.
- * </PRE>
- * @param sock The socket to read the data from.
- * @param buf The buffer to store the data in.
- * @param offset Offset in the byte buffer.
- * @param nbytes The number of bytes to read (-1) for full array.
- * @return If ≥ 0, the return value is the number of bytes read. Note a
- * non-blocking read with no data current available will return
- * {@link Status#EAGAIN} and EOF will return {@link Status#APR_EOF}.
- */
- public static native int recvb(long sock, ByteBuffer buf,
- int offset, int nbytes);
-
- /**
- * Read data from a network using internally set ByteBuffer.
- *
- * @param sock The socket to read the data from.
- * @param offset Offset in the byte buffer.
- * @param nbytes The number of bytes to read (-1) for full array.
- * @return If > 0, the return value is the number of bytes read. If == 0,
- * the return value indicates EOF and if < 0 the return value is the
- * error code. Note a non-blocking read with no data current
- * available will return {@link Status#EAGAIN} not zero.
- */
- public static native int recvbb(long sock,
- int offset, int nbytes);
- /**
- * Read data from a network with timeout.
- *
- * <PRE>
- * This functions acts like a blocking read by default. To change
- * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
- * socket option.
- * The number of bytes actually received is stored in argument 3.
- *
- * It is possible for both bytes to be received and an APR_EOF or
- * other error to be returned.
- *
- * APR_EINTR is never returned.
- * </PRE>
- * @param sock The socket to read the data from.
- * @param buf The buffer to store the data in.
- * @param offset Offset in the byte buffer.
- * @param nbytes The number of bytes to read (-1) for full array.
- * @param timeout The socket timeout in microseconds.
- * @return the number of bytes received.
- */
- public static native int recvbt(long sock, ByteBuffer buf,
- int offset, int nbytes, long timeout);
- /**
- * Read data from a network with timeout using internally set ByteBuffer
- * @param sock The socket to read the data from.
- * @param offset Offset in the byte buffer.
- * @param nbytes The number of bytes to read (-1) for full array.
- * @param timeout The socket timeout in microseconds.
- * @return the number of bytes received.
- */
- public static native int recvbbt(long sock,
- int offset, int nbytes, long timeout);
-
- /**
- * @param from The apr_sockaddr_t to fill in the recipient info
- * @param sock The socket to use
- * @param flags The flags to use
- * @param buf The buffer to use
- * @param offset Offset in the byte buffer.
- * @param nbytes The number of bytes to read (-1) for full array.
- * @return the number of bytes received.
- */
- public static native int recvfrom(long from, long sock, int flags,
- byte[] buf, int offset, int nbytes);
-
- /**
- * Setup socket options for the specified socket
- * @param sock The socket to set up.
- * @param opt The option we would like to configure. One of:
- * <PRE>
- * APR_SO_DEBUG -- turn on debugging information
- * APR_SO_KEEPALIVE -- keep connections active
- * APR_SO_LINGER -- lingers on close if data is present
- * APR_SO_NONBLOCK -- Turns blocking on/off for socket
- * When this option is enabled, use
- * the APR_STATUS_IS_EAGAIN() macro to
- * see if a send or receive function
- * could not transfer data without
- * blocking.
- * APR_SO_REUSEADDR -- The rules used in validating addresses
- * supplied to bind should allow reuse
- * of local addresses.
- * APR_SO_SNDBUF -- Set the SendBufferSize
- * APR_SO_RCVBUF -- Set the ReceiveBufferSize
- * </PRE>
- * @param on Value for the option.
- * @return the operation status
- */
- public static native int optSet(long sock, int opt, int on);
-
- /**
- * Query socket options for the specified socket
- * @param sock The socket to query
- * @param opt The option we would like to query. One of:
- * <PRE>
- * APR_SO_DEBUG -- turn on debugging information
- * APR_SO_KEEPALIVE -- keep connections active
- * APR_SO_LINGER -- lingers on close if data is present
- * APR_SO_NONBLOCK -- Turns blocking on/off for socket
- * APR_SO_REUSEADDR -- The rules used in validating addresses
- * supplied to bind should allow reuse
- * of local addresses.
- * APR_SO_SNDBUF -- Set the SendBufferSize
- * APR_SO_RCVBUF -- Set the ReceiveBufferSize
- * APR_SO_DISCONNECTED -- Query the disconnected state of the socket.
- * (Currently only used on Windows)
- * </PRE>
- * @return Socket option returned on the call.
- * @throws Exception An error occurred
- */
- public static native int optGet(long sock, int opt)
- throws Exception;
-
- /**
- * Setup socket timeout for the specified socket
- * @param sock The socket to set up.
- * @param t Value for the timeout in microseconds.
- * <PRE>
- * t > 0 -- read and write calls return APR_TIMEUP if specified time
- * elapses with no data read or written
- * t == 0 -- read and write calls never block
- * t < 0 -- read and write calls block
- * </PRE>
- * @return the operation status
- */
- public static native int timeoutSet(long sock, long t);
-
- /**
- * Query socket timeout for the specified socket
- * @param sock The socket to query
- * @return Socket timeout returned from the query.
- * @throws Exception An error occurred
- */
- public static native long timeoutGet(long sock)
- throws Exception;
-
- /**
- * Send a file from an open file descriptor to a socket, along with
- * optional headers and trailers.
- * <br>
- * This functions acts like a blocking write by default. To change
- * this behavior, use apr_socket_timeout_set() or the
- * APR_SO_NONBLOCK socket option.
- * The number of bytes actually sent is stored in the len parameter.
- * The offset parameter is passed by reference for no reason; its
- * value will never be modified by the apr_socket_sendfile() function.
- * @param sock The socket to which we're writing
- * @param file The open file from which to read
- * @param headers Array containing the headers to send
- * @param trailers Array containing the trailers to send
- * @param offset Offset into the file where we should begin writing
- * @param len Number of bytes to send from the file
- * @param flags APR flags that are mapped to OS specific flags
- * @return Number of bytes actually sent, including headers,
- * file, and trailers
- */
- public static native long sendfile(long sock, long file, byte [][] headers,
- byte[][] trailers, long offset,
- long len, int flags);
-
- /**
- * Send a file without header and trailer arrays.
- * @param sock The socket to which we're writing
- * @param file The open file from which to read
- * @param offset Offset into the file where we should begin writing
- * @param len Number of bytes to send from the file
- * @param flags APR flags that are mapped to OS specific flags
- * @return Number of bytes actually sent
- */
- public static native long sendfilen(long sock, long file, long offset,
- long len, int flags);
-
- /**
- * Create a child pool from associated socket pool.
- * @param thesocket The socket to use
- * @return a pointer to the pool
- * @throws Exception An error occurred
- */
- public static native long pool(long thesocket)
- throws Exception;
-
- /**
- * Private method for getting the socket struct members
- * @param socket The socket to use
- * @param what Struct member to obtain
- * <PRE>
- * SOCKET_GET_POOL - The socket pool
- * SOCKET_GET_IMPL - The socket implementation object
- * SOCKET_GET_APRS - APR socket
- * SOCKET_GET_TYPE - Socket type
- * </PRE>
- * @return The structure member address
- */
- private static native long get(long socket, int what);
-
- /**
- * Set internal send ByteBuffer.
- * This function will preset internal Java ByteBuffer for
- * consecutive sendbb calls.
- * @param sock The socket to use
- * @param buf The ByteBuffer
- */
- public static native void setsbb(long sock, ByteBuffer buf);
-
- /**
- * Set internal receive ByteBuffer.
- * This function will preset internal Java ByteBuffer for
- * consecutive revcvbb/recvbbt calls.
- * @param sock The socket to use
- * @param buf The ByteBuffer
- */
- public static native void setrbb(long sock, ByteBuffer buf);
-
- /**
- * Set the data associated with the current socket.
- * @param sock The currently open socket.
- * @param data The user data to associate with the socket.
- * @param key The key to associate with the data.
- * @return the operation status
- */
- public static native int dataSet(long sock, String key, Object data);
-
- /**
- * Return the data associated with the current socket
- * @param sock The currently open socket.
- * @param key The key to associate with the user data.
- * @return Data or null in case of error.
- */
- public static native Object dataGet(long sock, String key);
-
-}
diff --git a/java/org/apache/tomcat/jni/Status.java b/java/org/apache/tomcat/jni/Status.java
deleted file mode 100644
index 004340c..0000000
--- a/java/org/apache/tomcat/jni/Status.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Status
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Status {
-
- /**
- * APR_OS_START_ERROR is where the APR specific error values start.
- */
- public static final int APR_OS_START_ERROR = 20000;
- /**
- * APR_OS_ERRSPACE_SIZE is the maximum number of errors you can fit
- * into one of the error/status ranges below -- except for
- * APR_OS_START_USERERR, which see.
- */
- public static final int APR_OS_ERRSPACE_SIZE = 50000;
- /**
- * APR_OS_START_STATUS is where the APR specific status codes start.
- */
- public static final int APR_OS_START_STATUS = (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE);
-
- /**
- * APR_OS_START_USERERR are reserved for applications that use APR that
- * layer their own error codes along with APR's. Note that the
- * error immediately following this one is set ten times farther
- * away than usual, so that users of apr have a lot of room in
- * which to declare custom error codes.
- */
- public static final int APR_OS_START_USERERR = (APR_OS_START_STATUS + APR_OS_ERRSPACE_SIZE);
- /**
- * APR_OS_START_USEERR is obsolete, defined for compatibility only.
- * Use APR_OS_START_USERERR instead.
- */
- public static final int APR_OS_START_USEERR = APR_OS_START_USERERR;
- /**
- * APR_OS_START_CANONERR is where APR versions of errno values are defined
- * on systems which don't have the corresponding errno.
- */
- public static final int APR_OS_START_CANONERR = (APR_OS_START_USERERR + (APR_OS_ERRSPACE_SIZE * 10));
-
- /**
- * APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into
- * apr_status_t values.
- */
- public static final int APR_OS_START_EAIERR = (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE);
- /**
- * APR_OS_START_SYSERR folds platform-specific system error values into
- * apr_status_t values.
- */
- public static final int APR_OS_START_SYSERR = (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE);
-
- /** no error. */
- public static final int APR_SUCCESS = 0;
-
- /**
- * APR Error Values
- * <PRE>
- * <b>APR ERROR VALUES</b>
- * APR_ENOSTAT APR was unable to perform a stat on the file
- * APR_ENOPOOL APR was not provided a pool with which to allocate memory
- * APR_EBADDATE APR was given an invalid date
- * APR_EINVALSOCK APR was given an invalid socket
- * APR_ENOPROC APR was not given a process structure
- * APR_ENOTIME APR was not given a time structure
- * APR_ENODIR APR was not given a directory structure
- * APR_ENOLOCK APR was not given a lock structure
- * APR_ENOPOLL APR was not given a poll structure
- * APR_ENOSOCKET APR was not given a socket
- * APR_ENOTHREAD APR was not given a thread structure
- * APR_ENOTHDKEY APR was not given a thread key structure
- * APR_ENOSHMAVAIL There is no more shared memory available
- * APR_EDSOOPEN APR was unable to open the dso object. For more
- * information call apr_dso_error().
- * APR_EGENERAL General failure (specific information not available)
- * APR_EBADIP The specified IP address is invalid
- * APR_EBADMASK The specified netmask is invalid
- * APR_ESYMNOTFOUND Could not find the requested symbol
- * </PRE>
- *
- */
- public static final int APR_ENOSTAT = (APR_OS_START_ERROR + 1);
- public static final int APR_ENOPOOL = (APR_OS_START_ERROR + 2);
- public static final int APR_EBADDATE = (APR_OS_START_ERROR + 4);
- public static final int APR_EINVALSOCK = (APR_OS_START_ERROR + 5);
- public static final int APR_ENOPROC = (APR_OS_START_ERROR + 6);
- public static final int APR_ENOTIME = (APR_OS_START_ERROR + 7);
- public static final int APR_ENODIR = (APR_OS_START_ERROR + 8);
- public static final int APR_ENOLOCK = (APR_OS_START_ERROR + 9);
- public static final int APR_ENOPOLL = (APR_OS_START_ERROR + 10);
- public static final int APR_ENOSOCKET = (APR_OS_START_ERROR + 11);
- public static final int APR_ENOTHREAD = (APR_OS_START_ERROR + 12);
- public static final int APR_ENOTHDKEY = (APR_OS_START_ERROR + 13);
- public static final int APR_EGENERAL = (APR_OS_START_ERROR + 14);
- public static final int APR_ENOSHMAVAIL = (APR_OS_START_ERROR + 15);
- public static final int APR_EBADIP = (APR_OS_START_ERROR + 16);
- public static final int APR_EBADMASK = (APR_OS_START_ERROR + 17);
- public static final int APR_EDSOOPEN = (APR_OS_START_ERROR + 19);
- public static final int APR_EABSOLUTE = (APR_OS_START_ERROR + 20);
- public static final int APR_ERELATIVE = (APR_OS_START_ERROR + 21);
- public static final int APR_EINCOMPLETE = (APR_OS_START_ERROR + 22);
- public static final int APR_EABOVEROOT = (APR_OS_START_ERROR + 23);
- public static final int APR_EBADPATH = (APR_OS_START_ERROR + 24);
- public static final int APR_EPATHWILD = (APR_OS_START_ERROR + 25);
- public static final int APR_ESYMNOTFOUND = (APR_OS_START_ERROR + 26);
- public static final int APR_EPROC_UNKNOWN = (APR_OS_START_ERROR + 27);
- public static final int APR_ENOTENOUGHENTROPY = (APR_OS_START_ERROR + 28);
-
- /** APR Status Values
- * <PRE>
- * <b>APR STATUS VALUES</b>
- * APR_INCHILD Program is currently executing in the child
- * APR_INPARENT Program is currently executing in the parent
- * APR_DETACH The thread is detached
- * APR_NOTDETACH The thread is not detached
- * APR_CHILD_DONE The child has finished executing
- * APR_CHILD_NOTDONE The child has not finished executing
- * APR_TIMEUP The operation did not finish before the timeout
- * APR_INCOMPLETE The operation was incomplete although some processing
- * was performed and the results are partially valid
- * APR_BADCH Getopt found an option not in the option string
- * APR_BADARG Getopt found an option that is missing an argument
- * and an argument was specified in the option string
- * APR_EOF APR has encountered the end of the file
- * APR_NOTFOUND APR was unable to find the socket in the poll structure
- * APR_ANONYMOUS APR is using anonymous shared memory
- * APR_FILEBASED APR is using a file name as the key to the shared memory
- * APR_KEYBASED APR is using a shared key as the key to the shared memory
- * APR_EINIT Initializer value. If no option has been found, but
- * the status variable requires a value, this should be used
- * APR_ENOTIMPL The APR function has not been implemented on this
- * platform, either because nobody has gotten to it yet,
- * or the function is impossible on this platform.
- * APR_EMISMATCH Two passwords do not match.
- * APR_EBUSY The given lock was busy.
- * </PRE>
- *
- */
- public static final int APR_INCHILD = (APR_OS_START_STATUS + 1);
- public static final int APR_INPARENT = (APR_OS_START_STATUS + 2);
- public static final int APR_DETACH = (APR_OS_START_STATUS + 3);
- public static final int APR_NOTDETACH = (APR_OS_START_STATUS + 4);
- public static final int APR_CHILD_DONE = (APR_OS_START_STATUS + 5);
- public static final int APR_CHILD_NOTDONE = (APR_OS_START_STATUS + 6);
- public static final int APR_TIMEUP = (APR_OS_START_STATUS + 7);
- public static final int APR_INCOMPLETE = (APR_OS_START_STATUS + 8);
- public static final int APR_BADCH = (APR_OS_START_STATUS + 12);
- public static final int APR_BADARG = (APR_OS_START_STATUS + 13);
- public static final int APR_EOF = (APR_OS_START_STATUS + 14);
- public static final int APR_NOTFOUND = (APR_OS_START_STATUS + 15);
- public static final int APR_ANONYMOUS = (APR_OS_START_STATUS + 19);
- public static final int APR_FILEBASED = (APR_OS_START_STATUS + 20);
- public static final int APR_KEYBASED = (APR_OS_START_STATUS + 21);
- public static final int APR_EINIT = (APR_OS_START_STATUS + 22);
- public static final int APR_ENOTIMPL = (APR_OS_START_STATUS + 23);
- public static final int APR_EMISMATCH = (APR_OS_START_STATUS + 24);
- public static final int APR_EBUSY = (APR_OS_START_STATUS + 25);
-
- public static final int TIMEUP = (APR_OS_START_USERERR + 1);
- public static final int EAGAIN = (APR_OS_START_USERERR + 2);
- public static final int EINTR = (APR_OS_START_USERERR + 3);
- public static final int EINPROGRESS = (APR_OS_START_USERERR + 4);
- public static final int ETIMEDOUT = (APR_OS_START_USERERR + 5);
-
- private static native boolean is(int err, int idx);
- /*
- * APR_STATUS_IS Status Value Tests
- * <br><b>Warning :</b> For any particular error condition, more than one of these tests
- * may match. This is because platform-specific error codes may not
- * always match the semantics of the POSIX codes these tests (and the
- * corresponding APR error codes) are named after. A notable example
- * are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
- * Win32 platforms. The programmer should always be aware of this and
- * adjust the order of the tests accordingly.
- *
- */
- public static final boolean APR_STATUS_IS_ENOSTAT(int s) { return is(s, 1); }
- public static final boolean APR_STATUS_IS_ENOPOOL(int s) { return is(s, 2); }
- /* empty slot: +3 */
- public static final boolean APR_STATUS_IS_EBADDATE(int s) { return is(s, 4); }
- public static final boolean APR_STATUS_IS_EINVALSOCK(int s) { return is(s, 5); }
- public static final boolean APR_STATUS_IS_ENOPROC(int s) { return is(s, 6); }
- public static final boolean APR_STATUS_IS_ENOTIME(int s) { return is(s, 7); }
- public static final boolean APR_STATUS_IS_ENODIR(int s) { return is(s, 8); }
- public static final boolean APR_STATUS_IS_ENOLOCK(int s) { return is(s, 9); }
- public static final boolean APR_STATUS_IS_ENOPOLL(int s) { return is(s, 10); }
- public static final boolean APR_STATUS_IS_ENOSOCKET(int s) { return is(s, 11); }
- public static final boolean APR_STATUS_IS_ENOTHREAD(int s) { return is(s, 12); }
- public static final boolean APR_STATUS_IS_ENOTHDKEY(int s) { return is(s, 13); }
- public static final boolean APR_STATUS_IS_EGENERAL(int s) { return is(s, 14); }
- public static final boolean APR_STATUS_IS_ENOSHMAVAIL(int s){ return is(s, 15); }
- public static final boolean APR_STATUS_IS_EBADIP(int s) { return is(s, 16); }
- public static final boolean APR_STATUS_IS_EBADMASK(int s) { return is(s, 17); }
- /* empty slot: +18 */
- public static final boolean APR_STATUS_IS_EDSOPEN(int s) { return is(s, 19); }
- public static final boolean APR_STATUS_IS_EABSOLUTE(int s) { return is(s, 20); }
- public static final boolean APR_STATUS_IS_ERELATIVE(int s) { return is(s, 21); }
- public static final boolean APR_STATUS_IS_EINCOMPLETE(int s){ return is(s, 22); }
- public static final boolean APR_STATUS_IS_EABOVEROOT(int s) { return is(s, 23); }
- public static final boolean APR_STATUS_IS_EBADPATH(int s) { return is(s, 24); }
- public static final boolean APR_STATUS_IS_EPATHWILD(int s) { return is(s, 25); }
- public static final boolean APR_STATUS_IS_ESYMNOTFOUND(int s) { return is(s, 26); }
- public static final boolean APR_STATUS_IS_EPROC_UNKNOWN(int s) { return is(s, 27); }
- public static final boolean APR_STATUS_IS_ENOTENOUGHENTROPY(int s) { return is(s, 28); }
-
- /*
- * APR_Error
- */
- public static final boolean APR_STATUS_IS_INCHILD(int s) { return is(s, 51); }
- public static final boolean APR_STATUS_IS_INPARENT(int s) { return is(s, 52); }
- public static final boolean APR_STATUS_IS_DETACH(int s) { return is(s, 53); }
- public static final boolean APR_STATUS_IS_NOTDETACH(int s) { return is(s, 54); }
- public static final boolean APR_STATUS_IS_CHILD_DONE(int s) { return is(s, 55); }
- public static final boolean APR_STATUS_IS_CHILD_NOTDONE(int s) { return is(s, 56); }
- public static final boolean APR_STATUS_IS_TIMEUP(int s) { return is(s, 57); }
- public static final boolean APR_STATUS_IS_INCOMPLETE(int s) { return is(s, 58); }
- /* empty slot: +9 */
- /* empty slot: +10 */
- /* empty slot: +11 */
- public static final boolean APR_STATUS_IS_BADCH(int s) { return is(s, 62); }
- public static final boolean APR_STATUS_IS_BADARG(int s) { return is(s, 63); }
- public static final boolean APR_STATUS_IS_EOF(int s) { return is(s, 64); }
- public static final boolean APR_STATUS_IS_NOTFOUND(int s) { return is(s, 65); }
- /* empty slot: +16 */
- /* empty slot: +17 */
- /* empty slot: +18 */
- public static final boolean APR_STATUS_IS_ANONYMOUS(int s) { return is(s, 69); }
- public static final boolean APR_STATUS_IS_FILEBASED(int s) { return is(s, 70); }
- public static final boolean APR_STATUS_IS_KEYBASED(int s) { return is(s, 71); }
- public static final boolean APR_STATUS_IS_EINIT(int s) { return is(s, 72); }
- public static final boolean APR_STATUS_IS_ENOTIMPL(int s) { return is(s, 73); }
- public static final boolean APR_STATUS_IS_EMISMATCH(int s) { return is(s, 74); }
- public static final boolean APR_STATUS_IS_EBUSY(int s) { return is(s, 75); }
-
- /* Socket errors */
- public static final boolean APR_STATUS_IS_EAGAIN(int s) { return is(s, 90); }
- public static final boolean APR_STATUS_IS_ETIMEDOUT(int s) { return is(s, 91); }
- public static final boolean APR_STATUS_IS_ECONNABORTED(int s) { return is(s, 92); }
- public static final boolean APR_STATUS_IS_ECONNRESET(int s) { return is(s, 93); }
- public static final boolean APR_STATUS_IS_EINPROGRESS(int s) { return is(s, 94); }
- public static final boolean APR_STATUS_IS_EINTR(int s) { return is(s, 95); }
- public static final boolean APR_STATUS_IS_ENOTSOCK(int s) { return is(s, 96); }
- public static final boolean APR_STATUS_IS_EINVAL(int s) { return is(s, 97); }
-
-}
diff --git a/java/org/apache/tomcat/jni/Stdlib.java b/java/org/apache/tomcat/jni/Stdlib.java
deleted file mode 100644
index 18e8fb2..0000000
--- a/java/org/apache/tomcat/jni/Stdlib.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Stdlib
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Stdlib {
-
- /**
- * Read from plain memory
- * @param dst Destination byte array
- * @param src Source memory address
- * @param sz Number of bytes to copy.
- * @return <code>true</code> if the operation was successful
- */
- public static native boolean memread(byte [] dst, long src, int sz);
-
- /**
- * Write to plain memory
- * @param dst Destination memory address
- * @param src Source byte array
- * @param sz Number of bytes to copy.
- * @return <code>true</code> if the operation was successful
- */
- public static native boolean memwrite(long dst, byte [] src, int sz);
-
- /**
- * Sets buffers to a specified character
- * @param dst Destination memory address
- * @param c Character to set.
- * @param sz Number of characters.
- * @return <code>true</code> if the operation was successful
- */
- public static native boolean memset(long dst, int c, int sz);
-
- /**
- * Allocates memory blocks.
- * @param sz Bytes to allocate.
- * @return a pointer
- */
- public static native long malloc(int sz);
-
- /**
- * Reallocate memory blocks.
- * @param mem Pointer to previously allocated memory block.
- * @param sz New size in bytes.
- * @return a pointer
- */
- public static native long realloc(long mem, int sz);
-
- /**
- * Allocates an array in memory with elements initialized to 0.
- * @param num Number of elements.
- * @param sz Length in bytes of each element.
- * @return a pointer
- */
- public static native long calloc(int num, int sz);
-
- /**
- * Deallocates or frees a memory block.
- * @param mem Previously allocated memory block to be freed.
- */
- public static native void free(long mem);
-
- /**
- * Get current process pid.
- * @return current pid or < 1 in case of error.
- */
- public static native int getpid();
-
- /**
- * Get current process parent pid.
- * @return parent pid or < 1 in case of error.
- */
- public static native int getppid();
-
-}
diff --git a/java/org/apache/tomcat/jni/Thread.java b/java/org/apache/tomcat/jni/Thread.java
deleted file mode 100644
index 277cfb6..0000000
--- a/java/org/apache/tomcat/jni/Thread.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Thread
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Thread {
-
- /**
- * @return the current thread ID handle.
- */
- public static native long current();
-
-}
diff --git a/java/org/apache/tomcat/jni/Time.java b/java/org/apache/tomcat/jni/Time.java
deleted file mode 100644
index 24b0540..0000000
--- a/java/org/apache/tomcat/jni/Time.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** Time
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class Time {
-
- /** number of microseconds per second */
- public static final long APR_USEC_PER_SEC = 1000000L;
- /** number of milliseconds per microsecond */
- public static final long APR_MSEC_PER_USEC = 1000L;
-
- /**
- * @param t The time
- * @return apr_time_t as a second
- */
- public static long sec(long t)
- {
- return t / APR_USEC_PER_SEC;
- }
-
- /**
- * @param t The time
- * @return apr_time_t as a msec
- */
- public static long msec(long t)
- {
- return t / APR_MSEC_PER_USEC;
- }
-
- /**
- * number of microseconds since 00:00:00 January 1, 1970 UTC
- * @return the current time
- */
- public static native long now();
-
- /**
- * Formats dates in the RFC822
- * format in an efficient manner.
- * @param t the time to convert
- * @return the formatted date
- */
- public static native String rfc822(long t);
-
- /**
- * Formats dates in the ctime() format
- * in an efficient manner.
- * Unlike ANSI/ISO C ctime(), apr_ctime() does not include
- * a \n at the end of the string.
- * @param t the time to convert
- * @return the formatted date
- */
- public static native String ctime(long t);
-
- /**
- * Sleep for the specified number of micro-seconds.
- * <br><b>Warning :</b> May sleep for longer than the specified time.
- * @param t desired amount of time to sleep.
- */
- public static native void sleep(long t);
-
-}
diff --git a/java/org/apache/tomcat/jni/User.java b/java/org/apache/tomcat/jni/User.java
deleted file mode 100644
index b9a0547..0000000
--- a/java/org/apache/tomcat/jni/User.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-/** User
- *
- * @author Mladen Turk
- *
- * @deprecated The scope of the APR/Native Library will be reduced in Tomcat
- * 10.1.x / Tomcat Native 2.x onwards to only include those
- * components required to provide OpenSSL integration with the NIO
- * and NIO2 connectors.
- */
-@Deprecated
-public class User {
-
- /**
- * Get the userid (and groupid) of the calling process
- * This function is available only if APR_HAS_USER is defined.
- * @param p The pool from which to allocate working space
- * @return Returns the user id
- * @throws Error If an error occurred
- */
- public static native long uidCurrent(long p)
- throws Error;
-
- /**
- * Get the groupid of the calling process
- * This function is available only if APR_HAS_USER is defined.
- * @param p The pool from which to allocate working space
- * @return Returns the group id
- * @throws Error If an error occurred
- */
- public static native long gidCurrent(long p)
- throws Error;
-
-
- /**
- * Get the userid for the specified username
- * This function is available only if APR_HAS_USER is defined.
- * @param username The username to lookup
- * @param p The pool from which to allocate working space
- * @return Returns the user id
- * @throws Error If an error occurred
- */
- public static native long uid(String username, long p)
- throws Error;
-
- /**
- * Get the groupid for the specified username
- * This function is available only if APR_HAS_USER is defined.
- * @param username The username to lookup
- * @param p The pool from which to allocate working space
- * @return Returns the user's group id
- * @throws Error If an error occurred
- */
- public static native long usergid(String username, long p)
- throws Error;
-
- /**
- * Get the groupid for a specified group name
- * This function is available only if APR_HAS_USER is defined.
- * @param groupname The group name to look up
- * @param p The pool from which to allocate working space
- * @return Returns the user's group id
- * @throws Error If an error occurred
- */
- public static native long gid(String groupname, long p)
- throws Error;
-
- /**
- * Get the user name for a specified userid
- * This function is available only if APR_HAS_USER is defined.
- * @param userid The userid
- * @param p The pool from which to allocate the string
- * @return New string containing user name
- * @throws Error If an error occurred
- */
- public static native String username(long userid, long p)
- throws Error;
-
- /**
- * Get the group name for a specified groupid
- * This function is available only if APR_HAS_USER is defined.
- * @param groupid The groupid
- * @param p The pool from which to allocate the string
- * @return New string containing group name
- * @throws Error If an error occurred
- */
- public static native String groupname(long groupid, long p)
- throws Error;
-
- /**
- * Compare two user identifiers for equality.
- * This function is available only if APR_HAS_USER is defined.
- * @param left One uid to test
- * @param right Another uid to test
- * @return APR_SUCCESS if the apr_uid_t structures identify the same user,
- * APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid.
- */
- public static native int uidcompare(long left, long right);
-
- /**
- * Compare two group identifiers for equality.
- * This function is available only if APR_HAS_USER is defined.
- * @param left One gid to test
- * @param right Another gid to test
- * @return APR_SUCCESS if the apr_gid_t structures identify the same group,
- * APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid.
- */
- public static native int gidcompare(long left, long right);
-
- /**
- * Get the home directory for the named user
- * This function is available only if APR_HAS_USER is defined.
- * @param username The named user
- * @param p The pool from which to allocate the string
- * @return New string containing directory name
- * @throws Error If an error occurred
- */
- public static native String homepath(String username, long p)
- throws Error;
-
-}
diff --git a/java/overview.html b/java/overview.html
index 56f30bb..a9e787d 100644
--- a/java/overview.html
+++ b/java/overview.html
@@ -23,8 +23,8 @@
</head>
<body bgcolor="white">
<p>The <em>Tomcat Native Library</em> component of the Apache Tomcat
-Connectors project offers JNI wrappers around APR and various other
-system libraries.</p>
+Connectors project offers a JNI wrapper around OpenSSL allowing it to
+be used with Tomcat for TLS connections instead of JSSE.</p>
</body>
</html>
diff --git a/jnirelease.sh b/jnirelease.sh
index cc12260..4882d5b 100755
--- a/jnirelease.sh
+++ b/jnirelease.sh
@@ -169,14 +169,14 @@ if [ ! -d .git/refs/remotes/tcjava ]; then
git remote add -f tcjava ${TCJAVA_GITBASE}
fi
git remote update tcjava
-diffcount=`git diff HEAD remotes/tcjava/9.0.x java/org/apache/tomcat/jni | wc -l`
+diffcount=`git diff HEAD remotes/tcjava/main java/org/apache/tomcat/jni | wc -l`
if [ $diffcount -ne 0 ]; then
echo "WARNING: git subtree is not up to date with"
echo " $TCJAVA_GITBASE"
echo " Either correct now by running"
echo " 'git rm -rf java/org/apache/tomcat/jni'"
- echo " 'git read-tree --prefix=java/org/apache/tomcat/jni/ -u tcjava/9.0.x:java/org/apache/tomcat/jni'"
+ echo " 'git read-tree --prefix=java/org/apache/tomcat/jni/ -u tcjava/main:java/org/apache/tomcat/jni'"
echo " 'git commit'"
echo " or run this script with -f (force)"
if [ "X$JKJNIFORCE" = "X1" ]
@@ -285,7 +285,7 @@ cp ${JKJNIDIST}/CHANGELOG.txt ${JKWINDIST}
mv ${JKWINDIST}/build/docs ${JKWINDIST}/docs
rm -rf ${JKWINDIST}/build
-for i in LICENSE NOTICE README.txt TODO.txt
+for i in LICENSE NOTICE README.txt
do
$PERL ${JKWINDIST}/native/build/lineends.pl --cr ${JKWINDIST}/${i}
done
diff --git a/native/BUILDING b/native/BUILDING
index 7059e8d..79935c4 100644
--- a/native/BUILDING
+++ b/native/BUILDING
@@ -20,8 +20,8 @@ Linux / Unix / OSX (dynamic linking)
1. Prerequisites
- Install OpenSSL version 1.0.2 or higher
- Install APR version 1.4.3 or higher.
+ Install OpenSSL version 3.0.0 or higher
+ Install APR version 1.7.0 or higher.
Download and expand the source package or use an git checkout
> cd native
@@ -38,26 +38,19 @@ Linux / Unix / OSX (dynamic linking)
> configure --with-apr=apr_install_location --with-ssl=openssl_install_location
> make
- This should produce a file named libtcnative-1.so
+ This should produce a file named libtcnative-2.so
- Note: To build without SSL support use:
-
- > configure --disable-openssl --with-apr=apr_install_location
-
Linux / Unix / OSX (static linking)
===================================
-1. Build static version of OpenSSL 1.0.2 or later
+1. Build static version of OpenSSL 3.0.0 or later
- > ./Configure --prefix=~/natives/openssl no-shared -fPIC
+ > ./Configure --prefix=~/natives/openssl enable-fips
> make
- > make install_sw
-
- Note: For the Solaris platform you should use -KPIC instead -fPIC so that the
- library is compiled with position independent code.
+ > make install
-2. Build static version of APR 1.4.0 or later
+2. Build static version of APR 1.7.0 or later
> ./configure --prefix=~/natives/apr
> make
@@ -93,103 +86,92 @@ Windows
3. Build APR
Unpack the APR source distribution into native\srclib\apr
- Apply apr-enable-ipv6.patch
-
+
> c:\cmsc\setenv.bat /x86
> nmake -f NMAKEmakefile BUILD_CPU=x86 APR_DECLARE_STATIC=1
- > mkdir WINXP_X86_LIB_RELEASE\include
- > mkdir WINXP_X86_LIB_RELEASE\lib
- > xcopy /E include WINXP_X86_LIB_RELEASE\include\
- > copy WINXP_X86_LIB_RELEASE\apr-1.lib WINXP_X86_LIB_RELEASE\lib
-
+
> c:\cmsc\setenv.bat /x64
> nmake -f NMAKEmakefile BUILD_CPU=x64 APR_DECLARE_STATIC=1
- > mkdir WINXP_X64_LIB_RELEASE\include
- > mkdir WINXP_X64_LIB_RELEASE\lib
- > xcopy /E include WINXP_X64_LIB_RELEASE\include\
- > copy WINXP_X64_LIB_RELEASE\apr-1.lib WINXP_X64_LIB_RELEASE\lib
-
+
4. Build OpenSSL
- Unpack the OpenSSL source distribution into native\srclib\openssl
- Apply openssl-msvcrt.patch
-
- > c:\cmsc\setenv.bat /x86
- > perl Configure VC-WIN32
- > ms\do_nasm
- > nmake -f ms\nt.mak
- > mkdir release-x86
- > mkdir release-x86\include
- > mkdir release-x86\lib
- > xcopy /E inc32 release-x86\include\
- > copy out32\*.lib release-x86\lib\
-
- > c:\cmsc\setenv.bat /x64
- > perl Configure VC-WIN64A
- > ms\do_win64a
- > nmake -f ms\nt.mak clean
- > nmake -f ms\nt.mak
- > mkdir release-x64
- > mkdir release-x64\include
- > mkdir release-x64\lib
- > xcopy /E inc32 release-x64\include\
- > copy out32\*.lib release-x64\lib\
+ > cd ..\openssl
-5. Build tc-native
+ Unpack the OpenSSL 3.0.x source distribution in this directory
- > SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_71
+ Apply openssl-msvcrt-3.0.x.patch. Note that you may need to skip and/or use an offset to get the patch to apply.
> c:\cmsc\setenv.bat /x86
- > nmake -f NMAKEMakefile WITH_APR=srclib\apr\WINXP_X86_LIB_RELEASE WITH_OPENSSL=srclib\openssl\release-x86 APR_DECLARE_STATIC=1
+ > perl Configure no-shared VC-WIN32
+ > nmake
+ > mkdir out32-x86
+ > copy libssl.lib out32-x86\
+ > copy libcrypto.lib out32-x86\
+ > copy apps\openssl.exe out32-x86\
+ > nmake clean
+
> c:\cmsc\setenv.bat /x64
- > nmake -f NMAKEMakefile WITH_APR=srclib\apr\WINXP_X64_LIB_RELEASE WITH_OPENSSL=srclib\openssl\release-x64 APR_DECLARE_STATIC=1
-
- Note: Use ENABLE_OCSP=1 to create OCSP enabled builds
+ > perl Configure no-shared VC-WIN64A
+ > nmake
+ > mkdir out32-x64
+ > copy libssl.lib out32-x64\
+ > copy libcrypto.lib out32-x64\
+ > copy apps\openssl.exe out32-x64\
+5. Copy APR and OpenSSL to versioned directories
-Windows with FIPS
-=================
+ Keeping the various libraries in versioned directories saves having to
+ rebuild them next time if the version remains unchanged.
-The steps are broadly the same as the non-FIPS build with the following additions and changes.
+ > cd ..
+ > set OPENSSL_VER=3.0.0
+ > set APR_VER=1.7.0
+
+ > mkdir \deps-x86\apr-%APR_VER%\include
+ > mkdir \deps-x86\apr-%APR_VER%\lib
+ > mkdir \deps-x86\openssl-%OPENSSL_VER%\include
+ > mkdir \deps-x86\openssl-%OPENSSL_VER%\lib
+ > xcopy /E \deps-x86\apr-%APR_VER% \deps-x64\apr-%APR_VER%\
+ > xcopy /E \deps-x86\openssl-%OPENSSL_VER% \deps-x64\openssl-%OPENSSL_VER%\
+
+ > xcopy /E apr\include \deps-x86\apr-%APR_VER%\include\
+ > xcopy /E apr\include \deps-x64\apr-%APR_VER%\include\
+
+ > copy apr\WIN7_X86_LIB_RELEASE\apr-1.lib \deps-x86\apr-%APR_VER%\lib
+ > copy apr\WIN7_X64_LIB_RELEASE\apr-1.lib \deps-x64\apr-%APR_VER%\lib
+ > xcopy /E openssl\include\openssl \deps-x86\openssl-%OPENSSL_VER%\include\openssl\
+ > xcopy /E openssl\include\openssl \deps-x64\openssl-%OPENSSL_VER%\include\openssl\
+ > copy openssl\out32-x86\*.lib \deps-x86\openssl-%OPENSSL_VER%\lib\
+ > copy openssl\out32-x64\*.lib \deps-x64\openssl-%OPENSSL_VER%\lib\
-Note: The build process has only been verified with 64-bit Windows. The process
- for 32-bit Windows should be very similar.
+ > copy openssl\out32-x86\openssl.exe \deps-x86\openssl-%OPENSSL_VER%\
+ > copy openssl\out32-x64\openssl.exe \deps-x64\openssl-%OPENSSL_VER%\
-1. Build the FIPS object module
+
+ 6. Build Tomcat Native
+
+ > cd ..
+ >set JAVA_HOME=\java\jdk11
- This step should be completed immediately before building OpenSSL.
-
- Unpack the openssl-fips-2.0.x.tar.gz distribution into native\srclib\openssl-fips
- The tar.gz contains symbolic links. Ensure you unpack the archive with a tool
- that replaces these with the linked file or manually replace the symbolic
- links with associated the linked file before continuing.
-
+ > c:\cmsc\setenv.bat /x86
+ > nmake -f NMAKEMakefile WITH_APR=C:\deps-x86\apr-%APR_VER% WITH_OPENSSL=C:\deps-x86\openssl-%OPENSSL_VER% APR_DECLARE_STATIC=1 OPENSSL_NEW_LIBS=1 ENABLE_OCSP=1
+ > move WIN7_X86_DLL_RELEASE WIN7_X86_OCSP_DLL_RELEASE
+ > nmake -f NMAKEMakefile WITH_APR=C:\deps-x86\apr-%APR_VER% WITH_OPENSSL=C:\deps-x86\openssl-%OPENSSL_VER% APR_DECLARE_STATIC=1 OPENSSL_NEW_LIBS=1
+
> c:\cmsc\setenv.bat /x64
- > set FIPSDIR=%cd%\lib-x64
- > ms\do_fips
-
-2. Modify the OpenSSL build configuration
+ > nmake -f NMAKEMakefile WITH_APR=C:\deps-x64\apr-%APR_VER% WITH_OPENSSL=C:\deps-x64\openssl-%OPENSSL_VER% APR_DECLARE_STATIC=1 OPENSSL_NEW_LIBS=1 ENABLE_OCSP=1
+ > move WIN7_X64_DLL_RELEASE WIN7_X64_OCSP_DLL_RELEASE
+ > nmake -f NMAKEMakefile WITH_APR=C:\deps-x64\apr-%APR_VER% WITH_OPENSSL=C:\deps-x64\openssl-%OPENSSL_VER% APR_DECLARE_STATIC=1 OPENSSL_NEW_LIBS=1
+
+ Tomcat Native Connector DLLs may then be found in native\WIN7_*_[OCSP_]DLL_RELEASE
- Add 'fips' to the OpenSSL build configuration
-
- > perl Configure VC-WIN64A fips
-
-3. Test the OpenSSL build
- This step should be completed immediately after building OpenSSL.
-
- > SET OPENSSL_FIPS=1
- > openssl md5 openssl.exe
-
- This should fail since MD5 is disabled in FIPS mode.
-
- > SET OPENSSL_FIPS=
- > openssl md5 openssl.exe
-
- This should work.
+FIPS
+====
-4. Modify the tc-native build configuration
+No additional build steps are required. Configure OpenSSL to use the FIPS
+certified provider as the default provider as described in the OpenSSL
+documentation:
- > c:\cmsc\setenv.bat /x64
- > nmake -f NMAKEMakefile WITH_APR=srclib\apr\WINXP_X64_LIB_RELEASE WITH_OPENSSL=srclib\openssl\release-x64 WITH_FIPS=srclib\openssl-fips\lib-x64 APR_DECLARE_STATIC=1
+ https://www.openssl.org/docs/man3.0/man7/fips_module.html
diff --git a/native/NMAKEmakefile b/native/NMAKEmakefile
index 1c91b5c..224d135 100644
--- a/native/NMAKEmakefile
+++ b/native/NMAKEmakefile
@@ -83,40 +83,20 @@ LFLAGS = $(LFLAGS) libeay32.lib ssleay32.lib
!ENDIF
CFLAGS = $(CFLAGS) -DZLIB_WINAPI -DNO_IDEA -DNO_RC5 -DNO_MDC2 -DOPENSSL_NO_IDEA \
- -DOPENSSL_NO_RC5 -DOPENSSL_NO_MDC2 -DHAVE_OPENSSL -DHAVE_SSL_SET_STATE=1
+ -DOPENSSL_NO_RC5 -DOPENSSL_NO_MDC2 -DHAVE_SSL_SET_STATE=1
PDBFLAGS = -Fo$(WORKDIR)\ -Fd$(WORKDIR)\$(PROJECT)-src
OBJECTS = \
- $(WORKDIR)\address.obj \
$(WORKDIR)\bb.obj \
- $(WORKDIR)\dir.obj \
$(WORKDIR)\error.obj \
- $(WORKDIR)\file.obj \
- $(WORKDIR)\info.obj \
$(WORKDIR)\jnilib.obj \
- $(WORKDIR)\lock.obj \
- $(WORKDIR)\misc.obj \
- $(WORKDIR)\mmap.obj \
- $(WORKDIR)\multicast.obj \
- $(WORKDIR)\network.obj \
- $(WORKDIR)\os.obj \
- $(WORKDIR)\poll.obj \
$(WORKDIR)\pool.obj \
- $(WORKDIR)\proc.obj \
- $(WORKDIR)\shm.obj \
$(WORKDIR)\ssl.obj \
$(WORKDIR)\sslcontext.obj \
$(WORKDIR)\sslconf.obj \
- $(WORKDIR)\sslinfo.obj \
- $(WORKDIR)\sslnetwork.obj \
$(WORKDIR)\sslutils.obj \
- $(WORKDIR)\stdlib.obj \
- $(WORKDIR)\user.obj \
- $(WORKDIR)\thread.obj \
- $(WORKDIR)\ntpipe.obj \
- $(WORKDIR)\registry.obj \
- $(WORKDIR)\system.obj
+ $(WORKDIR)\system.obj
!IF DEFINED(WITH_FIPS)
OBJECTS = $(OBJECTS) srclib\openssl\tmp32\fips_premain.obj
!ENDIF
diff --git a/native/NMAKEmakefile.inc b/native/NMAKEmakefile.inc
index 257d30b..0b380b4 100644
--- a/native/NMAKEmakefile.inc
+++ b/native/NMAKEmakefile.inc
@@ -146,19 +146,7 @@ WINVER=WIN7
!ENDIF
-!IF "$(WINVER)" == "WIN2K"
-NMAKE_WINVER = 0x0500
-_WIN32_IE = 0x0500
-!ELSEIF "$(WINVER)" == "WINXP"
-NMAKE_WINVER = 0x0501
-_WIN32_IE = 0x0600
-!ELSEIF "$(WINVER)" == "WIN2003"
-NMAKE_WINVER = 0x0502
-_WIN32_IE = 0x0600
-!ELSEIF "$(WINVER)" == "VISTA"
-NMAKE_WINVER = 0x0600
-_WIN32_IE = 0x0700
-!ELSEIF "$(WINVER)" == "WIN7"
+!IF "$(WINVER)" == "WIN7"
NMAKE_WINVER = 0x0601
_WIN32_IE = 0x0800
!ELSEIF "$(WINVER)" == "WIN8"
@@ -171,7 +159,7 @@ _WIN32_IE = 0x0A00
NMAKE_WINVER = 0x0A00
_WIN32_IE = 0x0A00
!ELSE
-!ERROR Must specify WINVER environment variable (WIN2K, WINXP, WIN2003, VISTA, WIN7, WIN8, WIN81, WIN10)
+!ERROR Must specify WINVER environment variable (WIN7, WIN8, WIN81, WIN10)
!ENDIF
NMAKE_WINNT = -DWINNT -D_WINNT -D_WIN32_WINNT=$(NMAKE_WINVER) -DWINVER=$(NMAKE_WINVER) -D_WIN32_IE=$(_WIN32_IE) -DPSAPI_VERSION=1
diff --git a/native/build-outputs.mk b/native/build-outputs.mk
index 5bba367..39b8786 100644
--- a/native/build-outputs.mk
+++ b/native/build-outputs.mk
@@ -1,40 +1,17 @@
# DO NOT EDIT. AUTOMATICALLY GENERATED.
-src/address.lo: src/address.c .make.dirs include/tcn.h include/tcn_api.h
src/bb.lo: src/bb.c .make.dirs include/tcn.h include/tcn_api.h
-src/dir.lo: src/dir.c .make.dirs include/tcn.h include/tcn_api.h
src/error.lo: src/error.c .make.dirs include/tcn.h include/tcn_api.h
-src/file.lo: src/file.c .make.dirs include/tcn.h include/tcn_api.h
-src/info.lo: src/info.c .make.dirs include/tcn.h include/tcn_api.h
src/jnilib.lo: src/jnilib.c .make.dirs include/tcn.h include/tcn_api.h include/tcn_version.h
-src/lock.lo: src/lock.c .make.dirs include/tcn.h include/tcn_api.h
-src/misc.lo: src/misc.c .make.dirs include/tcn.h include/tcn_api.h
-src/mmap.lo: src/mmap.c .make.dirs include/tcn.h include/tcn_api.h
-src/multicast.lo: src/multicast.c .make.dirs include/tcn.h include/tcn_api.h
-src/network.lo: src/network.c .make.dirs include/tcn.h include/tcn_api.h
-src/os.lo: src/os.c .make.dirs include/tcn.h include/tcn_api.h
-src/poll.lo: src/poll.c .make.dirs include/tcn.h include/tcn_api.h
src/pool.lo: src/pool.c .make.dirs include/tcn.h include/tcn_api.h
-src/proc.lo: src/proc.c .make.dirs include/tcn.h include/tcn_api.h
-src/shm.lo: src/shm.c .make.dirs include/tcn.h include/tcn_api.h
src/ssl.lo: src/ssl.c .make.dirs include/ssl_private.h include/tcn.h include/tcn_api.h
src/sslconf.lo: src/sslconf.c .make.dirs include/ssl_private.h include/tcn.h include/tcn_api.h
src/sslcontext.lo: src/sslcontext.c .make.dirs include/ssl_private.h include/tcn.h include/tcn_api.h
-src/sslinfo.lo: src/sslinfo.c .make.dirs include/ssl_private.h include/tcn.h include/tcn_api.h
-src/sslnetwork.lo: src/sslnetwork.c .make.dirs include/ssl_private.h include/tcn.h include/tcn_api.h
src/sslutils.lo: src/sslutils.c .make.dirs include/ssl_private.h include/tcn.h include/tcn_api.h
-src/stdlib.lo: src/stdlib.c .make.dirs include/tcn.h include/tcn_api.h
-src/thread.lo: src/thread.c .make.dirs include/tcn.h include/tcn_api.h
-src/user.lo: src/user.c .make.dirs include/tcn.h include/tcn_api.h
-OBJECTS_all = src/address.lo src/bb.lo src/dir.lo src/error.lo src/file.lo src/info.lo src/jnilib.lo src/lock.lo src/misc.lo src/mmap.lo src/multicast.lo src/network.lo src/os.lo src/poll.lo src/pool.lo src/proc.lo src/shm.lo src/ssl.lo src/sslconf.lo src/sslcontext.lo src/sslinfo.lo src/sslnetwork.lo src/sslutils.lo src/stdlib.lo src/thread.lo src/user.lo
+OBJECTS_all = src/bb.lo src/error.lo src/jnilib.lo src/pool.lo src/ssl.lo src/sslconf.lo src/sslcontext.lo src/sslutils.lo
-os/unix/system.lo: os/unix/system.c .make.dirs include/tcn.h include/tcn_api.h
-os/unix/uxpipe.lo: os/unix/uxpipe.c .make.dirs include/tcn.h include/tcn_api.h
-
-OBJECTS_os_unix = os/unix/system.lo os/unix/uxpipe.lo
-
-OBJECTS_unix = $(OBJECTS_all) $(OBJECTS_os_unix)
+OBJECTS_unix = $(OBJECTS_all)
OBJECTS_aix = $(OBJECTS_all) $(OBJECTS_os_unix)
@@ -44,19 +21,17 @@ OBJECTS_os2 = $(OBJECTS_all) $(OBJECTS_os_unix)
OBJECTS_os390 = $(OBJECTS_all) $(OBJECTS_os_unix)
-os/win32/ntpipe.lo: os/win32/ntpipe.c .make.dirs include/tcn.h include/tcn_api.h
-os/win32/registry.lo: os/win32/registry.c .make.dirs include/tcn.h include/tcn_api.h
os/win32/system.lo: os/win32/system.c .make.dirs include/ssl_private.h include/tcn.h include/tcn_api.h
-OBJECTS_os_win32 = os/win32/ntpipe.lo os/win32/registry.lo os/win32/system.lo
+OBJECTS_os_win32 = os/win32/system.lo
OBJECTS_win32 = $(OBJECTS_all) $(OBJECTS_os_win32)
HEADERS = $(top_srcdir)/include/ssl_private.h $(top_srcdir)/include/tcn.h $(top_srcdir)/include/tcn_api.h $(top_srcdir)/include/tcn_version.h
-SOURCE_DIRS = src os/unix os/win32 $(EXTRA_SOURCE_DIRS)
+SOURCE_DIRS = src os/win32 $(EXTRA_SOURCE_DIRS)
-BUILD_DIRS = os os/unix os/win32 src
+BUILD_DIRS = os os/win32 src
.make.dirs: $(srcdir)/build-outputs.mk
@for d in $(BUILD_DIRS); do test -d $$d || mkdir $$d; done
diff --git a/native/build/apr_common.m4 b/native/build/apr_common.m4
index f4e2dfd..ac2312c 100644
--- a/native/build/apr_common.m4
+++ b/native/build/apr_common.m4
@@ -451,43 +451,6 @@ fi
])
-dnl
-dnl APR_CHECK_SIZEOF_EXTENDED(INCLUDES, TYPE [, CROSS_SIZE])
-dnl
-dnl A variant of AC_CHECK_SIZEOF which allows the checking of
-dnl sizes of non-builtin types
-dnl
-AC_DEFUN([APR_CHECK_SIZEOF_EXTENDED],
-[changequote(<<, >>)dnl
-dnl The name to #define.
-define(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl
-dnl The cache variable name.
-define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$2, [ *], [_p]))dnl
-changequote([, ])dnl
-AC_MSG_CHECKING(size of $2)
-AC_CACHE_VAL(AC_CV_NAME,
-[AC_TRY_RUN([#include <stdio.h>
-$1
-#ifdef WIN32
-#define binmode "b"
-#else
-#define binmode
-#endif
-main()
-{
- FILE *f=fopen("conftestval", "w" binmode);
- if (!f) exit(1);
- fprintf(f, "%d\n", sizeof($2));
- exit(0);
-}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,,
-AC_CV_NAME=$3))])dnl
-AC_MSG_RESULT($AC_CV_NAME)
-AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The size of ]$2)
-undefine([AC_TYPE_NAME])dnl
-undefine([AC_CV_NAME])dnl
-])
-
-
dnl
dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY,
dnl [ACTIONS-IF-NO-WARNINGS], [ACTIONS-IF-WARNINGS])
@@ -505,7 +468,10 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
fi
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
- [#include "confdefs.h"
+ [
+#ifndef PACKAGE_NAME
+#include "confdefs.h"
+#endif
]
[[$1]]
[int main(int argc, const char *const *argv) {]
@@ -526,12 +492,14 @@ dnl string.
dnl
dnl
AC_DEFUN([APR_CHECK_STRERROR_R_RC], [
-AC_MSG_CHECKING(for type of return code from strerror_r)
-AC_TRY_RUN([
+AC_CACHE_CHECK([whether return code from strerror_r has type int],
+[ac_cv_strerror_r_rc_int],
+[AC_TRY_RUN([
#include <errno.h>
#include <string.h>
#include <stdio.h>
-main()
+#include <stdlib.h>
+int main(void)
{
char buf[1024];
if (strerror_r(ERANGE, buf, sizeof buf) < 1) {
@@ -543,14 +511,10 @@ main()
}], [
ac_cv_strerror_r_rc_int=yes ], [
ac_cv_strerror_r_rc_int=no ], [
- ac_cv_strerror_r_rc_int=no ] )
+ ac_cv_strerror_r_rc_int=no ] ) ] )
if test "x$ac_cv_strerror_r_rc_int" = xyes; then
AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int])
- msg="int"
-else
- msg="pointer"
fi
-AC_MSG_RESULT([$msg])
] )
dnl
diff --git a/native/build/config.guess b/native/build/config.guess
index 0f9b29c..e81d3ae 100755
--- a/native/build/config.guess
+++ b/native/build/config.guess
@@ -1,8 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2019 Free Software Foundation, Inc.
+# Copyright 1992-2021 Free Software Foundation, Inc.
-timestamp='2019-01-01'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2021-06-03'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -27,11 +29,19 @@ timestamp='2019-01-01'
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
-# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
#
# Please send patches to <config-patches@gnu.org>.
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX. However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
+
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
@@ -50,7 +60,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2019 Free Software Foundation, Inc.
+Copyright 1992-2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -84,6 +94,9 @@ if test $# != 0; then
exit 1
fi
+# Just in case it came from the environment.
+GUESS=
+
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
@@ -99,8 +112,10 @@ tmp=
trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
set_cc_for_build() {
+ # prevent multiple calls if $tmp is already set
+ test "$tmp" && return 0
: "${TMPDIR=/tmp}"
- # shellcheck disable=SC2039
+ # shellcheck disable=SC2039,SC3028
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
@@ -110,7 +125,7 @@ set_cc_for_build() {
,,) echo "int x;" > "$dummy.c"
for driver in cc gcc c89 c99 ; do
if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$driver"
+ CC_FOR_BUILD=$driver
break
fi
done
@@ -131,14 +146,12 @@ fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-case "$UNAME_SYSTEM" in
+case $UNAME_SYSTEM in
Linux|GNU|GNU/*)
- # If the system lacks a compiler, then just pick glibc.
- # We could probably try harder.
- LIBC=gnu
+ LIBC=unknown
set_cc_for_build
cat <<-EOF > "$dummy.c"
@@ -147,24 +160,37 @@ Linux|GNU|GNU/*)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
- #else
+ #elif defined(__GLIBC__)
LIBC=gnu
+ #else
+ #include <stdarg.h>
+ /* First heuristic to detect musl libc. */
+ #ifdef __DEFINED_va_list
+ LIBC=musl
+ #endif
#endif
EOF
- eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
+ cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+ eval "$cc_set_libc"
- # If ldd exists, use it to detect musl libc.
- if command -v ldd >/dev/null && \
- ldd --version 2>&1 | grep -q ^musl
- then
- LIBC=musl
+ # Second heuristic to detect musl libc.
+ if [ "$LIBC" = unknown ] &&
+ command -v ldd >/dev/null &&
+ ldd --version 2>&1 | grep -q ^musl; then
+ LIBC=musl
+ fi
+
+ # If the system lacks a compiler, then just pick glibc.
+ # We could probably try harder.
+ if [ "$LIBC" = unknown ]; then
+ LIBC=gnu
fi
;;
esac
# Note: order is significant - the case branches are not exclusive.
-case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
+case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
@@ -176,12 +202,12 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
- "/sbin/$sysctl" 2>/dev/null || \
- "/usr/sbin/$sysctl" 2>/dev/null || \
+ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
+ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
echo unknown)`
- case "$UNAME_MACHINE_ARCH" in
+ case $UNAME_MACHINE_ARCH in
+ aarch64eb) machine=aarch64_be-unknown ;;
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
@@ -190,13 +216,13 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
earmv*)
arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
- machine="${arch}${endian}"-unknown
+ machine=${arch}${endian}-unknown
;;
- *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
+ *) machine=$UNAME_MACHINE_ARCH-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently (or will in the future) and ABI.
- case "$UNAME_MACHINE_ARCH" in
+ case $UNAME_MACHINE_ARCH in
earm*)
os=netbsdelf
;;
@@ -217,7 +243,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
;;
esac
# Determine ABI tags.
- case "$UNAME_MACHINE_ARCH" in
+ case $UNAME_MACHINE_ARCH in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
@@ -228,7 +254,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
- case "$UNAME_VERSION" in
+ case $UNAME_VERSION in
Debian*)
release='-gnu'
;;
@@ -239,45 +265,57 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "$machine-${os}${release}${abi-}"
- exit ;;
+ GUESS=$machine-${os}${release}${abi-}
+ ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
+ ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
+ ;;
+ *:SecBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
+ GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
+ ;;
*:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
- echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
+ ;;
*:MidnightBSD:*:*)
- echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
+ ;;
*:ekkoBSD:*:*)
- echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
+ ;;
*:SolidBSD:*:*)
- echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
+ ;;
+ *:OS108:*:*)
+ GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
+ ;;
macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
+ ;;
*:MirBSD:*:*)
- echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
+ ;;
*:Sortix:*:*)
- echo "$UNAME_MACHINE"-unknown-sortix
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-sortix
+ ;;
+ *:Twizzler:*:*)
+ GUESS=$UNAME_MACHINE-unknown-twizzler
+ ;;
*:Redox:*:*)
- echo "$UNAME_MACHINE"-unknown-redox
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-redox
+ ;;
mips:OSF1:*.*)
- echo mips-dec-osf1
- exit ;;
+ GUESS=mips-dec-osf1
+ ;;
alpha:OSF1:*:*)
+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+ trap '' 0
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@@ -291,7 +329,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
+ case $ALPHA_CPU_TYPE in
"EV4 (21064)")
UNAME_MACHINE=alpha ;;
"EV4.5 (21064)")
@@ -328,75 +366,76 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
- # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
- exitcode=$?
- trap '' 0
- exit $exitcode ;;
+ OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+ GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
+ ;;
Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
+ GUESS=m68k-unknown-sysv4
+ ;;
*:[Aa]miga[Oo][Ss]:*:*)
- echo "$UNAME_MACHINE"-unknown-amigaos
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-amigaos
+ ;;
*:[Mm]orph[Oo][Ss]:*:*)
- echo "$UNAME_MACHINE"-unknown-morphos
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-morphos
+ ;;
*:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
+ GUESS=i370-ibm-openedition
+ ;;
*:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
+ GUESS=s390-ibm-zvmoe
+ ;;
*:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
+ GUESS=powerpc-ibm-os400
+ ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix"$UNAME_RELEASE"
- exit ;;
+ GUESS=arm-acorn-riscix$UNAME_RELEASE
+ ;;
arm*:riscos:*:*|arm*:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
+ GUESS=arm-unknown-riscos
+ ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
+ GUESS=hppa1.1-hitachi-hiuxmpp
+ ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
+ case `(/bin/universe) 2>/dev/null` in
+ att) GUESS=pyramid-pyramid-sysv3 ;;
+ *) GUESS=pyramid-pyramid-bsd ;;
+ esac
+ ;;
NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
+ GUESS=pyramid-pyramid-svr4
+ ;;
DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
+ GUESS=sparc-icl-nx6
+ ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
+ sparc) GUESS=sparc-icl-nx7 ;;
+ esac
+ ;;
s390x:SunOS:*:*)
- echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
+ ;;
sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=sparc-hal-solaris2$SUN_REL
+ ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=sparc-sun-solaris2$SUN_REL
+ ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux"$UNAME_RELEASE"
- exit ;;
+ GUESS=i386-pc-auroraux$UNAME_RELEASE
+ ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
set_cc_for_build
SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
@@ -404,41 +443,44 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
SUN_ARCH=x86_64
fi
fi
- echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
+ ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=sparc-sun-solaris3$SUN_REL
+ ;;
sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
+ case `/usr/bin/arch -k` in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
+ GUESS=sparc-sun-sunos$SUN_REL
+ ;;
sun3*:SunOS:*:*)
- echo m68k-sun-sunos"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-sun-sunos$UNAME_RELEASE
+ ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
- case "`/bin/arch`" in
+ case `/bin/arch` in
sun3)
- echo m68k-sun-sunos"$UNAME_RELEASE"
+ GUESS=m68k-sun-sunos$UNAME_RELEASE
;;
sun4)
- echo sparc-sun-sunos"$UNAME_RELEASE"
+ GUESS=sparc-sun-sunos$UNAME_RELEASE
;;
esac
- exit ;;
+ ;;
aushp:SunOS:*:*)
- echo sparc-auspex-sunos"$UNAME_RELEASE"
- exit ;;
+ GUESS=sparc-auspex-sunos$UNAME_RELEASE
+ ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
@@ -448,41 +490,41 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-atari-mint$UNAME_RELEASE
+ ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-atari-mint$UNAME_RELEASE
+ ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-atari-mint$UNAME_RELEASE
+ ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-milan-mint$UNAME_RELEASE
+ ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-hades-mint$UNAME_RELEASE
+ ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-unknown-mint$UNAME_RELEASE
+ ;;
m68k:machten:*:*)
- echo m68k-apple-machten"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-apple-machten$UNAME_RELEASE
+ ;;
powerpc:machten:*:*)
- echo powerpc-apple-machten"$UNAME_RELEASE"
- exit ;;
+ GUESS=powerpc-apple-machten$UNAME_RELEASE
+ ;;
RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
+ GUESS=mips-dec-mach_bsd4.3
+ ;;
RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix"$UNAME_RELEASE"
- exit ;;
+ GUESS=mips-dec-ultrix$UNAME_RELEASE
+ ;;
VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix"$UNAME_RELEASE"
- exit ;;
+ GUESS=vax-dec-ultrix$UNAME_RELEASE
+ ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix"$UNAME_RELEASE"
- exit ;;
+ GUESS=clipper-intergraph-clix$UNAME_RELEASE
+ ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
@@ -510,75 +552,76 @@ EOF
dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
{ echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos"$UNAME_RELEASE"
- exit ;;
+ GUESS=mips-mips-riscos$UNAME_RELEASE
+ ;;
Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
+ GUESS=powerpc-motorola-powermax
+ ;;
Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
+ GUESS=powerpc-harris-powermax
+ ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
+ GUESS=powerpc-harris-powermax
+ ;;
Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
+ GUESS=powerpc-harris-powerunix
+ ;;
m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
+ GUESS=m88k-harris-cxux7
+ ;;
m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
+ GUESS=m88k-motorola-sysv4
+ ;;
m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
+ GUESS=m88k-motorola-sysv3
+ ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
+ if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
then
- if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
- [ "$TARGET_BINARY_INTERFACE"x = x ]
+ if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
+ test "$TARGET_BINARY_INTERFACE"x = x
then
- echo m88k-dg-dgux"$UNAME_RELEASE"
+ GUESS=m88k-dg-dgux$UNAME_RELEASE
else
- echo m88k-dg-dguxbcs"$UNAME_RELEASE"
+ GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
fi
else
- echo i586-dg-dgux"$UNAME_RELEASE"
+ GUESS=i586-dg-dgux$UNAME_RELEASE
fi
- exit ;;
+ ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
+ GUESS=m88k-dolphin-sysv3
+ ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
+ GUESS=m88k-motorola-sysv3
+ ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
+ GUESS=m88k-tektronix-sysv3
+ ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
+ GUESS=m68k-tektronix-bsd
+ ;;
*:IRIX*:*:*)
- echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
- exit ;;
+ IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
+ GUESS=mips-sgi-irix$IRIX_REL
+ ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
+ GUESS=i386-ibm-aix
+ ;;
ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
+ if test -x /usr/bin/oslevel ; then
IBM_REV=`/usr/bin/oslevel`
else
- IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
+ IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
fi
- echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
- exit ;;
+ GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
+ ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
set_cc_for_build
@@ -595,16 +638,16 @@ EOF
EOF
if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
then
- echo "$SYSTEM_NAME"
+ GUESS=$SYSTEM_NAME
else
- echo rs6000-ibm-aix3.2.5
+ GUESS=rs6000-ibm-aix3.2.5
fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
+ GUESS=rs6000-ibm-aix3.2.4
else
- echo rs6000-ibm-aix3.2
+ GUESS=rs6000-ibm-aix3.2
fi
- exit ;;
+ ;;
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
@@ -612,56 +655,56 @@ EOF
else
IBM_ARCH=powerpc
fi
- if [ -x /usr/bin/lslpp ] ; then
- IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+ if test -x /usr/bin/lslpp ; then
+ IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
- IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
+ IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
fi
- echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
- exit ;;
+ GUESS=$IBM_ARCH-ibm-aix$IBM_REV
+ ;;
*:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
+ GUESS=rs6000-ibm-aix
+ ;;
ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
+ GUESS=romp-ibm-bsd4.4
+ ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
+ GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to
+ ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
+ GUESS=rs6000-bull-bosx
+ ;;
DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
+ GUESS=m68k-bull-sysv3
+ ;;
9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
+ GUESS=m68k-hp-bsd
+ ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
+ GUESS=m68k-hp-bsd4.4
+ ;;
9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
- case "$UNAME_MACHINE" in
+ HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+ case $UNAME_MACHINE in
9000/31?) HP_ARCH=m68000 ;;
9000/[34]??) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
+ if test -x /usr/bin/getconf; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "$sc_cpu_version" in
+ case $sc_cpu_version in
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
- case "$sc_kernel_bits" in
+ case $sc_kernel_bits in
32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;;
esac
fi
- if [ "$HP_ARCH" = "" ]; then
+ if test "$HP_ARCH" = ""; then
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
@@ -700,7 +743,7 @@ EOF
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
- if [ "$HP_ARCH" = hppa2.0w ]
+ if test "$HP_ARCH" = hppa2.0w
then
set_cc_for_build
@@ -721,12 +764,12 @@ EOF
HP_ARCH=hppa64
fi
fi
- echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
- exit ;;
+ GUESS=$HP_ARCH-hp-hpux$HPUX_REV
+ ;;
ia64:HP-UX:*:*)
- HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux"$HPUX_REV"
- exit ;;
+ HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+ GUESS=ia64-hp-hpux$HPUX_REV
+ ;;
3050*:HI-UX:*:*)
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
@@ -756,36 +799,36 @@ EOF
EOF
$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
{ echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
+ GUESS=unknown-hitachi-hiuxwe2
+ ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
- echo hppa1.1-hp-bsd
- exit ;;
+ GUESS=hppa1.1-hp-bsd
+ ;;
9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
+ GUESS=hppa1.0-hp-bsd
+ ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
+ GUESS=hppa1.0-hp-mpeix
+ ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
- echo hppa1.1-hp-osf
- exit ;;
+ GUESS=hppa1.1-hp-osf
+ ;;
hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
+ GUESS=hppa1.0-hp-osf
+ ;;
i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo "$UNAME_MACHINE"-unknown-osf1mk
+ if test -x /usr/sbin/sysversion ; then
+ GUESS=$UNAME_MACHINE-unknown-osf1mk
else
- echo "$UNAME_MACHINE"-unknown-osf1
+ GUESS=$UNAME_MACHINE-unknown-osf1
fi
- exit ;;
+ ;;
parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
+ GUESS=hppa1.1-hp-lites
+ ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
+ GUESS=c1-convex-bsd
+ ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
@@ -793,17 +836,18 @@ EOF
fi
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
+ GUESS=c34-convex-bsd
+ ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
+ GUESS=c38-convex-bsd
+ ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
+ GUESS=c4-convex-bsd
+ ;;
CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=ymp-cray-unicos$CRAY_REL
+ ;;
CRAY*[A-Z]90:*:*:*)
echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
@@ -811,114 +855,126 @@ EOF
-e 's/\.[^.]*$/.X/'
exit ;;
CRAY*TS:*:*:*)
- echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=t90-cray-unicos$CRAY_REL
+ ;;
CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=alphaev5-cray-unicosmk$CRAY_REL
+ ;;
CRAY*SV1:*:*:*)
- echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=sv1-cray-unicos$CRAY_REL
+ ;;
*:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=craynv-cray-unicosmp$CRAY_REL
+ ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
+ GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+ ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
+ GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+ ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
+ ;;
sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi"$UNAME_RELEASE"
- exit ;;
+ GUESS=sparc-unknown-bsdi$UNAME_RELEASE
+ ;;
*:BSD/OS:*:*)
- echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
+ ;;
arm:FreeBSD:*:*)
UNAME_PROCESSOR=`uname -p`
set_cc_for_build
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi
+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
else
- echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf
+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
fi
- exit ;;
+ ;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
- case "$UNAME_PROCESSOR" in
+ case $UNAME_PROCESSOR in
amd64)
UNAME_PROCESSOR=x86_64 ;;
i386)
UNAME_PROCESSOR=i586 ;;
esac
- echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
- exit ;;
+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
+ ;;
i*:CYGWIN*:*)
- echo "$UNAME_MACHINE"-pc-cygwin
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-cygwin
+ ;;
*:MINGW64*:*)
- echo "$UNAME_MACHINE"-pc-mingw64
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-mingw64
+ ;;
*:MINGW*:*)
- echo "$UNAME_MACHINE"-pc-mingw32
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-mingw32
+ ;;
*:MSYS*:*)
- echo "$UNAME_MACHINE"-pc-msys
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-msys
+ ;;
i*:PW*:*)
- echo "$UNAME_MACHINE"-pc-pw32
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-pw32
+ ;;
*:Interix*:*)
- case "$UNAME_MACHINE" in
+ case $UNAME_MACHINE in
x86)
- echo i586-pc-interix"$UNAME_RELEASE"
- exit ;;
+ GUESS=i586-pc-interix$UNAME_RELEASE
+ ;;
authenticamd | genuineintel | EM64T)
- echo x86_64-unknown-interix"$UNAME_RELEASE"
- exit ;;
+ GUESS=x86_64-unknown-interix$UNAME_RELEASE
+ ;;
IA64)
- echo ia64-unknown-interix"$UNAME_RELEASE"
- exit ;;
+ GUESS=ia64-unknown-interix$UNAME_RELEASE
+ ;;
esac ;;
i*:UWIN*:*)
- echo "$UNAME_MACHINE"-pc-uwin
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-uwin
+ ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-pc-cygwin
- exit ;;
+ GUESS=x86_64-pc-cygwin
+ ;;
prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=powerpcle-unknown-solaris2$SUN_REL
+ ;;
*:GNU:*:*)
# the GNU system
- echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
- exit ;;
+ GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
+ GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
+ GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
+ ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
- exit ;;
+ GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
+ GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
+ ;;
*:Minix:*:*)
- echo "$UNAME_MACHINE"-unknown-minix
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-minix
+ ;;
aarch64:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
@@ -929,183 +985,225 @@ EOF
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
- arc:Linux:*:* | arceb:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
arm*:Linux:*:*)
set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
+ GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
else
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
+ GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
fi
fi
- exit ;;
+ ;;
avr32*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
cris:Linux:*:*)
- echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+ ;;
crisv32:Linux:*:*)
- echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+ ;;
e2k:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
frv:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
hexagon:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
i*86:Linux:*:*)
- echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-linux-$LIBC
+ ;;
ia64:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
k1om:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
m32r*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
m68*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
mips:Linux:*:* | mips64:Linux:*:*)
set_cc_for_build
+ IS_GLIBC=0
+ test x"${LIBC}" = xgnu && IS_GLIBC=1
sed 's/^ //' << EOF > "$dummy.c"
#undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
+ #undef mips
+ #undef mipsel
+ #undef mips64
+ #undef mips64el
+ #if ${IS_GLIBC} && defined(_ABI64)
+ LIBCABI=gnuabi64
+ #else
+ #if ${IS_GLIBC} && defined(_ABIN32)
+ LIBCABI=gnuabin32
+ #else
+ LIBCABI=${LIBC}
+ #endif
+ #endif
+
+ #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+ CPU=mipsisa64r6
+ #else
+ #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+ CPU=mipsisa32r6
+ #else
+ #if defined(__mips64)
+ CPU=mips64
+ #else
+ CPU=mips
+ #endif
+ #endif
+ #endif
+
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
+ MIPS_ENDIAN=el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
+ MIPS_ENDIAN=
#else
- CPU=
+ MIPS_ENDIAN=
#endif
#endif
EOF
- eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
- test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
+ cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
+ eval "$cc_set_vars"
+ test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
;;
mips64el:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
openrisc*:Linux:*:*)
- echo or1k-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=or1k-unknown-linux-$LIBC
+ ;;
or32:Linux:*:* | or1k*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
padre:Linux:*:*)
- echo sparc-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=sparc-unknown-linux-$LIBC
+ ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=hppa64-unknown-linux-$LIBC
+ ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
- PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
- *) echo hppa-unknown-linux-"$LIBC" ;;
+ PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
+ PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
+ *) GUESS=hppa-unknown-linux-$LIBC ;;
esac
- exit ;;
+ ;;
ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=powerpc64-unknown-linux-$LIBC
+ ;;
ppc:Linux:*:*)
- echo powerpc-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=powerpc-unknown-linux-$LIBC
+ ;;
ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=powerpc64le-unknown-linux-$LIBC
+ ;;
ppcle:Linux:*:*)
- echo powerpcle-unknown-linux-"$LIBC"
- exit ;;
- riscv32:Linux:*:* | riscv64:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=powerpcle-unknown-linux-$LIBC
+ ;;
+ riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
+ ;;
sh64*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
sh*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
tile*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
vax:Linux:*:*)
- echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-dec-linux-$LIBC
+ ;;
x86_64:Linux:*:*)
- echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
- exit ;;
+ set_cc_for_build
+ LIBCABI=$LIBC
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
+ if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_X32 >/dev/null
+ then
+ LIBCABI=${LIBC}x32
+ fi
+ fi
+ GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
+ ;;
xtensa*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
+ GUESS=i386-sequent-sysv4
+ ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
- echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
+ ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
- echo "$UNAME_MACHINE"-pc-os2-emx
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-os2-emx
+ ;;
i*86:XTS-300:*:STOP)
- echo "$UNAME_MACHINE"-unknown-stop
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-stop
+ ;;
i*86:atheos:*:*)
- echo "$UNAME_MACHINE"-unknown-atheos
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-atheos
+ ;;
i*86:syllable:*:*)
- echo "$UNAME_MACHINE"-pc-syllable
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-syllable
+ ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
- echo i386-unknown-lynxos"$UNAME_RELEASE"
- exit ;;
+ GUESS=i386-unknown-lynxos$UNAME_RELEASE
+ ;;
i*86:*DOS:*:*)
- echo "$UNAME_MACHINE"-pc-msdosdjgpp
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-msdosdjgpp
+ ;;
i*86:*:4.*:*)
UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
+ GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
else
- echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
+ GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
fi
- exit ;;
+ ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
@@ -1113,12 +1211,12 @@ EOF
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
- echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
+ GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
@@ -1128,11 +1226,11 @@ EOF
&& UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
- echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
+ GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
else
- echo "$UNAME_MACHINE"-pc-sysv32
+ GUESS=$UNAME_MACHINE-pc-sysv32
fi
- exit ;;
+ ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
@@ -1140,31 +1238,31 @@ EOF
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build.
- echo i586-pc-msdosdjgpp
- exit ;;
+ GUESS=i586-pc-msdosdjgpp
+ ;;
Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
+ GUESS=i386-pc-mach3
+ ;;
paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
+ GUESS=i860-intel-osf1
+ ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
+ GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4
+ GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4
fi
- exit ;;
+ ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
- echo m68010-convergent-sysv
- exit ;;
+ GUESS=m68010-convergent-sysv
+ ;;
mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
+ GUESS=m68k-convergent-sysv
+ ;;
M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
+ GUESS=m68k-diab-dnix
+ ;;
M68*:*:R3V[5678]*:*)
test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
@@ -1189,253 +1287,401 @@ EOF
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-unknown-lynxos$UNAME_RELEASE
+ ;;
mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
+ GUESS=m68k-atari-sysv4
+ ;;
TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos"$UNAME_RELEASE"
- exit ;;
+ GUESS=sparc-unknown-lynxos$UNAME_RELEASE
+ ;;
rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos"$UNAME_RELEASE"
- exit ;;
+ GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
+ ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
- echo powerpc-unknown-lynxos"$UNAME_RELEASE"
- exit ;;
+ GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
+ ;;
SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv"$UNAME_RELEASE"
- exit ;;
+ GUESS=mips-dde-sysv$UNAME_RELEASE
+ ;;
RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
+ GUESS=mips-sni-sysv4
+ ;;
RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
+ GUESS=mips-sni-sysv4
+ ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo "$UNAME_MACHINE"-sni-sysv4
+ GUESS=$UNAME_MACHINE-sni-sysv4
else
- echo ns32k-sni-sysv
+ GUESS=ns32k-sni-sysv
fi
- exit ;;
+ ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
+ GUESS=i586-unisys-sysv4
+ ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
+ GUESS=hppa1.1-stratus-sysv4
+ ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
+ GUESS=i860-stratus-sysv4
+ ;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
- echo "$UNAME_MACHINE"-stratus-vos
- exit ;;
+ GUESS=$UNAME_MACHINE-stratus-vos
+ ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
+ GUESS=hppa1.1-stratus-vos
+ ;;
mc68*:A/UX:*:*)
- echo m68k-apple-aux"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-apple-aux$UNAME_RELEASE
+ ;;
news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
+ GUESS=mips-sony-newsos6
+ ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv"$UNAME_RELEASE"
+ if test -d /usr/nec; then
+ GUESS=mips-nec-sysv$UNAME_RELEASE
else
- echo mips-unknown-sysv"$UNAME_RELEASE"
+ GUESS=mips-unknown-sysv$UNAME_RELEASE
fi
- exit ;;
+ ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
+ GUESS=powerpc-be-beos
+ ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
+ GUESS=powerpc-apple-beos
+ ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
+ GUESS=i586-pc-beos
+ ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
+ GUESS=i586-pc-haiku
+ ;;
x86_64:Haiku:*:*)
- echo x86_64-unknown-haiku
- exit ;;
+ GUESS=x86_64-unknown-haiku
+ ;;
SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sx4-nec-superux$UNAME_RELEASE
+ ;;
SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sx5-nec-superux$UNAME_RELEASE
+ ;;
SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sx6-nec-superux$UNAME_RELEASE
+ ;;
SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sx7-nec-superux$UNAME_RELEASE
+ ;;
SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sx8-nec-superux$UNAME_RELEASE
+ ;;
SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sx8r-nec-superux$UNAME_RELEASE
+ ;;
SX-ACE:SUPER-UX:*:*)
- echo sxace-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sxace-nec-superux$UNAME_RELEASE
+ ;;
Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody"$UNAME_RELEASE"
- exit ;;
+ GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
+ ;;
*:Rhapsody:*:*)
- echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
+ ;;
+ arm64:Darwin:*:*)
+ GUESS=aarch64-apple-darwin$UNAME_RELEASE
+ ;;
*:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- set_cc_for_build
- if test "$UNAME_PROCESSOR" = unknown ; then
- UNAME_PROCESSOR=powerpc
+ UNAME_PROCESSOR=`uname -p`
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ if command -v xcode-select > /dev/null 2> /dev/null && \
+ ! xcode-select --print-path > /dev/null 2> /dev/null ; then
+ # Avoid executing cc if there is no toolchain installed as
+ # cc will be a stub that puts up a graphical alert
+ # prompting the user to install developer tools.
+ CC_FOR_BUILD=no_compiler_found
+ else
+ set_cc_for_build
fi
- if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
- fi
- # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
- if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_PPC >/dev/null
- then
- UNAME_PROCESSOR=powerpc
- fi
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+ if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_PPC >/dev/null
+ then
+ UNAME_PROCESSOR=powerpc
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
- # Avoid executing cc on OS X 10.9, as it ships with a stub
- # that puts up a graphical alert prompting to install
- # developer tools. Any system running Mac OS X 10.7 or
- # later (Darwin 11 and later) is required to have a 64-bit
- # processor. This is not true of the ARM version of Darwin
- # that Apple uses in portable devices.
- UNAME_PROCESSOR=x86_64
+ # uname -m returns i386 or x86_64
+ UNAME_PROCESSOR=$UNAME_MACHINE
fi
- echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
+ ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
- echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
+ ;;
*:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
+ GUESS=i386-pc-qnx
+ ;;
NEO-*:NONSTOP_KERNEL:*:*)
- echo neo-tandem-nsk"$UNAME_RELEASE"
- exit ;;
+ GUESS=neo-tandem-nsk$UNAME_RELEASE
+ ;;
NSE-*:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk"$UNAME_RELEASE"
- exit ;;
+ GUESS=nse-tandem-nsk$UNAME_RELEASE
+ ;;
NSR-*:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk"$UNAME_RELEASE"
- exit ;;
+ GUESS=nsr-tandem-nsk$UNAME_RELEASE
+ ;;
NSV-*:NONSTOP_KERNEL:*:*)
- echo nsv-tandem-nsk"$UNAME_RELEASE"
- exit ;;
+ GUESS=nsv-tandem-nsk$UNAME_RELEASE
+ ;;
NSX-*:NONSTOP_KERNEL:*:*)
- echo nsx-tandem-nsk"$UNAME_RELEASE"
- exit ;;
+ GUESS=nsx-tandem-nsk$UNAME_RELEASE
+ ;;
*:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
+ GUESS=mips-compaq-nonstopux
+ ;;
BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
+ GUESS=bs2000-siemens-sysv
+ ;;
DS/*:UNIX_System_V:*:*)
- echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
+ ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
- # shellcheck disable=SC2154
- if test "$cputype" = 386; then
+ if test "${cputype-}" = 386; then
UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
+ elif test "x${cputype-}" != x; then
+ UNAME_MACHINE=$cputype
fi
- echo "$UNAME_MACHINE"-unknown-plan9
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-plan9
+ ;;
*:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
+ GUESS=pdp10-unknown-tops10
+ ;;
*:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
+ GUESS=pdp10-unknown-tenex
+ ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
+ GUESS=pdp10-dec-tops20
+ ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
+ GUESS=pdp10-xkl-tops20
+ ;;
*:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
+ GUESS=pdp10-unknown-tops20
+ ;;
*:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
+ GUESS=pdp10-unknown-its
+ ;;
SEI:*:*:SEIUX)
- echo mips-sei-seiux"$UNAME_RELEASE"
- exit ;;
+ GUESS=mips-sei-seiux$UNAME_RELEASE
+ ;;
*:DragonFly:*:*)
- echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
- exit ;;
+ DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
+ ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "$UNAME_MACHINE" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
+ case $UNAME_MACHINE in
+ A*) GUESS=alpha-dec-vms ;;
+ I*) GUESS=ia64-dec-vms ;;
+ V*) GUESS=vax-dec-vms ;;
esac ;;
*:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
+ GUESS=i386-pc-xenix
+ ;;
i*86:skyos:*:*)
- echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
- exit ;;
+ SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
+ GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
+ ;;
i*86:rdos:*:*)
- echo "$UNAME_MACHINE"-pc-rdos
- exit ;;
- i*86:AROS:*:*)
- echo "$UNAME_MACHINE"-pc-aros
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-rdos
+ ;;
+ *:AROS:*:*)
+ GUESS=$UNAME_MACHINE-unknown-aros
+ ;;
x86_64:VMkernel:*:*)
- echo "$UNAME_MACHINE"-unknown-esx
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-esx
+ ;;
amd64:Isilon\ OneFS:*:*)
- echo x86_64-unknown-onefs
- exit ;;
+ GUESS=x86_64-unknown-onefs
+ ;;
*:Unleashed:*:*)
- echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
+ ;;
esac
+# Do we have a guess based on uname results?
+if test "x$GUESS" != x; then
+ echo "$GUESS"
+ exit
+fi
+
+# No uname command or uname output not recognized.
+set_cc_for_build
+cat > "$dummy.c" <<EOF
+#ifdef _SEQUENT_
+#include <sys/types.h>
+#include <sys/utsname.h>
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#include <signal.h>
+#if defined(_SIZE_T_) || defined(SIGLOST)
+#include <sys/utsname.h>
+#endif
+#endif
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+#include <sys/param.h>
+#if defined (BSD)
+#if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+#else
+#if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#else
+ printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#endif
+#else
+ printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#else
+#if defined(_SIZE_T_) || defined(SIGLOST)
+ struct utsname un;
+ uname (&un);
+ printf ("vax-dec-ultrix%s\n", un.release); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#if defined(_SIZE_T_) || defined(SIGLOST)
+ struct utsname *un;
+ uname (&un);
+ printf ("mips-dec-ultrix%s\n", un.release); exit (0);
+#else
+ printf ("mips-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
+
echo "$0: unable to guess system type" >&2
-case "$UNAME_MACHINE:$UNAME_SYSTEM" in
+case $UNAME_MACHINE:$UNAME_SYSTEM in
mips:Linux | mips64:Linux)
# If we got here on MIPS GNU/Linux, output extra information.
cat >&2 <<EOF
@@ -1452,9 +1698,17 @@ This script (version $timestamp), has failed to recognize the
operating system you are using. If your script is old, overwrite *all*
copies of config.guess and config.sub with the latest versions from:
- https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+ https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
and
- https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+ https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
+EOF
+
+our_year=`echo $timestamp | sed 's,-.*,,'`
+thisyear=`date +%Y`
+# shellcheck disable=SC2003
+script_age=`expr "$thisyear" - "$our_year"`
+if test "$script_age" -lt 3 ; then
+ cat >&2 <<EOF
If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to
@@ -1482,6 +1736,7 @@ UNAME_RELEASE = "$UNAME_RELEASE"
UNAME_SYSTEM = "$UNAME_SYSTEM"
UNAME_VERSION = "$UNAME_VERSION"
EOF
+fi
exit 1
diff --git a/native/build/config.sub b/native/build/config.sub
index a8f3f7e..d74fb6d 100755
--- a/native/build/config.sub
+++ b/native/build/config.sub
@@ -1,8 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2019 Free Software Foundation, Inc.
+# Copyright 1992-2021 Free Software Foundation, Inc.
-timestamp='2019-01-01'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2021-08-14'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -33,7 +35,7 @@ timestamp='2019-01-01'
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
-# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
@@ -50,6 +52,13 @@ timestamp='2019-01-01'
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX. However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
@@ -67,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2019 Free Software Foundation, Inc.
+Copyright 1992-2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -111,9 +120,12 @@ case $# in
esac
# Split fields of configuration type
+# shellcheck disable=SC2162
+saved_IFS=$IFS
IFS="-" read field1 field2 field3 field4 <<EOF
$1
EOF
+IFS=$saved_IFS
# Separate into logical components for further validation
case $1 in
@@ -123,28 +135,27 @@ case $1 in
;;
*-*-*-*)
basic_machine=$field1-$field2
- os=$field3-$field4
+ basic_os=$field3-$field4
;;
*-*-*)
# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
# parts
maybe_os=$field2-$field3
case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \
- | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \
+ nto-qnx* | linux-* | uclinux-uclibc* \
| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
| storm-chaos* | os2-emx* | rtmk-nova*)
basic_machine=$field1
- os=$maybe_os
+ basic_os=$maybe_os
;;
android-linux)
basic_machine=$field1-unknown
- os=linux-android
+ basic_os=linux-android
;;
*)
basic_machine=$field1-$field2
- os=$field3
+ basic_os=$field3
;;
esac
;;
@@ -153,7 +164,7 @@ case $1 in
case $field1-$field2 in
decstation-3100)
basic_machine=mips-dec
- os=
+ basic_os=
;;
*-*)
# Second component is usually, but not always the OS
@@ -161,7 +172,11 @@ case $1 in
# Prevent following clause from handling this valid os
sun*os*)
basic_machine=$field1
- os=$field2
+ basic_os=$field2
+ ;;
+ zephyr*)
+ basic_machine=$field1-unknown
+ basic_os=$field2
;;
# Manufacturers
dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
@@ -174,11 +189,11 @@ case $1 in
| microblaze* | sim | cisco \
| oki | wec | wrs | winbond)
basic_machine=$field1-$field2
- os=
+ basic_os=
;;
*)
basic_machine=$field1
- os=$field2
+ basic_os=$field2
;;
esac
;;
@@ -190,450 +205,451 @@ case $1 in
case $field1 in
386bsd)
basic_machine=i386-pc
- os=bsd
+ basic_os=bsd
;;
a29khif)
basic_machine=a29k-amd
- os=udi
+ basic_os=udi
;;
adobe68k)
basic_machine=m68010-adobe
- os=scout
+ basic_os=scout
;;
alliant)
basic_machine=fx80-alliant
- os=
+ basic_os=
;;
altos | altos3068)
basic_machine=m68k-altos
- os=
+ basic_os=
;;
am29k)
basic_machine=a29k-none
- os=bsd
+ basic_os=bsd
;;
amdahl)
basic_machine=580-amdahl
- os=sysv
+ basic_os=sysv
;;
amiga)
basic_machine=m68k-unknown
- os=
+ basic_os=
;;
amigaos | amigados)
basic_machine=m68k-unknown
- os=amigaos
+ basic_os=amigaos
;;
amigaunix | amix)
basic_machine=m68k-unknown
- os=sysv4
+ basic_os=sysv4
;;
apollo68)
basic_machine=m68k-apollo
- os=sysv
+ basic_os=sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
- os=bsd
+ basic_os=bsd
;;
aros)
basic_machine=i386-pc
- os=aros
+ basic_os=aros
;;
aux)
basic_machine=m68k-apple
- os=aux
+ basic_os=aux
;;
balance)
basic_machine=ns32k-sequent
- os=dynix
+ basic_os=dynix
;;
blackfin)
basic_machine=bfin-unknown
- os=linux
+ basic_os=linux
;;
cegcc)
basic_machine=arm-unknown
- os=cegcc
+ basic_os=cegcc
;;
convex-c1)
basic_machine=c1-convex
- os=bsd
+ basic_os=bsd
;;
convex-c2)
basic_machine=c2-convex
- os=bsd
+ basic_os=bsd
;;
convex-c32)
basic_machine=c32-convex
- os=bsd
+ basic_os=bsd
;;
convex-c34)
basic_machine=c34-convex
- os=bsd
+ basic_os=bsd
;;
convex-c38)
basic_machine=c38-convex
- os=bsd
+ basic_os=bsd
;;
cray)
basic_machine=j90-cray
- os=unicos
+ basic_os=unicos
;;
crds | unos)
basic_machine=m68k-crds
- os=
+ basic_os=
;;
da30)
basic_machine=m68k-da30
- os=
+ basic_os=
;;
decstation | pmax | pmin | dec3100 | decstatn)
basic_machine=mips-dec
- os=
+ basic_os=
;;
delta88)
basic_machine=m88k-motorola
- os=sysv3
+ basic_os=sysv3
;;
dicos)
basic_machine=i686-pc
- os=dicos
+ basic_os=dicos
;;
djgpp)
basic_machine=i586-pc
- os=msdosdjgpp
+ basic_os=msdosdjgpp
;;
ebmon29k)
basic_machine=a29k-amd
- os=ebmon
+ basic_os=ebmon
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
- os=ose
+ basic_os=ose
;;
gmicro)
basic_machine=tron-gmicro
- os=sysv
+ basic_os=sysv
;;
go32)
basic_machine=i386-pc
- os=go32
+ basic_os=go32
;;
h8300hms)
basic_machine=h8300-hitachi
- os=hms
+ basic_os=hms
;;
h8300xray)
basic_machine=h8300-hitachi
- os=xray
+ basic_os=xray
;;
h8500hms)
basic_machine=h8500-hitachi
- os=hms
+ basic_os=hms
;;
harris)
basic_machine=m88k-harris
- os=sysv3
+ basic_os=sysv3
;;
- hp300)
+ hp300 | hp300hpux)
basic_machine=m68k-hp
+ basic_os=hpux
;;
hp300bsd)
basic_machine=m68k-hp
- os=bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=hpux
+ basic_os=bsd
;;
hppaosf)
basic_machine=hppa1.1-hp
- os=osf
+ basic_os=osf
;;
hppro)
basic_machine=hppa1.1-hp
- os=proelf
+ basic_os=proelf
;;
i386mach)
basic_machine=i386-mach
- os=mach
- ;;
- vsta)
- basic_machine=i386-pc
- os=vsta
+ basic_os=mach
;;
isi68 | isi)
basic_machine=m68k-isi
- os=sysv
+ basic_os=sysv
;;
m68knommu)
basic_machine=m68k-unknown
- os=linux
+ basic_os=linux
;;
magnum | m3230)
basic_machine=mips-mips
- os=sysv
+ basic_os=sysv
;;
merlin)
basic_machine=ns32k-utek
- os=sysv
+ basic_os=sysv
;;
mingw64)
basic_machine=x86_64-pc
- os=mingw64
+ basic_os=mingw64
;;
mingw32)
basic_machine=i686-pc
- os=mingw32
+ basic_os=mingw32
;;
mingw32ce)
basic_machine=arm-unknown
- os=mingw32ce
+ basic_os=mingw32ce
;;
monitor)
basic_machine=m68k-rom68k
- os=coff
+ basic_os=coff
;;
morphos)
basic_machine=powerpc-unknown
- os=morphos
+ basic_os=morphos
;;
moxiebox)
basic_machine=moxie-unknown
- os=moxiebox
+ basic_os=moxiebox
;;
msdos)
basic_machine=i386-pc
- os=msdos
+ basic_os=msdos
;;
msys)
basic_machine=i686-pc
- os=msys
+ basic_os=msys
;;
mvs)
basic_machine=i370-ibm
- os=mvs
+ basic_os=mvs
;;
nacl)
basic_machine=le32-unknown
- os=nacl
+ basic_os=nacl
;;
ncr3000)
basic_machine=i486-ncr
- os=sysv4
+ basic_os=sysv4
;;
netbsd386)
basic_machine=i386-pc
- os=netbsd
+ basic_os=netbsd
;;
netwinder)
basic_machine=armv4l-rebel
- os=linux
+ basic_os=linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
- os=newsos
+ basic_os=newsos
;;
news1000)
basic_machine=m68030-sony
- os=newsos
+ basic_os=newsos
;;
necv70)
basic_machine=v70-nec
- os=sysv
+ basic_os=sysv
;;
nh3000)
basic_machine=m68k-harris
- os=cxux
+ basic_os=cxux
;;
nh[45]000)
basic_machine=m88k-harris
- os=cxux
+ basic_os=cxux
;;
nindy960)
basic_machine=i960-intel
- os=nindy
+ basic_os=nindy
;;
mon960)
basic_machine=i960-intel
- os=mon960
+ basic_os=mon960
;;
nonstopux)
basic_machine=mips-compaq
- os=nonstopux
+ basic_os=nonstopux
;;
os400)
basic_machine=powerpc-ibm
- os=os400
+ basic_os=os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
- os=ose
+ basic_os=ose
;;
os68k)
basic_machine=m68k-none
- os=os68k
+ basic_os=os68k
;;
paragon)
basic_machine=i860-intel
- os=osf
+ basic_os=osf
;;
parisc)
basic_machine=hppa-unknown
- os=linux
+ basic_os=linux
+ ;;
+ psp)
+ basic_machine=mipsallegrexel-sony
+ basic_os=psp
;;
pw32)
basic_machine=i586-unknown
- os=pw32
+ basic_os=pw32
;;
rdos | rdos64)
basic_machine=x86_64-pc
- os=rdos
+ basic_os=rdos
;;
rdos32)
basic_machine=i386-pc
- os=rdos
+ basic_os=rdos
;;
rom68k)
basic_machine=m68k-rom68k
- os=coff
+ basic_os=coff
;;
sa29200)
basic_machine=a29k-amd
- os=udi
+ basic_os=udi
;;
sei)
basic_machine=mips-sei
- os=seiux
+ basic_os=seiux
;;
sequent)
basic_machine=i386-sequent
- os=
+ basic_os=
;;
sps7)
basic_machine=m68k-bull
- os=sysv2
+ basic_os=sysv2
;;
st2000)
basic_machine=m68k-tandem
- os=
+ basic_os=
;;
stratus)
basic_machine=i860-stratus
- os=sysv4
+ basic_os=sysv4
;;
sun2)
basic_machine=m68000-sun
- os=
+ basic_os=
;;
sun2os3)
basic_machine=m68000-sun
- os=sunos3
+ basic_os=sunos3
;;
sun2os4)
basic_machine=m68000-sun
- os=sunos4
+ basic_os=sunos4
;;
sun3)
basic_machine=m68k-sun
- os=
+ basic_os=
;;
sun3os3)
basic_machine=m68k-sun
- os=sunos3
+ basic_os=sunos3
;;
sun3os4)
basic_machine=m68k-sun
- os=sunos4
+ basic_os=sunos4
;;
sun4)
basic_machine=sparc-sun
- os=
+ basic_os=
;;
sun4os3)
basic_machine=sparc-sun
- os=sunos3
+ basic_os=sunos3
;;
sun4os4)
basic_machine=sparc-sun
- os=sunos4
+ basic_os=sunos4
;;
sun4sol2)
basic_machine=sparc-sun
- os=solaris2
+ basic_os=solaris2
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
- os=
+ basic_os=
;;
sv1)
basic_machine=sv1-cray
- os=unicos
+ basic_os=unicos
;;
symmetry)
basic_machine=i386-sequent
- os=dynix
+ basic_os=dynix
;;
t3e)
basic_machine=alphaev5-cray
- os=unicos
+ basic_os=unicos
;;
t90)
basic_machine=t90-cray
- os=unicos
+ basic_os=unicos
;;
toad1)
basic_machine=pdp10-xkl
- os=tops20
+ basic_os=tops20
;;
tpf)
basic_machine=s390x-ibm
- os=tpf
+ basic_os=tpf
;;
udi29k)
basic_machine=a29k-amd
- os=udi
+ basic_os=udi
;;
ultra3)
basic_machine=a29k-nyu
- os=sym1
+ basic_os=sym1
;;
v810 | necv810)
basic_machine=v810-nec
- os=none
+ basic_os=none
;;
vaxv)
basic_machine=vax-dec
- os=sysv
+ basic_os=sysv
;;
vms)
basic_machine=vax-dec
- os=vms
+ basic_os=vms
+ ;;
+ vsta)
+ basic_machine=i386-pc
+ basic_os=vsta
;;
vxworks960)
basic_machine=i960-wrs
- os=vxworks
+ basic_os=vxworks
;;
vxworks68)
basic_machine=m68k-wrs
- os=vxworks
+ basic_os=vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
- os=vxworks
+ basic_os=vxworks
;;
xbox)
basic_machine=i686-pc
- os=mingw32
+ basic_os=mingw32
;;
ymp)
basic_machine=ymp-cray
- os=unicos
+ basic_os=unicos
;;
*)
basic_machine=$1
- os=
+ basic_os=
;;
esac
;;
@@ -685,17 +701,17 @@ case $basic_machine in
bluegene*)
cpu=powerpc
vendor=ibm
- os=cnk
+ basic_os=cnk
;;
decsystem10* | dec10*)
cpu=pdp10
vendor=dec
- os=tops10
+ basic_os=tops10
;;
decsystem20* | dec20*)
cpu=pdp10
vendor=dec
- os=tops20
+ basic_os=tops20
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
@@ -705,7 +721,7 @@ case $basic_machine in
dpx2*)
cpu=m68k
vendor=bull
- os=sysv3
+ basic_os=sysv3
;;
encore | umax | mmax)
cpu=ns32k
@@ -714,7 +730,7 @@ case $basic_machine in
elxsi)
cpu=elxsi
vendor=elxsi
- os=${os:-bsd}
+ basic_os=${basic_os:-bsd}
;;
fx2800)
cpu=i860
@@ -727,7 +743,7 @@ case $basic_machine in
h3050r* | hiux*)
cpu=hppa1.1
vendor=hitachi
- os=hiuxwe2
+ basic_os=hiuxwe2
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
cpu=hppa1.0
@@ -770,36 +786,36 @@ case $basic_machine in
i*86v32)
cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc
- os=sysv32
+ basic_os=sysv32
;;
i*86v4*)
cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc
- os=sysv4
+ basic_os=sysv4
;;
i*86v)
cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc
- os=sysv
+ basic_os=sysv
;;
i*86sol2)
cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc
- os=solaris2
+ basic_os=solaris2
;;
j90 | j90-cray)
cpu=j90
vendor=cray
- os=${os:-unicos}
+ basic_os=${basic_os:-unicos}
;;
iris | iris4d)
cpu=mips
vendor=sgi
- case $os in
+ case $basic_os in
irix*)
;;
*)
- os=irix4
+ basic_os=irix4
;;
esac
;;
@@ -810,24 +826,26 @@ case $basic_machine in
*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
cpu=m68k
vendor=atari
- os=mint
+ basic_os=mint
;;
news-3600 | risc-news)
cpu=mips
vendor=sony
- os=newsos
+ basic_os=newsos
;;
next | m*-next)
cpu=m68k
vendor=next
- case $os in
- nextstep* )
+ case $basic_os in
+ openstep*)
+ ;;
+ nextstep*)
;;
ns2*)
- os=nextstep2
+ basic_os=nextstep2
;;
*)
- os=nextstep3
+ basic_os=nextstep3
;;
esac
;;
@@ -838,12 +856,12 @@ case $basic_machine in
op50n-* | op60c-*)
cpu=hppa1.1
vendor=oki
- os=proelf
+ basic_os=proelf
;;
pa-hitachi)
cpu=hppa1.1
vendor=hitachi
- os=hiuxwe2
+ basic_os=hiuxwe2
;;
pbd)
cpu=sparc
@@ -880,12 +898,12 @@ case $basic_machine in
sde)
cpu=mipsisa32
vendor=sde
- os=${os:-elf}
+ basic_os=${basic_os:-elf}
;;
simso-wrs)
cpu=sparclite
vendor=wrs
- os=vxworks
+ basic_os=vxworks
;;
tower | tower-32)
cpu=m68k
@@ -902,7 +920,7 @@ case $basic_machine in
w89k-*)
cpu=hppa1.1
vendor=winbond
- os=proelf
+ basic_os=proelf
;;
none)
cpu=none
@@ -918,9 +936,12 @@ case $basic_machine in
;;
*-*)
+ # shellcheck disable=SC2162
+ saved_IFS=$IFS
IFS="-" read cpu vendor <<EOF
$basic_machine
EOF
+ IFS=$saved_IFS
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
@@ -954,11 +975,11 @@ case $cpu-$vendor in
# some cases the only manufacturer, in others, it is the most popular.
craynv-unknown)
vendor=cray
- os=${os:-unicosmp}
+ basic_os=${basic_os:-unicosmp}
;;
c90-unknown | c90-cray)
vendor=cray
- os=${os:-unicos}
+ basic_os=${Basic_os:-unicos}
;;
fx80-unknown)
vendor=alliant
@@ -1002,7 +1023,7 @@ case $cpu-$vendor in
dpx20-unknown | dpx20-bull)
cpu=rs6000
vendor=bull
- os=${os:-bosx}
+ basic_os=${basic_os:-bosx}
;;
# Here we normalize CPU types irrespective of the vendor
@@ -1011,7 +1032,7 @@ case $cpu-$vendor in
;;
blackfin-*)
cpu=bfin
- os=linux
+ basic_os=linux
;;
c54x-*)
cpu=tic54x
@@ -1024,7 +1045,7 @@ case $cpu-$vendor in
;;
e500v[12]-*)
cpu=powerpc
- os=$os"spe"
+ basic_os=${basic_os}"spe"
;;
mips3*-*)
cpu=mips64
@@ -1034,7 +1055,7 @@ case $cpu-$vendor in
;;
m68knommu-*)
cpu=m68k
- os=linux
+ basic_os=linux
;;
m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
cpu=s12z
@@ -1044,7 +1065,7 @@ case $cpu-$vendor in
;;
parisc-*)
cpu=hppa
- os=linux
+ basic_os=linux
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
cpu=i586
@@ -1100,11 +1121,14 @@ case $cpu-$vendor in
xscale-* | xscalee[bl]-*)
cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
;;
+ arm64-*)
+ cpu=aarch64
+ ;;
# Recognize the canonical CPU Types that limit and/or modify the
# company names they are paired with.
cr16-*)
- os=${os:-elf}
+ basic_os=${basic_os:-elf}
;;
crisv32-* | etraxfs*-*)
cpu=crisv32
@@ -1115,7 +1139,7 @@ case $cpu-$vendor in
vendor=axis
;;
crx-*)
- os=${os:-elf}
+ basic_os=${basic_os:-elf}
;;
neo-tandem)
cpu=neo
@@ -1137,16 +1161,12 @@ case $cpu-$vendor in
cpu=nsx
vendor=tandem
;;
- s390-*)
- cpu=s390
- vendor=ibm
- ;;
- s390x-*)
- cpu=s390x
- vendor=ibm
+ mipsallegrexel-sony)
+ cpu=mipsallegrexel
+ vendor=sony
;;
tile*-*)
- os=${os:-linux-gnu}
+ basic_os=${basic_os:-linux-gnu}
;;
*)
@@ -1162,13 +1182,13 @@ case $cpu-$vendor in
| alphapca5[67] | alpha64pca5[67] \
| am33_2.0 \
| amdgcn \
- | arc | arceb \
- | arm | arm[lb]e | arme[lb] | armv* \
+ | arc | arceb | arc32 | arc64 \
+ | arm | arm[lb]e | arme[lb] | armv* \
| avr | avr32 \
| asmjs \
| ba \
| be32 | be64 \
- | bfin | bs2000 \
+ | bfin | bpf | bs2000 \
| c[123]* | c30 | [cjt]90 | c4x \
| c8051 | clipper | craynv | csky | cydra \
| d10v | d30v | dlx | dsp16xx \
@@ -1182,14 +1202,15 @@ case $cpu-$vendor in
| k1om \
| le32 | le64 \
| lm32 \
+ | loongarch32 | loongarch64 | loongarchx32 \
| m32c | m32r | m32rle \
- | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k | v70 | w65 \
- | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip \
+ | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
+ | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
| m88110 | m88k | maxq | mb | mcore | mep | metag \
| microblaze | microblazeel \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
- | mips64 | mips64el \
+ | mips64 | mips64eb | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
@@ -1200,9 +1221,13 @@ case $cpu-$vendor in
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
+ | mipsisa32r3 | mipsisa32r3el \
+ | mipsisa32r5 | mipsisa32r5el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64r3 | mipsisa64r3el \
+ | mipsisa64r5 | mipsisa64r5el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
@@ -1216,32 +1241,37 @@ case $cpu-$vendor in
| nds32 | nds32le | nds32be \
| nfp \
| nios | nios2 | nios2eb | nios2el \
- | none | np1 | ns16k | ns32k \
+ | none | np1 | ns16k | ns32k | nvptx \
| open8 \
| or1k* \
| or32 \
| orion \
+ | picochip \
| pdp10 | pdp11 | pj | pjl | pn | power \
| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
| pru \
| pyramid \
- | riscv | riscv32 | riscv64 \
+ | riscv | riscv32 | riscv32be | riscv64 | riscv64be \
| rl78 | romp | rs6000 | rx \
+ | s390 | s390x \
| score \
- | sh | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
+ | sh | shl \
+ | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
| sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
| sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
| spu \
| tahoe \
+ | thumbv7* \
| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
| tron \
| ubicom32 \
- | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
+ | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
| vax \
| visium \
- | wasm32 \
+ | w65 \
+ | wasm32 | wasm64 \
| we32k \
| x86 | x86_64 | xc16x | xgate | xps100 \
| xstormy16 | xtensa* \
@@ -1271,8 +1301,49 @@ esac
# Decode manufacturer-specific aliases for certain operating systems.
-if [ x$os != x ]
+if test x$basic_os != x
then
+
+# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
+# set os.
+case $basic_os in
+ gnu/linux*)
+ kernel=linux
+ os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
+ ;;
+ os2-emx)
+ kernel=os2
+ os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
+ ;;
+ nto-qnx*)
+ kernel=nto
+ os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
+ ;;
+ *-*)
+ # shellcheck disable=SC2162
+ saved_IFS=$IFS
+ IFS="-" read kernel os <<EOF
+$basic_os
+EOF
+ IFS=$saved_IFS
+ ;;
+ # Default OS when just kernel was specified
+ nto*)
+ kernel=nto
+ os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
+ ;;
+ linux*)
+ kernel=linux
+ os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
+ ;;
+ *)
+ kernel=
+ os=$basic_os
+ ;;
+esac
+
+# Now, normalize the OS (knowing we just have one component, it's not a kernel,
+# etc.)
case $os in
# First match some system type aliases that might get confused
# with valid system types.
@@ -1284,7 +1355,7 @@ case $os in
os=cnk
;;
solaris1 | solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
;;
solaris)
os=solaris2
@@ -1292,9 +1363,6 @@ case $os in
unixware*)
os=sysv4.2uw
;;
- gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
# es1800 is here to avoid being matched by es* (a different OS)
es1800*)
os=ose
@@ -1316,12 +1384,9 @@ case $os in
os=sco3.2v4
;;
sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
;;
- sco3.2v[4-9]* | sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- ;;
- scout)
+ sco*v* | scout)
# Don't match below
;;
sco*)
@@ -1330,77 +1395,25 @@ case $os in
psos*)
os=psos
;;
- # Now accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST end in a * to match a version number.
- # sysv* is not here because it comes later, after sysvr4.
- gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
- | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\
- | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
- | sym* | kopensolaris* | plan9* \
- | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
- | aos* | aros* | cloudabi* | sortix* \
- | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
- | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
- | knetbsd* | mirbsd* | netbsd* \
- | bitrig* | openbsd* | solidbsd* | libertybsd* \
- | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \
- | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
- | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
- | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \
- | chorusrdb* | cegcc* | glidix* \
- | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
- | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \
- | linux-newlib* | linux-musl* | linux-uclibc* \
- | uxpv* | beos* | mpeix* | udk* | moxiebox* \
- | interix* | uwin* | mks* | rhapsody* | darwin* \
- | openstep* | oskit* | conix* | pw32* | nonstopux* \
- | storm-chaos* | tops10* | tenex* | tops20* | its* \
- | os2* | vos* | palmos* | uclinux* | nucleus* \
- | morphos* | superux* | rtmk* | windiss* \
- | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
- | skyos* | haiku* | rdos* | toppers* | drops* | es* \
- | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
- | midnightbsd* | amdhsa* | unleashed* | emscripten*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
qnx*)
- case $cpu in
- x86 | i*86)
- ;;
- *)
- os=nto-$os
- ;;
- esac
+ os=qnx
;;
hiux*)
os=hiuxwe2
;;
- nto-qnx*)
- ;;
- nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- sim | xray | os68k* | v88r* \
- | windows* | osx | abug | netware* | os9* \
- | macos* | mpw* | magic* | mmixware* | mon960* | lnews*)
- ;;
- linux-dietlibc)
- os=linux-dietlibc
- ;;
- linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
lynx*178)
os=lynxos178
;;
lynx*5)
os=lynxos5
;;
+ lynxos*)
+ # don't get caught up in next wildcard
+ ;;
lynx*)
os=lynxos
;;
- mac*)
+ mac[0-9]*)
os=`echo "$os" | sed -e 's|mac|macos|'`
;;
opened*)
@@ -1445,12 +1458,9 @@ case $os in
ns2)
os=nextstep2
;;
- nsk*)
- os=nsk
- ;;
# Preserve the version number of sinix5.
sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
+ os=`echo "$os" | sed -e 's|sinix|sysv|'`
;;
sinix*)
os=sysv4
@@ -1473,18 +1483,12 @@ case $os in
sysvr4)
os=sysv4
;;
- # This must come after sysvr4.
- sysv*)
- ;;
ose*)
os=ose
;;
*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
os=mint
;;
- zvmoe)
- os=zvmoe
- ;;
dicos*)
os=dicos
;;
@@ -1501,19 +1505,11 @@ case $os in
;;
esac
;;
- nacl*)
- ;;
- ios)
- ;;
- none)
- ;;
- *-eabi)
- ;;
*)
- echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
- exit 1
+ # No normalization, but not necessarily accepted, that comes below.
;;
esac
+
else
# Here we handle the default operating systems that come with various machines.
@@ -1526,6 +1522,7 @@ else
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
+kernel=
case $cpu-$vendor in
score-*)
os=elf
@@ -1537,7 +1534,8 @@ case $cpu-$vendor in
os=riscix1.2
;;
arm*-rebel)
- os=linux
+ kernel=linux
+ os=gnu
;;
arm*-semi)
os=aout
@@ -1703,84 +1701,179 @@ case $cpu-$vendor in
os=none
;;
esac
+
fi
+# Now, validate our (potentially fixed-up) OS.
+case $os in
+ # Sometimes we do "kernel-libc", so those need to count as OSes.
+ musl* | newlib* | relibc* | uclibc*)
+ ;;
+ # Likewise for "kernel-abi"
+ eabi* | gnueabi*)
+ ;;
+ # VxWorks passes extra cpu info in the 4th filed.
+ simlinux | simwindows | spe)
+ ;;
+ # Now accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST end in a * to match a version number.
+ gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
+ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
+ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
+ | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
+ | hiux* | abug | nacl* | netware* | windows* \
+ | os9* | macos* | osx* | ios* \
+ | mpw* | magic* | mmixware* | mon960* | lnews* \
+ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
+ | aos* | aros* | cloudabi* | sortix* | twizzler* \
+ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
+ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
+ | mirbsd* | netbsd* | dicos* | openedition* | ose* \
+ | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
+ | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
+ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
+ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
+ | udi* | lites* | ieee* | go32* | aux* | hcos* \
+ | chorusrdb* | cegcc* | glidix* | serenity* \
+ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
+ | midipix* | mingw32* | mingw64* | mint* \
+ | uxpv* | beos* | mpeix* | udk* | moxiebox* \
+ | interix* | uwin* | mks* | rhapsody* | darwin* \
+ | openstep* | oskit* | conix* | pw32* | nonstopux* \
+ | storm-chaos* | tops10* | tenex* | tops20* | its* \
+ | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
+ | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
+ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
+ | skyos* | haiku* | rdos* | toppers* | drops* | es* \
+ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
+ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*)
+ ;;
+ # This one is extra strict with allowed versions
+ sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ ;;
+ none)
+ ;;
+ *)
+ echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# As a final step for OS-related things, validate the OS-kernel combination
+# (given a valid OS), if there is a kernel.
+case $kernel-$os in
+ linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
+ | linux-musl* | linux-relibc* | linux-uclibc* )
+ ;;
+ uclinux-uclibc* )
+ ;;
+ -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
+ # These are just libc implementations, not actual OSes, and thus
+ # require a kernel.
+ echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
+ exit 1
+ ;;
+ kfreebsd*-gnu* | kopensolaris*-gnu*)
+ ;;
+ vxworks-simlinux | vxworks-simwindows | vxworks-spe)
+ ;;
+ nto-qnx*)
+ ;;
+ os2-emx)
+ ;;
+ *-eabi* | *-gnueabi*)
+ ;;
+ -*)
+ # Blank kernel with real OS is always fine.
+ ;;
+ *-*)
+ echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
+ exit 1
+ ;;
+esac
+
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
case $vendor in
unknown)
- case $os in
- riscix*)
+ case $cpu-$os in
+ *-riscix*)
vendor=acorn
;;
- sunos*)
+ *-sunos*)
vendor=sun
;;
- cnk*|-aix*)
+ *-cnk* | *-aix*)
vendor=ibm
;;
- beos*)
+ *-beos*)
vendor=be
;;
- hpux*)
+ *-hpux*)
vendor=hp
;;
- mpeix*)
+ *-mpeix*)
vendor=hp
;;
- hiux*)
+ *-hiux*)
vendor=hitachi
;;
- unos*)
+ *-unos*)
vendor=crds
;;
- dgux*)
+ *-dgux*)
vendor=dg
;;
- luna*)
+ *-luna*)
vendor=omron
;;
- genix*)
+ *-genix*)
vendor=ns
;;
- clix*)
+ *-clix*)
vendor=intergraph
;;
- mvs* | opened*)
+ *-mvs* | *-opened*)
+ vendor=ibm
+ ;;
+ *-os400*)
vendor=ibm
;;
- os400*)
+ s390-* | s390x-*)
vendor=ibm
;;
- ptx*)
+ *-ptx*)
vendor=sequent
;;
- tpf*)
+ *-tpf*)
vendor=ibm
;;
- vxsim* | vxworks* | windiss*)
+ *-vxsim* | *-vxworks* | *-windiss*)
vendor=wrs
;;
- aux*)
+ *-aux*)
vendor=apple
;;
- hms*)
+ *-hms*)
vendor=hitachi
;;
- mpw* | macos*)
+ *-mpw* | *-macos*)
vendor=apple
;;
- *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
+ *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
vendor=atari
;;
- vos*)
+ *-vos*)
vendor=stratus
;;
esac
;;
esac
-echo "$cpu-$vendor-$os"
+echo "$cpu-$vendor-${kernel:+$kernel-}$os"
exit
# Local variables:
diff --git a/native/build/rpm/tcnative.spec.in b/native/build/rpm/tcnative.spec.in
index 73c1642..9267e58 100644
--- a/native/build/rpm/tcnative.spec.in
+++ b/native/build/rpm/tcnative.spec.in
@@ -15,9 +15,9 @@
# limitations under the License.
#
-%define tcnver 1
+%define tcnver 2
%define aprmajor 1
-%define aprminor 4
+%define aprminor 7
Summary: Tomcat Native Java library
Name: tcnative
@@ -28,7 +28,7 @@ Group: System Environment/Libraries
URL: http://apr.apache.org/
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
-BuildPrereq: autoconf, libtool, doxygen, apr-devel >= %{aprmajor}.%{aprminor}.0, openssl >= 1.0.2
+BuildPrereq: autoconf, libtool, doxygen, apr-devel >= %{aprmajor}.%{aprminor}.0, openssl >= 3.0.0
%description
The mission of the Tomcat Native Library (TCN) is to provide a
@@ -38,7 +38,7 @@ contains additional utility interfaces for Java.
%package devel
Group: Development/Libraries
Summary: Tomcat Native development kit
-Requires: tcnative = %{version}-%{release}, apr-devel >= %{aprmajor}.%{aprminor}.0, openssl-devel >= 1.0.2
+Requires: tcnative = %{version}-%{release}, apr-devel >= %{aprmajor}.%{aprminor}.0, openssl-devel >= 3.0.0
%description devel
The mission of the Tomcat Native Library (TCN) is to provide a
@@ -90,6 +90,8 @@ rm -rf $RPM_BUILD_ROOT
%doc --parents html
%changelog
+* Tue Jun 30 2022 Mark Thomas <markt@apache.org> 2.0.0-1
+- update for tcnative 2.0
* Sat Oct 31 2015 Rainer Jung <rjung@apache.org> 1.2.0-1
- update for tcnative 1.2
* Tue Jun 22 2004 Mladen Turk <mturk@jboss.com> 1.0.0-1
diff --git a/native/build/tcnative.m4 b/native/build/tcnative.m4
index 9681586..3b80fb2 100644
--- a/native/build/tcnative.m4
+++ b/native/build/tcnative.m4
@@ -143,143 +143,119 @@ AC_DEFUN([TCN_FIND_JDK_OS],[
dnl TCN_HELP_STRING(LHS, RHS)
dnl Autoconf 2.50 can not handle substr correctly. It does have
-dnl AC_HELP_STRING, so let's try to call it if we can.
+dnl AS_HELP_STRING, so let's try to call it if we can.
dnl Note: this define must be on one line so that it can be properly returned
dnl as the help string.
-AC_DEFUN(TCN_HELP_STRING,[ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING($1,$2),[ ]$1 substr([ ],len($1))$2)])dnl
+AC_DEFUN(TCN_HELP_STRING,[ifelse(regexp(AC_ACVERSION, 2\.1), -1, AS_HELP_STRING($1,$2),[ ]$1 substr([ ],len($1))$2)])dnl
dnl
-dnl TCN_CHECK_SSL_TOOLKIT
+dnl TCN_FIND_SSL_TOOLKIT
dnl
dnl Configure for the detected openssl toolkit installation, giving
dnl preference to "--with-ssl=<path>" if it was specified.
dnl
-AC_DEFUN(TCN_CHECK_SSL_TOOLKIT,[
-AC_MSG_CHECKING(for OpenSSL library)
-AC_ARG_WITH(ssl,
-[ --with-ssl[=PATH] Build with OpenSSL [yes|no|path]],
- use_openssl="$withval", use_openssl="auto")
-
-openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
-if test "$use_openssl" = "auto"
-then
+AC_DEFUN([TCN_FIND_SSL_TOOLKIT],[
+ AC_ARG_WITH(ssl,[ --with-ssl=DIR Specify the location of your OpenSSL installation],[
+ AC_MSG_CHECKING([for OpenSSL library])
+ if test -d "$withval"
+ then
+ use_openssl="$withval"
+ AC_MSG_RESULT([$use_openssl])
+ else
+ AC_MSG_RESULT([failed])
+ AC_MSG_ERROR([$withval is not a directory])
+ fi
+ ])
+
+ if test "x$use_openssl" = x
+ then
+ # User did not specify a path - guess it
+ AC_MSG_CHECKING([for OpenSSL location])
+ openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
for d in $openssldirs
- do
+ do
if test -f $d/include/openssl/opensslv.h
then
- use_openssl=$d
- break
+ use_openssl=$d
+ break
fi
- done
-fi
-case "$use_openssl" in
- no)
- AC_MSG_RESULT(no)
- TCN_OPENSSL_INC=""
- USE_OPENSSL=""
+ done
+ fi
+
+ if test x"$use_openssl" = x
+ then
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR([OpenSSL was not found in any of $openssldirs; use --with-ssl=/path])
+ fi
+
+ USE_OPENSSL='-DOPENSSL'
+
+ test -d $use_openssl/lib64 && ssllibdir=lib64 || ssllibdir=lib
+
+ if test "$use_openssl" = "/usr"
+ then
+ TCN_OPENSSL_INC=""
+ TCN_OPENSSL_LIBS="-lssl -lcrypto"
+ else
+ TCN_OPENSSL_INC="-I$use_openssl/include"
+ case $host in
+ *-solaris*)
+ TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -R$use_openssl/$ssllibdir -lssl -lcrypto"
;;
- auto)
- TCN_OPENSSL_INC=""
- USE_OPENSSL=""
- AC_MSG_RESULT(not found)
+ *-hp-hpux*)
+ # By default cc/aCC on HP-UX IA64 will produce 32 bit output
+ ssllibdir=lib/hpux32
+ TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -lssl -lcrypto"
;;
- *)
- if test "$use_openssl" = "yes"
- then
- # User did not specify a path - guess it
- for d in $openssldirs
- do
- if test -f $d/include/openssl/opensslv.h
- then
- use_openssl=$d
- break
- fi
- done
- if test "$use_openssl" = "yes"
- then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(
-[OpenSSL was not found in any of $openssldirs; use --with-ssl=/path])
- fi
- fi
- USE_OPENSSL='-DOPENSSL'
-
- test -d $use_openssl/lib64 && ssllibdir=lib64 || ssllibdir=lib
- if test "$use_openssl" = "/usr"
- then
- TCN_OPENSSL_INC=""
- TCN_OPENSSL_LIBS="-lssl -lcrypto"
- else
- TCN_OPENSSL_INC="-I$use_openssl/include"
- case $host in
- *-solaris*)
- TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -R$use_openssl/$ssllibdir -lssl -lcrypto"
- ;;
- *-hp-hpux*)
- # By default cc/aCC on HP-UX IA64 will produce 32 bit output
- ssllibdir=lib/hpux32
- TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -lssl -lcrypto"
- ;;
- *linux*|*freebsd*)
- TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -Wl,-rpath,$use_openssl/$ssllibdir -lssl -lcrypto"
- ;;
- *)
- TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -lssl -lcrypto"
- ;;
- esac
- fi
- AC_MSG_RESULT(using openssl from $use_openssl/$ssllibdir and $use_openssl/include)
+ *linux*|*freebsd*)
+ TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -Wl,-rpath,$use_openssl/$ssllibdir -lssl -lcrypto"
+ ;;
+ *)
+ TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -lssl -lcrypto"
+ ;;
+ esac
+ fi
+
+ AC_MSG_RESULT(using openssl from $use_openssl/$ssllibdir and $use_openssl/include)
- saved_cflags="$CFLAGS"
- saved_libs="$LIBS"
- CFLAGS="$CFLAGS $TCN_OPENSSL_INC"
- LIBS="$LIBS $TCN_OPENSSL_LIBS"
+ saved_cflags="$CFLAGS"
+ saved_libs="$LIBS"
+ CFLAGS="$CFLAGS $TCN_OPENSSL_INC"
+ LIBS="$LIBS $TCN_OPENSSL_LIBS"
-AC_ARG_ENABLE(openssl-version-check,
-[AC_HELP_STRING([--disable-openssl-version-check],
- [disable the OpenSSL version check])])
-case "$enable_openssl_version_check" in
-yes|'')
- AC_MSG_CHECKING(OpenSSL library version >= 1.0.2)
- AC_TRY_RUN([
+ AC_ARG_ENABLE(openssl-version-check,
+ [AS_HELP_STRING([--disable-openssl-version-check],
+ [disable the OpenSSL version check])])
+ case "$enable_openssl_version_check" in
+ yes|'')
+ AC_MSG_CHECKING(OpenSSL library version >= 3.0.0)
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <openssl/opensslv.h>
int main() {
- if (OPENSSL_VERSION_NUMBER >= 0x1000200fL)
- return (0);
+ #ifdef LIBRESSL_VERSION_NUMBER
+ if (OPENSSL_VERSION_NUMBER >= 0x3000000fL || LIBRESSL_VERSION_NUMBER >= 0x3050200fL)
+ #else
+ if (OPENSSL_VERSION_NUMBER >= 0x3000000fL)
+ #endif
+ return (0);
printf("\n\nFound OPENSSL_VERSION_NUMBER %#010x (" OPENSSL_VERSION_TEXT ")\n",
OPENSSL_VERSION_NUMBER);
- printf("Require OPENSSL_VERSION_NUMBER 0x1000200f or greater (1.0.2)\n\n");
+ printf("Require OPENSSL_VERSION_NUMBER 0x3000000f or greater (3.0.0)\n\n");
return (1);
}
- ],
- [AC_MSG_RESULT(ok)],
- [AC_MSG_ERROR(Your version of OpenSSL is not compatible with this version of tcnative)],
- [AC_MSG_RESULT(assuming target platform has compatible version)])
-;;
-no)
+ ]])],[AC_MSG_RESULT(ok)],[AC_MSG_ERROR(Your version of OpenSSL is not compatible with this version of tcnative)],[AC_MSG_RESULT(assuming target platform has compatible version)])
+ ;;
+ no)
AC_MSG_RESULT(Skipped OpenSSL version check)
-;;
-esac
+ ;;
+ esac
- AC_MSG_CHECKING(for OpenSSL DSA support)
- if test -f $use_openssl/include/openssl/dsa.h
- then
- AC_DEFINE(HAVE_OPENSSL_DSA)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
- CFLAGS="$saved_cflags"
- LIBS="$saved_libs"
- ;;
-esac
-if test "x$USE_OPENSSL" != "x"
-then
- APR_ADDTO(TCNATIVE_PRIV_INCLUDES, [$TCN_OPENSSL_INC])
- APR_ADDTO(TCNATIVE_LDFLAGS, [$TCN_OPENSSL_LIBS])
- APR_ADDTO(CFLAGS, [-DHAVE_OPENSSL])
-fi
+ CFLAGS="$saved_cflags"
+ LIBS="$saved_libs"
+
+ APR_ADDTO(TCNATIVE_PRIV_INCLUDES, [$TCN_OPENSSL_INC])
+ APR_ADDTO(TCNATIVE_LDFLAGS, [$TCN_OPENSSL_LIBS])
])
dnl
diff --git a/native/configure b/native/configure
index ba88091..de26c83 100755
--- a/native/configure
+++ b/native/configure
@@ -708,7 +708,6 @@ enable_layout
with_apr
with_java_home
with_os_type
-enable_openssl
enable_insecure_export_ciphers
with_ssl
enable_openssl_version_check
@@ -1344,7 +1343,6 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-layout=LAYOUT
- --disable-openssl avoid using OpenSSL toolkit
--enable-insecure-export-ciphers
allow including insecure export and null ciphers in
the cipher string (default is disabled=not allowed)
@@ -1360,7 +1358,7 @@ Optional Packages:
apr-config
--with-java-home=DIR Specify the location of your JDK installation
--with-os-type=SUBDIR Location of JDK os-type subdirectory.
- --with-ssl=PATH Build with OpenSSL yes|no|path
+ --with-ssl=DIR Specify the location of your OpenSSL installation
Some influential environment variables:
CC C compiler command
@@ -2424,9 +2422,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
@@ -2657,7 +2652,6 @@ test -n "$target_alias" &&
NONENONEs,x,x, &&
program_prefix=${target_alias}-
-
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
@@ -2757,6 +2751,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+LT_INIT
+
top_builddir="$abs_builddir"
@@ -3320,24 +3316,6 @@ fi
-
-use_openssl=true;
-
-# Check whether --enable-openssl was given.
-if test ${enable_openssl+y}
-then :
- enableval=$enable_openssl;
- case "${enableval}" in
- no )
- use_openssl=false;
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Disabling SSL support..." >&5
-printf "%s\n" "Disabling SSL support..." >&6; }
- ;;
- esac
-
-fi
-
-
# Check whether --enable-insecure-export-ciphers was given.
if test ${enable_insecure_export_ciphers+y}
then :
@@ -3373,7 +3351,6 @@ printf "%s\n" "$as_me: WARNING: Enabling insecure export and null cipher support
fi
-if $use_openssl ; then
@@ -4371,107 +4348,97 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenSSL library" >&5
-printf %s "checking for OpenSSL library... " >&6; }
# Check whether --with-ssl was given.
if test ${with_ssl+y}
then :
- withval=$with_ssl; use_openssl="$withval"
-else $as_nop
- use_openssl="auto"
+ withval=$with_ssl;
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenSSL library" >&5
+printf %s "checking for OpenSSL library... " >&6; }
+ if test -d "$withval"
+ then
+ use_openssl="$withval"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $use_openssl" >&5
+printf "%s\n" "$use_openssl" >&6; }
+ else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+printf "%s\n" "failed" >&6; }
+ as_fn_error $? "$withval is not a directory" "$LINENO" 5
+ fi
+
fi
-openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
-if test "$use_openssl" = "auto"
-then
+ if test "x$use_openssl" = x
+ then
+ # User did not specify a path - guess it
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenSSL location" >&5
+printf %s "checking for OpenSSL location... " >&6; }
+ openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
for d in $openssldirs
- do
+ do
if test -f $d/include/openssl/opensslv.h
then
- use_openssl=$d
- break
+ use_openssl=$d
+ break
fi
- done
-fi
-case "$use_openssl" in
- no)
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
- TCN_OPENSSL_INC=""
- USE_OPENSSL=""
- ;;
- auto)
- TCN_OPENSSL_INC=""
- USE_OPENSSL=""
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ done
+ fi
+
+ if test x"$use_openssl" = x
+ then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
printf "%s\n" "not found" >&6; }
+ as_fn_error $? "OpenSSL was not found in any of $openssldirs; use --with-ssl=/path" "$LINENO" 5
+ fi
+
+ USE_OPENSSL='-DOPENSSL'
+
+ test -d $use_openssl/lib64 && ssllibdir=lib64 || ssllibdir=lib
+
+ if test "$use_openssl" = "/usr"
+ then
+ TCN_OPENSSL_INC=""
+ TCN_OPENSSL_LIBS="-lssl -lcrypto"
+ else
+ TCN_OPENSSL_INC="-I$use_openssl/include"
+ case $host in
+ *-solaris*)
+ TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -R$use_openssl/$ssllibdir -lssl -lcrypto"
;;
- *)
- if test "$use_openssl" = "yes"
- then
- # User did not specify a path - guess it
- for d in $openssldirs
- do
- if test -f $d/include/openssl/opensslv.h
- then
- use_openssl=$d
- break
- fi
- done
- if test "$use_openssl" = "yes"
- then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-printf "%s\n" "not found" >&6; }
- as_fn_error $? "OpenSSL was not found in any of $openssldirs; use --with-ssl=/path" "$LINENO" 5
- fi
- fi
- USE_OPENSSL='-DOPENSSL'
+ *-hp-hpux*)
+ # By default cc/aCC on HP-UX IA64 will produce 32 bit output
+ ssllibdir=lib/hpux32
+ TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -lssl -lcrypto"
+ ;;
+ *linux*|*freebsd*)
+ TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -Wl,-rpath,$use_openssl/$ssllibdir -lssl -lcrypto"
+ ;;
+ *)
+ TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -lssl -lcrypto"
+ ;;
+ esac
+ fi
- test -d $use_openssl/lib64 && ssllibdir=lib64 || ssllibdir=lib
- if test "$use_openssl" = "/usr"
- then
- TCN_OPENSSL_INC=""
- TCN_OPENSSL_LIBS="-lssl -lcrypto"
- else
- TCN_OPENSSL_INC="-I$use_openssl/include"
- case $host in
- *-solaris*)
- TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -R$use_openssl/$ssllibdir -lssl -lcrypto"
- ;;
- *-hp-hpux*)
- # By default cc/aCC on HP-UX IA64 will produce 32 bit output
- ssllibdir=lib/hpux32
- TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -lssl -lcrypto"
- ;;
- *linux*|*freebsd*)
- TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -Wl,-rpath,$use_openssl/$ssllibdir -lssl -lcrypto"
- ;;
- *)
- TCN_OPENSSL_LIBS="-L$use_openssl/$ssllibdir -lssl -lcrypto"
- ;;
- esac
- fi
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using openssl from $use_openssl/$ssllibdir and $use_openssl/include" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using openssl from $use_openssl/$ssllibdir and $use_openssl/include" >&5
printf "%s\n" "using openssl from $use_openssl/$ssllibdir and $use_openssl/include" >&6; }
- saved_cflags="$CFLAGS"
- saved_libs="$LIBS"
- CFLAGS="$CFLAGS $TCN_OPENSSL_INC"
- LIBS="$LIBS $TCN_OPENSSL_LIBS"
+ saved_cflags="$CFLAGS"
+ saved_libs="$LIBS"
+ CFLAGS="$CFLAGS $TCN_OPENSSL_INC"
+ LIBS="$LIBS $TCN_OPENSSL_LIBS"
-# Check whether --enable-openssl-version-check was given.
+ # Check whether --enable-openssl-version-check was given.
if test ${enable_openssl_version_check+y}
then :
enableval=$enable_openssl_version_check;
fi
-case "$enable_openssl_version_check" in
-yes|'')
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OpenSSL library version >= 1.0.2" >&5
-printf %s "checking OpenSSL library version >= 1.0.2... " >&6; }
- if test "$cross_compiling" = yes
+ case "$enable_openssl_version_check" in
+ yes|'')
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OpenSSL library version >= 3.0.0" >&5
+printf %s "checking OpenSSL library version >= 3.0.0... " >&6; }
+ if test "$cross_compiling" = yes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: assuming target platform has compatible version" >&5
printf "%s\n" "assuming target platform has compatible version" >&6; }
@@ -4482,11 +4449,15 @@ else $as_nop
#include <stdio.h>
#include <openssl/opensslv.h>
int main() {
- if (OPENSSL_VERSION_NUMBER >= 0x1000200fL)
- return (0);
+ #ifdef LIBRESSL_VERSION_NUMBER
+ if (OPENSSL_VERSION_NUMBER >= 0x3000000fL || LIBRESSL_VERSION_NUMBER >= 0x3050200fL)
+ #else
+ if (OPENSSL_VERSION_NUMBER >= 0x3000000fL)
+ #endif
+ return (0);
printf("\n\nFound OPENSSL_VERSION_NUMBER %#010x (" OPENSSL_VERSION_TEXT ")\n",
OPENSSL_VERSION_NUMBER);
- printf("Require OPENSSL_VERSION_NUMBER 0x1000200f or greater (1.0.2)\n\n");
+ printf("Require OPENSSL_VERSION_NUMBER 0x3000000f or greater (3.0.0)\n\n");
return (1);
}
@@ -4502,31 +4473,16 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-;;
-no)
+ ;;
+ no)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Skipped OpenSSL version check" >&5
printf "%s\n" "Skipped OpenSSL version check" >&6; }
-;;
-esac
+ ;;
+ esac
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenSSL DSA support" >&5
-printf %s "checking for OpenSSL DSA support... " >&6; }
- if test -f $use_openssl/include/openssl/dsa.h
- then
- printf "%s\n" "#define HAVE_OPENSSL_DSA 1" >>confdefs.h
+ CFLAGS="$saved_cflags"
+ LIBS="$saved_libs"
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-printf "%s\n" "yes" >&6; }
- else
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
- fi
- CFLAGS="$saved_cflags"
- LIBS="$saved_libs"
- ;;
-esac
-if test "x$USE_OPENSSL" != "x"
-then
if test "x$TCNATIVE_PRIV_INCLUDES" = "x"; then
test "x$silent" != "xyes" && echo " setting TCNATIVE_PRIV_INCLUDES to \"$TCN_OPENSSL_INC\""
@@ -4570,29 +4526,6 @@ then
fi
- if test "x$CFLAGS" = "x"; then
- test "x$silent" != "xyes" && echo " setting CFLAGS to \"-DHAVE_OPENSSL\""
- CFLAGS="-DHAVE_OPENSSL"
- else
- apr_addto_bugger="-DHAVE_OPENSSL"
- for i in $apr_addto_bugger; do
- apr_addto_duplicate="0"
- for j in $CFLAGS; do
- if test "x$i" = "x$j"; then
- apr_addto_duplicate="1"
- break
- fi
- done
- if test $apr_addto_duplicate = "0"; then
- test "x$silent" != "xyes" && echo " adding \"$i\" to CFLAGS"
- CFLAGS="$CFLAGS $i"
- fi
- done
- fi
-
-fi
-
-fi
so_ext=$APR_SO_EXT
lib_target=$APR_LIB_TARGET
diff --git a/native/configure.in b/native/configure.in
index ee9ff2f..e082ae6 100644
--- a/native/configure.in
+++ b/native/configure.in
@@ -47,9 +47,12 @@ else
fi
AC_SUBST(TCN_CONFIG_LOCATION)
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
AC_PROG_INSTALL
+dnl Generate the libtool script which is needed for rlibtool
+LT_INIT
+
dnl
dnl compute the top directory of the build
dnl note: this is needed for LIBTOOL and exporting the bundled Expat
@@ -132,23 +135,6 @@ AC_SUBST(JAVA_PLATFORM)
AC_SUBST(JAVA_OS)
-dnl
-dnl Detect openssl toolkit installation
-dnl
-
-use_openssl=true;
-
-AC_ARG_ENABLE(openssl,
-[AS_HELP_STRING([--disable-openssl],[avoid using OpenSSL toolkit])],
-[
- case "${enableval}" in
- no )
- use_openssl=false;
- AC_MSG_RESULT([Disabling SSL support...])
- ;;
- esac
-])
-
AC_ARG_ENABLE(insecure-export-ciphers,
[AS_HELP_STRING([--enable-insecure-export-ciphers],[allow including insecure export and null ciphers in the cipher string (default is disabled=not allowed)])],
[
@@ -160,9 +146,10 @@ AC_ARG_ENABLE(insecure-export-ciphers,
esac
])
-if $use_openssl ; then
- TCN_CHECK_SSL_TOOLKIT
-fi
+dnl
+dnl Find the OpenSSL installation
+dnl
+TCN_FIND_SSL_TOOLKIT
so_ext=$APR_SO_EXT
lib_target=$APR_LIB_TARGET
@@ -275,8 +262,10 @@ fi
dnl
dnl everything is done.
MAKEFILES="Makefile"
-AC_OUTPUT([
+AC_CONFIG_FILES([
$MAKEFILES
- ],[
+ ])
+AC_CONFIG_COMMANDS([default],[
TCNATIVE_MAJOR_VERSION=$TCNATIVE_MAJOR_VERSION
-])
+],[])
+AC_OUTPUT
diff --git a/native/download_deps.sh b/native/download_deps.sh
new file mode 100755
index 0000000..de0d1fa
--- /dev/null
+++ b/native/download_deps.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# Small script to get a recent openssl
+# Will run configure and build_libs to generate the .s files
+
+cd $(dirname $0)
+
+SSL=openssl-3.0.9.tar.gz
+APR=apr-1.7.4.tar.gz
+mkdir -p deps
+
+if [ ! -f deps/$SSL ] ; then
+ curl https://www.openssl.org/source/$SSL -o deps/$SSL
+fi
+if [ ! -d deps/src/openssl ] ; then
+ mkdir -p deps/src/openssl
+ (cd deps/src/openssl; tar -xvz --strip-components=1 -f ../../$SSL)
+fi
+if [ ! -f deps/src/openssl/Makefile ] ; then
+ (cd deps/src/openssl; ./config )
+fi
+
+(cd deps/src/openssl; make build_libs )
+
+if [ ! -f deps/$APR ] ; then
+ curl https://archive.apache.org/dist/apr/$APR -o deps/$APR
+fi
+if [ ! -d deps/src/apr ] ; then
+ mkdir -p deps/src/apr
+ (cd deps/src/apr; tar -xvz --strip-components=1 -f ../../$APR)
+fi
diff --git a/native/include/ssl_private.h b/native/include/ssl_private.h
index 545022b..091634d 100644
--- a/native/include/ssl_private.h
+++ b/native/include/ssl_private.h
@@ -46,7 +46,7 @@
#include <openssl/x509v3.h>
#include <openssl/dh.h>
#include <openssl/bn.h>
-#if (OPENSSL_VERSION_NUMBER > 0x2FFFFFFFL)
+#ifndef LIBRESSL_VERSION_NUMBER
#include <openssl/provider.h>
#endif
/* Avoid tripping over an engine build installed globally and detected
@@ -217,39 +217,7 @@ extern ENGINE *tcn_ssl_engine;
#endif /* !defined(OPENSSL_NO_TLSEXT) && defined(SSL_set_tlsext_host_name) */
-/* OpenSSL 1.0.2 compatibility */
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-#define OpenSSL_version SSLeay_version
-#define OpenSSL_version_num SSLeay
-#define OPENSSL_VERSION SSLEAY_VERSION
-#define OPENSSL_malloc_init CRYPTO_malloc_init
-#define BN_get_rfc2409_prime_768 get_rfc2409_prime_768
-#define BN_get_rfc2409_prime_1024 get_rfc2409_prime_1024
-#define BN_get_rfc3526_prime_1536 get_rfc3526_prime_1536
-#define BN_get_rfc3526_prime_2048 get_rfc3526_prime_2048
-#define BN_get_rfc3526_prime_3072 get_rfc3526_prime_3072
-#define BN_get_rfc3526_prime_4096 get_rfc3526_prime_4096
-#define BN_get_rfc3526_prime_6144 get_rfc3526_prime_6144
-#define BN_get_rfc3526_prime_8192 get_rfc3526_prime_8192
-#define BIO_get_init(x) (x->init)
-#define BIO_set_init(x,v) (x->init=v)
-#define BIO_get_data(x) (x->ptr)
-#define BIO_set_data(x,v) (x->ptr=v)
-#define BIO_set_shutdown(x,v) (x->shutdown=v)
-#define X509_REVOKED_get0_serialNumber(x) x->serialNumber
-#define X509_STORE_CTX_get0_untrusted(x) (x->untrusted)
-#define X509_OBJECT_free(x) {X509_OBJECT_free_contents(obj);\
- OPENSSL_free(obj);}
-#define TLS_method SSLv23_method
-#define TLS_client_method SSLv23_client_method
-#define TLS_server_method SSLv23_server_method
-#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) */
-
-#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
-#define HAVE_KEYLOG_CALLBACK
-#endif
-
-#define MAX_ALPN_NPN_PROTO_SIZE 65535
+#define MAX_ALPN_PROTO_SIZE 65535
#define SSL_SELECTOR_FAILURE_CHOOSE_MY_LAST_PROTOCOL 1
typedef struct {
@@ -394,19 +362,10 @@ void SSL_callback_handshake(const SSL *, int, int);
int SSL_CTX_use_certificate_chain(SSL_CTX *, const char *, int);
int SSL_callback_SSL_verify(int, X509_STORE_CTX *);
int SSL_rand_seed(const char *file);
-int SSL_callback_next_protos(SSL *, const unsigned char **, unsigned int *, void *);
-int SSL_callback_select_next_proto(SSL *, unsigned char **, unsigned char *, const unsigned char *, unsigned int,void *);
int SSL_callback_alpn_select_proto(SSL *, const unsigned char **, unsigned char *, const unsigned char *, unsigned int, void *);
-#ifdef HAVE_KEYLOG_CALLBACK
void SSL_callback_add_keylog(SSL_CTX *);
-#endif
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)) && ! (defined(WIN32) || defined(WIN64))
-unsigned long SSL_ERR_get(void);
-void SSL_ERR_clear(void);
-#else
#define SSL_ERR_get() ERR_get_error()
#define SSL_ERR_clear() ERR_clear_error()
-#endif
#endif /* SSL_PRIVATE_H */
diff --git a/native/include/tcn.h b/native/include/tcn.h
index 4eb2c97..e1d50d4 100644
--- a/native/include/tcn.h
+++ b/native/include/tcn.h
@@ -32,10 +32,6 @@
#endif
#if defined(DEBUG) || defined(_DEBUG)
-/* On -DDEBUG use the statistics */
-#ifndef TCN_DO_STATISTICS
-#define TCN_DO_STATISTICS
-#endif
#endif
#include <stdio.h>
#include <stdlib.h>
@@ -227,13 +223,10 @@ unsigned long tcn_get_thread_id(void);
jclass _##C = (*(E))->FindClass((E), N); \
if (_##C == NULL) { \
(*(E))->ExceptionClear((E)); \
- if (R != JNI_OK) { \
- return R; \
- } \
- } else { \
- C = (*(E))->NewGlobalRef((E), _##C); \
- (*(E))->DeleteLocalRef((E), _##C); \
+ return R; \
} \
+ C = (*(E))->NewGlobalRef((E), _##C); \
+ (*(E))->DeleteLocalRef((E), _##C); \
TCN_END_MACRO
#define TCN_UNLOAD_CLASS(E, C) \
diff --git a/native/include/tcn_version.h b/native/include/tcn_version.h
index b9ba883..26a17a2 100644
--- a/native/include/tcn_version.h
+++ b/native/include/tcn_version.h
@@ -54,16 +54,16 @@ extern "C" {
* programs such as structure size changes. No binary compatibility is
* possible across a change in the major version.
*/
-#define TCN_MAJOR_VERSION 1
+#define TCN_MAJOR_VERSION 2
/**
* Minor API changes that do not cause binary compatibility problems.
* Should be reset to 0 when upgrading TCN_MAJOR_VERSION
*/
-#define TCN_MINOR_VERSION 2
+#define TCN_MINOR_VERSION 0
/** patch level */
-#define TCN_PATCH_VERSION 35
+#define TCN_PATCH_VERSION 4
/**
* This symbol is defined for internal, "development" copies of TCN. This
diff --git a/native/libtcnative.dsp b/native/libtcnative.dsp
index 4451dcc..1e88b7c 100644
--- a/native/libtcnative.dsp
+++ b/native/libtcnative.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /Zi /O2 /Oy- /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
-# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./srclib/apr/include" /I "./srclib/apr/include/arch/win32" /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "./srclib/openssl/inc32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "NO_IDEA" /D "NO_RC5" /D "NO_MDC2" /D "OPENSSL_NO_IDEA" /D "OPENSSL_NO_RC5" /D "OPENSSL_NO_MDC2" /D "HAVE_OPENSSL" /D HAVE_SSL_SET_STATE=1 /Fd"Release\libtcnative_src" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./srclib/apr/include" /I "./srclib/apr/include/arch/win32" /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "./srclib/openssl/inc32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "NO_IDEA" /D "NO_RC5" /D "NO_MDC2" /D "OPENSSL_NO_IDEA" /D "OPENSSL_NO_RC5" /D "OPENSSL_NO_MDC2" /D HAVE_SSL_SET_STATE=1 /Fd"Release\libtcnative_src" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
-# ADD CPP /nologo /MDd /W4 /GX /Zi /Od /I "./include" /I "./srclib/apr/include" /I "./srclib/apr/include/arch/win32" /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "./srclib/openssl/inc32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "NO_IDEA" /D "NO_RC5" /D "NO_MDC2" /D "OPENSSL_NO_IDEA" /D "OPENSSL_NO_RC5" /D "OPENSSL_NO_MDC2" /D "HAVE_OPENSSL" /D HAVE_SSL_SET_STATE=1 /Fd"Debug\libtcnative_src" /FD /c
+# ADD CPP /nologo /MDd /W4 /GX /Zi /Od /I "./include" /I "./srclib/apr/include" /I "./srclib/apr/include/arch/win32" /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "./srclib/openssl/inc32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "NO_IDEA" /D "NO_RC5" /D "NO_MDC2" /D "OPENSSL_NO_IDEA" /D "OPENSSL_NO_RC5" /D "OPENSSL_NO_MDC2" /D HAVE_SSL_SET_STATE=1 /Fd"Debug\libtcnative_src" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -92,74 +92,22 @@ LINK32=link.exe
# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\src\address.c
-# End Source File
-# Begin Source File
-
SOURCE=.\src\bb.c
# End Source File
# Begin Source File
-SOURCE=.\src\dir.c
-# End Source File
-# Begin Source File
-
SOURCE=.\src\error.c
# End Source File
# Begin Source File
-SOURCE=.\src\file.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\info.c
-# End Source File
-# Begin Source File
-
SOURCE=.\src\jnilib.c
# End Source File
# Begin Source File
-SOURCE=.\src\lock.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\misc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\mmap.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\multicast.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\network.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\os.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\poll.c
-# End Source File
-# Begin Source File
-
SOURCE=.\src\pool.c
# End Source File
# Begin Source File
-SOURCE=.\src\proc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\shm.c
-# End Source File
-# Begin Source File
-
SOURCE=.\src\ssl.c
# End Source File
# Begin Source File
@@ -172,28 +120,8 @@ SOURCE=.\src\sslconf.c
# End Source File
# Begin Source File
-SOURCE=.\src\sslinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\sslnetwork.c
-# End Source File
-# Begin Source File
-
SOURCE=.\src\sslutils.c
# End Source File
-# Begin Source File
-
-SOURCE=.\src\stdlib.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\thread.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\user.c
-# End Source File
# End Group
# Begin Group "Generated Files"
@@ -224,14 +152,6 @@ SOURCE=.\include\tcn_version.h
# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\os\win32\ntpipe.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\os\win32\registry.c
-# End Source File
-# Begin Source File
-
SOURCE=.\os\win32\system.c
# End Source File
# End Group
diff --git a/native/os/unix/system.c b/native/os/unix/system.c
deleted file mode 100644
index c32d342..0000000
--- a/native/os/unix/system.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "apr.h"
-#include "apr_pools.h"
-#include "apr_network_io.h"
-#include "apr_poll.h"
-
-#include "tcn.h"
-#if defined(__linux__)
-#include <sys/sysinfo.h>
-#elif defined(sun)
-#include <unistd.h>
-#include <sys/swap.h>
-#include <procfs.h>
-#include <kstat.h>
-#include <sys/sysinfo.h>
-#endif
-
-#if defined(DARWIN)
-#include <mach/mach_init.h>
-#include <mach/mach_host.h>
-#include <mach/host_info.h>
-#include <sys/sysctl.h>
-#include <sys/stat.h>
-#endif
-
-#include <syslog.h>
-#include <stdarg.h>
-
-#ifndef LOG_WARN
-#define LOG_WARN LOG_WARNING
-#endif
-
-#if defined(sun)
-#define MAX_PROC_PATH_LEN 64
-#define MAX_CPUS 512
-#define PSINFO_T_SZ sizeof(psinfo_t)
-#define PRUSAGE_T_SZ sizeof(prusage_t)
-
-static int proc_open(const char *type)
-{
- char proc_path[MAX_PROC_PATH_LEN+1];
-
- sprintf(proc_path, "/proc/self/%s", type);
- return open(proc_path, O_RDONLY);
-}
-
-static int proc_read(void *buf, const size_t size, int filedes)
-{
- ssize_t bytes;
-
- if (filedes >= 0) {
- bytes = pread(filedes, buf, size, 0);
- if (bytes != size)
- return -1;
- else
- return 0;
- }
- else
- return -1;
-}
-
-#endif
-
-TCN_IMPLEMENT_CALL(jboolean, OS, is)(TCN_STDARGS, jint type)
-{
- UNREFERENCED_STDARGS;
- if (type == 1)
- return JNI_TRUE;
-#if defined(__linux__)
- else if (type == 5)
- return JNI_TRUE;
-#endif
-#if defined(sun)
- else if (type == 6)
- return JNI_TRUE;
-#endif
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
- else if (type == 7)
- return JNI_TRUE;
-#endif
-#if defined(__APPLE__) || defined(DARWIN)
- else if (type == 8)
- return JNI_TRUE;
-#endif
- else
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jint, OS, info)(TCN_STDARGS,
- jlongArray inf)
-{
- jint rv;
- int i;
- jsize ilen = (*e)->GetArrayLength(e, inf);
- jlong *pvals = (*e)->GetLongArrayElements(e, inf, NULL);
-
- UNREFERENCED(o);
- if (ilen < 16) {
- return APR_EINVAL;
- }
- for (i = 0; i < 16; i++)
- pvals[i] = 0;
-#if defined(__linux__)
- {
- struct sysinfo info;
- if (sysinfo(&info))
- rv = apr_get_os_error();
- else {
- static char buf[1024];
- unsigned long user = 0;
- unsigned long system = 0;
- long idle = 0;
- long long starttime = 0;
- int fd;
- int len;
- long sys_clk_tck = sysconf(_SC_CLK_TCK); /* number of system ticks per second */
-
- pvals[0] = (jlong)(info.totalram * info.mem_unit);
- pvals[1] = (jlong)(info.freeram * info.mem_unit);
- pvals[2] = (jlong)(info.totalswap * info.mem_unit);
- pvals[3] = (jlong)(info.freeswap * info.mem_unit);
- pvals[4] = (jlong)(info.sharedram * info.mem_unit);
- pvals[5] = (jlong)(info.bufferram * info.mem_unit);
- pvals[6] = (jlong)(100 - (info.freeram * 100 / info.totalram));
-
- if (sys_clk_tck >= 0) {
- /* Get total CPU times from /proc/stat */
- /* Example for the first line: cpu 2095497 8176 3280198 908667841 1543576 28867 375399 0 0 */
- /* According to the man pages, the numbers are given in units of USER_HZ:
- * user mode, user mode with low priority (nice), system mode, and the idle task.
- * Additional values can be ignored. */
- fd = open("/proc/stat", O_RDONLY);
- if (fd != -1) {
- len = read(fd, buf, sizeof buf - 1);
- if (len > 0) {
- buf[len] = '\0';
- if (sscanf(buf, "cpu %lu %*d %lu %ld", &user, &system, &idle) == 3) {
- pvals[7] = (jlong)(idle * 1000 / sys_clk_tck * 1000); /* Idle Time in microseconds */
- pvals[8] = (jlong)(system * 1000 / sys_clk_tck * 1000); /* Kernel Time in microseconds */
- pvals[9] = (jlong)(user * 1000 / sys_clk_tck * 1000); /* User Time in microseconds */
- }
- }
- close(fd);
- }
- /* Get process CPU times from /proc/self/stat */
- /* Example for the first line:
- * 6309 (csh) S 6308 6309 6309 34816 7124 4202496 15119 252261 1 30 21 58 1537 1447 20 0 1 0 916031966 ... */
- /* Parsing it according to man -s 5 proci:
- * pid %d, comm %s, state %c, ppid %d pgrp %d, session %d, tty_nr %d, tpgid %d, flags %u,
- * minflt %lu, cminflt %lu, majflt %lu, cmajflt %lu,
- * utime %lu (!), stime %lu (!), cutime %ld (!), cstime %ld (!),
- * priority %ld, nice %ld, num_threads %ld, itrealvalue %ld,
- * starttime %llu (!) */
- fd = open("/proc/self/stat", O_RDONLY);
- if (fd != -1) {
- len = read(fd, buf, sizeof buf - 1);
- if (len > 0) {
- buf[len] = '\0';
- if (sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u"
- " %*u %*u %*u %*u"
- " %lu %lu %*d %*d"
- " %*d %*d %*d %*d"
- "%llu", &user, &system, &starttime) == 3) {
- pvals[10] = (jlong)(apr_time_now() - apr_time_make(info.uptime - starttime / sys_clk_tck, 0)); /* Process creation time (apr_time_t) */
- pvals[11] = (jlong)(system * 1000 / sys_clk_tck * 1000); /* Process System Time in microseconds */
- pvals[12] = (jlong)(user * 1000 / sys_clk_tck * 1000); /* Process User Time in microseconds */
- }
- }
- close(fd);
- }
- }
-
- rv = APR_SUCCESS;
- }
- }
-#elif defined(sun)
- {
- /* static variables with basic procfs info */
- static long creation = 0; /* unix timestamp of process creation */
- static int psinf_fd = 0; /* file descriptor for the psinfo procfs file */
- static int prusg_fd = 0; /* file descriptor for the usage procfs file */
- static size_t rss = 0; /* maximum of resident set size from previous calls */
- /* static variables with basic kstat info */
- static kstat_ctl_t *kstat_ctl = NULL; /* kstat control object, only initialized once */
- static kstat_t *kstat_cpu[MAX_CPUS]; /* array of kstat objects for per cpu statistics */
- static int cpu_count = 0; /* number of cpu structures found in kstat */
- static kid_t kid = 0; /* kstat ID, for which the kstat_ctl holds the correct chain */
- /* non-static variables - general use */
- int res = 0; /* general result state */
- /* non-static variables - sysinfo/swapctl use */
- long ret_sysconf; /* value returned from sysconf call */
- long tck_dividend; /* factor used by transforming tick numbers to microseconds */
- long tck_divisor; /* divisor used by transforming tick numbers to microseconds */
- long sys_pagesize = sysconf(_SC_PAGESIZE); /* size of a system memory page in bytes */
- long sys_clk_tck = sysconf(_SC_CLK_TCK); /* number of system ticks per second */
- struct anoninfo info; /* structure for information about sizes in anonymous memory system */
- /* non-static variables - procfs use */
- psinfo_t psinf; /* psinfo structure from procfs */
- prusage_t prusg; /* usage structure from procfs */
- size_t new_rss = 0; /* resident set size read from procfs */
- time_t now; /* time needed for calculating process creation time */
- /* non-static variables - kstat use */
- kstat_t *kstat = NULL; /* kstat working pointer */
- cpu_sysinfo_t cpu; /* cpu sysinfo working pointer */
- kid_t new_kid = 0; /* kstat ID returned from chain update */
- int new_kstat = 0; /* flag indicating, if kstat structure has changed since last call */
-
- rv = APR_SUCCESS;
-
- if (sys_pagesize <= 0) {
- rv = apr_get_os_error();
- }
- else {
- ret_sysconf = sysconf(_SC_PHYS_PAGES);
- if (ret_sysconf >= 0) {
- pvals[0] = (jlong)((jlong)sys_pagesize * ret_sysconf);
- }
- else {
- rv = apr_get_os_error();
- }
- ret_sysconf = sysconf(_SC_AVPHYS_PAGES);
- if (ret_sysconf >= 0) {
- pvals[1] = (jlong)((jlong)sys_pagesize * ret_sysconf);
- }
- else {
- rv = apr_get_os_error();
- }
- res=swapctl(SC_AINFO, &info);
- if (res >= 0) {
- pvals[2] = (jlong)((jlong)sys_pagesize * info.ani_max);
- pvals[3] = (jlong)((jlong)sys_pagesize * info.ani_free);
- pvals[6] = (jlong)(100 - (jlong)info.ani_free * 100 / info.ani_max);
- }
- else {
- rv = apr_get_os_error();
- }
- }
-
- if (psinf_fd == 0) {
- psinf_fd = proc_open("psinfo");
- }
- res = proc_read(&psinf, PSINFO_T_SZ, psinf_fd);
- if (res >= 0) {
- new_rss = psinf.pr_rssize*1024;
- pvals[13] = (jlong)(new_rss);
- if (new_rss > rss) {
- rss = new_rss;
- }
- pvals[14] = (jlong)(rss);
- }
- else {
- psinf_fd = 0;
- rv = apr_get_os_error();
- }
- if (prusg_fd == 0) {
- prusg_fd = proc_open("usage");
- }
- res = proc_read(&prusg, PRUSAGE_T_SZ, prusg_fd);
- if (res >= 0) {
- if (creation <= 0) {
- time(&now);
- creation = (long)(now - (prusg.pr_tstamp.tv_sec -
- prusg.pr_create.tv_sec));
- }
- pvals[10] = (jlong)(creation * 1000000L);
- pvals[11] = (jlong)((jlong)prusg.pr_stime.tv_sec * 1000000L +
- (prusg.pr_stime.tv_nsec / 1000L));
- pvals[12] = (jlong)((jlong)prusg.pr_utime.tv_sec * 1000000L +
- (prusg.pr_utime.tv_nsec / 1000L));
- pvals[15] = (jlong)(prusg.pr_majf);
- }
- else {
- prusg_fd = 0;
- rv = apr_get_os_error();
- }
-
- if (sys_clk_tck <= 0) {
- rv = apr_get_os_error();
- }
- else {
- tck_dividend = 1000000L;
- tck_divisor = sys_clk_tck;
- for (i = 0; i < 3; i++) {
- if (tck_divisor % 2 == 0) {
- tck_divisor = tck_divisor / 2;
- tck_dividend = tck_dividend / 2;
- }
- if (tck_divisor % 5 == 0) {
- tck_divisor = tck_divisor / 5;
- tck_dividend = tck_dividend / 5;
- }
- }
- if (kstat_ctl == NULL) {
- kstat_ctl = kstat_open();
- kid = kstat_ctl->kc_chain_id;
- new_kstat = 1;
- } else {
- new_kid = kstat_chain_update(kstat_ctl);
- if (new_kid < 0) {
- res=kstat_close(kstat_ctl);
- kstat_ctl = kstat_open();
- kid = kstat_ctl->kc_chain_id;
- new_kstat = 1;
- } else if (new_kid > 0 && kid != new_kid) {
- kid = new_kid;
- new_kstat = 1;
- }
- }
- if (new_kstat) {
- cpu_count = 0;
- for (kstat = kstat_ctl->kc_chain; kstat; kstat = kstat->ks_next) {
- if (strncmp(kstat->ks_name, "cpu_stat", 8) == 0) {
- kstat_cpu[cpu_count++]=kstat;
- }
- }
- }
- for (i = 0; i < cpu_count; i++) {
- new_kid = kstat_read(kstat_ctl, kstat_cpu[i], NULL);
- if (new_kid >= 0) {
- cpu = ((cpu_stat_t *)kstat_cpu[i]->ks_data)->cpu_sysinfo;
- if ( tck_divisor == 1 ) {
- pvals[7] += (jlong)(((jlong)cpu.cpu[CPU_IDLE]) * tck_dividend);
- pvals[7] += (jlong)(((jlong)cpu.cpu[CPU_WAIT]) * tck_dividend);
- pvals[8] += (jlong)(((jlong)cpu.cpu[CPU_KERNEL]) * tck_dividend);
- pvals[9] += (jlong)(((jlong)cpu.cpu[CPU_USER]) * tck_dividend);
- } else {
- pvals[7] += (jlong)(((jlong)cpu.cpu[CPU_IDLE]) * tck_dividend / tck_divisor);
- pvals[7] += (jlong)(((jlong)cpu.cpu[CPU_WAIT]) * tck_dividend / tck_divisor);
- pvals[8] += (jlong)(((jlong)cpu.cpu[CPU_KERNEL]) * tck_dividend / tck_divisor);
- pvals[9] += (jlong)(((jlong)cpu.cpu[CPU_USER]) * tck_dividend / tck_divisor);
- }
- }
- }
- }
-
- /*
- * The next two are not implemented yet for Solaris
- * inf[4] - Amount of shared memory
- * inf[5] - Memory used by buffers
- *
- */
- }
-
-#elif defined(DARWIN)
-
- uint64_t mem_total;
- size_t len = sizeof(mem_total);
-
- vm_statistics_data_t vm_info;
- mach_msg_type_number_t info_count = HOST_VM_INFO_COUNT;
-
- sysctlbyname("hw.memsize", &mem_total, &len, NULL, 0);
- pvals[0] = (jlong)mem_total;
-
- host_statistics(mach_host_self (), HOST_VM_INFO, (host_info_t)&vm_info, &info_count);
- pvals[1] = (jlong)(((double)vm_info.free_count)*vm_page_size);
- pvals[6] = (jlong)(100 - (pvals[1] * 100 / mem_total));
- rv = APR_SUCCESS;
-
-/* DARWIN */
-#else
- rv = APR_ENOTIMPL;
-#endif
- (*e)->ReleaseLongArrayElements(e, inf, pvals, 0);
- return rv;
-}
-
-#define LOG_MSG_DOMAIN "Native"
-
-
-TCN_IMPLEMENT_CALL(jstring, OS, expand)(TCN_STDARGS, jstring val)
-{
- jstring str;
- TCN_ALLOC_CSTRING(val);
-
- UNREFERENCED(o);
-
- /* TODO: Make ${ENVAR} expansion */
- str = (*e)->NewStringUTF(e, J2S(val));
-
- TCN_FREE_CSTRING(val);
- return str;
-}
-
-TCN_IMPLEMENT_CALL(void, OS, sysloginit)(TCN_STDARGS, jstring domain)
-{
- const char *d;
- TCN_ALLOC_CSTRING(domain);
-
- UNREFERENCED(o);
- if ((d = J2S(domain)) == NULL)
- d = LOG_MSG_DOMAIN;
-
- openlog(d, LOG_CONS | LOG_PID, LOG_LOCAL0);
- TCN_FREE_CSTRING(domain);
-}
-
-TCN_IMPLEMENT_CALL(void, OS, syslog)(TCN_STDARGS, jint level,
- jstring msg)
-{
- TCN_ALLOC_CSTRING(msg);
- int id = LOG_DEBUG;
- UNREFERENCED(o);
-
- switch (level) {
- case TCN_LOG_EMERG:
- id = LOG_EMERG;
- break;
- case TCN_LOG_ERROR:
- id = LOG_ERR;
- break;
- case TCN_LOG_NOTICE:
- id = LOG_NOTICE;
- break;
- case TCN_LOG_WARN:
- id = LOG_WARN;
- break;
- case TCN_LOG_INFO:
- id = LOG_INFO;
- break;
- }
- syslog (id, "%s", J2S(msg));
-
- TCN_FREE_CSTRING(msg);
-}
diff --git a/native/os/unix/uxpipe.c b/native/os/unix/uxpipe.c
deleted file mode 100644
index 69a7ddc..0000000
--- a/native/os/unix/uxpipe.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** UNIX AF_LOCAL network wrapper
- */
-
-
-#include "tcn.h"
-#include "apr_thread_mutex.h"
-#include "apr_poll.h"
-
-/* ### should be tossed in favor of APR */
-#include <sys/stat.h>
-#include <sys/un.h> /* for sockaddr_un */
-
-#ifdef TCN_DO_STATISTICS
-#include "apr_atomic.h"
-
-static volatile apr_uint32_t uxp_created = 0;
-static volatile apr_uint32_t uxp_closed = 0;
-static volatile apr_uint32_t uxp_cleared = 0;
-static volatile apr_uint32_t uxp_accepted = 0;
-
-void uxp_network_dump_statistics()
-{
- fprintf(stderr, "NT Network Statistics ..\n");
- fprintf(stderr, "Sockets created : %d\n", uxp_created);
- fprintf(stderr, "Sockets accepted : %d\n", uxp_accepted);
- fprintf(stderr, "Sockets closed : %d\n", uxp_closed);
- fprintf(stderr, "Sockets cleared : %d\n", uxp_cleared);
-}
-
-#endif
-
-#define DEFNAME "/var/run/tomcatnativesock"
-#define DEFNAME_FMT "/var/run/tomcatnativesock%08x%08x"
-#define DEFSIZE 8192
-#define DEFTIMEOUT 60000
-
-#define TCN_UXP_UNKNOWN 0
-#define TCN_UXP_CLIENT 1
-#define TCN_UXP_ACCEPTED 2
-#define TCN_UXP_SERVER 3
-
-#define TCN_UNIX_MAXPATH 1024
-typedef struct {
- apr_pool_t *pool;
- apr_socket_t *sock; /* APR socket */
- int sd;
- struct sockaddr_un uxaddr;
- int timeout;
- int mode; /* Client or server mode */
- char name[TCN_UNIX_MAXPATH+1];
-} tcn_uxp_conn_t;
-
-static apr_status_t APR_THREAD_FUNC
-uxp_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t)
-{
- tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
- if (t < 0)
- con->timeout = -1;
- else
- con->timeout = (int)(apr_time_as_msec(t));
- return APR_SUCCESS;
-}
-
-static apr_status_t APR_THREAD_FUNC
-uxp_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t)
-{
- tcn_uxp_conn_t *con = (tcn_uxp_conn_t*)sock;
- if (con->timeout < 0)
- *t = -1;
- else
- *t = con->timeout * 1000;
- return APR_SUCCESS;
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-uxp_socket_opt_set(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on)
-{
- tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
- return apr_socket_opt_set(con->sock, opt, on);
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-uxp_socket_opt_get(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on)
-{
- tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
- return apr_socket_opt_get(con->sock, opt, on);
-}
-
-static apr_status_t uxp_cleanup(void *data)
-{
- tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)data;
-
- if (con) {
- if (con->sock) {
- apr_socket_close(con->sock);
- con->sock = NULL;
- }
- if (con->mode == TCN_UXP_SERVER) {
- unlink(con->name);
- con->mode = TCN_UXP_UNKNOWN;
- }
- }
-
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&uxp_cleared);
-#endif
- return APR_SUCCESS;
-}
-
-static apr_status_t APR_THREAD_FUNC
-uxp_socket_shutdown(apr_socket_t *sock, apr_shutdown_how_e how)
-{
- tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
- return apr_socket_shutdown(con->sock, how);
-}
-
-static apr_status_t APR_THREAD_FUNC
-uxp_socket_close(apr_socket_t *sock)
-{
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&uxp_closed);
-#endif
- return uxp_cleanup(sock);
-}
-
-static apr_status_t APR_THREAD_FUNC
-uxp_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len)
-{
- tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
- return apr_socket_recv(con->sock, buf, len);
-}
-
-
-static apr_status_t APR_THREAD_FUNC
-uxp_socket_send(apr_socket_t *sock, const char *buf,
- apr_size_t *len)
-{
- tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
- return apr_socket_send(con->sock, buf, len);
-}
-
-static apr_status_t APR_THREAD_FUNC
-uxp_socket_sendv(apr_socket_t *sock,
- const struct iovec *vec,
- apr_int32_t nvec, apr_size_t *len)
-{
- tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
- return apr_socket_sendv(con->sock, vec, nvec, len);
-}
-
-static apr_status_t uxp_socket_cleanup(void *data)
-{
- tcn_socket_t *s = (tcn_socket_t *)data;
-
- if (s->net->cleanup) {
- (*s->net->cleanup)(s->opaque);
- s->net->cleanup = NULL;
- }
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&uxp_cleared);
-#endif
- return APR_SUCCESS;
-}
-
-static tcn_nlayer_t uxp_socket_layer = {
- TCN_SOCKET_UNIX,
- uxp_cleanup,
- uxp_socket_close,
- uxp_socket_shutdown,
- uxp_socket_opt_get,
- uxp_socket_opt_set,
- uxp_socket_timeout_get,
- uxp_socket_timeout_set,
- uxp_socket_send,
- uxp_socket_sendv,
- uxp_socket_recv
-};
-
-TCN_IMPLEMENT_CALL(jlong, Local, create)(TCN_STDARGS, jstring name,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- tcn_socket_t *s = NULL;
- tcn_uxp_conn_t *con = NULL;
- int sd;
- TCN_ALLOC_CSTRING(name);
-
- UNREFERENCED(o);
- TCN_ASSERT(pool != 0);
-
- if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
- tcn_ThrowAPRException(e, apr_get_netos_error());
- return 0;
- }
-#ifdef TCN_DO_STATISTICS
- uxp_created++;
-#endif
- con = (tcn_uxp_conn_t *)apr_pcalloc(p, sizeof(tcn_uxp_conn_t));
- con->pool = p;
- con->mode = TCN_UXP_UNKNOWN;
- con->timeout = DEFTIMEOUT;
- con->sd = sd;
- con->uxaddr.sun_family = AF_UNIX;
- if (J2S(name)) {
- strcpy(con->uxaddr.sun_path, J2S(name));
- TCN_FREE_CSTRING(name);
- }
- else
- strcpy(con->uxaddr.sun_path, DEFNAME);
- s = (tcn_socket_t *)apr_pcalloc(p, sizeof(tcn_socket_t));
- s->pool = p;
- s->net = &uxp_socket_layer;
- s->opaque = con;
- apr_pool_cleanup_register(p, (const void *)s,
- uxp_socket_cleanup,
- apr_pool_cleanup_null);
-
- apr_os_sock_put(&(con->sock), &(con->sd), p);
-
- return P2J(s);
-
-}
-
-TCN_IMPLEMENT_CALL(jint, Local, bind)(TCN_STDARGS, jlong sock,
- jlong sa)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- UNREFERENCED_STDARGS;
- UNREFERENCED(sa);
- TCN_ASSERT(sock != 0);
- if (s->net->type == TCN_SOCKET_UNIX) {
- int rc;
- tcn_uxp_conn_t *c = (tcn_uxp_conn_t *)s->opaque;
- c->mode = TCN_UXP_SERVER;
- rc = bind(c->sd, (struct sockaddr *)&(c->uxaddr), sizeof(c->uxaddr));
- if (rc < 0)
- return errno;
- else
- return APR_SUCCESS;
- }
- else
- return APR_EINVAL;
-}
-
-TCN_IMPLEMENT_CALL(jint, Local, listen)(TCN_STDARGS, jlong sock,
- jint backlog)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- UNREFERENCED_STDARGS;
-
- TCN_ASSERT(sock != 0);
- if (s->net->type == TCN_SOCKET_UNIX) {
- tcn_uxp_conn_t *c = (tcn_uxp_conn_t *)s->opaque;
- c->mode = TCN_UXP_SERVER;
- return apr_socket_listen(c->sock, (apr_int32_t)backlog);
- }
- else
- return APR_EINVAL;
-}
-
-TCN_IMPLEMENT_CALL(jlong, Local, accept)(TCN_STDARGS, jlong sock)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_pool_t *p = NULL;
- tcn_socket_t *a = NULL;
- tcn_uxp_conn_t *con = NULL;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
-
- TCN_THROW_IF_ERR(apr_pool_create(&p, s->pool), p);
- if (s->net->type == TCN_SOCKET_UNIX) {
- apr_socklen_t len;
- tcn_uxp_conn_t *c = (tcn_uxp_conn_t *)s->opaque;
- con = (tcn_uxp_conn_t *)apr_pcalloc(p, sizeof(tcn_uxp_conn_t));
- con->pool = p;
- con->mode = TCN_UXP_ACCEPTED;
- con->timeout = c->timeout;
- len = sizeof(c->uxaddr);
- /* Block until a client connects */
- con->sd = accept(c->sd, (struct sockaddr *)&(con->uxaddr), &len);
- if (con->sd < 0) {
- tcn_ThrowAPRException(e, apr_get_os_error());
- goto cleanup;
- }
- }
- else {
- tcn_ThrowAPRException(e, APR_ENOTIMPL);
- goto cleanup;
- }
- if (con) {
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&uxp_accepted);
-#endif
- a = (tcn_socket_t *)apr_pcalloc(p, sizeof(tcn_socket_t));
- a->pool = p;
- a->net = &uxp_socket_layer;
- a->opaque = con;
- apr_pool_cleanup_register(p, (const void *)a,
- uxp_socket_cleanup,
- apr_pool_cleanup_null);
- apr_os_sock_put(&(con->sock), &(con->sd), p);
- }
- return P2J(a);
-cleanup:
- if (p)
- apr_pool_destroy(p);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, Local, connect)(TCN_STDARGS, jlong sock,
- jlong sa)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- tcn_uxp_conn_t *con = NULL;
- int rc;
-
- UNREFERENCED(o);
- UNREFERENCED(sa);
- TCN_ASSERT(sock != 0);
- if (s->net->type != TCN_SOCKET_UNIX)
- return APR_ENOTSOCK;
- con = (tcn_uxp_conn_t *)s->opaque;
- if (con->mode != TCN_UXP_UNKNOWN)
- return APR_EINVAL;
- do {
- rc = connect(con->sd, (const struct sockaddr *)&(con->uxaddr),
- sizeof(con->uxaddr));
- } while (rc == -1 && errno == EINTR);
-
- if (rc == -1 && errno != EISCONN)
- return errno;
- con->mode = TCN_UXP_CLIENT;
-
- return APR_SUCCESS;
-}
diff --git a/native/os/win32/libtcnative.rc b/native/os/win32/libtcnative.rc
index 6e7c858..ecedd73 100644
--- a/native/os/win32/libtcnative.rc
+++ b/native/os/win32/libtcnative.rc
@@ -1,7 +1,6 @@
#include <windows.h>
LANGUAGE 0x9,0x1
-1 11 logmessages.bin
#define TCN_COPYRIGHT "Licensed to the Apache Software Foundation (ASF) under " \
"one or more contributor license agreements. See the " \
@@ -20,7 +19,7 @@ LANGUAGE 0x9,0x1
"See the License for the specific language governing " \
"permissions and limitations under the License."
-#define TCN_VERSION "1.2.35"
+#define TCN_VERSION "2.0.4"
1000 ICON "apache.ico"
1001 DIALOGEX 0, 0, 252, 51
@@ -36,8 +35,8 @@ BEGIN
END
1 VERSIONINFO
- FILEVERSION 1,2,35,0
- PRODUCTVERSION 1,2,35,0
+ FILEVERSION 2,0,4,0
+ PRODUCTVERSION 2,0,4,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -56,9 +55,9 @@ BEGIN
VALUE "CompanyName", "Apache Software Foundation\0"
VALUE "FileDescription", "Tomcat Native Java Library\0"
VALUE "FileVersion", TCN_VERSION "\0"
- VALUE "InternalName", "libtcnative-1\0"
+ VALUE "InternalName", "libtcnative-2\0"
VALUE "LegalCopyright", TCN_COPYRIGHT "\0"
- VALUE "OriginalFilename", "libtcnative-1.dll\0"
+ VALUE "OriginalFilename", "libtcnative-2.dll\0"
VALUE "ProductName", "Tomcat Native Java Library\0"
VALUE "ProductVersion", TCN_VERSION "\0"
END
diff --git a/native/os/win32/logmessages.bin b/native/os/win32/logmessages.bin
deleted file mode 100644
index 44ce985..0000000
Binary files a/native/os/win32/logmessages.bin and /dev/null differ
diff --git a/native/os/win32/logmessages.mc b/native/os/win32/logmessages.mc
deleted file mode 100644
index 68f86f6..0000000
--- a/native/os/win32/logmessages.mc
+++ /dev/null
@@ -1,41 +0,0 @@
-MessageId=0x1
-Severity=Error
-SymbolicName=LOG_MSG_EMERG
-Language=English
-Emerg: %1
-.
-
-MessageId=0x2
-Severity=Error
-SymbolicName=LOG_MSG_ERROR
-Language=English
-Error: %1
-.
-
-MessageId=0x3
-Severity=Warning
-SymbolicName=LOG_MSG_NOTICE
-Language=English
-Notice: %1
-.
-
-MessageId=0x4
-Severity=Warning
-SymbolicName=LOG_MSG_WARN
-Language=English
-Warn: %1
-.
-
-MessageId=0x5
-Severity=Informational
-SymbolicName=LOG_MSG_INFO
-Language=English
-Info: %1
-.
-
-MessageId=0x6
-Severity=Success
-SymbolicName=LOG_MSG_DEBUG
-Language=English
-Debug: %1
-.
diff --git a/native/os/win32/ntpipe.c b/native/os/win32/ntpipe.c
deleted file mode 100644
index 5447567..0000000
--- a/native/os/win32/ntpipe.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** NT Pipes network wrapper
- */
-
-
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
-#endif
-#define STRICT
-#include <winsock2.h>
-#include <mswsock.h>
-#include <ws2tcpip.h>
-#include <sddl.h>
-
-#include "tcn.h"
-#include "apr_thread_mutex.h"
-#include "apr_poll.h"
-
-#ifdef TCN_DO_STATISTICS
-#include "apr_atomic.h"
-
-static volatile apr_uint32_t ntp_created = 0;
-static volatile apr_uint32_t ntp_closed = 0;
-static volatile apr_uint32_t ntp_cleared = 0;
-static volatile apr_uint32_t ntp_accepted = 0;
-
-void ntp_network_dump_statistics()
-{
- fprintf(stderr, "NT Network Statistics ..\n");
- fprintf(stderr, "Sockets created : %d\n", ntp_created);
- fprintf(stderr, "Sockets accepted : %d\n", ntp_accepted);
- fprintf(stderr, "Sockets closed : %d\n", ntp_closed);
- fprintf(stderr, "Sockets cleared : %d\n", ntp_cleared);
-}
-
-#endif
-
-#define DEFNAME "\\\\.\\PIPE\\TOMCATNATIVEPIPE"
-#define DEFNAME_FMT "\\\\.\\PIPE\\TOMCATNATIVEPIPE%08X%08X"
-#define DEFSIZE 8192
-#define DEFTIMEOUT 60000
-
-#define TCN_NTP_UNKNOWN 0
-#define TCN_NTP_CLIENT 1
-#define TCN_NTP_SERVER 2
-
-typedef struct {
- apr_pool_t *pool;
- apr_socket_t *sock; /* Dummy socket */
- OVERLAPPED rd_o;
- OVERLAPPED wr_o;
- HANDLE h_pipe;
- HANDLE rd_event;
- HANDLE wr_event;
- DWORD timeout;
- int mode; /* Client or server mode */
- int nmax;
- DWORD sndbuf;
- DWORD rcvbuf;
- char name[MAX_PATH+1];
- SECURITY_ATTRIBUTES sa;
-} tcn_ntp_conn_t;
-
-static const char *NTSD_STRING = "D:" /* Discretionary ACL */
- "(D;OICI;GA;;;BG)" /* Deny access to Built-in Guests */
- "(D;OICI;GA;;;AN)" /* Deny access to Anonymous Logon */
- "(A;OICI;GRGWGX;;;AU)" /* Allow read/write/execute to Authenticated Users */
- "(A;OICI;GA;;;BA)" /* Allow full control to Administrators */
- "(A;OICI;GA;;;LS)" /* Allow full control to Local service account */
- "(A;OICI;GA;;;SY)"; /* Allow full control to Local system */
-
-
-
-static apr_status_t APR_THREAD_FUNC
-ntp_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t)
-{
- tcn_ntp_conn_t *con = (tcn_ntp_conn_t *)sock;
- if (t < 0)
- con->timeout = INFINITE;
- else
- con->timeout = (DWORD)(apr_time_as_msec(t));
- return APR_SUCCESS;
-}
-
-static apr_status_t APR_THREAD_FUNC
-ntp_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t)
-{
- tcn_ntp_conn_t *con = (tcn_ntp_conn_t*)sock;
- if (con->timeout == INFINITE)
- *t = -1;
- else
- *t = con->timeout * 1000;
- return APR_SUCCESS;
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-ntp_socket_opt_set(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on)
-{
- tcn_ntp_conn_t *con = (tcn_ntp_conn_t *)sock;
- apr_status_t rv = APR_SUCCESS;
- switch (opt) {
- case APR_SO_SNDBUF:
- con->sndbuf = (DWORD)on;
- break;
- case APR_SO_RCVBUF:
- con->rcvbuf = (DWORD)on;
- break;
- default:
- rv = APR_EINVAL;
- break;
- }
- return rv;
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-ntp_socket_opt_get(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on)
-{
- tcn_ntp_conn_t *con = (tcn_ntp_conn_t *)sock;
- apr_status_t rv = APR_SUCCESS;
- switch (opt) {
- case APR_SO_SNDBUF:
- *on = con->sndbuf;
- break;
- case APR_SO_RCVBUF:
- *on = con->rcvbuf;
- break;
- default:
- rv = APR_EINVAL;
- break;
- }
- return rv;
-}
-
-static apr_status_t ntp_cleanup(void *data)
-{
- tcn_ntp_conn_t *con = (tcn_ntp_conn_t *)data;
-
- if (con) {
- if (con->h_pipe) {
- FlushFileBuffers(con->h_pipe);
- CloseHandle(con->h_pipe);
- con->h_pipe = NULL;
- }
- if (con->rd_event) {
- CloseHandle(con->rd_event);
- con->rd_event = NULL;
- }
- if (con->wr_event) {
- CloseHandle(con->wr_event);
- con->wr_event= NULL;
- }
- }
-
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&ntp_cleared);
-#endif
- return APR_SUCCESS;
-}
-
-static apr_status_t APR_THREAD_FUNC
-ntp_socket_shutdown(apr_socket_t *sock, apr_shutdown_how_e how)
-{
- UNREFERENCED(how);
- return ntp_cleanup(sock);;
-}
-
-static apr_status_t APR_THREAD_FUNC
-ntp_socket_close(apr_socket_t *sock)
-{
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&ntp_closed);
-#endif
- return ntp_cleanup(sock);;
-}
-
-static apr_status_t APR_THREAD_FUNC
-ntp_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len)
-{
- tcn_ntp_conn_t *con = (tcn_ntp_conn_t *)sock;
- DWORD readed;
-
- if (!ReadFile(con->h_pipe, buf, (DWORD)*len, &readed, &con->rd_o)) {
- DWORD err = GetLastError();
- if (err == ERROR_IO_PENDING) {
- DWORD r = WaitForSingleObject(con->rd_event, con->timeout);
- if (r == WAIT_TIMEOUT)
- return APR_TIMEUP;
- else if (r != WAIT_OBJECT_0)
- return APR_EOF;
- }
- else if (err == ERROR_BROKEN_PIPE || err == ERROR_NO_DATA) {
- /* Server closed the pipe */
- return APR_EOF;
- }
- GetOverlappedResult(con->h_pipe, &con->rd_o, &readed, FALSE);
- }
- *len = readed;
- return APR_SUCCESS;
-}
-
-static apr_status_t APR_THREAD_FUNC
-ntp_socket_send(apr_socket_t *sock, const char *buf,
- apr_size_t *len)
-{
- tcn_ntp_conn_t *con = (tcn_ntp_conn_t *)sock;
- DWORD written;
-
- if (!WriteFile(con->h_pipe, buf, (DWORD)*len, &written, &con->wr_o)) {
- DWORD err = GetLastError();
- if (err == ERROR_IO_PENDING) {
- DWORD r = WaitForSingleObject(con->wr_event, con->timeout);
- if (r == WAIT_TIMEOUT)
- return APR_TIMEUP;
- else if (r != WAIT_OBJECT_0)
- return APR_EOF;
- }
- else if (err == ERROR_BROKEN_PIPE || err == ERROR_NO_DATA) {
- /* Server closed the pipe */
- return APR_EOF;
- }
- GetOverlappedResult(con->h_pipe, &con->wr_o, &written, FALSE);
- }
- *len = written;
- return APR_SUCCESS;
-}
-
-static apr_status_t APR_THREAD_FUNC
-ntp_socket_sendv(apr_socket_t *sock,
- const struct iovec *vec,
- apr_int32_t nvec, apr_size_t *len)
-{
- tcn_ntp_conn_t *con = (tcn_ntp_conn_t *)sock;
- apr_status_t rv;
- apr_size_t written = 0;
- apr_int32_t i;
-
- for (i = 0; i < nvec; i++) {
- apr_size_t rd = vec[i].iov_len;
- if ((rv = ntp_socket_send((apr_socket_t *)con,
- vec[i].iov_base, &rd)) != APR_SUCCESS) {
- *len = written;
- return rv;
- }
- written += rd;
- }
- *len = written;
- return APR_SUCCESS;
-}
-
-static apr_status_t ntp_socket_cleanup(void *data)
-{
- tcn_socket_t *s = (tcn_socket_t *)data;
-
- if (s->net->cleanup) {
- (*s->net->cleanup)(s->opaque);
- s->net->cleanup = NULL;
- }
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&ntp_cleared);
-#endif
- return APR_SUCCESS;
-}
-
-static tcn_nlayer_t ntp_socket_layer = {
- TCN_SOCKET_NTPIPE,
- ntp_cleanup,
- ntp_socket_close,
- ntp_socket_shutdown,
- ntp_socket_opt_get,
- ntp_socket_opt_set,
- ntp_socket_timeout_get,
- ntp_socket_timeout_set,
- ntp_socket_send,
- ntp_socket_sendv,
- ntp_socket_recv
-};
-
-static BOOL create_DACL(LPSECURITY_ATTRIBUTES psa)
-{
-
- return ConvertStringSecurityDescriptorToSecurityDescriptor(
- NTSD_STRING,
- SDDL_REVISION_1,
- &(psa->lpSecurityDescriptor),
- NULL);
-}
-
-TCN_IMPLEMENT_CALL(jlong, Local, create)(TCN_STDARGS, jstring name,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- tcn_socket_t *s = NULL;
- tcn_ntp_conn_t *con = NULL;
- TCN_ALLOC_CSTRING(name);
-
- UNREFERENCED(o);
- TCN_ASSERT(pool != 0);
-
-#ifdef TCN_DO_STATISTICS
- ntp_created++;
-#endif
- con = (tcn_ntp_conn_t *)apr_pcalloc(p, sizeof(tcn_ntp_conn_t));
- con->pool = p;
- con->mode = TCN_NTP_UNKNOWN;
- con->nmax = PIPE_UNLIMITED_INSTANCES;
- con->timeout = DEFTIMEOUT;
- con->sndbuf = DEFSIZE;
- con->rcvbuf = DEFSIZE;
- if (J2S(name)) {
- strncpy(con->name, J2S(name), MAX_PATH);
- con->name[MAX_PATH] = '\0';
- TCN_FREE_CSTRING(name);
- }
- else
- strcpy(con->name, DEFNAME);
- con->sa.nLength = sizeof(con->sa);
- con->sa.bInheritHandle = TRUE;
- if (!create_DACL(&con->sa)) {
- tcn_ThrowAPRException(e, apr_get_os_error());
- return 0;
- }
-
- s = (tcn_socket_t *)apr_pcalloc(p, sizeof(tcn_socket_t));
- s->pool = p;
- s->net = &ntp_socket_layer;
- s->opaque = con;
- apr_pool_cleanup_register(p, (const void *)s,
- ntp_socket_cleanup,
- apr_pool_cleanup_null);
-
- fflush(stderr);
- return P2J(s);
-
-}
-
-TCN_IMPLEMENT_CALL(jint, Local, bind)(TCN_STDARGS, jlong sock,
- jlong sa)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- UNREFERENCED_STDARGS;
- UNREFERENCED(sa);
- TCN_ASSERT(sock != 0);
- if (s->net->type == TCN_SOCKET_NTPIPE) {
- tcn_ntp_conn_t *c = (tcn_ntp_conn_t *)s->opaque;
- c->mode = TCN_NTP_SERVER;
- return APR_SUCCESS;
- }
- else
- return APR_EINVAL;
-}
-
-TCN_IMPLEMENT_CALL(jint, Local, listen)(TCN_STDARGS, jlong sock,
- jint backlog)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- UNREFERENCED_STDARGS;
-
- TCN_ASSERT(sock != 0);
- if (s->net->type == TCN_SOCKET_NTPIPE) {
- tcn_ntp_conn_t *c = (tcn_ntp_conn_t *)s->opaque;
- c->mode = TCN_NTP_SERVER;
- if (backlog > 0)
- c->nmax = backlog;
- else
- c->nmax = PIPE_UNLIMITED_INSTANCES;
- return APR_SUCCESS;
- }
- else
- return APR_EINVAL;
-}
-
-TCN_IMPLEMENT_CALL(jlong, Local, accept)(TCN_STDARGS, jlong sock)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_pool_t *p = NULL;
- tcn_socket_t *a = NULL;
- tcn_ntp_conn_t *con = NULL;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
-
- TCN_THROW_IF_ERR(apr_pool_create(&p, s->pool), p);
- if (s->net->type == TCN_SOCKET_NTPIPE) {
- tcn_ntp_conn_t *c = (tcn_ntp_conn_t *)s->opaque;
- con = (tcn_ntp_conn_t *)apr_pcalloc(p, sizeof(tcn_ntp_conn_t));
- con->pool = p;
- con->mode = TCN_NTP_SERVER;
- con->nmax = c->nmax;
- con->timeout = c->timeout;
- strcpy(con->name, c->name);
- con->h_pipe = CreateNamedPipe(con->name,
- PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
- PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
- con->nmax,
- con->sndbuf,
- con->rcvbuf,
- con->timeout,
- &c->sa);
- if (con->h_pipe == INVALID_HANDLE_VALUE) {
- tcn_ThrowAPRException(e, apr_get_os_error());
- goto cleanup;
- }
- /* Block until a client connects */
- if (!ConnectNamedPipe(con->h_pipe, NULL)) {
- DWORD err = GetLastError();
- if (err != ERROR_PIPE_CONNECTED) {
- CloseHandle(con->h_pipe);
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(err));
- goto cleanup;
- }
- }
- /* Create overlapped events */
- con->rd_event = CreateEvent(NULL, TRUE, FALSE, NULL);
- con->rd_o.hEvent = con->rd_event;
- con->wr_event = CreateEvent(NULL, TRUE, FALSE, NULL);
- con->wr_o.hEvent = con->wr_event;
- }
- else {
- tcn_ThrowAPRException(e, APR_ENOTIMPL);
- goto cleanup;
- }
- if (con) {
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&ntp_accepted);
-#endif
- a = (tcn_socket_t *)apr_pcalloc(p, sizeof(tcn_socket_t));
- a->pool = p;
- a->net = &ntp_socket_layer;
- a->opaque = con;
- apr_pool_cleanup_register(p, (const void *)a,
- ntp_socket_cleanup,
- apr_pool_cleanup_null);
- }
- return P2J(a);
-cleanup:
- if (p)
- apr_pool_destroy(p);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, Local, connect)(TCN_STDARGS, jlong sock,
- jlong sa)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_pool_t *p = NULL;
- tcn_socket_t *a = NULL;
- tcn_ntp_conn_t *con = NULL;
-
- UNREFERENCED(o);
- UNREFERENCED(sa);
- TCN_ASSERT(sock != 0);
- if (s->net->type != TCN_SOCKET_NTPIPE)
- return APR_ENOTSOCK;
- con = (tcn_ntp_conn_t *)s->opaque;
- if (con->mode == TCN_NTP_SERVER)
- return APR_EINVAL;
- con->mode = TCN_NTP_CLIENT;
-
- while (TRUE) {
- con->h_pipe = CreateFile(con->name,
- GENERIC_WRITE | GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE ,
- NULL,
- OPEN_EXISTING,
- FILE_FLAG_OVERLAPPED,
- NULL);
- if (con->h_pipe != INVALID_HANDLE_VALUE)
- break;
- if (GetLastError() == ERROR_PIPE_BUSY) {
- /* All pipe instances are busy, so wait for
- * timeout value specified by the server process in
- * the CreateNamedPipe function.
- */
- if (!WaitNamedPipe(con->name, NMPWAIT_USE_DEFAULT_WAIT))
- return apr_get_os_error();
- }
- else
- return apr_get_os_error();
- }
-
- /* Create overlapped events */
- con->rd_event = CreateEvent(NULL, TRUE, FALSE, NULL);
- con->rd_o.hEvent = con->rd_event;
- con->wr_event = CreateEvent(NULL, TRUE, FALSE, NULL);
- con->wr_o.hEvent = con->wr_event;
-
- return APR_SUCCESS;
-}
diff --git a/native/os/win32/registry.c b/native/os/win32/registry.c
deleted file mode 100644
index 71312ef..0000000
--- a/native/os/win32/registry.c
+++ /dev/null
@@ -1,786 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
-#endif
-#include <winsock2.h>
-#include <mswsock.h>
-#include <ws2tcpip.h>
-#include <shlwapi.h>
-#include <tlhelp32.h>
-
-#include "apr.h"
-#include "apr_pools.h"
-#include "apr_arch_misc.h" /* for apr_os_level */
-#include "apr_arch_atime.h" /* for FileTimeToAprTime */
-
-#include "tcn.h"
-
-#define SAFE_CLOSE_KEY(k) \
- if ((k) != NULL && (k) != INVALID_HANDLE_VALUE) { \
- RegCloseKey((k)); \
- (k) = NULL; \
- }
-
-typedef struct {
- apr_pool_t *pool;
- HKEY root;
- HKEY key;
-} tcn_nt_registry_t;
-
-
-#define TCN_HKEY_CLASSES_ROOT 1
-#define TCN_HKEY_CURRENT_CONFIG 2
-#define TCN_HKEY_CURRENT_USER 3
-#define TCN_HKEY_LOCAL_MACHINE 4
-#define TCN_HKEY_USERS 5
-
-static const struct {
- HKEY k;
-} TCN_KEYS[] = {
- INVALID_HANDLE_VALUE,
- HKEY_CLASSES_ROOT,
- HKEY_CURRENT_CONFIG,
- HKEY_CURRENT_USER,
- HKEY_LOCAL_MACHINE,
- HKEY_USERS,
- INVALID_HANDLE_VALUE
-};
-
-#define TCN_KEY_ALL_ACCESS 0x0001
-#define TCN_KEY_CREATE_LINK 0x0002
-#define TCN_KEY_CREATE_SUB_KEY 0x0004
-#define TCN_KEY_ENUMERATE_SUB_KEYS 0x0008
-#define TCN_KEY_EXECUTE 0x0010
-#define TCN_KEY_NOTIFY 0x0020
-#define TCN_KEY_QUERY_VALUE 0x0040
-#define TCN_KEY_READ 0x0080
-#define TCN_KEY_SET_VALUE 0x0100
-#define TCN_KEY_WOW64_64KEY 0x0200
-#define TCN_KEY_WOW64_32KEY 0x0400
-#define TCN_KEY_WRITE 0x0800
-
-#define TCN_REGSAM(s, x) \
- s = 0; \
- if (x & TCN_KEY_ALL_ACCESS) \
- s |= KEY_ALL_ACCESS; \
- if (x & TCN_KEY_CREATE_LINK) \
- s |= KEY_CREATE_LINK; \
- if (x & TCN_KEY_CREATE_SUB_KEY) \
- s |= KEY_CREATE_SUB_KEY; \
- if (x & TCN_KEY_ENUMERATE_SUB_KEYS) \
- s |= KEY_ENUMERATE_SUB_KEYS; \
- if (x & TCN_KEY_EXECUTE) \
- s |= KEY_EXECUTE; \
- if (x & TCN_KEY_NOTIFY) \
- s |= KEY_NOTIFY; \
- if (x & TCN_KEY_READ) \
- s |= KEY_READ; \
- if (x & TCN_KEY_SET_VALUE) \
- s |= KEY_SET_VALUE; \
- if (x & TCN_KEY_WOW64_64KEY) \
- s |= KEY_WOW64_64KEY; \
- if (x & TCN_KEY_WOW64_32KEY) \
- s |= KEY_WOW64_32KEY; \
- if (x & TCN_KEY_WRITE) \
- s |= KEY_WRITE
-
-#define TCN_REG_BINARY 1
-#define TCN_REG_DWORD 2
-#define TCN_REG_EXPAND_SZ 3
-#define TCN_REG_MULTI_SZ 4
-#define TCN_REG_QWORD 5
-#define TCN_REG_SZ 6
-
-static const struct {
- DWORD t;
-} TCN_REGTYPES[] = {
- REG_NONE,
- REG_BINARY,
- REG_DWORD,
- REG_EXPAND_SZ,
- REG_MULTI_SZ,
- REG_QWORD,
- REG_SZ,
- REG_NONE
-};
-
-static apr_status_t registry_cleanup(void *data)
-{
- tcn_nt_registry_t *reg = (tcn_nt_registry_t *)data;
-
- if (reg) {
- SAFE_CLOSE_KEY(reg->key);
- }
- return APR_SUCCESS;
-}
-
-TCN_IMPLEMENT_CALL(jlong, Registry, create)(TCN_STDARGS, jint root, jstring name,
- jint sam, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- tcn_nt_registry_t *reg = NULL;
- TCN_ALLOC_WSTRING(name);
- HKEY key;
- LONG rc;
- REGSAM s;
-
- UNREFERENCED(o);
- TCN_ASSERT(pool != 0);
-
- if (root < TCN_HKEY_CLASSES_ROOT || root > TCN_HKEY_USERS) {
- tcn_ThrowException(e, "Invalid Registry Root Key");
- goto cleanup;
- }
- if (sam < TCN_KEY_ALL_ACCESS || root > TCN_KEY_WRITE) {
- tcn_ThrowException(e, "Invalid Registry Key Security");
- goto cleanup;
- }
- reg = (tcn_nt_registry_t *)apr_palloc(p, sizeof(tcn_nt_registry_t));
- reg->pool = p;
- reg->root = TCN_KEYS[root].k;
- reg->key = NULL;
- TCN_INIT_WSTRING(name);
- TCN_REGSAM(s, sam);
- rc = RegCreateKeyExW(reg->root, J2W(name), 0, NULL, REG_OPTION_NON_VOLATILE,
- s, NULL, &key, NULL);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- goto cleanup;
- }
- reg->key = key;
- apr_pool_cleanup_register(p, (const void *)reg,
- registry_cleanup,
- apr_pool_cleanup_null);
-
-cleanup:
- TCN_FREE_WSTRING(name);
- return P2J(reg);
-}
-
-TCN_IMPLEMENT_CALL(jlong, Registry, open)(TCN_STDARGS, jint root, jstring name,
- jint sam, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- tcn_nt_registry_t *reg = NULL;
- TCN_ALLOC_WSTRING(name);
- HKEY key;
- LONG rc;
- REGSAM s;
-
- UNREFERENCED(o);
- TCN_ASSERT(pool != 0);
-
- if (root < TCN_HKEY_CLASSES_ROOT || root > TCN_HKEY_USERS) {
- tcn_ThrowException(e, "Invalid Registry Root Key");
- goto cleanup;
- }
- if (sam < TCN_KEY_ALL_ACCESS || root > TCN_KEY_WRITE) {
- tcn_ThrowException(e, "Invalid Registry Key Security");
- goto cleanup;
- }
- reg = (tcn_nt_registry_t *)apr_palloc(p, sizeof(tcn_nt_registry_t));
- reg->pool = p;
- reg->root = TCN_KEYS[root].k;
- reg->key = NULL;
- TCN_INIT_WSTRING(name);
- TCN_REGSAM(s, sam);
- rc = RegOpenKeyExW(reg->root, J2W(name), 0, s, &key);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- goto cleanup;
- }
- reg->key = key;
- apr_pool_cleanup_register(p, (const void *)reg,
- registry_cleanup,
- apr_pool_cleanup_null);
-
-cleanup:
- TCN_FREE_WSTRING(name);
- return P2J(reg);
-}
-
-TCN_IMPLEMENT_CALL(jint, Registry, close)(TCN_STDARGS, jlong reg)
-{
- tcn_nt_registry_t *r = J2P(reg, tcn_nt_registry_t *);
- UNREFERENCED_STDARGS;
-
- TCN_ASSERT(reg != 0);
-
- registry_cleanup(r);
- apr_pool_cleanup_kill(r->pool, r, registry_cleanup);
- return APR_SUCCESS;
-}
-
-TCN_IMPLEMENT_CALL(jint, Registry, getType)(TCN_STDARGS, jlong key,
- jstring name)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- LONG rc;
- DWORD v;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- TCN_INIT_WSTRING(name);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, &v, NULL, NULL);
- if (rc != ERROR_SUCCESS)
- v = -rc;
- TCN_FREE_WSTRING(name);
- switch (v) {
- case REG_BINARY:
- v = TCN_REG_BINARY;
- break;
- case REG_DWORD:
- v = TCN_REG_DWORD;
- break;
- case REG_EXPAND_SZ:
- v = TCN_REG_EXPAND_SZ;
- break;
- case REG_MULTI_SZ:
- v = TCN_REG_MULTI_SZ;
- break;
- case REG_QWORD:
- v = TCN_REG_QWORD;
- break;
- case REG_SZ:
- v = TCN_REG_SZ;
- break;
- case REG_DWORD_BIG_ENDIAN:
- v = 0;
- break;
- }
- return v;
-}
-
-TCN_IMPLEMENT_CALL(jint, Registry, getSize)(TCN_STDARGS, jlong key,
- jstring name)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- LONG rc;
- DWORD v;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- TCN_INIT_WSTRING(name);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, NULL, NULL, &v);
- if (rc != ERROR_SUCCESS)
- v = -rc;
- TCN_FREE_WSTRING(name);
- return v;
-}
-
-TCN_IMPLEMENT_CALL(jint, Registry, getValueI)(TCN_STDARGS, jlong key,
- jstring name)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- LONG rc;
- DWORD t, l;
- DWORD v = 0;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- TCN_INIT_WSTRING(name);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, &t, NULL, &l);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- goto cleanup;
- }
- if (t == REG_DWORD) {
- l = sizeof(DWORD);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, NULL, (LPBYTE)&v, &l);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- goto cleanup;
- }
- }
- else if (t == REG_SZ || t == REG_BINARY ||
- t == REG_MULTI_SZ || t == REG_EXPAND_SZ)
- v = l;
- else {
- v = 0;
- tcn_ThrowException(e, "Unable to convert the value to integer");
- }
-cleanup:
- TCN_FREE_WSTRING(name);
- return v;
-}
-
-TCN_IMPLEMENT_CALL(jlong, Registry, getValueJ)(TCN_STDARGS, jlong key,
- jstring name)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- LONG rc;
- DWORD t, l;
- UINT64 v = 0;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- TCN_INIT_WSTRING(name);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, &t, NULL, &l);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- goto cleanup;
- }
- if (t == REG_DWORD) {
- DWORD tv;
- l = sizeof(DWORD);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, NULL, (LPBYTE)&tv, &l);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- goto cleanup;
- }
- v = tv;
- }
- else if (t == REG_QWORD) {
- l = sizeof(UINT64);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, NULL, (LPBYTE)&v, &l);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- goto cleanup;
- }
- }
- else if (t == REG_SZ || t == REG_BINARY ||
- t == REG_MULTI_SZ || t == REG_EXPAND_SZ)
- v = l;
- else {
- v = 0;
- tcn_ThrowException(e, "Unable to convert the value to long");
- }
-cleanup:
- TCN_FREE_WSTRING(name);
- return v;
-}
-
-TCN_IMPLEMENT_CALL(jstring, Registry, getValueS)(TCN_STDARGS, jlong key,
- jstring name)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- LONG rc;
- DWORD t, l;
- jstring v = NULL;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- TCN_INIT_WSTRING(name);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, &t, NULL, &l);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- goto cleanup;
- }
- if (t == REG_SZ || t == REG_EXPAND_SZ) {
- jchar *vw = (jchar *)malloc(l);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, NULL, (LPBYTE)vw, &l);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- free(vw);
- goto cleanup;
- }
- v = (*e)->NewString((e), vw, lstrlenW(vw));
- free(vw);
- }
-cleanup:
- TCN_FREE_WSTRING(name);
- return v;
-}
-
-TCN_IMPLEMENT_CALL(jbyteArray, Registry, getValueB)(TCN_STDARGS, jlong key,
- jstring name)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- LONG rc;
- DWORD t, l;
- jbyteArray v = NULL;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- TCN_INIT_WSTRING(name);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, &t, NULL, &l);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- goto cleanup;
- }
- if (t == REG_BINARY) {
- BYTE *b = (BYTE *)malloc(l);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, NULL, b, &l);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- free(b);
- goto cleanup;
- }
- v = tcn_new_arrayb(e, b, l);
- free(b);
- }
-cleanup:
- TCN_FREE_WSTRING(name);
- return v;
-}
-
-static jsize get_multi_sz_count(LPCWSTR str)
-{
- LPCWSTR p = str;
- jsize cnt = 0;
- for ( ; p && *p; p++) {
- cnt++;
- while (*p)
- p++;
- }
- return cnt;
-}
-
-TCN_IMPLEMENT_CALL(jobjectArray, Registry, getValueA)(TCN_STDARGS, jlong key,
- jstring name)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- LONG rc;
- DWORD t, l;
- jobjectArray v = NULL;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- TCN_INIT_WSTRING(name);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, &t, NULL, &l);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- goto cleanup;
- }
- if (t == REG_MULTI_SZ) {
- jsize cnt = 0;
- jchar *p;
- jchar *vw = (jchar *)malloc(l);
- rc = RegQueryValueExW(k->key, J2W(name), NULL, NULL, (LPBYTE)vw, &l);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- free(vw);
- goto cleanup;
- }
- cnt = get_multi_sz_count(vw);
- if (cnt) {
- jsize idx = 0;
- v = tcn_new_arrays(e, cnt);
- for (p = vw ; p && *p; p++) {
- jstring s;
- jchar *b = p;
- while (*p)
- p++;
- s = (*e)->NewString((e), b, (jsize)(p - b));
- (*e)->SetObjectArrayElement((e), v, idx++, s);
- }
- }
- free(vw);
- }
-cleanup:
- TCN_FREE_WSTRING(name);
- return v;
-}
-
-TCN_IMPLEMENT_CALL(jint, Registry, setValueI)(TCN_STDARGS, jlong key,
- jstring name, jint val)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- LONG rc;
- DWORD v = (DWORD)val;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- TCN_INIT_WSTRING(name);
- rc = RegSetValueExW(k->key, J2W(name), 0, REG_DWORD, (CONST BYTE *)&v, sizeof(DWORD));
- TCN_FREE_WSTRING(name);
- return v;
-}
-
-TCN_IMPLEMENT_CALL(jint, Registry, setValueJ)(TCN_STDARGS, jlong key,
- jstring name, jlong val)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- LONG rc;
- UINT64 v = (UINT64)val;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- TCN_INIT_WSTRING(name);
- rc = RegSetValueExW(k->key, J2W(name), 0, REG_QWORD, (CONST BYTE *)&v, sizeof(UINT64));
- TCN_FREE_WSTRING(name);
- return rc;
-}
-
-TCN_IMPLEMENT_CALL(jint, Registry, setValueS)(TCN_STDARGS, jlong key,
- jstring name, jstring val)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- TCN_ALLOC_WSTRING(val);
- LONG rc;
- DWORD len;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- TCN_INIT_WSTRING(name);
- TCN_INIT_WSTRING(val);
- len = lstrlenW(J2W(val));
- rc = RegSetValueExW(k->key, J2W(name), 0, REG_SZ,
- (CONST BYTE *)J2W(val), (len + 1) * 2);
- TCN_FREE_WSTRING(name);
- TCN_FREE_WSTRING(val);
- return rc;
-}
-
-TCN_IMPLEMENT_CALL(jint, Registry, setValueE)(TCN_STDARGS, jlong key,
- jstring name, jstring val)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- TCN_ALLOC_WSTRING(val);
- LONG rc;
- DWORD len;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- TCN_INIT_WSTRING(name);
- TCN_INIT_WSTRING(val);
- len = lstrlenW(J2W(val));
- rc = RegSetValueExW(k->key, J2W(name), 0, REG_EXPAND_SZ,
- (CONST BYTE *)J2W(val), (len + 1) * 2);
- TCN_FREE_WSTRING(name);
- TCN_FREE_WSTRING(val);
- return rc;
-}
-
-TCN_IMPLEMENT_CALL(jint, Registry, setValueA)(TCN_STDARGS, jlong key,
- jstring name,
- jobjectArray vals)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- LONG rc;
- jsize i, len;
- jsize sl = 0;
- jchar *msz, *p;
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- TCN_INIT_WSTRING(name);
- len = (*e)->GetArrayLength((e), vals);
- for (i = 0; i < len; i++) {
- jstring s = (jstring)(*e)->GetObjectArrayElement((e), vals, i);
- sl += (*e)->GetStringLength((e), s) + 1;
- }
- sl = (sl + 1) * 2;
- p = msz = (jchar *)calloc(1, sl);
- for (i = 0; i < len; i++) {
- jsize l;
- jstring s = (jstring)(*e)->GetObjectArrayElement((e), vals, i);
- l = (*e)->GetStringLength((e), s);
- wcsncpy(p, (*e)->GetStringChars(e, s, 0), l);
- p += l + 1;
- }
- rc = RegSetValueExW(k->key, J2W(name), 0, REG_MULTI_SZ,
- (CONST BYTE *)msz, sl);
- TCN_FREE_WSTRING(name);
- free(msz);
- return rc;
-}
-
-TCN_IMPLEMENT_CALL(jint, Registry, setValueB)(TCN_STDARGS, jlong key,
- jstring name,
- jbyteArray val)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- TCN_ALLOC_WSTRING(name);
- jsize nbytes = (*e)->GetArrayLength(e, val);
- jbyte *bytes = (*e)->GetByteArrayElements(e, val, NULL);
- LONG rc;
-
- rc = RegSetValueExW(k->key, J2W(name), 0, REG_BINARY,
- bytes, (DWORD)nbytes);
- (*e)->ReleaseByteArrayElements(e, val, bytes, JNI_ABORT);
- TCN_FREE_WSTRING(name);
- return rc;
-}
-
-#define MAX_VALUE_NAME 4096
-
-TCN_IMPLEMENT_CALL(jobjectArray, Registry, enumKeys)(TCN_STDARGS, jlong key)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- LONG rc;
- jobjectArray v = NULL;
- jsize cnt = 0;
-
- WCHAR achKey[MAX_PATH];
- WCHAR achClass[MAX_PATH] = L"";
- DWORD cchClassName = MAX_PATH;
- DWORD cSubKeys;
- DWORD cbMaxSubKey;
- DWORD cchMaxClass;
- DWORD cValues;
- DWORD cchMaxValue;
- DWORD cbMaxValueData;
- DWORD cbSecurityDescriptor;
- FILETIME ftLastWriteTime;
-
- DWORD cchValue = MAX_VALUE_NAME;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- rc = RegQueryInfoKeyW(k->key,
- achClass,
- &cchClassName,
- NULL,
- &cSubKeys,
- &cbMaxSubKey,
- &cchMaxClass,
- &cValues,
- &cchMaxValue,
- &cbMaxValueData,
- &cbSecurityDescriptor,
- &ftLastWriteTime);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- goto cleanup;
- }
- cnt = cSubKeys;
- if (cnt) {
- jsize idx = 0;
- v = tcn_new_arrays(e, cnt);
- for (idx = 0; idx < cnt; idx++) {
- jstring s;
- DWORD achKeyLen = MAX_PATH;
- rc = RegEnumKeyExW(k->key,
- idx,
- achKey,
- &achKeyLen,
- NULL,
- NULL,
- NULL,
- &ftLastWriteTime);
- if (rc == (DWORD)ERROR_SUCCESS) {
- s = (*e)->NewString((e), achKey, lstrlenW(achKey));
- (*e)->SetObjectArrayElement((e), v, idx, s);
- }
- }
- }
-cleanup:
- return v;
-}
-
-TCN_IMPLEMENT_CALL(jobjectArray, Registry, enumValues)(TCN_STDARGS, jlong key)
-{
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
- LONG rc;
- jobjectArray v = NULL;
- jsize cnt = 0;
-
- WCHAR achClass[MAX_PATH] = L"";
- DWORD cchClassName = MAX_PATH;
- DWORD cSubKeys;
- DWORD cbMaxSubKey;
- DWORD cchMaxClass;
- DWORD cValues;
- DWORD cchMaxValue;
- DWORD cbMaxValueData;
- DWORD cbSecurityDescriptor;
- FILETIME ftLastWriteTime;
-
- WCHAR achValue[MAX_VALUE_NAME];
- DWORD cchValue = MAX_VALUE_NAME;
-
- UNREFERENCED(o);
- TCN_ASSERT(key != 0);
- /* Get the class name and the value count. */
- rc = RegQueryInfoKeyW(k->key,
- achClass,
- &cchClassName,
- NULL,
- &cSubKeys,
- &cbMaxSubKey,
- &cchMaxClass,
- &cValues,
- &cchMaxValue,
- &cbMaxValueData,
- &cbSecurityDescriptor,
- &ftLastWriteTime);
- if (rc != ERROR_SUCCESS) {
- tcn_ThrowAPRException(e, APR_FROM_OS_ERROR(rc));
- goto cleanup;
- }
- cnt = cValues;
- if (cnt) {
- jsize idx = 0;
- v = tcn_new_arrays(e, cnt);
- for (idx = 0; idx < cnt; idx++) {
- jstring s;
- cchValue = MAX_VALUE_NAME;
- achValue[0] = '\0';
- rc = RegEnumValueW(k->key, idx,
- achValue,
- &cchValue,
- NULL,
- NULL, // &dwType,
- NULL, // &bData,
- NULL); // &bcData
- if (rc == (DWORD)ERROR_SUCCESS) {
- s = (*e)->NewString((e), achValue, lstrlenW(achValue));
- (*e)->SetObjectArrayElement((e), v, idx, s);
- }
- }
- }
-cleanup:
- return v;
-}
-
-TCN_IMPLEMENT_CALL(jint, Registry, deleteKey)(TCN_STDARGS, jint root, jstring name,
- jboolean only_if_empty)
-{
- DWORD rv;
- TCN_ALLOC_WSTRING(name);
-
- UNREFERENCED(o);
- if (root < TCN_HKEY_CLASSES_ROOT || root > TCN_HKEY_USERS) {
- rv = EBADF;
- goto cleanup;
- }
- TCN_INIT_WSTRING(name);
- if (only_if_empty)
- rv = SHDeleteEmptyKeyW(TCN_KEYS[root].k, J2W(name));
- else
- rv = SHDeleteKeyW(TCN_KEYS[root].k, J2W(name));
-cleanup:
- TCN_FREE_WSTRING(name);
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, Registry, deleteValue)(TCN_STDARGS, jlong key,
- jstring name)
-{
- LONG rv;
- TCN_ALLOC_WSTRING(name);
- tcn_nt_registry_t *k = J2P(key, tcn_nt_registry_t *);
-
- UNREFERENCED(o);
- TCN_INIT_WSTRING(name);
- rv = RegDeleteValueW(k->key, J2W(name));
- TCN_FREE_WSTRING(name);
- return (jint)rv;
-}
diff --git a/native/os/win32/system.c b/native/os/win32/system.c
index c09cc49..0f7377f 100644
--- a/native/os/win32/system.c
+++ b/native/os/win32/system.c
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
-#endif
#include <winsock2.h>
#include <mswsock.h>
#include <ws2tcpip.h>
@@ -27,35 +24,18 @@
#include "apr_poll.h"
#include "apr_network_io.h"
#include "apr_arch_misc.h" /* for apr_os_level */
-#include "apr_arch_atime.h" /* for FileTimeToAprTime */
#include "tcn.h"
-#ifdef HAVE_OPENSSL
#include "ssl_private.h"
-#endif
#pragma warning(push)
#pragma warning(disable : 4201)
-#if (_WIN32_WINNT < 0x0501)
-#include <winternl.h>
-#endif
#include <psapi.h>
#pragma warning(pop)
static CRITICAL_SECTION dll_critical_section; /* dll's critical section */
static HINSTANCE dll_instance = NULL;
-static SYSTEM_INFO dll_system_info;
-static HANDLE h_kernel = NULL;
-static HANDLE h_ntdll = NULL;
-static char dll_file_name[MAX_PATH];
-
-typedef BOOL (WINAPI *pfnGetSystemTimes)(LPFILETIME, LPFILETIME, LPFILETIME);
-static pfnGetSystemTimes fnGetSystemTimes = NULL;
-#if (_WIN32_WINNT < 0x0501)
-typedef NTSTATUS (WINAPI *pfnNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
-static pfnNtQuerySystemInformation fnNtQuerySystemInformation = NULL;
-#endif
BOOL
WINAPI
@@ -72,15 +52,6 @@ DllMain(
case DLL_PROCESS_ATTACH:
InitializeCriticalSection(&dll_critical_section);
dll_instance = instance;
- GetSystemInfo(&dll_system_info);
- if ((h_kernel = LoadLibrary("kernel32.dll")) != NULL)
- fnGetSystemTimes = (pfnGetSystemTimes)GetProcAddress(h_kernel,
- "GetSystemTimes");
- if (fnGetSystemTimes == NULL) {
- FreeLibrary(h_kernel);
- h_kernel = NULL;
- }
- GetModuleFileName(instance, dll_file_name, sizeof(dll_file_name));
break;
/** The attached process creates a new thread.
*/
@@ -90,19 +61,13 @@ DllMain(
/** The thread of the attached process terminates.
*/
case DLL_THREAD_DETACH:
-#ifdef HAVE_OPENSSL
ERR_remove_thread_state(NULL);
-#endif
break;
/** DLL unload due to process termination
* or FreeLibrary.
*/
case DLL_PROCESS_DETACH:
- if (h_kernel)
- FreeLibrary(h_kernel);
- if (h_ntdll)
- FreeLibrary(h_ntdll);
DeleteCriticalSection(&dll_critical_section);
break;
@@ -115,252 +80,6 @@ DllMain(
}
-TCN_IMPLEMENT_CALL(jstring, OS, syserror)(TCN_STDARGS, jint err)
-{
- jstring str;
- void *buf;
-
- UNREFERENCED(o);
- if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- err,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR)&buf,
- 0,
- NULL)) {
- str = AJP_TO_JSTRING("Unknown Error");
- }
- else {
- str = AJP_TO_JSTRING((const char *)buf);
- LocalFree(buf);
- }
- return str;
-}
-
-TCN_IMPLEMENT_CALL(jstring, OS, expand)(TCN_STDARGS, jstring val)
-{
- jstring str;
- jchar buf[TCN_BUFFER_SZ] = L"";
- DWORD len;
- TCN_ALLOC_WSTRING(val);
-
- UNREFERENCED(o);
- TCN_INIT_WSTRING(val);
-
- len = ExpandEnvironmentStringsW(J2W(val), buf, TCN_BUFFER_SZ - 1);
- if (len > (TCN_BUFFER_SZ - 1)) {
- jchar *dbuf = malloc((len + 1) * 2);
- ExpandEnvironmentStringsW(J2W(val), dbuf, len);
- str = (*e)->NewString(e, dbuf, lstrlenW(dbuf));
- free(dbuf);
- }
- else
- str = (*e)->NewString(e, buf, lstrlenW(buf));
-
- TCN_FREE_WSTRING(val);
- return str;
-}
-
-#define LOG_MSG_EMERG 0xC0000001L
-#define LOG_MSG_ERROR 0xC0000002L
-#define LOG_MSG_NOTICE 0x80000003L
-#define LOG_MSG_WARN 0x80000004L
-#define LOG_MSG_INFO 0x40000005L
-#define LOG_MSG_DEBUG 0x00000006L
-#define LOG_MSG_DOMAIN "Native"
-
-static char log_domain[MAX_PATH] = "Native";
-
-static void init_log_source(const char *domain)
-{
- HKEY key;
- DWORD ts;
- char event_key[MAX_PATH];
-
- strcpy(event_key, "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\");
- strcat(event_key, domain);
- if (!RegCreateKey(HKEY_LOCAL_MACHINE, event_key, &key)) {
- RegSetValueEx(key, "EventMessageFile", 0, REG_SZ, (LPBYTE)&dll_file_name[0],
- lstrlenA(dll_file_name) + 1);
- ts = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;
-
- RegSetValueEx(key, "TypesSupported", 0, REG_DWORD, (LPBYTE) &ts, sizeof(DWORD));
- RegCloseKey(key);
- }
- strcpy(log_domain, domain);
-}
-
-TCN_IMPLEMENT_CALL(void, OS, sysloginit)(TCN_STDARGS, jstring domain)
-{
- const char *d;
- TCN_ALLOC_CSTRING(domain);
-
- UNREFERENCED(o);
-
- if ((d = J2S(domain)) == NULL)
- d = LOG_MSG_DOMAIN;
- init_log_source(d);
-
- TCN_FREE_CSTRING(domain);
-}
-
-TCN_IMPLEMENT_CALL(void, OS, syslog)(TCN_STDARGS, jint level,
- jstring msg)
-{
- TCN_ALLOC_CSTRING(msg);
- DWORD id = LOG_MSG_DEBUG;
- WORD il = EVENTLOG_SUCCESS;
- HANDLE source;
- const char *messages[1];
- UNREFERENCED(o);
-
- switch (level) {
- case TCN_LOG_EMERG:
- id = LOG_MSG_EMERG;
- il = EVENTLOG_ERROR_TYPE;
- break;
- case TCN_LOG_ERROR:
- id = LOG_MSG_ERROR;
- il = EVENTLOG_ERROR_TYPE;
- break;
- case TCN_LOG_NOTICE:
- id = LOG_MSG_NOTICE;
- il = EVENTLOG_WARNING_TYPE;
- break;
- case TCN_LOG_WARN:
- id = LOG_MSG_WARN;
- il = EVENTLOG_WARNING_TYPE;
- break;
- case TCN_LOG_INFO:
- id = LOG_MSG_INFO;
- il = EVENTLOG_INFORMATION_TYPE;
- break;
- }
-
- messages[0] = J2S(msg);
- source = RegisterEventSource(NULL, log_domain);
-
- if (source != NULL) {
- ReportEvent(source, il,
- 0,
- id,
- NULL,
- 1, 0,
- messages, NULL);
- DeregisterEventSource(source);
- }
-
- TCN_FREE_CSTRING(msg);
-}
-
-TCN_IMPLEMENT_CALL(jboolean, OS, is)(TCN_STDARGS, jint type)
-{
- UNREFERENCED_STDARGS;
-#ifdef _WIN64
- if (type == 4)
- return JNI_TRUE;
- else
-#endif
- if (type == 3)
- return JNI_TRUE;
- else
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jint, OS, info)(TCN_STDARGS,
- jlongArray inf)
-{
- MEMORYSTATUSEX ms;
- ULONGLONG st[4];
- FILETIME ft[4];
- PROCESS_MEMORY_COUNTERS pmc;
- jint rv;
- int i;
- jsize ilen = (*e)->GetArrayLength(e, inf);
- jlong *pvals = (*e)->GetLongArrayElements(e, inf, NULL);
-
- if (ilen < 16) {
- return APR_EINVAL;
- }
- for (i = 0; i < 16; i++)
- pvals[i] = 0;
-
- ms.dwLength = sizeof(MEMORYSTATUSEX);
-
- UNREFERENCED(o);
- if (GlobalMemoryStatusEx(&ms)) {
- pvals[0] = (jlong)ms.ullTotalPhys;
- pvals[1] = (jlong)ms.ullAvailPhys;
- pvals[2] = (jlong)ms.ullTotalPageFile;
- pvals[3] = (jlong)ms.ullAvailPageFile;
- /* Slots 4 and 5 are for shared memory */
- pvals[6] = (jlong)ms.dwMemoryLoad;
- }
- else
- goto cleanup;
-
- memset(st, 0, sizeof(st));
-
- if (fnGetSystemTimes) {
- if ((*fnGetSystemTimes)(&ft[0], &ft[1], &ft[2])) {
- st[0] = (((ULONGLONG)ft[0].dwHighDateTime << 32) | ft[0].dwLowDateTime) / 10;
- st[1] = (((ULONGLONG)ft[1].dwHighDateTime << 32) | ft[1].dwLowDateTime) / 10;
- st[2] = (((ULONGLONG)ft[2].dwHighDateTime << 32) | ft[2].dwLowDateTime) / 10;
- }
- else
- goto cleanup;
- }
-#if (_WIN32_WINNT < 0x0501)
- else if (fnNtQuerySystemInformation) {
- BYTE buf[2048]; /* This should ne enough for 32 processors */
- NTSTATUS rs = (*fnNtQuerySystemInformation)(SystemProcessorPerformanceInformation,
- (LPVOID)buf, 2048, NULL);
- if (rs == 0) {
- PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION pspi = (PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)&buf[0];
- DWORD i;
- /* Calculate all processors */
- for (i = 0; i < dll_system_info.dwNumberOfProcessors; i++) {
- st[0] += pspi[i].IdleTime.QuadPart / 10;
- st[1] += pspi[i].KernelTime.QuadPart / 10;
- st[2] += pspi[i].UserTime.QuadPart / 10;
- }
- }
- else
- goto cleanup;
- }
-#endif
- pvals[7] = st[0];
- pvals[8] = st[1];
- pvals[9] = st[2];
-
- memset(st, 0, sizeof(st));
- if (GetProcessTimes(GetCurrentProcess(), &ft[0], &ft[1], &ft[2], &ft[3])) {
- FileTimeToAprTime((apr_time_t *)&st[0], &ft[0]);
- st[1] = (((ULONGLONG)ft[2].dwHighDateTime << 32) | ft[2].dwLowDateTime) / 10;
- st[2] = (((ULONGLONG)ft[3].dwHighDateTime << 32) | ft[3].dwLowDateTime) / 10;
- }
- pvals[10] = st[0];
- pvals[11] = st[1];
- pvals[12] = st[2];
-
- if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
- pvals[13] = pmc.WorkingSetSize;
- pvals[14] = pmc.PeakWorkingSetSize;
- pvals[15] = pmc.PageFaultCount;
- }
-
- (*e)->ReleaseLongArrayElements(e, inf, pvals, 0);
- return APR_SUCCESS;
-cleanup:
- rv = apr_get_os_error();
- (*e)->ReleaseLongArrayElements(e, inf, pvals, 0);
- return rv;
-}
-
-#ifdef HAVE_OPENSSL
-
static DWORD WINAPI password_thread(void *data)
{
tcn_pass_cb_t *cb = (tcn_pass_cb_t *)data;
@@ -450,5 +169,3 @@ int WIN32_SSL_password_prompt(tcn_pass_cb_t *data)
CloseHandle(thread);
return (int)strlen(data->password);
}
-
-#endif
diff --git a/native/src/address.c b/native/src/address.c
deleted file mode 100644
index 87a8771..0000000
--- a/native/src/address.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-
-TCN_IMPLEMENT_CALL(jlong, Address, info)(TCN_STDARGS,
- jstring hostname,
- jint family, jint port,
- jint flags, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(hostname);
- char *sp = NULL;
- int scope_id = 0;
- apr_sockaddr_t *sa = NULL;
- apr_sockaddr_t *sl = NULL;
- apr_int32_t f;
-
-
- UNREFERENCED(o);
- GET_S_FAMILY(f, family);
-#if APR_HAVE_IPV6
- if (hostname) {
- /* XXX: This only works for real scope_id's
- */
- if ((sp = strchr(J2S(hostname), '%'))) {
- *sp++ = '\0';
- scope_id = atoi(sp);
- }
- }
-#endif
- TCN_THROW_IF_ERR(apr_sockaddr_info_get(&sa,
- J2S(hostname), f, (apr_port_t)port,
- (apr_int32_t)flags, p), sa);
- sl = sa;
- /*
- * apr_sockaddr_info_get may return several address so this is not
- * go to work in some cases (but as least it works for Linux)
- * XXX: with AP_ENABLE_V4_MAPPED it is going to work otherwise it won't.
- */
-#if APR_HAVE_IPV6
- if (hostname == NULL) {
- /* Try all address using IPV6 one */
- while (sl) {
- if (sl->family == APR_INET6)
- break; /* Done */
- sl = sl->next;
- }
- /* If we don't find an IPv6 address, use the original one */
- if (sl == NULL) {
- sl = sa;
- }
- }
- if (sp) {
- /* Set the provided scope id
- * APR lack the api for setting this directly so lets presume
- * the sin6_scope_id is present everywhere
- */
- sl->sa.sin6.sin6_scope_id = scope_id;
- }
-#endif
-
-cleanup:
- TCN_FREE_CSTRING(hostname);
- return P2J(sl);
-}
-
-TCN_IMPLEMENT_CALL(jstring, Address, getnameinfo)(TCN_STDARGS,
- jlong sa, jint flags)
-{
- apr_sockaddr_t *s = J2P(sa, apr_sockaddr_t *);
- char *hostname;
-
- UNREFERENCED(o);
- if (apr_getnameinfo(&hostname, s, (apr_int32_t)flags) == APR_SUCCESS)
- return AJP_TO_JSTRING(hostname);
- else
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jstring, Address, getip)(TCN_STDARGS, jlong sa)
-{
- apr_sockaddr_t *s = J2P(sa, apr_sockaddr_t *);
- char *ipaddr;
-
- UNREFERENCED(o);
- if (apr_sockaddr_ip_get(&ipaddr, s) == APR_SUCCESS)
- return AJP_TO_JSTRING(ipaddr);
- else
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jlong, Address, get)(TCN_STDARGS, jint which,
- jlong sock)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_sockaddr_t *sa = NULL;
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_socket_addr_get(&sa,
- (apr_interface_e)which, s->sock), sa);
-cleanup:
- return P2J(sa);
-}
-
-TCN_IMPLEMENT_CALL(jboolean, Address, equal)(TCN_STDARGS,
- jlong a, jlong b)
-{
- apr_sockaddr_t *sa = J2P(a, apr_sockaddr_t *);
- apr_sockaddr_t *sb = J2P(b, apr_sockaddr_t *);
-
- UNREFERENCED_STDARGS;
- return apr_sockaddr_equal(sa, sb) ? JNI_TRUE : JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jint, Address, getservbyname)(TCN_STDARGS,
- jlong sa, jstring servname)
-{
- apr_sockaddr_t *s = J2P(sa, apr_sockaddr_t *);
- TCN_ALLOC_CSTRING(servname);
- apr_status_t rv;
-
- UNREFERENCED(o);
- rv = apr_getservbyname(s, J2S(servname));
- TCN_FREE_CSTRING(servname);
- return (jint)rv;
-}
diff --git a/native/src/bb.c b/native/src/bb.c
index 616ea78..3e48c9b 100644
--- a/native/src/bb.c
+++ b/native/src/bb.c
@@ -20,110 +20,8 @@
* DirectByteBuffer utilities
*/
-TCN_IMPLEMENT_CALL(jobject, Buffer, malloc)(TCN_STDARGS, jint size)
-{
- void *mem;
- size_t sz = (size_t)APR_ALIGN_DEFAULT(size);
-
- UNREFERENCED(o);
-
- if ((mem = malloc(sz)) != NULL) {
- jobject rv = (*e)->NewDirectByteBuffer(e, mem, (jlong)sz);
- if (rv == NULL)
- free(mem);
- return rv;
- }
- else {
- return NULL;
- }
-}
-
-TCN_IMPLEMENT_CALL(jobject, Buffer, calloc)(TCN_STDARGS, jint num, jint size)
-{
- size_t sz = (size_t)APR_ALIGN_DEFAULT((size * num));
- void *mem;
-
- UNREFERENCED(o);
-
- if ((mem = calloc(1, sz)) != NULL) {
- jobject rv = (*e)->NewDirectByteBuffer(e, mem, (jlong)sz);
- if (rv == NULL)
- free(mem);
- return rv;
- }
- else {
- return NULL;
- }
-}
-
-TCN_IMPLEMENT_CALL(jobject, Buffer, palloc)(TCN_STDARGS, jlong pool,
- jint size)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_size_t sz = (apr_size_t)APR_ALIGN_DEFAULT(size);
- void *mem;
-
- UNREFERENCED(o);
- TCN_ASSERT(pool != 0);
-
- if ((mem = apr_palloc(p, sz)) != NULL)
- return (*e)->NewDirectByteBuffer(e, mem, (jlong)sz);
- else
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jobject, Buffer, pcalloc)(TCN_STDARGS, jlong pool,
- jint size)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_size_t sz = (apr_size_t)APR_ALIGN_DEFAULT(size);
- void *mem;
-
- UNREFERENCED(o);
- TCN_ASSERT(pool != 0);
-
- if ((mem = apr_pcalloc(p, sz)) != NULL)
- return (*e)->NewDirectByteBuffer(e, mem, (jlong)sz);
- else
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jobject, Buffer, create)(TCN_STDARGS, jlong addr,
- jint size)
-{
- void *mem = J2P(addr, void *);
-
- UNREFERENCED(o);
- TCN_ASSERT(mem != 0);
- TCN_ASSERT(size != 0);
-
- if (mem && size)
- return (*e)->NewDirectByteBuffer(e, mem, (jlong)size);
- else
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(void, Buffer, free)(TCN_STDARGS, jobject bb)
-{
- void *mem;
-
- UNREFERENCED(o);
- if ((mem = (*e)->GetDirectBufferAddress(e, bb)) != NULL) {
- /* This can cause core dump if address was
- * allocated from the APR pool.
- */
- free(mem);
- }
-}
-
TCN_IMPLEMENT_CALL(jlong, Buffer, address)(TCN_STDARGS, jobject bb)
{
UNREFERENCED(o);
return P2J((*e)->GetDirectBufferAddress(e, bb));
}
-
-TCN_IMPLEMENT_CALL(jlong, Buffer, size)(TCN_STDARGS, jobject bb)
-{
- UNREFERENCED(o);
- return (*e)->GetDirectBufferCapacity(e, bb);
-}
diff --git a/native/src/dir.c b/native/src/dir.c
deleted file mode 100644
index 33c04fa..0000000
--- a/native/src/dir.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-#include "apr_file_io.h"
-
-TCN_IMPLEMENT_CALL(jint, Directory, make)(TCN_STDARGS, jstring path,
- jint perm, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(path);
- apr_status_t rv;
-
- UNREFERENCED(o);
- rv = apr_dir_make(J2S(path), (apr_fileperms_t)perm, p);
- TCN_FREE_CSTRING(path);
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, Directory, makeRecursive)(TCN_STDARGS, jstring path,
- jint perm, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(path);
- apr_status_t rv;
-
- UNREFERENCED(o);
- rv = apr_dir_make_recursive(J2S(path), (apr_fileperms_t)perm, p);
- TCN_FREE_CSTRING(path);
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, Directory, remove)(TCN_STDARGS, jstring path,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(path);
- apr_status_t rv;
-
- UNREFERENCED(o);
- rv = apr_dir_remove(J2S(path), p);
- TCN_FREE_CSTRING(path);
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jstring, Directory, tempGet)(TCN_STDARGS, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- jstring name = NULL;
- const char *tname;
-
- UNREFERENCED(o);
- if (apr_temp_dir_get(&tname, p) == APR_SUCCESS)
- name = AJP_TO_JSTRING(tname);
-
- return name;
-}
-
-TCN_IMPLEMENT_CALL(jlong, Directory, open)(TCN_STDARGS, jstring path,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_dir_t *d = NULL;
- TCN_ALLOC_CSTRING(path);
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_dir_open(&d, J2S(path), p), d);
-
-cleanup:
- TCN_FREE_CSTRING(path);
- return P2J(d);
-}
-
-TCN_IMPLEMENT_CALL(jint, Directory, close)(TCN_STDARGS, jlong dir)
-{
- apr_dir_t *d = J2P(dir, apr_dir_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_dir_close(d);
-}
-
-TCN_IMPLEMENT_CALL(jint, Directory, rewind)(TCN_STDARGS, jlong dir)
-{
- apr_dir_t *d = J2P(dir, apr_dir_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_dir_rewind(d);
-}
diff --git a/native/src/error.c b/native/src/error.c
index d365084..7a7eecc 100644
--- a/native/src/error.c
+++ b/native/src/error.c
@@ -16,16 +16,6 @@
#include "tcn.h"
-static const char *tcn_errors[] = {
- "Unknown user error",
- /* TCN_TIMEUP */ "Operation timed out",
- /* TCN_EAGAIN */ "There is no data ready",
- /* TCN_EINTR */ "Interrupted system call",
- /* TCN_EINPROGRESS */ "Operation in progress",
- /* TCN_ETIMEDOUT */ "Connection timed out",
- NULL
-};
-
/* Merge IS_ETIMEDOUT with APR_TIMEUP
*/
#define TCN_STATUS_IS_ETIMEDOUT(x) (APR_STATUS_IS_ETIMEDOUT((x)) || ((x) == APR_TIMEUP))
@@ -134,109 +124,3 @@ void tcn_ThrowAPRException(JNIEnv *e, apr_status_t err)
cleanup:
(*e)->DeleteLocalRef(e, aprErrorClass);
}
-
-
-TCN_IMPLEMENT_CALL(jint, Error, osError)(TCN_STDARGS)
-{
- UNREFERENCED_STDARGS;
- return (jint)apr_get_os_error();
-}
-
-TCN_IMPLEMENT_CALL(jint, Error, netosError)(TCN_STDARGS)
-{
- UNREFERENCED_STDARGS;
- return (jint)apr_get_netos_error();
-}
-
-TCN_IMPLEMENT_CALL(jstring, Error, strerror)(TCN_STDARGS, jint err)
-{
- char serr[512] = {0};
- jstring jerr;
-
- UNREFERENCED(o);
- if (err >= TCN_TIMEUP && err <= TCN_ETIMEDOUT) {
- err -= TCN_TIMEUP;
- jerr = AJP_TO_JSTRING(tcn_errors[err + 1]);
- }
- else {
- apr_strerror(err, serr, 512);
- jerr = AJP_TO_JSTRING(serr);
- }
- return jerr;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, Status, is)(TCN_STDARGS, jint err, jint idx)
-{
-#define APR_IS(I, E) case I: if (E(err)) return JNI_TRUE; break
-#define APR_ISX(I, E, T) case I: if (E(err) || (err == T)) return JNI_TRUE; break
-
- UNREFERENCED_STDARGS;
- switch (idx) {
- APR_IS(1, APR_STATUS_IS_ENOSTAT);
- APR_IS(2, APR_STATUS_IS_ENOPOOL);
- /* empty slot: +3 */
- APR_IS(4, APR_STATUS_IS_EBADDATE);
- APR_IS(5, APR_STATUS_IS_EINVALSOCK);
- APR_IS(6, APR_STATUS_IS_ENOPROC);
- APR_IS(7, APR_STATUS_IS_ENOTIME);
- APR_IS(8, APR_STATUS_IS_ENODIR);
- APR_IS(9, APR_STATUS_IS_ENOLOCK);
- APR_IS(10, APR_STATUS_IS_ENOPOLL);
- APR_IS(11, APR_STATUS_IS_ENOSOCKET);
- APR_IS(12, APR_STATUS_IS_ENOTHREAD);
- APR_IS(13, APR_STATUS_IS_ENOTHDKEY);
- APR_IS(14, APR_STATUS_IS_EGENERAL);
- APR_IS(15, APR_STATUS_IS_ENOSHMAVAIL);
- APR_IS(16, APR_STATUS_IS_EBADIP);
- APR_IS(17, APR_STATUS_IS_EBADMASK);
- /* empty slot: +18 */
- APR_IS(19, APR_STATUS_IS_EDSOOPEN);
- APR_IS(20, APR_STATUS_IS_EABSOLUTE);
- APR_IS(21, APR_STATUS_IS_ERELATIVE);
- APR_IS(22, APR_STATUS_IS_EINCOMPLETE);
- APR_IS(23, APR_STATUS_IS_EABOVEROOT);
- APR_IS(24, APR_STATUS_IS_EBADPATH);
- APR_IS(25, APR_STATUS_IS_EPATHWILD);
- APR_IS(26, APR_STATUS_IS_ESYMNOTFOUND);
- APR_IS(27, APR_STATUS_IS_EPROC_UNKNOWN);
- APR_IS(28, APR_STATUS_IS_ENOTENOUGHENTROPY);
-
-
- /* APR_Error */
- APR_IS(51, APR_STATUS_IS_INCHILD);
- APR_IS(52, APR_STATUS_IS_INPARENT);
- APR_IS(53, APR_STATUS_IS_DETACH);
- APR_IS(54, APR_STATUS_IS_NOTDETACH);
- APR_IS(55, APR_STATUS_IS_CHILD_DONE);
- APR_IS(56, APR_STATUS_IS_CHILD_NOTDONE);
- APR_ISX(57, APR_STATUS_IS_TIMEUP, TCN_TIMEUP);
- APR_IS(58, APR_STATUS_IS_INCOMPLETE);
- /* empty slot: +9 */
- /* empty slot: +10 */
- /* empty slot: +11 */
- APR_IS(62, APR_STATUS_IS_BADCH);
- APR_IS(63, APR_STATUS_IS_BADARG);
- APR_IS(64, APR_STATUS_IS_EOF);
- APR_IS(65, APR_STATUS_IS_NOTFOUND);
- /* empty slot: +16 */
- /* empty slot: +17 */
- /* empty slot: +18 */
- APR_IS(69, APR_STATUS_IS_ANONYMOUS);
- APR_IS(70, APR_STATUS_IS_FILEBASED);
- APR_IS(71, APR_STATUS_IS_KEYBASED);
- APR_IS(72, APR_STATUS_IS_EINIT);
- APR_IS(73, APR_STATUS_IS_ENOTIMPL);
- APR_IS(74, APR_STATUS_IS_EMISMATCH);
- APR_IS(75, APR_STATUS_IS_EBUSY);
- /* Socket errors */
- APR_ISX(90, APR_STATUS_IS_EAGAIN, TCN_EAGAIN);
- APR_ISX(91, TCN_STATUS_IS_ETIMEDOUT, TCN_ETIMEDOUT);
- APR_IS(92, APR_STATUS_IS_ECONNABORTED);
- APR_IS(93, APR_STATUS_IS_ECONNRESET);
- APR_ISX(94, APR_STATUS_IS_EINPROGRESS, TCN_EINPROGRESS);
- APR_ISX(95, APR_STATUS_IS_EINTR, TCN_EINTR);
- APR_IS(96, APR_STATUS_IS_ENOTSOCK);
- APR_IS(97, APR_STATUS_IS_EINVAL);
- }
- return JNI_FALSE;
-}
diff --git a/native/src/file.c b/native/src/file.c
deleted file mode 100644
index 9a7acea..0000000
--- a/native/src/file.c
+++ /dev/null
@@ -1,587 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-#include "apr_file_io.h"
-
-
-TCN_IMPLEMENT_CALL(jint, File, close)(TCN_STDARGS, jlong file)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_file_close(f);
-}
-
-TCN_IMPLEMENT_CALL(jint, File, eof)(TCN_STDARGS, jlong file)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_file_eof(f);
-}
-
-TCN_IMPLEMENT_CALL(jint, File, flush)(TCN_STDARGS, jlong file)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_file_flush(f);
-}
-
-TCN_IMPLEMENT_CALL(jint, File, unlock)(TCN_STDARGS, jlong file)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_file_unlock(f);
-}
-
-TCN_IMPLEMENT_CALL(jint, File, flagsGet)(TCN_STDARGS, jlong file)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_file_flags_get(f);
-}
-
-TCN_IMPLEMENT_CALL(jint, File, lock)(TCN_STDARGS, jlong file, jint flags)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_file_lock(f, (int)flags);
-}
-
-TCN_IMPLEMENT_CALL(jint, File, trunc)(TCN_STDARGS, jlong file, jlong off)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_file_trunc(f, (apr_off_t)off);
-}
-
-TCN_IMPLEMENT_CALL(jlong, File, open)(TCN_STDARGS, jstring fname,
- jint flag, jint perm,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_file_t *f = NULL;
- TCN_ALLOC_CSTRING(fname);
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_file_open(&f, J2S(fname), (apr_int32_t)flag,
- (apr_fileperms_t)perm, p), f);
-
-cleanup:
- TCN_FREE_CSTRING(fname);
- return P2J(f);
-}
-
-TCN_IMPLEMENT_CALL(jlong, File, mktemp)(TCN_STDARGS, jstring templ,
- jint flags,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_file_t *f = NULL;
- char *ctempl = tcn_strdup(e, templ);
-
- UNREFERENCED(o);
- if (!ctempl) {
- TCN_THROW_OS_ERROR(e);
- return 0;
- }
- TCN_THROW_IF_ERR(apr_file_mktemp(&f, ctempl,
- (apr_int32_t)flags, p), f);
-
-cleanup:
- free(ctempl);
- return P2J(f);
-}
-
-TCN_IMPLEMENT_CALL(jint, File, remove)(TCN_STDARGS, jstring path, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(path);
- apr_status_t rv;
-
- UNREFERENCED(o);
- rv = apr_file_remove(J2S(path), p);
- TCN_FREE_CSTRING(path);
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, rename)(TCN_STDARGS, jstring from,
- jstring to, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(from);
- TCN_ALLOC_CSTRING(to);
- apr_status_t rv;
-
- UNREFERENCED(o);
- rv = apr_file_rename(J2S(from), J2S(to), p);
- TCN_FREE_CSTRING(from);
- TCN_FREE_CSTRING(to);
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, copy)(TCN_STDARGS, jstring from,
- jstring to, jint perms, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(from);
- TCN_ALLOC_CSTRING(to);
- apr_status_t rv;
-
- UNREFERENCED(o);
- rv = apr_file_copy(J2S(from), J2S(to), (apr_fileperms_t)perms, p);
- TCN_FREE_CSTRING(from);
- TCN_FREE_CSTRING(to);
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, append)(TCN_STDARGS, jstring from,
- jstring to, jint perms, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(from);
- TCN_ALLOC_CSTRING(to);
- apr_status_t rv;
-
- UNREFERENCED(o);
- rv = apr_file_append(J2S(from), J2S(to), (apr_fileperms_t)perms, p);
- TCN_FREE_CSTRING(from);
- TCN_FREE_CSTRING(to);
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jstring, File, nameGet)(TCN_STDARGS, jlong file)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- jstring name = NULL;
- const char *fname;
-
- UNREFERENCED(o);
- if (apr_file_name_get(&fname, f) == APR_SUCCESS)
- name = AJP_TO_JSTRING(fname);
-
- return name;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, permsSet)(TCN_STDARGS, jstring file, jint perms)
-{
- TCN_ALLOC_CSTRING(file);
- apr_status_t rv;
-
- UNREFERENCED(o);
- rv = apr_file_perms_set(J2S(file), (apr_fileperms_t)perms);
- TCN_FREE_CSTRING(file);
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, attrsSet)(TCN_STDARGS, jstring file, jint attrs,
- jint mask, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(file);
- apr_status_t rv;
-
- UNREFERENCED(o);
- rv = apr_file_attrs_set(J2S(file), (apr_fileattrs_t)attrs,
- (apr_fileattrs_t)mask, p);
- TCN_FREE_CSTRING(file);
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, mtimeSet)(TCN_STDARGS, jstring file, jlong mtime,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(file);
- apr_status_t rv;
-
- UNREFERENCED(o);
- rv = apr_file_mtime_set(J2S(file), J2T(mtime), p);
- TCN_FREE_CSTRING(file);
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jlong, File, seek)(TCN_STDARGS, jlong file,
- jint where, jlong offset)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_off_t pos = (apr_off_t)offset;
- apr_seek_where_t w;
- UNREFERENCED(o);
- switch (where) {
- case 1:
- w = APR_CUR;
- break;
- case 2:
- w = APR_END;
- break;
- default:
- w = APR_SET;
- break;
- }
- TCN_THROW_IF_ERR(apr_file_seek(f, w, &pos), pos);
-
-cleanup:
- return (jlong)pos;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, putc)(TCN_STDARGS, jbyte c, jlong file)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_file_putc((char)c, f);
-}
-
-TCN_IMPLEMENT_CALL(jint, File, getc)(TCN_STDARGS, jlong file)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- char ch;
-
- UNREFERENCED_STDARGS;
- TCN_THROW_IF_ERR(apr_file_getc(&ch, f), ch);
-
-cleanup:
- return (jint)ch;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, ungetc)(TCN_STDARGS, jbyte c, jlong file)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_file_ungetc((char)c, f);
-}
-
-TCN_IMPLEMENT_CALL(jint, File, puts)(TCN_STDARGS, jbyteArray str, jlong file)
-{
- apr_status_t rv = APR_EINVAL;
- apr_file_t *f = J2P(file, apr_file_t *);
- jbyte *bytes = (*e)->GetPrimitiveArrayCritical(e, str, NULL);
-
- UNREFERENCED(o);
- if (bytes) {
- rv = apr_file_puts((const char *)bytes, f);
- (*e)->ReleasePrimitiveArrayCritical(e, str, bytes, JNI_ABORT);
- }
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, write)(TCN_STDARGS, jlong file,
- jbyteArray buf, jint offset, jint towrite)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_size_t nbytes = (apr_size_t)towrite;
- jbyte *bytes = (*e)->GetPrimitiveArrayCritical(e, buf, NULL);
- apr_status_t ss;
-
- UNREFERENCED(o);
- ss = apr_file_write(f, bytes + offset, &nbytes);
-
- (*e)->ReleasePrimitiveArrayCritical(e, buf, bytes, JNI_ABORT);
- if (ss == APR_SUCCESS)
- return (jint)nbytes;
- else
- return -(jint)ss;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, writeb)(TCN_STDARGS, jlong file,
- jobject buf, jint offset, jint towrite)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_size_t nbytes = (apr_size_t)towrite;
- char *bytes = (char *)(*e)->GetDirectBufferAddress(e, buf);
- apr_status_t ss = APR_EINVAL;
-
- UNREFERENCED(o);
- if (bytes)
- ss = apr_file_write(f, bytes + offset, &nbytes);
-
- if (ss == APR_SUCCESS)
- return (jint)nbytes;
- else
- return -(jint)ss;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, writeFull)(TCN_STDARGS, jlong file,
- jbyteArray buf, jint offset, jint towrite)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_size_t nbytes = (apr_size_t)towrite;
- apr_size_t written = 0;
- apr_status_t ss;
- jbyte *bytes = (*e)->GetByteArrayElements(e, buf, NULL);
-
- UNREFERENCED(o);
- ss = apr_file_write_full(f, bytes + offset, nbytes, &written);
-
- (*e)->ReleaseByteArrayElements(e, buf, bytes, JNI_ABORT);
- if (ss == APR_SUCCESS)
- return (jint)written;
- else
- return -(jint)ss;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, writeFullb)(TCN_STDARGS, jlong file,
- jobject buf, jint offset, jint towrite)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_size_t nbytes = (apr_size_t)towrite;
- apr_size_t written = 0;
- apr_status_t ss = APR_EINVAL;
- char *bytes = (char *)(*e)->GetDirectBufferAddress(e, buf);
-
- UNREFERENCED(o);
- if (bytes)
- ss = apr_file_write_full(f, bytes + offset, nbytes, &written);
-
- if (ss == APR_SUCCESS)
- return (jint)written;
- else
- return -(jint)ss;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, writev)(TCN_STDARGS, jlong file,
- jobjectArray bufs)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- jsize nvec = (*e)->GetArrayLength(e, bufs);
- jsize i;
- struct iovec vec[APR_MAX_IOVEC_SIZE];
- jobject ba[APR_MAX_IOVEC_SIZE];
- apr_size_t written = 0;
- apr_status_t ss;
-
- UNREFERENCED(o);
-
- if (nvec >= APR_MAX_IOVEC_SIZE) {
- /* TODO: Throw something here */
- return 0;
- }
- for (i = 0; i < nvec; i++) {
- ba[i] = (*e)->GetObjectArrayElement(e, bufs, i);
- vec[i].iov_len = (*e)->GetArrayLength(e, ba[i]);
- vec[i].iov_base = (void *)((*e)->GetByteArrayElements(e, ba[i], NULL));
- }
-
- ss = apr_file_writev(f, vec, nvec, &written);
-
- for (i = 0; i < nvec; i++) {
- (*e)->ReleaseByteArrayElements(e, ba[i], (jbyte *)vec[i].iov_base, JNI_ABORT);
- }
- if (ss == APR_SUCCESS)
- return (jint)written;
- else
- return -(jint)ss;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, writevFull)(TCN_STDARGS, jlong file,
- jobjectArray bufs)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- jsize nvec = (*e)->GetArrayLength(e, bufs);
- jsize i;
- struct iovec vec[APR_MAX_IOVEC_SIZE];
- jobject ba[APR_MAX_IOVEC_SIZE];
- apr_size_t written = 0;
- apr_status_t ss;
-
- UNREFERENCED(o);
-
- if (nvec >= APR_MAX_IOVEC_SIZE) {
- /* TODO: Throw something here */
- return 0;
- }
- for (i = 0; i < nvec; i++) {
- ba[i] = (*e)->GetObjectArrayElement(e, bufs, i);
- vec[i].iov_len = (*e)->GetArrayLength(e, ba[i]);
- vec[i].iov_base = (void *)((*e)->GetByteArrayElements(e, ba[i], NULL));
- }
- ss = apr_file_writev_full(f, vec, nvec, &written);
-
- for (i = 0; i < nvec; i++) {
- (*e)->ReleaseByteArrayElements(e, ba[i], (jbyte *)vec[i].iov_base,
- JNI_ABORT);
- }
- if (ss == APR_SUCCESS)
- return (jint)written;
- else
- return -(jint)ss;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, read)(TCN_STDARGS, jlong file,
- jbyteArray buf, jint offset,
- jint toread)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_size_t nbytes = (apr_size_t)toread;
- jbyte *bytes = (*e)->GetByteArrayElements(e, buf, NULL);
- apr_status_t ss;
-
- UNREFERENCED(o);
- ss = apr_file_read(f, bytes + offset, &nbytes);
-
- (*e)->ReleaseByteArrayElements(e, buf, bytes,
- ss == APR_SUCCESS ? 0 : JNI_ABORT);
- if (ss == APR_SUCCESS)
- return (jint)nbytes;
- else
- return -(jint)ss;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, readb)(TCN_STDARGS, jlong file,
- jobject buf, jint offset,
- jint toread)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_size_t nbytes = (apr_size_t)toread;
- char *bytes = (char *)(*e)->GetDirectBufferAddress(e, buf);
- apr_status_t ss = APR_EINVAL;
-
- UNREFERENCED(o);
- if (bytes)
- ss = apr_file_read(f, bytes + offset, &nbytes);
-
- if (ss == APR_SUCCESS)
- return (jint)nbytes;
- else
- return -(jint)ss;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, readFull)(TCN_STDARGS, jlong file,
- jbyteArray buf, jint offset,
- jint toread)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_size_t nbytes = (apr_size_t)toread;
- apr_size_t nread = 0;
- apr_status_t ss;
- jbyte *bytes = (*e)->GetByteArrayElements(e, buf, NULL);
-
- UNREFERENCED(o);
- ss = apr_file_read_full(f, bytes + offset, nbytes, &nread);
-
- (*e)->ReleaseByteArrayElements(e, buf, bytes,
- ss == APR_SUCCESS ? 0 : JNI_ABORT);
- if (ss == APR_SUCCESS)
- return (jint)nread;
- else
- return -(jint)ss;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, readFullb)(TCN_STDARGS, jlong file,
- jobject buf, jint offset,
- jint toread)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_size_t nbytes = (apr_size_t)toread;
- apr_size_t nread = 0;
- char *bytes = (char *)(*e)->GetDirectBufferAddress(e, buf);
- apr_status_t ss = APR_EINVAL;
-
- UNREFERENCED(o);
- if (bytes)
- ss = apr_file_read_full(f, bytes + offset, nbytes, &nread);
-
- if (ss == APR_SUCCESS)
- return (jint)nread;
- else
- return -(jint)ss;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, gets)(TCN_STDARGS, jbyteArray buf, jint offset,
- jlong file)
-{
- apr_status_t rv;
- apr_file_t *f = J2P(file, apr_file_t *);
- jsize nbytes = (*e)->GetArrayLength(e, buf);
- jbyte *bytes = (*e)->GetByteArrayElements(e, buf, NULL);
-
- UNREFERENCED(o);
- rv = apr_file_gets((char*)(bytes + offset),nbytes - offset, f);
- (*e)->ReleaseByteArrayElements(e, buf, bytes,
- rv == APR_SUCCESS ? 0 : JNI_ABORT);
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, pipeCreate)(TCN_STDARGS, jlongArray io, jlong pool)
-{
- apr_status_t rv;
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- jsize npipes = (*e)->GetArrayLength(e, io);
- jlong *pipes = (*e)->GetLongArrayElements(e, io, NULL);
- apr_file_t *in;
- apr_file_t *out;
-
- UNREFERENCED(o);
- if (npipes < 2) {
- (*e)->ReleaseLongArrayElements(e, io, pipes, JNI_ABORT);
- return APR_EINVAL;
- }
-
- rv = apr_file_pipe_create(&in, &out, p);
- if (rv == APR_SUCCESS) {
- pipes[0] = P2J(in);
- pipes[1] = P2J(out);
- (*e)->ReleaseLongArrayElements(e, io, pipes, 0);
- }
- else
- (*e)->ReleaseLongArrayElements(e, io, pipes, JNI_ABORT);
-
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, pipeTimeoutSet)(TCN_STDARGS, jlong pipe,
- jlong timeout)
-{
- apr_file_t *f = J2P(pipe, apr_file_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_file_pipe_timeout_set(f, J2T(timeout));
-}
-
-TCN_IMPLEMENT_CALL(jlong, File, pipeTimeoutGet)(TCN_STDARGS, jlong pipe)
-{
- apr_file_t *f = J2P(pipe, apr_file_t *);
- apr_interval_time_t timeout;
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_file_pipe_timeout_get(f, &timeout), timeout);
-
-cleanup:
- return (jlong)timeout;
-}
-
-TCN_IMPLEMENT_CALL(jlong, File, dup)(TCN_STDARGS, jlong newf, jlong file,
- jlong pool)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_file_t *d = J2P(newf, apr_file_t *);
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_file_dup(&d, f, p), d);
-
-cleanup:
- return P2J(d);
-}
-
-TCN_IMPLEMENT_CALL(jint, File, dup2)(TCN_STDARGS, jlong newf, jlong file,
- jlong pool)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_file_t *d = J2P(newf, apr_file_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_file_dup2(d, f, p);
-}
diff --git a/native/src/info.c b/native/src/info.c
deleted file mode 100644
index 4734e54..0000000
--- a/native/src/info.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-#include "apr_file_io.h"
-
-#define DECLARE_FINFO_FIELD(name) static jfieldID _fid##name = NULL
-#define FINFO_FIELD(name) _fid##name
-
-#define GET_FINFO_I(N) \
- _fid##N = (*e)->GetFieldID(e, finfo, #N, "I"); \
- if (_fid##N == NULL) { \
- (*e)->ExceptionClear(e); \
- goto cleanup; \
- } else (void)(0)
-
-#define GET_FINFO_J(N) \
- _fid##N = (*e)->GetFieldID(e, finfo, #N, "J"); \
- if (_fid##N == NULL) { \
- (*e)->ExceptionClear(e); \
- goto cleanup; \
- } else (void)(0)
-
-#define GET_FINFO_S(N) \
- _fid##N = (*e)->GetFieldID(e, finfo, #N, \
- "Ljava/lang/String;"); \
- if (_fid##N == NULL) { \
- (*e)->ExceptionClear(e); \
- goto cleanup; \
- } else (void)(0)
-
-#define SET_FINFO_I(N, V) \
- (*e)->SetIntField(e, obj, _fid##N, (jint)(V))
-
-#define SET_FINFO_J(N, V) \
- (*e)->SetLongField(e, obj, _fid##N, (jlong)(V))
-
-#define SET_FINFO_S(N, V) \
- (*e)->SetObjectField(e, obj, _fid##N, \
- (V) ? AJP_TO_JSTRING((V)) : NULL)
-
-
-#define DECLARE_AINFO_FIELD(name) static jfieldID _aid##name = NULL
-#define AINFO_FIELD(name) _aid##name
-
-#define GET_AINFO_I(N) \
- _aid##N = (*e)->GetFieldID(e, ainfo, #N, "I"); \
- if (_aid##N == NULL) { \
- (*e)->ExceptionClear(e); \
- goto cleanup; \
- } else (void)(0)
-
-#define GET_AINFO_J(N) \
- _aid##N = (*e)->GetFieldID(e, ainfo, #N, "J"); \
- if (_aid##N == NULL) { \
- (*e)->ExceptionClear(e); \
- goto cleanup; \
- } else (void)(0)
-
-#define GET_AINFO_S(N) \
- _aid##N = (*e)->GetFieldID(e, ainfo, #N, \
- "Ljava/lang/String;"); \
- if (_aid##N == NULL) { \
- (*e)->ExceptionClear(e); \
- goto cleanup; \
- } else (void)(0)
-
-#define SET_AINFO_I(N, V) \
- (*e)->SetIntField(e, obj, _aid##N, (jint)(V))
-
-#define SET_AINFO_J(N, V) \
- (*e)->SetLongField(e, obj, _aid##N, (jlong)(V))
-
-#define SET_AINFO_S(N, V) \
- (*e)->SetObjectField(e, obj, _aid##N, \
- (V) ? AJP_TO_JSTRING((V)) : NULL)
-
-
-DECLARE_FINFO_FIELD(pool);
-DECLARE_FINFO_FIELD(valid);
-DECLARE_FINFO_FIELD(protection);
-DECLARE_FINFO_FIELD(filetype);
-DECLARE_FINFO_FIELD(user);
-DECLARE_FINFO_FIELD(group);
-DECLARE_FINFO_FIELD(inode);
-DECLARE_FINFO_FIELD(device);
-DECLARE_FINFO_FIELD(nlink);
-DECLARE_FINFO_FIELD(size);
-DECLARE_FINFO_FIELD(csize);
-DECLARE_FINFO_FIELD(atime);
-DECLARE_FINFO_FIELD(mtime);
-DECLARE_FINFO_FIELD(ctime);
-DECLARE_FINFO_FIELD(fname);
-DECLARE_FINFO_FIELD(name);
-DECLARE_FINFO_FIELD(filehand);
-
-DECLARE_AINFO_FIELD(pool);
-DECLARE_AINFO_FIELD(hostname);
-DECLARE_AINFO_FIELD(servname);
-DECLARE_AINFO_FIELD(port);
-DECLARE_AINFO_FIELD(family);
-DECLARE_AINFO_FIELD(next);
-
-static int finfo_class_initialized = 0;
-static int ainfo_class_initialized = 0;
-static jmethodID finfo_class_init = NULL;
-static jmethodID ainfo_class_init = NULL;
-static jclass finfo_class = NULL;
-static jclass ainfo_class = NULL;
-
-apr_status_t tcn_load_finfo_class(JNIEnv *e, jclass finfo)
-{
- GET_FINFO_J(pool);
- GET_FINFO_I(valid);
- GET_FINFO_I(protection);
- GET_FINFO_I(filetype);
- GET_FINFO_I(user);
- GET_FINFO_I(group);
- GET_FINFO_I(inode);
- GET_FINFO_I(device);
- GET_FINFO_I(nlink);
- GET_FINFO_J(size);
- GET_FINFO_J(csize);
- GET_FINFO_J(atime);
- GET_FINFO_J(mtime);
- GET_FINFO_J(ctime);
- GET_FINFO_S(fname);
- GET_FINFO_S(name);
- GET_FINFO_J(filehand);
-
- finfo_class_init = (*e)->GetMethodID(e, finfo,
- "<init>", "()V");
- if (finfo_class_init == NULL)
- goto cleanup;
- finfo_class_initialized = 1;
- finfo_class = finfo;
-cleanup:
- return APR_SUCCESS;
-}
-
-apr_status_t tcn_load_ainfo_class(JNIEnv *e, jclass ainfo)
-{
- GET_AINFO_J(pool);
- GET_AINFO_S(hostname);
- GET_AINFO_S(servname);
- GET_AINFO_I(port);
- GET_AINFO_I(family);
- GET_AINFO_J(next);
- ainfo_class_init = (*e)->GetMethodID(e, ainfo,
- "<init>", "()V");
-
- if (ainfo_class_init == NULL)
- goto cleanup;
- ainfo_class_initialized = 1;
- ainfo_class = ainfo;
-cleanup:
- return APR_SUCCESS;
-}
-
-static void fill_finfo(JNIEnv *e, jobject obj, apr_finfo_t *info)
-{
-
- SET_FINFO_J(pool, P2J(info->pool));
- SET_FINFO_I(valid, info->valid);
- SET_FINFO_I(protection, info->protection);
- SET_FINFO_I(filetype, info->filetype);
- SET_FINFO_I(user, ((jlong)info->user));
- SET_FINFO_I(group, ((jlong)info->group));
- SET_FINFO_I(inode, info->inode);
- SET_FINFO_I(device, info->device);
- SET_FINFO_I(nlink, info->nlink);
- SET_FINFO_J(size, info->size);
- SET_FINFO_J(csize, info->csize);
- SET_FINFO_J(atime, info->atime);
- SET_FINFO_J(mtime, info->mtime);
- SET_FINFO_J(ctime, info->ctime);
- SET_FINFO_S(fname, info->fname);
- SET_FINFO_S(name, info->name);
- SET_FINFO_J(filehand, P2J(info->filehand));
-}
-
-static void fill_ainfo(JNIEnv *e, jobject obj, apr_sockaddr_t *info)
-{
- apr_int32_t f;
- if (info->family == APR_UNSPEC) f = 0;
- else if (info->family == APR_INET) f = 1;
- else if (info->family == APR_INET6) f = 2;
-#ifdef APR_UNIX
- else if (info->family == APR_UNIX) f = 3;
-#endif
- else f = info->family;
-
- SET_AINFO_J(pool, P2J(info->pool));
- SET_AINFO_S(hostname, info->hostname);
- SET_AINFO_S(servname, info->servname);
- SET_AINFO_I(port, info->port);
- SET_AINFO_I(family, f);
- SET_AINFO_J(next, P2J(info->next));
-
-}
-
-TCN_IMPLEMENT_CALL(jint, File, stat)(TCN_STDARGS, jobject finfo,
- jstring fname, jint wanted,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(fname);
- apr_status_t rv;
- apr_finfo_t info = {0};
-
- UNREFERENCED(o);
-
- if ((rv = apr_stat(&info, J2S(fname), wanted, p)) == APR_SUCCESS) {
- jobject io = (*e)->NewLocalRef(e, finfo);
- fill_finfo(e, io, &info);
- (*e)->DeleteLocalRef(e, io);
- }
- TCN_FREE_CSTRING(fname);
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jobject, File, getStat)(TCN_STDARGS, jstring fname,
- jint wanted, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(fname);
- apr_status_t rv;
- apr_finfo_t info = {0};
- jobject finfo = NULL;
-
- UNREFERENCED(o);
-
- if ((rv = apr_stat(&info, J2S(fname), wanted, p)) == APR_SUCCESS) {
- finfo = (*e)->NewObject(e, finfo_class, finfo_class_init);
- if (finfo == NULL)
- goto cleanup;
- fill_finfo(e, finfo, &info);
- }
- else
- tcn_ThrowAPRException(e, rv);
-cleanup:
- TCN_FREE_CSTRING(fname);
- return finfo;
-}
-
-TCN_IMPLEMENT_CALL(jint, File, infoGet)(TCN_STDARGS, jobject finfo,
- jint wanted, jlong file)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_status_t rv;
- apr_finfo_t info = {0};
-
- UNREFERENCED(o);
-
- if ((rv = apr_file_info_get(&info, wanted, f)) == APR_SUCCESS) {
- jobject io = (*e)->NewLocalRef(e, finfo);
- fill_finfo(e, io, &info);
- (*e)->DeleteLocalRef(e, io);
- }
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jobject, File, getInfo)(TCN_STDARGS, jint wanted, jlong file)
-{
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_status_t rv;
- apr_finfo_t info = {0};
-
- UNREFERENCED(o);
-
- if ((rv = apr_file_info_get(&info, wanted, f)) == APR_SUCCESS) {
- jobject finfo;
- finfo = (*e)->NewObject(e, finfo_class, finfo_class_init);
- if (finfo == NULL)
- return NULL;
- fill_finfo(e, finfo, &info);
- return finfo;
- }
- else
- tcn_ThrowAPRException(e, rv);
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jint, Directory, read)(TCN_STDARGS, jobject finfo,
- jint wanted, jlong dir)
-{
- apr_dir_t *d = J2P(dir, apr_dir_t *);
- apr_status_t rv;
- apr_finfo_t info = {0};
-
- UNREFERENCED(o);
-
- if ((rv = apr_dir_read(&info, wanted, d)) == APR_SUCCESS) {
- jobject io = (*e)->NewLocalRef(e, finfo);
- fill_finfo(e, io, &info);
- if ((*e)->ExceptionCheck(e)) {
- (*e)->ExceptionClear(e);
- }
- else
- rv = APR_EGENERAL;
- (*e)->DeleteLocalRef(e, io);
- }
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, Address, fill)(TCN_STDARGS,
- jobject addr, jlong info)
-{
- apr_sockaddr_t *i = J2P(info, apr_sockaddr_t *);
- jobject ao;
- jboolean rv = JNI_FALSE;
-
- UNREFERENCED(o);
-
- if (i) {
- ao = (*e)->NewLocalRef(e, addr);
- fill_ainfo(e, ao, i);
- if ((*e)->ExceptionCheck(e)) {
- (*e)->ExceptionClear(e);
- }
- else
- rv = JNI_TRUE;
- (*e)->DeleteLocalRef(e, ao);
- }
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(jobject, Address, getInfo)(TCN_STDARGS, jlong info)
-{
- apr_sockaddr_t *i = J2P(info, apr_sockaddr_t *);
- jobject sockaddrObj = NULL;
-
- UNREFERENCED(o);
-
- /* Create the APR Error object */
- sockaddrObj = (*e)->NewObject(e, ainfo_class, ainfo_class_init);
- if (sockaddrObj == NULL)
- return NULL;
- fill_ainfo(e, sockaddrObj, i);
- return sockaddrObj;
-}
diff --git a/native/src/jnilib.c b/native/src/jnilib.c
index 300fe8c..7367cd3 100644
--- a/native/src/jnilib.c
+++ b/native/src/jnilib.c
@@ -38,18 +38,10 @@
#include <pthread.h>
#endif
-#ifdef TCN_DO_STATISTICS
-extern void sp_poll_dump_statistics();
-extern void sp_network_dump_statistics();
-extern void ssl_network_dump_statistics();
-#endif
-
apr_pool_t *tcn_global_pool = NULL;
static JavaVM *tcn_global_vm = NULL;
static jclass jString_class;
-static jclass jFinfo_class;
-static jclass jAinfo_class;
static jmethodID jString_init;
static jmethodID jString_getBytes;
@@ -70,36 +62,24 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
tcn_global_vm = vm;
env = (JNIEnv *)ppe;
/* Before doing anything else check if we have a valid
- * APR version. We need version 1.4.3 as minimum.
+ * APR version. We need version 1.7.0 as minimum.
*/
apr_version(&apv);
apvn = apv.major * 1000 + apv.minor * 100 + apv.patch;
- if (apvn < 1403) {
- tcn_Throw(env, "Unsupported APR version %s: this tcnative requires at least 1.4.3",
+ if (apvn < 1700) {
+ tcn_Throw(env, "Unsupported APR version %s: this tcnative requires at least 1.7.0",
apr_version_string());
return JNI_ERR;
}
/* Initialize global java.lang.String class */
TCN_LOAD_CLASS(env, jString_class, "java/lang/String", JNI_ERR);
+
TCN_GET_METHOD(env, jString_class, jString_init,
"<init>", "([B)V", JNI_ERR);
TCN_GET_METHOD(env, jString_class, jString_getBytes,
"getBytes", "()[B", JNI_ERR);
- TCN_LOAD_CLASS(env, jFinfo_class, TCN_FINFO_CLASS, JNI_OK);
- if (jFinfo_class) {
- if (tcn_load_finfo_class(env, jFinfo_class) != APR_SUCCESS) {
- return JNI_ERR;
- }
- }
-
- TCN_LOAD_CLASS(env, jAinfo_class, TCN_AINFO_CLASS, JNI_OK);
- if (jAinfo_class) {
- if (tcn_load_ainfo_class(env, jAinfo_class) != APR_SUCCESS) {
- return JNI_ERR;
- }
- }
#ifdef WIN32
{
char *ppid = getenv(TCN_PARENT_IDE);
@@ -128,8 +108,6 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved)
if (tcn_global_pool) {
env = (JNIEnv *)ppe;
TCN_UNLOAD_CLASS(env, jString_class);
- TCN_UNLOAD_CLASS(env, jFinfo_class);
- TCN_UNLOAD_CLASS(env, jAinfo_class);
apr_terminate();
}
}
@@ -253,26 +231,11 @@ TCN_IMPLEMENT_CALL(void, Library, terminate)(TCN_STDARGS)
if (tcn_global_pool) {
apr_pool_t *p = tcn_global_pool;
tcn_global_pool = NULL;
-#ifdef TCN_DO_STATISTICS
- fprintf(stderr, "APR Statistical data ....\n");
-#endif
apr_pool_destroy(p);
-#ifdef TCN_DO_STATISTICS
- sp_poll_dump_statistics();
- sp_network_dump_statistics();
- ssl_network_dump_statistics();
- fprintf(stderr, "APR Terminated\n");
-#endif
apr_terminate();
}
}
-TCN_IMPLEMENT_CALL(jlong, Library, globalPool)(TCN_STDARGS)
-{
- UNREFERENCED_STDARGS;
- return P2J(tcn_global_pool);
-}
-
TCN_IMPLEMENT_CALL(jint, Library, version)(TCN_STDARGS, jint what)
{
apr_version_t apv;
diff --git a/native/src/lock.c b/native/src/lock.c
deleted file mode 100644
index 05874f7..0000000
--- a/native/src/lock.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-#include "apr_proc_mutex.h"
-#include "apr_global_mutex.h"
-
-TCN_IMPLEMENT_CALL(jlong, Lock, create)(TCN_STDARGS,
- jstring fname,
- jint mech, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_proc_mutex_t *mutex;
- TCN_ALLOC_CSTRING(fname);
-
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_proc_mutex_create(&mutex, J2S(fname),
- (apr_lockmech_e)mech, p), mutex);
-
-cleanup:
- TCN_FREE_CSTRING(fname);
- return P2J(mutex);
-}
-
-TCN_IMPLEMENT_CALL(jlong, Lock, childInit)(TCN_STDARGS,
- jstring fname,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_proc_mutex_t *mutex;
- TCN_ALLOC_CSTRING(fname);
-
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_proc_mutex_child_init(&mutex,
- J2S(fname), p), mutex);
-
-cleanup:
- TCN_FREE_CSTRING(fname);
- return P2J(mutex);
-}
-
-TCN_IMPLEMENT_CALL(jint, Lock, lock)(TCN_STDARGS, jlong mutex)
-{
- apr_proc_mutex_t *m = J2P(mutex, apr_proc_mutex_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_proc_mutex_lock(m);
-}
-
-TCN_IMPLEMENT_CALL(jint, Lock, trylock)(TCN_STDARGS, jlong mutex)
-{
- apr_proc_mutex_t *m = J2P(mutex, apr_proc_mutex_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_proc_mutex_trylock(m);
-}
-
-TCN_IMPLEMENT_CALL(jint, Lock, unlock)(TCN_STDARGS, jlong mutex)
-{
- apr_proc_mutex_t *m = J2P(mutex, apr_proc_mutex_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_proc_mutex_unlock(m);
-}
-
-TCN_IMPLEMENT_CALL(jint, Lock, destroy)(TCN_STDARGS, jlong mutex)
-{
- apr_proc_mutex_t *m = J2P(mutex, apr_proc_mutex_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_proc_mutex_destroy(m);
-}
-
-TCN_IMPLEMENT_CALL(jstring, Lock, lockfile)(TCN_STDARGS, jlong mutex)
-{
- apr_proc_mutex_t *m = J2P(mutex, apr_proc_mutex_t *);
- const char *s = apr_proc_mutex_lockfile(m);
-
- UNREFERENCED_STDARGS;
- if (s)
- return AJP_TO_JSTRING(s);
- else
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jstring, Lock, name)(TCN_STDARGS, jlong mutex)
-{
- apr_proc_mutex_t *m = J2P(mutex, apr_proc_mutex_t *);
-
- UNREFERENCED(o);
- return AJP_TO_JSTRING(apr_proc_mutex_name(m));
-}
-
-TCN_IMPLEMENT_CALL(jstring, Lock, defname)(TCN_STDARGS)
-{
-
- UNREFERENCED(o);
- return AJP_TO_JSTRING(apr_proc_mutex_defname());
-}
-
-
-
-TCN_IMPLEMENT_CALL(jlong, Global, create)(TCN_STDARGS,
- jstring fname,
- jint mech, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_global_mutex_t *mutex;
- TCN_ALLOC_CSTRING(fname);
-
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_global_mutex_create(&mutex, J2S(fname),
- (apr_lockmech_e)mech, p), mutex);
-
-cleanup:
- TCN_FREE_CSTRING(fname);
- return P2J(mutex);
-}
-
-TCN_IMPLEMENT_CALL(jlong, Global, childInit)(TCN_STDARGS,
- jstring fname,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_global_mutex_t *mutex;
- TCN_ALLOC_CSTRING(fname);
-
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_global_mutex_child_init(&mutex,
- J2S(fname), p), mutex);
-
-cleanup:
- TCN_FREE_CSTRING(fname);
- return P2J(mutex);
-}
-
-TCN_IMPLEMENT_CALL(jint, Global, lock)(TCN_STDARGS, jlong mutex)
-{
- apr_global_mutex_t *m = J2P(mutex, apr_global_mutex_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_global_mutex_lock(m);
-}
-
-TCN_IMPLEMENT_CALL(jint, Global, trylock)(TCN_STDARGS, jlong mutex)
-{
- apr_global_mutex_t *m = J2P(mutex, apr_global_mutex_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_global_mutex_trylock(m);
-}
-
-TCN_IMPLEMENT_CALL(jint, Global, unlock)(TCN_STDARGS, jlong mutex)
-{
- apr_global_mutex_t *m = J2P(mutex, apr_global_mutex_t*);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_global_mutex_unlock(m);
-}
-
-TCN_IMPLEMENT_CALL(jint, Global, destroy)(TCN_STDARGS, jlong mutex)
-{
- apr_global_mutex_t *m = J2P(mutex, apr_global_mutex_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_global_mutex_destroy(m);
-}
-
diff --git a/native/src/misc.c b/native/src/misc.c
deleted file mode 100644
index e1b0a2d..0000000
--- a/native/src/misc.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-#include "apr_time.h"
-
-TCN_IMPLEMENT_CALL(void, Time, sleep)(TCN_STDARGS, jlong t)
-{
-
- UNREFERENCED_STDARGS;
- apr_sleep((apr_interval_time_t)t);
-}
-
-TCN_IMPLEMENT_CALL(jint, OS, random)(TCN_STDARGS, jbyteArray buf,
- jint len)
-{
-#if APR_HAS_RANDOM
- apr_status_t rv;
- jbyte *b = (*e)->GetPrimitiveArrayCritical(e, buf, NULL);
-
- UNREFERENCED(o);
- if ((rv = apr_generate_random_bytes((unsigned char *)b,
- (apr_size_t)len)) == APR_SUCCESS)
- (*e)->ReleasePrimitiveArrayCritical(e, buf, b, 0);
- else
- (*e)->ReleasePrimitiveArrayCritical(e, buf, b, JNI_ABORT);
-
- if ((*e)->ExceptionCheck(e)) {
- (*e)->ExceptionClear(e);
- rv = APR_EGENERAL;
- }
- return (jint)rv;
-#else
- return APR_ENOTIMPL;
-#endif
-}
-
-TCN_IMPLEMENT_CALL(jlong, Time, now)(TCN_STDARGS)
-{
- UNREFERENCED_STDARGS;
- return (jlong)apr_time_now();
-}
-
-TCN_IMPLEMENT_CALL(jstring, Time, rfc822)(TCN_STDARGS, jlong t)
-{
- char ts[APR_RFC822_DATE_LEN];
- UNREFERENCED(o);
- if (apr_rfc822_date(ts, J2T(t)) == APR_SUCCESS)
- return AJP_TO_JSTRING(ts);
- else
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jstring, Time, ctime)(TCN_STDARGS, jlong t)
-{
- char ts[APR_CTIME_LEN];
- UNREFERENCED(o);
- if (apr_ctime(ts, J2T(t)) == APR_SUCCESS)
- return AJP_TO_JSTRING(ts);
- else
- return NULL;
-}
diff --git a/native/src/mmap.c b/native/src/mmap.c
deleted file mode 100644
index 7880c06..0000000
--- a/native/src/mmap.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-#include "apr_mmap.h"
-
-TCN_IMPLEMENT_CALL(jlong, Mmap, create)(TCN_STDARGS, jlong file,
- jlong offset, jlong size,
- jint flag, jlong pool)
-{
-#if APR_HAS_MMAP
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_mmap_t *m = NULL;
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_mmap_create(&m, f, (apr_off_t)offset,
- (apr_size_t)size,
- (apr_uint32_t)flag, p), m);
-
-cleanup:
- return P2J(m);
-#else
- UNREFERENCED(o);
- tcn_ThrowAPRException(e, APR_ENOTIMPL);
- return 0;
-#endif
-}
-
-TCN_IMPLEMENT_CALL(jlong, Mmap, dup)(TCN_STDARGS, jlong mmap,
- jlong pool)
-{
-#if APR_HAS_MMAP
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_mmap_t *m = J2P(mmap, apr_mmap_t *);
- apr_mmap_t *newm = NULL;
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_mmap_dup(&newm, m, p), newm);
-
-cleanup:
- return P2J(newm);
-#else
- UNREFERENCED(o);
- tcn_ThrowAPRException(e, APR_ENOTIMPL);
- return 0;
-#endif
-}
-
-TCN_IMPLEMENT_CALL(jint, Mmap, delete)(TCN_STDARGS, jlong mmap)
-{
-#if APR_HAS_MMAP
- apr_mmap_t *m = J2P(mmap, apr_mmap_t *);
-
- UNREFERENCED_STDARGS;
- return apr_mmap_delete(m);
-
-#else
- UNREFERENCED_STDARGS;
- UNREFERENCED(mmap);
- return APR_ENOTIMPL;
-#endif
-}
-
-TCN_IMPLEMENT_CALL(jlong, Mmap, offset)(TCN_STDARGS, jlong mmap,
- jlong offset)
-{
-#if APR_HAS_MMAP
- apr_mmap_t *m = J2P(mmap, apr_mmap_t *);
- void *r;
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_mmap_offset(&r, m, (apr_off_t)offset), r);
-
-cleanup:
- return P2J(r);
-
-#else
- UNREFERENCED(o);
- tcn_ThrowAPRException(e, APR_ENOTIMPL);
- return 0;
-#endif
-}
diff --git a/native/src/multicast.c b/native/src/multicast.c
deleted file mode 100644
index 747227a..0000000
--- a/native/src/multicast.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-
-TCN_IMPLEMENT_CALL(jint, Multicast, join)(TCN_STDARGS,
- jlong sock, jlong join,
- jlong iface, jlong source)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_sockaddr_t *ja = J2P(join, apr_sockaddr_t *);
- apr_sockaddr_t *ia = J2P(iface, apr_sockaddr_t *);
- apr_sockaddr_t *sa = J2P(source, apr_sockaddr_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_mcast_join(s->sock, ja, ia, sa);
-}
-
-TCN_IMPLEMENT_CALL(jint, Multicast, leave)(TCN_STDARGS,
- jlong sock, jlong addr,
- jlong iface, jlong source)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_sockaddr_t *aa = J2P(addr, apr_sockaddr_t *);
- apr_sockaddr_t *ia = J2P(iface, apr_sockaddr_t *);
- apr_sockaddr_t *sa = J2P(source, apr_sockaddr_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_mcast_leave(s->sock, aa, ia, sa);
-}
-
-TCN_IMPLEMENT_CALL(jint, Multicast, hops)(TCN_STDARGS,
- jlong sock, jint ttl)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_mcast_hops(s->sock, (apr_byte_t)ttl);
-}
-
-TCN_IMPLEMENT_CALL(jint, Multicast, loopback)(TCN_STDARGS,
- jlong sock, jboolean opt)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_byte_t on = 0;
- UNREFERENCED_STDARGS;
- if (opt)
- on = 1;
- return (jint)apr_mcast_loopback(s->sock, on);
-}
-
-TCN_IMPLEMENT_CALL(jint, Multicast, ointerface)(TCN_STDARGS,
- jlong sock, jlong iface)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_sockaddr_t *ia = J2P(iface, apr_sockaddr_t *);
- UNREFERENCED_STDARGS;
- return (jint)apr_mcast_interface(s->sock, ia);
-}
diff --git a/native/src/network.c b/native/src/network.c
deleted file mode 100644
index 05f0fd2..0000000
--- a/native/src/network.c
+++ /dev/null
@@ -1,1480 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-
-#ifdef TCN_DO_STATISTICS
-
-#include "apr_atomic.h"
-#include "apr_file_io.h"
-
-static volatile apr_uint32_t sp_created = 0;
-static volatile apr_uint32_t sp_closed = 0;
-static volatile apr_uint32_t sp_cleared = 0;
-static volatile apr_uint32_t sp_accepted = 0;
-static volatile apr_uint32_t sp_max_send = 0;
-static volatile apr_uint32_t sp_min_send = 10000000;
-static volatile apr_uint32_t sp_num_send = 0;
-static volatile apr_off_t sp_tot_send = 0;
-static volatile apr_uint32_t sp_max_recv = 0;
-static volatile apr_uint32_t sp_min_recv = 10000000;
-static volatile apr_uint32_t sp_num_recv = 0;
-static volatile apr_off_t sp_tot_recv = 0;
-static volatile apr_uint32_t sp_err_recv = 0;
-static volatile apr_uint32_t sp_tmo_recv = 0;
-static volatile apr_uint32_t sp_rst_recv = 0;
-static volatile apr_status_t sp_erl_recv = 0;
-
-static volatile apr_size_t sf_max_send = 0;
-static volatile apr_size_t sf_min_send = 10000000;
-static volatile apr_uint32_t sf_num_send = 0;
-static volatile apr_off_t sf_tot_send = 0;
-
-void sp_network_dump_statistics()
-{
- fprintf(stderr, "Network Statistics ......\n");
- fprintf(stderr, "Sockets created : %d\n", sp_created);
- fprintf(stderr, "Sockets accepted : %d\n", sp_accepted);
- fprintf(stderr, "Sockets closed : %d\n", sp_closed);
- fprintf(stderr, "Sockets cleared : %d\n", sp_cleared);
- fprintf(stderr, "Total send calls : %d\n", sp_num_send);
- fprintf(stderr, "Minimum send length : %d\n", sp_min_send);
- fprintf(stderr, "Maximum send length : %d\n", sp_max_send);
- fprintf(stderr, "Average send length : %.2f\n", (double)sp_tot_send/(double)sp_num_send);
- fprintf(stderr, "Total recv calls : %d\n", sp_num_recv);
- fprintf(stderr, "Minimum recv length : %d\n", sp_min_recv);
- fprintf(stderr, "Maximum recv length : %d\n", sp_max_recv);
- fprintf(stderr, "Average recv length : %.2f\n", (double)sp_tot_recv/(double)sp_num_recv);
- fprintf(stderr, "Receive timeouts : %d\n", sp_tmo_recv);
- fprintf(stderr, "Receive errors : %d\n", sp_err_recv);
- fprintf(stderr, "Receive resets : %d\n", sp_rst_recv);
- fprintf(stderr, "Last receive error : %d\n", sp_erl_recv);
-
- fprintf(stderr, "Total sendfile calls : %d\n", sf_num_send);
- fprintf(stderr, "Minimum sendfile length : %" APR_SIZE_T_FMT "\n", sf_min_send);
- fprintf(stderr, "Maximum sendfile length : %" APR_SIZE_T_FMT "\n", sf_max_send);
-
-}
-
-#endif /* TCN_DO_STATISTICS */
-
-static apr_status_t sp_socket_remove(void *data)
-{
-#ifdef APR_UNIX
- tcn_socket_t *s = (tcn_socket_t *)data;
-
- if (s->sock) {
- apr_sockaddr_t *sa = NULL;
- apr_socket_addr_get(&sa, APR_LOCAL, s->sock);
- if (sa && sa->family == APR_UNIX) {
- char *path = NULL;
- apr_getnameinfo(&path, sa, 0);
- if (path) {
- apr_file_remove(path, s->pool);
- }
- }
- }
-#endif
- return APR_SUCCESS;
-}
-
-extern apr_pool_t *tcn_global_pool;
-static apr_status_t sp_socket_cleanup(void *data)
-{
- tcn_socket_t *s = (tcn_socket_t *)data;
-
- if (s->net && s->net->cleanup)
- (*s->net->cleanup)(s->opaque);
- if (s->sock) {
- apr_socket_t *as = s->sock;
- s->sock = NULL;
- apr_socket_close(as);
- }
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&sp_cleared);
-#endif
- return APR_SUCCESS;
-}
-
-#if defined(DEBUG) || defined(_DEBUG)
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-APR_socket_send(apr_socket_t *sock, const char *buf, apr_size_t *len)
-{
- return apr_socket_send(sock, buf, len);
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-APR_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len)
-{
- return apr_socket_recv(sock, buf, len);
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-APR_socket_sendv(apr_socket_t *sock, const struct iovec *vec,
- apr_int32_t nvec, apr_size_t *len)
-{
- return apr_socket_sendv(sock, vec, nvec, len);
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-APR_socket_shutdown(apr_socket_t *sock, apr_shutdown_how_e how)
-{
- return apr_socket_shutdown(sock, how);
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-APR_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t)
-{
- return apr_socket_timeout_set(sock, t);
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-APR_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t)
-{
- return apr_socket_timeout_get(sock, t);
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-APR_socket_opt_set(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on)
-{
- return apr_socket_opt_set(sock, opt, on);
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-APR_socket_opt_get(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on)
-{
- return apr_socket_opt_get(sock, opt, on);
-}
-
-#else
-#define APR_socket_send apr_socket_send
-#define APR_socket_recv apr_socket_recv
-#define APR_socket_sendv apr_socket_sendv
-#define APR_socket_shutdown apr_socket_shutdown
-#define APR_socket_timeout_set apr_socket_timeout_set
-#define APR_socket_timeout_get apr_socket_timeout_get
-#define APR_socket_opt_set apr_socket_opt_set
-#define APR_socket_opt_get apr_socket_opt_get
-#endif
-
-static tcn_nlayer_t apr_socket_layer = {
- TCN_SOCKET_APR,
- NULL,
- NULL,
- APR_socket_shutdown,
- APR_socket_opt_get,
- APR_socket_opt_set,
- APR_socket_timeout_get,
- APR_socket_timeout_set,
- APR_socket_send,
- APR_socket_sendv,
- APR_socket_recv
-};
-
-TCN_IMPLEMENT_CALL(jlong, Socket, create)(TCN_STDARGS, jint family,
- jint type, jint protocol,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_pool_t *c = NULL;
- apr_socket_t *s = NULL;
- tcn_socket_t *a = NULL;
- apr_int32_t f, t;
-
- UNREFERENCED(o);
- GET_S_FAMILY(f, family);
- GET_S_TYPE(t, type);
-
- if (p == NULL) {
- TCN_THROW_IF_ERR(apr_pool_create_unmanaged(&c), c);
- }
- else {
- TCN_THROW_IF_ERR(apr_pool_create(&c, p), c);
- }
-
- a = (tcn_socket_t *)apr_pcalloc(c, sizeof(tcn_socket_t));
- TCN_CHECK_ALLOCATED(a);
- TCN_THROW_IF_ERR(apr_pool_create(&a->child, c), a->child);
- a->pool = c;
-
- if (family >= 0) {
- a->net = &apr_socket_layer;
- TCN_THROW_IF_ERR(apr_socket_create(&s,
- f, t, protocol, c), a);
- }
- apr_pool_pre_cleanup_register(c, (const void *)a,
- sp_socket_cleanup);
-
-#ifdef TCN_DO_STATISTICS
- sp_created++;
-#endif
- a->sock = s;
- if (family >= 0)
- a->net = &apr_socket_layer;
- a->opaque = s;
- return P2J(a);
-cleanup:
- if (c)
- apr_pool_destroy(c);
- return 0;
-
-}
-
-TCN_IMPLEMENT_CALL(void, Socket, destroy)(TCN_STDARGS, jlong sock)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_socket_t *as;
- UNREFERENCED_STDARGS;
- TCN_ASSERT(sock != 0);
-
- as = s->sock;
- s->sock = NULL;
- apr_pool_cleanup_kill(s->pool, s, sp_socket_cleanup);
- if (s->net && s->net->cleanup) {
- (*s->net->cleanup)(s->opaque);
- s->net = NULL;
- }
- if (as) {
- apr_socket_close(as);
- }
-
- apr_pool_destroy(s->pool);
-}
-
-TCN_IMPLEMENT_CALL(jlong, Socket, pool)(TCN_STDARGS, jlong sock)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_pool_t *n;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
- TCN_THROW_IF_ERR(apr_pool_create(&n, s->pool), n);
-cleanup:
- return P2J(n);
-}
-
-TCN_IMPLEMENT_CALL(jlong, Socket, get)(TCN_STDARGS, jlong sock, jint what)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- UNREFERENCED_STDARGS;
- TCN_ASSERT(sock != 0);
-
- switch (what) {
- case TCN_SOCKET_GET_POOL:
- return P2J(s->pool);
- break;
- case TCN_SOCKET_GET_IMPL:
- return P2J(s->opaque);
- break;
- case TCN_SOCKET_GET_APRS:
- return P2J(s->sock);
- break;
- case TCN_SOCKET_GET_TYPE:
- return (jlong)(s->net->type);
- break;
- }
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, shutdown)(TCN_STDARGS, jlong sock,
- jint how)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(sock != 0);
- return (jint)(*s->net->shutdown)(s->opaque, how);
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, close)(TCN_STDARGS, jlong sock)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- jint rv = APR_SUCCESS;
- apr_socket_t *as;
- UNREFERENCED_STDARGS;
- TCN_ASSERT(sock != 0);
-
- as = s->sock;
- s->sock = NULL;
- apr_pool_cleanup_kill(s->pool, s, sp_socket_cleanup);
- if (s->child) {
- apr_pool_clear(s->child);
- }
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&sp_closed);
-#endif
- if (s->net && s->net->close) {
- rv = (*s->net->close)(s->opaque);
- s->net = NULL;
- }
- if (as) {
- rv = (jint)apr_socket_close(as);
- }
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, bind)(TCN_STDARGS, jlong sock,
- jlong sa)
-{
- jint rv = APR_SUCCESS;
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_sockaddr_t *a = J2P(sa, apr_sockaddr_t *);
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(sock != 0);
- TCN_ASSERT(s->sock != NULL);
- rv = (jint)apr_socket_bind(s->sock, a);
-
- apr_pool_cleanup_register(s->pool, (const void *)s,
- sp_socket_remove,
- apr_pool_cleanup_null);
-
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, listen)(TCN_STDARGS, jlong sock,
- jint backlog)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(sock != 0);
- TCN_ASSERT(s->sock != NULL);
- return (jint)apr_socket_listen(s->sock, backlog);
-}
-
-TCN_IMPLEMENT_CALL(jlong, Socket, acceptx)(TCN_STDARGS, jlong sock,
- jlong pool)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_socket_t *n = NULL;
- tcn_socket_t *a = NULL;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
-
- if (s->net->type == TCN_SOCKET_APR) {
- TCN_ASSERT(s->sock != NULL);
- a = (tcn_socket_t *)apr_pcalloc(p, sizeof(tcn_socket_t));
- TCN_CHECK_ALLOCATED(a);
- a->pool = p;
- apr_pool_cleanup_register(a->pool, (const void *)a,
- sp_socket_cleanup,
- apr_pool_cleanup_null);
-
- TCN_THROW_IF_ERR(apr_socket_accept(&n, s->sock, p), n);
- }
- else {
- tcn_ThrowAPRException(e, APR_ENOTIMPL);
- goto cleanup;
- }
- if (n) {
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&sp_accepted);
-#endif
- a->net = &apr_socket_layer;
- a->sock = n;
- a->opaque = n;
- }
-
-cleanup:
- return P2J(a);
-}
-
-TCN_IMPLEMENT_CALL(jlong, Socket, accept)(TCN_STDARGS, jlong sock)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_pool_t *p = NULL;
- apr_socket_t *n = NULL;
- tcn_socket_t *a = NULL;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
-
- TCN_THROW_IF_ERR(apr_pool_create_unmanaged(&p), p);
- if (s->net->type == TCN_SOCKET_APR) {
- TCN_ASSERT(s->sock != NULL);
- a = (tcn_socket_t *)apr_pcalloc(p, sizeof(tcn_socket_t));
- TCN_CHECK_ALLOCATED(a);
- TCN_THROW_IF_ERR(apr_socket_accept(&n, s->sock, p), n);
-
- a->pool = p;
- apr_pool_pre_cleanup_register(a->pool, (const void *)a,
- sp_socket_cleanup);
- }
- else {
- tcn_ThrowAPRException(e, APR_ENOTIMPL);
- goto cleanup;
- }
- if (n) {
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&sp_accepted);
-#endif
- a->net = &apr_socket_layer;
- a->sock = n;
- a->opaque = n;
- }
- return P2J(a);
-cleanup:
- TCN_ASSERT(p != 0);
- apr_pool_destroy(p);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, connect)(TCN_STDARGS, jlong sock,
- jlong sa)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_sockaddr_t *a = J2P(sa, apr_sockaddr_t *);
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(sock != 0);
- TCN_ASSERT(s->sock != NULL);
- return (jint)apr_socket_connect(s->sock, a);
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, send)(TCN_STDARGS, jlong sock,
- jbyteArray buf, jint offset, jint tosend)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_size_t nbytes = (apr_size_t)tosend;
- apr_status_t ss;
-
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return -(jint)APR_ENOTSOCK;
- }
- TCN_ASSERT(s->opaque != NULL);
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
-#ifdef TCN_DO_STATISTICS
- sp_max_send = TCN_MAX(sp_max_send, nbytes);
- sp_min_send = TCN_MIN(sp_min_send, nbytes);
- sp_tot_send += nbytes;
- sp_num_send++;
-#endif
-
- if (tosend <= TCN_BUFFER_SZ) {
- jbyte sb[TCN_BUFFER_SZ];
- (*e)->GetByteArrayRegion(e, buf, offset, tosend, &sb[0]);
- ss = (*s->net->send)(s->opaque, (const char *)&sb[0], &nbytes);
- }
- else {
- jbyte *sb = (jbyte *)malloc(nbytes);
- if (sb == NULL)
- return -APR_ENOMEM;
- (*e)->GetByteArrayRegion(e, buf, offset, tosend, sb);
- ss = (*s->net->send)(s->opaque, (const char *)sb, &nbytes);
- free(sb);
- }
- if (ss == APR_SUCCESS || ((APR_STATUS_IS_EAGAIN(ss) || ss == TCN_EAGAIN) && nbytes > 0))
- return (jint)nbytes;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(void, Socket, setsbb)(TCN_STDARGS, jlong sock,
- jobject buf)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return;
- }
- TCN_ASSERT(s->opaque != NULL);
- if (buf)
- s->jsbbuff = (char *)(*e)->GetDirectBufferAddress(e, buf);
- else
- s->jsbbuff = NULL;
-}
-
-TCN_IMPLEMENT_CALL(void, Socket, setrbb)(TCN_STDARGS, jlong sock,
- jobject buf)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return;
- }
- TCN_ASSERT(s->opaque != NULL);
- if (buf)
- s->jrbbuff = (char *)(*e)->GetDirectBufferAddress(e, buf);
- else
- s->jrbbuff = NULL;
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, sendb)(TCN_STDARGS, jlong sock,
- jobject buf, jint offset, jint len)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_size_t nbytes = (apr_size_t)len;
- apr_size_t sent = 0;
- char *bytes;
- apr_status_t ss = APR_SUCCESS;
-
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return -(jint)APR_ENOTSOCK;
- }
- TCN_ASSERT(s->opaque != NULL);
- TCN_ASSERT(buf != NULL);
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
-#ifdef TCN_DO_STATISTICS
- sp_max_send = TCN_MAX(sp_max_send, nbytes);
- sp_min_send = TCN_MIN(sp_min_send, nbytes);
- sp_tot_send += nbytes;
- sp_num_send++;
-#endif
-
- bytes = (char *)(*e)->GetDirectBufferAddress(e, buf);
-
- while (sent < nbytes) {
- apr_size_t wr = nbytes - sent;
- ss = (*s->net->send)(s->opaque, bytes + offset + sent, &wr);
- if (ss != APR_SUCCESS)
- break;
- sent += wr;
- }
-
- if (ss == APR_SUCCESS || ((APR_STATUS_IS_EAGAIN(ss) || ss == TCN_EAGAIN) && sent > 0))
- return (jint)sent;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, sendib)(TCN_STDARGS, jlong sock,
- jobject buf, jint offset, jint len)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_size_t nbytes = (apr_size_t)len;
- char *bytes;
- apr_status_t ss = APR_SUCCESS;
-
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return -(jint)APR_ENOTSOCK;
- }
- TCN_ASSERT(s->opaque != NULL);
- TCN_ASSERT(buf != NULL);
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
-#ifdef TCN_DO_STATISTICS
- sp_max_send = TCN_MAX(sp_max_send, nbytes);
- sp_min_send = TCN_MIN(sp_min_send, nbytes);
- sp_tot_send += nbytes;
- sp_num_send++;
-#endif
-
- bytes = (char *)(*e)->GetDirectBufferAddress(e, buf);
-
- ss = (*s->net->send)(s->opaque, bytes + offset, &nbytes);
-
- if (ss == APR_SUCCESS || ((APR_STATUS_IS_EAGAIN(ss) || ss == TCN_EAGAIN) && nbytes > 0))
- return (jint)nbytes;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, sendbb)(TCN_STDARGS, jlong sock,
- jint offset, jint len)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_size_t nbytes = (apr_size_t)len;
- apr_size_t sent = 0;
- apr_status_t ss = APR_SUCCESS;
-
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return -(jint)APR_ENOTSOCK;
- }
- TCN_ASSERT(s->opaque != NULL);
- TCN_ASSERT(s->jsbbuff != NULL);
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
-#ifdef TCN_DO_STATISTICS
- sp_max_send = TCN_MAX(sp_max_send, nbytes);
- sp_min_send = TCN_MIN(sp_min_send, nbytes);
- sp_tot_send += nbytes;
- sp_num_send++;
-#endif
-
- while (sent < nbytes) {
- apr_size_t wr = nbytes - sent;
- ss = (*s->net->send)(s->opaque, s->jsbbuff + offset + sent, &wr);
- if (ss != APR_SUCCESS || wr == 0)
- break;
- sent += wr;
- }
- if (ss == APR_SUCCESS || ((APR_STATUS_IS_EAGAIN(ss) || ss == TCN_EAGAIN) && sent > 0))
- return (jint)sent;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, sendibb)(TCN_STDARGS, jlong sock,
- jint offset, jint len)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_size_t nbytes = (apr_size_t)len;
- apr_status_t ss = APR_SUCCESS;
-
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return -(jint)APR_ENOTSOCK;
- }
- TCN_ASSERT(s->opaque != NULL);
- TCN_ASSERT(s->jsbbuff != NULL);
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
-#ifdef TCN_DO_STATISTICS
- sp_max_send = TCN_MAX(sp_max_send, nbytes);
- sp_min_send = TCN_MIN(sp_min_send, nbytes);
- sp_tot_send += nbytes;
- sp_num_send++;
-#endif
-
- ss = (*s->net->send)(s->opaque, s->jsbbuff + offset, &nbytes);
-
- if (ss == APR_SUCCESS || ((APR_STATUS_IS_EAGAIN(ss) || ss == TCN_EAGAIN) && nbytes > 0))
- return (jint)nbytes;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, sendv)(TCN_STDARGS, jlong sock,
- jobjectArray bufs)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- jsize nvec;
- jsize i;
- struct iovec vec[APR_MAX_IOVEC_SIZE];
- jobject ba[APR_MAX_IOVEC_SIZE];
- apr_size_t written = 0;
- apr_status_t ss;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
- TCN_ASSERT(s->opaque != NULL);
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
-
- nvec = (*e)->GetArrayLength(e, bufs);
- if (nvec >= APR_MAX_IOVEC_SIZE)
- return (jint)(-APR_ENOMEM);
-
- for (i = 0; i < nvec; i++) {
- ba[i] = (*e)->GetObjectArrayElement(e, bufs, i);
- vec[i].iov_len = (*e)->GetArrayLength(e, ba[i]);
- vec[i].iov_base = (void *)((*e)->GetByteArrayElements(e, ba[i], NULL));
- }
-
- ss = (*s->net->sendv)(s->opaque, vec, nvec, &written);
-
- for (i = 0; i < nvec; i++) {
- (*e)->ReleaseByteArrayElements(e, ba[i], (jbyte*)vec[i].iov_base, JNI_ABORT);
- }
- if (ss == APR_SUCCESS || ((APR_STATUS_IS_EAGAIN(ss) || ss == TCN_EAGAIN) && written > 0))
- return (jint)written;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, sendto)(TCN_STDARGS, jlong sock,
- jlong where, jint flag,
- jbyteArray buf, jint offset, jint tosend)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_sockaddr_t *w = J2P(where, apr_sockaddr_t *);
- apr_size_t nbytes = (apr_size_t)tosend;
- jbyte *bytes;
- apr_int32_t nb;
- apr_status_t ss;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
- TCN_ASSERT(s->sock != NULL);
-
- apr_socket_opt_get(s->sock, APR_SO_NONBLOCK, &nb);
- if (nb)
- bytes = (*e)->GetPrimitiveArrayCritical(e, buf, NULL);
- else
- bytes = (*e)->GetByteArrayElements(e, buf, NULL);
- TCN_ASSERT(bytes != NULL);
- ss = apr_socket_sendto(s->sock, w, flag, (char *)(bytes + offset), &nbytes);
-
- if (nb)
- (*e)->ReleasePrimitiveArrayCritical(e, buf, bytes, 0);
- else
- (*e)->ReleaseByteArrayElements(e, buf, bytes, JNI_ABORT);
- if (ss == APR_SUCCESS)
- return (jint)nbytes;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, recv)(TCN_STDARGS, jlong sock,
- jbyteArray buf, jint offset, jint toread)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_size_t nbytes = (apr_size_t)toread;
- apr_status_t ss;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
- TCN_ASSERT(s->opaque != NULL);
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
-
- if (toread <= TCN_BUFFER_SZ) {
- char sb[TCN_BUFFER_SZ];
-
- if ((ss = (*s->net->recv)(s->opaque, sb, &nbytes)) == APR_SUCCESS)
- (*e)->SetByteArrayRegion(e, buf, offset, (jsize)nbytes, (jbyte*)&sb[0]);
- }
- else {
- jbyte *bytes = (*e)->GetByteArrayElements(e, buf, NULL);
- ss = (*s->net->recv)(s->opaque, (char*)(bytes + offset), &nbytes);
- if (ss == APR_SUCCESS) {
- (*e)->ReleaseByteArrayElements(e, buf, bytes, nbytes ? 0 : JNI_ABORT);
- } else {
- (*e)->ReleaseByteArrayElements(e, buf, bytes, JNI_ABORT);
- }
- }
-#ifdef TCN_DO_STATISTICS
- if (ss == APR_SUCCESS) {
- sp_max_recv = TCN_MAX(sp_max_recv, nbytes);
- sp_min_recv = TCN_MIN(sp_min_recv, nbytes);
- sp_tot_recv += nbytes;
- sp_num_recv++;
- }
- else {
- if (APR_STATUS_IS_ETIMEDOUT(ss) ||
- APR_STATUS_IS_TIMEUP(ss))
- sp_tmo_recv++;
- else if (APR_STATUS_IS_ECONNABORTED(ss) ||
- APR_STATUS_IS_ECONNRESET(ss) ||
- APR_STATUS_IS_EOF(ss))
- sp_rst_recv++;
- else {
- sp_err_recv++;
- sp_erl_recv = ss;
- }
- }
-#endif
- if (ss == APR_SUCCESS)
- return (jint)nbytes;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, recvt)(TCN_STDARGS, jlong sock,
- jbyteArray buf, jint offset,
- jint toread, jlong timeout)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_size_t nbytes = (apr_size_t)toread;
- apr_status_t ss;
- apr_interval_time_t pt;
- apr_interval_time_t nt = J2T(timeout);
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
- TCN_ASSERT(s->opaque != NULL);
- TCN_ASSERT(buf != NULL);
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
-
- if ((ss = (*s->net->timeout_get)(s->opaque, &pt)) != APR_SUCCESS) {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
- if (pt != nt) {
- if ((ss = (*s->net->timeout_set)(s->opaque, nt)) != APR_SUCCESS)
- goto cleanup;
- }
- if (toread <= TCN_BUFFER_SZ) {
- jbyte sb[TCN_BUFFER_SZ];
- if ((ss = (*s->net->recv)(s->opaque, (char *)&sb[0], &nbytes)) == APR_SUCCESS)
- (*e)->SetByteArrayRegion(e, buf, offset, (jsize)nbytes, &sb[0]);
- }
- else {
- jbyte *sb = (jbyte *)malloc(nbytes);
- if (sb == NULL)
- return -APR_ENOMEM;
- if ((ss = (*s->net->recv)(s->opaque, (char *)sb, &nbytes)) == APR_SUCCESS)
- (*e)->SetByteArrayRegion(e, buf, offset, (jsize)nbytes, &sb[0]);
- free(sb);
- }
- if (pt != nt) {
- if ((ss = (*s->net->timeout_set)(s->opaque, pt)) != APR_SUCCESS)
- goto cleanup;
- }
-
-#ifdef TCN_DO_STATISTICS
- if (ss == APR_SUCCESS) {
- sp_max_recv = TCN_MAX(sp_max_recv, nbytes);
- sp_min_recv = TCN_MIN(sp_min_recv, nbytes);
- sp_tot_recv += nbytes;
- sp_num_recv++;
- }
- else {
- if (APR_STATUS_IS_ETIMEDOUT(ss) ||
- APR_STATUS_IS_TIMEUP(ss))
- sp_tmo_recv++;
- else if (APR_STATUS_IS_ECONNABORTED(ss) ||
- APR_STATUS_IS_ECONNRESET(ss) ||
- APR_STATUS_IS_EOF(ss))
- sp_rst_recv++;
- else {
- sp_err_recv++;
- sp_erl_recv = ss;
- }
- }
-#endif
-cleanup:
- if (ss == APR_SUCCESS)
- return (jint)nbytes;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, recvb)(TCN_STDARGS, jlong sock,
- jobject buf, jint offset, jint len)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_status_t ss;
- apr_size_t nbytes = (apr_size_t)len;
- char *bytes;
-
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return -(jint)APR_ENOTSOCK;
- }
- TCN_ASSERT(s->opaque != NULL);
- TCN_ASSERT(buf != NULL);
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
-
- bytes = (char *)(*e)->GetDirectBufferAddress(e, buf);
- TCN_ASSERT(bytes != NULL);
- ss = (*s->net->recv)(s->opaque, bytes + offset, &nbytes);
-#ifdef TCN_DO_STATISTICS
- if (ss == APR_SUCCESS) {
- sp_max_recv = TCN_MAX(sp_max_recv, nbytes);
- sp_min_recv = TCN_MIN(sp_min_recv, nbytes);
- sp_tot_recv += nbytes;
- sp_num_recv++;
- }
- else {
- if (APR_STATUS_IS_ETIMEDOUT(ss) ||
- APR_STATUS_IS_TIMEUP(ss))
- sp_tmo_recv++;
- else if (APR_STATUS_IS_ECONNABORTED(ss) ||
- APR_STATUS_IS_ECONNRESET(ss) ||
- APR_STATUS_IS_EOF(ss))
- sp_rst_recv++;
- else {
- sp_err_recv++;
- sp_erl_recv = ss;
- }
- }
-#endif
- if (ss == APR_SUCCESS)
- return (jint)nbytes;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, recvbb)(TCN_STDARGS, jlong sock,
- jint offset, jint len)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_status_t ss;
- apr_size_t nbytes = (apr_size_t)len;
-
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return -(jint)APR_ENOTSOCK;
- }
- TCN_ASSERT(sock != 0);
- TCN_ASSERT(s->opaque != NULL);
- TCN_ASSERT(s->jrbbuff != NULL);
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
-
- ss = (*s->net->recv)(s->opaque, s->jrbbuff + offset, &nbytes);
-#ifdef TCN_DO_STATISTICS
- if (ss == APR_SUCCESS) {
- sp_max_recv = TCN_MAX(sp_max_recv, nbytes);
- sp_min_recv = TCN_MIN(sp_min_recv, nbytes);
- sp_tot_recv += nbytes;
- sp_num_recv++;
- }
- else {
- if (APR_STATUS_IS_ETIMEDOUT(ss) ||
- APR_STATUS_IS_TIMEUP(ss))
- sp_tmo_recv++;
- else if (APR_STATUS_IS_ECONNABORTED(ss) ||
- APR_STATUS_IS_ECONNRESET(ss) ||
- APR_STATUS_IS_EOF(ss))
- sp_rst_recv++;
- else {
- sp_err_recv++;
- sp_erl_recv = ss;
- }
- }
-#endif
- if (ss == APR_SUCCESS)
- return (jint)nbytes;
- else if (APR_STATUS_IS_EOF(ss))
- return 0;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, recvbt)(TCN_STDARGS, jlong sock,
- jobject buf, jint offset,
- jint len, jlong timeout)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_status_t ss;
- apr_size_t nbytes = (apr_size_t)len;
- char *bytes;
- apr_interval_time_t pt;
- apr_interval_time_t nt = J2T(timeout);
-
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return -(jint)APR_ENOTSOCK;
- }
- TCN_ASSERT(buf != NULL);
- TCN_ASSERT(s->opaque != NULL);
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
-
- bytes = (char *)(*e)->GetDirectBufferAddress(e, buf);
- TCN_ASSERT(bytes != NULL);
-
- if ((ss = (*s->net->timeout_get)(s->opaque, &pt)) != APR_SUCCESS) {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
- if (pt != nt) {
- if ((ss = (*s->net->timeout_set)(s->opaque, nt)) != APR_SUCCESS) {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
- }
- ss = (*s->net->recv)(s->opaque, bytes + offset, &nbytes);
- if (pt != nt) {
- if ((ss = (*s->net->timeout_set)(s->opaque, pt)) != APR_SUCCESS) {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
- }
-
-#ifdef TCN_DO_STATISTICS
- if (ss == APR_SUCCESS) {
- sp_max_recv = TCN_MAX(sp_max_recv, nbytes);
- sp_min_recv = TCN_MIN(sp_min_recv, nbytes);
- sp_tot_recv += nbytes;
- sp_num_recv++;
- }
- else {
- if (APR_STATUS_IS_ETIMEDOUT(ss) ||
- APR_STATUS_IS_TIMEUP(ss))
- sp_tmo_recv++;
- else if (APR_STATUS_IS_ECONNABORTED(ss) ||
- APR_STATUS_IS_ECONNRESET(ss) ||
- APR_STATUS_IS_EOF(ss))
- sp_rst_recv++;
- else {
- sp_err_recv++;
- sp_erl_recv = ss;
- }
- }
-#endif
- if (ss == APR_SUCCESS)
- return (jint)nbytes;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, recvbbt)(TCN_STDARGS, jlong sock,
- jint offset,
- jint len, jlong timeout)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_status_t ss;
- apr_size_t nbytes = (apr_size_t)len;
- apr_interval_time_t pt;
- apr_interval_time_t nt = J2T(timeout);
-
- UNREFERENCED_STDARGS;
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return -(jint)APR_ENOTSOCK;
- }
- TCN_ASSERT(s->jrbbuff != NULL);
- TCN_ASSERT(s->opaque != NULL);
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
-
- if ((ss = (*s->net->timeout_get)(s->opaque, &pt)) != APR_SUCCESS) {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
- if (pt != nt) {
- if ((ss = (*s->net->timeout_set)(s->opaque, nt)) != APR_SUCCESS) {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
- }
- ss = (*s->net->recv)(s->opaque, s->jrbbuff + offset, &nbytes);
- if (pt != nt) {
- if ((ss = (*s->net->timeout_set)(s->opaque, pt)) != APR_SUCCESS) {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
- }
-
-#ifdef TCN_DO_STATISTICS
- if (ss == APR_SUCCESS) {
- sp_max_recv = TCN_MAX(sp_max_recv, nbytes);
- sp_min_recv = TCN_MIN(sp_min_recv, nbytes);
- sp_tot_recv += nbytes;
- sp_num_recv++;
- }
- else {
- if (APR_STATUS_IS_ETIMEDOUT(ss) ||
- APR_STATUS_IS_TIMEUP(ss))
- sp_tmo_recv++;
- else if (APR_STATUS_IS_ECONNABORTED(ss) ||
- APR_STATUS_IS_ECONNRESET(ss) ||
- APR_STATUS_IS_EOF(ss))
- sp_rst_recv++;
- else {
- sp_err_recv++;
- sp_erl_recv = ss;
- }
- }
-#endif
- if (ss == APR_SUCCESS)
- return (jint)nbytes;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, recvfrom)(TCN_STDARGS, jlong from,
- jlong sock, jint flags,
- jbyteArray buf, jint offset, jint toread)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_sockaddr_t *f = J2P(from, apr_sockaddr_t *);
- apr_size_t nbytes = (apr_size_t)toread;
- jbyte *bytes = (*e)->GetByteArrayElements(e, buf, NULL);
- apr_status_t ss;
-
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return -(jint)APR_ENOTSOCK;
- }
- TCN_ASSERT(s->sock != NULL);
- TCN_ASSERT(buf != NULL);
- ss = apr_socket_recvfrom(f, s->sock, (apr_int32_t)flags, (char*)(bytes + offset), &nbytes);
-
- (*e)->ReleaseByteArrayElements(e, buf, bytes,
- nbytes ? 0 : JNI_ABORT);
- if (ss == APR_SUCCESS)
- return (jint)nbytes;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jint)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, optSet)(TCN_STDARGS, jlong sock,
- jint opt, jint on)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
-
- UNREFERENCED(o);
- if (!s->sock) {
- return APR_ENOTSOCK;
- }
- if(!s->net) {
- return -(jint)APR_EINVALSOCK;
- }
- return (jint)(*s->net->opt_set)(s->opaque, (apr_int32_t)opt, (apr_int32_t)on);
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, optGet)(TCN_STDARGS, jlong sock,
- jint opt)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_int32_t on = 0;
-
- UNREFERENCED(o);
- if (!s->sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return APR_ENOTSOCK;
- }
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
- TCN_THROW_IF_ERR((*s->net->opt_get)(s->opaque, (apr_int32_t)opt,
- &on), on);
-cleanup:
- return (jint)on;
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, timeoutSet)(TCN_STDARGS, jlong sock,
- jlong timeout)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
-
- UNREFERENCED(o);
- TCN_ASSERT(s->opaque != NULL);
- if (!sock) {
- return APR_ENOTSOCK;
- }
- if(!s->net) {
- return -(jint)APR_EINVALSOCK;
- }
- return (jint)(*s->net->timeout_set)(s->opaque, J2T(timeout));
-}
-
-TCN_IMPLEMENT_CALL(jlong, Socket, timeoutGet)(TCN_STDARGS, jlong sock)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_interval_time_t timeout;
-
- UNREFERENCED(o);
- if (!sock) {
- tcn_ThrowAPRException(e, APR_ENOTSOCK);
- return 0;
- }
- if(!s->net) {
- tcn_ThrowAPRException(e, APR_EINVALSOCK);
- return -(jint)APR_EINVALSOCK;
- }
- TCN_ASSERT(s->opaque != NULL);
-
- TCN_THROW_IF_ERR((*s->net->timeout_get)(s->opaque, &timeout), timeout);
-cleanup:
- return (jlong)timeout;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, Socket, atmark)(TCN_STDARGS, jlong sock)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_int32_t mark;
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(sock != 0);
- TCN_ASSERT(s->sock != NULL);
-
- if (apr_socket_atmark(s->sock, &mark) != APR_SUCCESS)
- return JNI_FALSE;
- return mark ? JNI_TRUE : JNI_FALSE;
-}
-
-#if APR_HAS_SENDFILE
-
-TCN_IMPLEMENT_CALL(jlong, Socket, sendfile)(TCN_STDARGS, jlong sock,
- jlong file,
- jobjectArray headers,
- jobjectArray trailers,
- jlong offset, jlong len,
- jint flags)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_file_t *f = J2P(file, apr_file_t *);
- jsize nh = 0;
- jsize nt = 0;
- jsize i;
- struct iovec hvec[APR_MAX_IOVEC_SIZE];
- struct iovec tvec[APR_MAX_IOVEC_SIZE];
- jobject hba[APR_MAX_IOVEC_SIZE];
- jobject tba[APR_MAX_IOVEC_SIZE];
- apr_off_t off = (apr_off_t)offset;
- apr_size_t written = (apr_size_t)len;
- apr_hdtr_t hdrs;
- apr_status_t ss;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
- TCN_ASSERT(file != 0);
-
- if (s->net->type != TCN_SOCKET_APR)
- return (jint)(-APR_ENOTIMPL);
- if (headers)
- nh = (*e)->GetArrayLength(e, headers);
- if (trailers)
- nt = (*e)->GetArrayLength(e, trailers);
- /* Check for overflow */
- if (nh >= APR_MAX_IOVEC_SIZE || nt >= APR_MAX_IOVEC_SIZE)
- return (jint)(-APR_ENOMEM);
-
- for (i = 0; i < nh; i++) {
- hba[i] = (*e)->GetObjectArrayElement(e, headers, i);
- hvec[i].iov_len = (*e)->GetArrayLength(e, hba[i]);
- hvec[i].iov_base = (void *)((*e)->GetByteArrayElements(e, hba[i], NULL));
- }
- for (i = 0; i < nt; i++) {
- tba[i] = (*e)->GetObjectArrayElement(e, trailers, i);
- tvec[i].iov_len = (*e)->GetArrayLength(e, tba[i]);
- tvec[i].iov_base = (void *)((*e)->GetByteArrayElements(e, tba[i], NULL));
- }
- hdrs.headers = &hvec[0];
- hdrs.numheaders = nh;
- hdrs.trailers = &tvec[0];
- hdrs.numtrailers = nt;
-
-
- ss = apr_socket_sendfile(s->sock, f, &hdrs, &off, &written, (apr_int32_t)flags);
-
-#ifdef TCN_DO_STATISTICS
- sf_max_send = TCN_MAX(sf_max_send, written);
- sf_min_send = TCN_MIN(sf_min_send, written);
- sf_tot_send += written;
- sf_num_send++;
-#endif
-
- for (i = 0; i < nh; i++) {
- (*e)->ReleaseByteArrayElements(e, hba[i], (jbyte*)hvec[i].iov_base, JNI_ABORT);
- }
-
- for (i = 0; i < nt; i++) {
- (*e)->ReleaseByteArrayElements(e, tba[i], (jbyte*)tvec[i].iov_base, JNI_ABORT);
- }
- /* Return Number of bytes actually sent,
- * including headers, file, and trailers
- */
- if (ss == APR_SUCCESS)
- return (jlong)written;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jlong)ss;
- }
-}
-
-TCN_IMPLEMENT_CALL(jlong, Socket, sendfilen)(TCN_STDARGS, jlong sock,
- jlong file,
- jlong offset, jlong len,
- jint flags)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_file_t *f = J2P(file, apr_file_t *);
- apr_off_t off = (apr_off_t)offset;
- apr_size_t written = (apr_size_t)len;
- apr_hdtr_t hdrs;
- apr_status_t ss;
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(sock != 0);
- TCN_ASSERT(file != 0);
-
- if (s->net->type != TCN_SOCKET_APR)
- return (jint)(-APR_ENOTIMPL);
-
- hdrs.headers = NULL;
- hdrs.numheaders = 0;
- hdrs.trailers = NULL;
- hdrs.numtrailers = 0;
-
-
- ss = apr_socket_sendfile(s->sock, f, &hdrs, &off, &written, (apr_int32_t)flags);
-
-#ifdef TCN_DO_STATISTICS
- sf_max_send = TCN_MAX(sf_max_send, written);
- sf_min_send = TCN_MIN(sf_min_send, written);
- sf_tot_send += written;
- sf_num_send++;
-#endif
-
- /* Return Number of bytes actually sent,
- * including headers, file, and trailers
- */
- if (ss == APR_SUCCESS)
- return (jlong)written;
- else {
- TCN_ERROR_WRAP(ss);
- return -(jlong)ss;
- }
-}
-
-#else /* APR_HAS_SENDIFLE */
-
-TCN_IMPLEMENT_CALL(jlong, Socket, sendfile)(TCN_STDARGS, jlong sock,
- jlong file,
- jobjectArray headers,
- jobjectArray trailers,
- jlong offset, jlong len,
- jint flags)
-{
-
- UNREFERENCED_STDARGS;
- UNREFERENCED(sock);
- UNREFERENCED(file);
- UNREFERENCED(headers);
- UNREFERENCED(trailers);
- UNREFERENCED(offset);
- UNREFERENCED(len);
- UNREFERENCED(flags);
- return -(jlong)APR_ENOTIMPL;
-}
-
-TCN_IMPLEMENT_CALL(jlong, Socket, sendfilen)(TCN_STDARGS, jlong sock,
- jlong file,
- jlong offset, jlong len,
- jint flags)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(sock);
- UNREFERENCED(file);
- UNREFERENCED(offset);
- UNREFERENCED(len);
- UNREFERENCED(flags);
- return -(jlong)APR_ENOTIMPL;
-}
-
-#endif /* APR_HAS_SENDIFLE */
-
-
-TCN_IMPLEMENT_CALL(jint, Socket, acceptfilter)(TCN_STDARGS,
- jlong sock,
- jstring name,
- jstring args)
-{
-#if APR_HAS_SO_ACCEPTFILTER
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- TCN_ALLOC_CSTRING(name);
- TCN_ALLOC_CSTRING(args);
- apr_status_t rv;
-
-
- UNREFERENCED(o);
- rv = apr_socket_accept_filter(s->sock, J2S(name),
- J2S(args) ? J2S(args) : "");
- TCN_FREE_CSTRING(name);
- TCN_FREE_CSTRING(args);
- return (jint)rv;
-#else
- UNREFERENCED_STDARGS;
- UNREFERENCED(sock);
- UNREFERENCED(name);
- UNREFERENCED(args);
- return (jint)APR_ENOTIMPL;
-#endif
-}
-
-TCN_IMPLEMENT_CALL(jint, Socket, dataSet)(TCN_STDARGS, jlong sock,
- jstring key, jobject data)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- apr_status_t rv = APR_SUCCESS;
- TCN_ALLOC_CSTRING(key);
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
-
- rv = apr_socket_data_set(s->sock, data, J2S(key), NULL);
- TCN_FREE_CSTRING(key);
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(jobject, Socket, dataGet)(TCN_STDARGS, jlong socket,
- jstring key)
-{
- tcn_socket_t *s = J2P(socket, tcn_socket_t *);
- TCN_ALLOC_CSTRING(key);
- void *rv = NULL;
-
- UNREFERENCED(o);
- TCN_ASSERT(socket != 0);
-
- if (apr_socket_data_get(&rv, J2S(key), s->sock) != APR_SUCCESS) {
- rv = NULL;
- }
- TCN_FREE_CSTRING(key);
- return rv;
-}
diff --git a/native/src/os.c b/native/src/os.c
deleted file mode 100644
index 256a697..0000000
--- a/native/src/os.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-
-TCN_IMPLEMENT_CALL(jstring, OS, defaultEncoding)(TCN_STDARGS, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
-
- UNREFERENCED(o);
- return AJP_TO_JSTRING(apr_os_default_encoding(p));
-}
-
-TCN_IMPLEMENT_CALL(jstring, OS, localeEncoding)(TCN_STDARGS, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
-
- UNREFERENCED(o);
- return AJP_TO_JSTRING(apr_os_locale_encoding(p));
-}
-
diff --git a/native/src/poll.c b/native/src/poll.c
deleted file mode 100644
index 4414ec8..0000000
--- a/native/src/poll.c
+++ /dev/null
@@ -1,560 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-
-#ifdef TCN_DO_STATISTICS
-static int sp_created = 0;
-static int sp_destroyed = 0;
-static int sp_cleared = 0;
-#endif
-
-/* Internal poll structure for queryset
- */
-typedef struct tcn_pollset {
- apr_pool_t *pool;
- apr_int32_t nelts;
- apr_int32_t nalloc;
- apr_pollset_t *pollset;
- jlong *set;
- apr_interval_time_t default_timeout;
- jboolean wakeable;
- /* A ring containing all of the pollfd_t that are active
- */
- APR_RING_HEAD(pfd_poll_ring_t, tcn_pfde_t) poll_ring;
- /* A ring of pollfd_t that have been used, and then _remove()'d
- */
- APR_RING_HEAD(pfd_free_ring_t, tcn_pfde_t) free_ring;
- /* A ring of pollfd_t where rings that have been _remove()`ed but
- * might still be inside a _poll()
- */
- APR_RING_HEAD(pfd_dead_ring_t, tcn_pfde_t) dead_ring;
-#ifdef TCN_DO_STATISTICS
- int sp_added;
- int sp_max_count;
- int sp_poll;
- int sp_polled;
- int sp_max_polled;
- int sp_remove;
- int sp_removed;
- int sp_maintained;
- int sp_max_maintained;
- int sp_err_poll;
- int sp_poll_timeout;
- int sp_overflow;
- int sp_equals;
- int sp_eintr;
-#endif
-} tcn_pollset_t;
-
-#ifdef TCN_DO_STATISTICS
-static void sp_poll_statistics(tcn_pollset_t *p)
-{
- fprintf(stderr, "Pollset Statistics ......\n");
- fprintf(stderr, "Number of added sockets : %d\n", p->sp_added);
- fprintf(stderr, "Max. number of sockets : %d\n", p->sp_max_count);
- fprintf(stderr, "Poll calls : %d\n", p->sp_poll);
- fprintf(stderr, "Poll timeouts : %d\n", p->sp_poll_timeout);
- fprintf(stderr, "Poll errors : %d\n", p->sp_err_poll);
- fprintf(stderr, "Poll overflows : %d\n", p->sp_overflow);
- fprintf(stderr, "Polled sockets : %d\n", p->sp_polled);
- fprintf(stderr, "Max. Polled sockets : %d\n", p->sp_max_polled);
- fprintf(stderr, "Poll remove : %d\n", p->sp_remove);
- fprintf(stderr, "Total removed : %d\n", p->sp_removed);
- fprintf(stderr, "Maintained : %d\n", p->sp_maintained);
- fprintf(stderr, "Max. maintained : %d\n", p->sp_max_maintained);
- fprintf(stderr, "Number of duplicates : %d\n", p->sp_equals);
- fprintf(stderr, "Number of interrupts : %d\n", p->sp_eintr);
-
-}
-
-static apr_status_t sp_poll_cleanup(void *data)
-{
- sp_cleared++;
- sp_poll_statistics(data);
- return APR_SUCCESS;
-}
-
-void sp_poll_dump_statistics()
-{
- fprintf(stderr, "Poll Statistics .........\n");
- fprintf(stderr, "Polls created : %d\n", sp_created);
- fprintf(stderr, "Polls destroyed : %d\n", sp_destroyed);
- fprintf(stderr, "Polls cleared : %d\n", sp_cleared);
-}
-#endif
-
-TCN_IMPLEMENT_CALL(jlong, Poll, create)(TCN_STDARGS, jint size,
- jlong pool, jint flags,
- jlong default_timeout)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_pollset_t *pollset = NULL;
- tcn_pollset_t *tps = NULL;
- apr_uint32_t f = (apr_uint32_t)flags | APR_POLLSET_NOCOPY;
-
- UNREFERENCED(o);
- TCN_ASSERT(pool != 0);
-
-#if defined(APR_POLLSET_WAKEABLE)
- /* By default all pollsets are wakeable.
- * XXX: See if wee need to define that in Java API when calling this
- * method.
- */
- f |= APR_POLLSET_WAKEABLE;
-#endif
- if (f & APR_POLLSET_THREADSAFE) {
- apr_status_t rv = apr_pollset_create(&pollset, (apr_uint32_t)size,
- p, f);
- /* Pass the ENOTIMPL to java, as described in javadocs. Java must clean the
- flag, will know it's not supported.
- */
- if (rv != APR_SUCCESS) {
- tcn_ThrowAPRException(e, rv);
- goto cleanup;
- }
- }
- if (pollset == NULL) {
- apr_status_t rv = apr_pollset_create(&pollset, (apr_uint32_t)size,
- p, f);
-#if defined(APR_POLLSET_WAKEABLE)
- /* If case we fallback to select provider remove the
- * APR_POLLSET_WAKEABLE which causes size + 1 elements
- * and try again if APR_EINVAL is returned.
- */
- if (rv == APR_EINVAL)
- f &= ~APR_POLLSET_WAKEABLE;
- else if (rv != APR_SUCCESS) {
- tcn_ThrowAPRException(e, rv);
- goto cleanup;
- }
-#else
- if (rv != APR_SUCCESS) {
- tcn_ThrowAPRException(e, rv);
- goto cleanup;
- }
-#endif
- }
-#if defined(APR_POLLSET_WAKEABLE)
- if (pollset == NULL) {
- apr_status_t rv = apr_pollset_create(&pollset, (apr_uint32_t)size,
- p, f);
- if (rv != APR_SUCCESS) {
- tcn_ThrowAPRException(e, rv);
- goto cleanup;
- }
- }
-#endif
- tps = apr_pcalloc(p, sizeof(tcn_pollset_t));
- TCN_CHECK_ALLOCATED(tps);
- tps->pollset = pollset;
- tps->set = apr_pcalloc(p, size * sizeof(jlong) * 2);
- TCN_CHECK_ALLOCATED(tps->set);
- APR_RING_INIT(&tps->poll_ring, tcn_pfde_t, link);
- APR_RING_INIT(&tps->free_ring, tcn_pfde_t, link);
- APR_RING_INIT(&tps->dead_ring, tcn_pfde_t, link);
-
- tps->nelts = 0;
- tps->nalloc = size;
- tps->pool = p;
- tps->default_timeout = J2T(default_timeout);
-#if defined(APR_POLLSET_WAKEABLE)
- if (f & APR_POLLSET_WAKEABLE)
- tps->wakeable = JNI_TRUE;
- else
-#endif
- tps->wakeable = JNI_FALSE;
-#ifdef TCN_DO_STATISTICS
- sp_created++;
- apr_pool_cleanup_register(p, (const void *)tps,
- sp_poll_cleanup,
- apr_pool_cleanup_null);
-#endif
-cleanup:
- return P2J(tps);
-}
-
-TCN_IMPLEMENT_CALL(jint, Poll, destroy)(TCN_STDARGS, jlong pollset)
-{
- tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *);
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(pollset != 0);
-#ifdef TCN_DO_STATISTICS
- sp_destroyed++;
- apr_pool_cleanup_kill(p->pool, p, sp_poll_cleanup);
- sp_poll_statistics(p);
-#endif
- return (jint)apr_pollset_destroy(p->pollset);
-}
-
-static apr_status_t do_add(tcn_pollset_t *p, tcn_socket_t *s,
- apr_int16_t reqevents,
- apr_interval_time_t socket_timeout)
-{
-
- apr_status_t rv;
- apr_interval_time_t timeout = socket_timeout;
- tcn_pfde_t *elem = NULL;
-
- if (p->nelts == p->nalloc) {
-#ifdef TCN_DO_STATISTICS
- p->sp_overflow++;
-#endif
- return APR_ENOMEM;
- }
- if (s->pe != NULL) {
- /* Socket is already added to the pollset.
- */
-#ifdef TCN_DO_STATISTICS
- p->sp_equals++;
-#endif
- return APR_EEXIST;
- }
- if (timeout == TCN_NO_SOCKET_TIMEOUT) {
- timeout = p->default_timeout;
- }
- if (timeout > 0)
- s->last_active = apr_time_now();
- else
- s->last_active = 0;
- s->timeout = socket_timeout;
- if (!APR_RING_EMPTY(&p->free_ring, tcn_pfde_t, link)) {
- elem = APR_RING_FIRST(&p->free_ring);
- APR_RING_REMOVE(elem, link);
- }
- else {
- elem = (tcn_pfde_t *)apr_palloc(p->pool, sizeof(tcn_pfde_t));
- APR_RING_ELEM_INIT(elem, link);
- }
- elem->fd.reqevents = reqevents;
- elem->fd.desc_type = APR_POLL_SOCKET;
- elem->fd.desc.s = s->sock;
- elem->fd.client_data = s;
-#ifdef TCN_DO_STATISTICS
- p->sp_added++;
- p->sp_max_count = TCN_MAX(p->sp_max_count, p->sp_added);
-#endif
- rv = apr_pollset_add(p->pollset, &elem->fd);
- if (rv != APR_SUCCESS) {
- APR_RING_INSERT_TAIL(&p->free_ring, elem, tcn_pfde_t, link);
- }
- else {
- APR_RING_INSERT_TAIL(&p->poll_ring, elem, tcn_pfde_t, link);
- s->pe = elem;
- }
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, Poll, add)(TCN_STDARGS, jlong pollset,
- jlong socket, jint reqevents)
-{
- tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *);
- tcn_socket_t *s = J2P(socket, tcn_socket_t *);
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(socket != 0);
-
- return (jint) do_add(p, s, (apr_int16_t)reqevents, TCN_NO_SOCKET_TIMEOUT);
-}
-
-TCN_IMPLEMENT_CALL(jint, Poll, addWithTimeout)(TCN_STDARGS, jlong pollset,
- jlong socket, jint reqevents,
- jlong socket_timeout)
-{
- tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *);
- tcn_socket_t *s = J2P(socket, tcn_socket_t *);
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(socket != 0);
-
- return (jint) do_add(p, s, (apr_int16_t)reqevents, J2T(socket_timeout));
-}
-
-TCN_IMPLEMENT_CALL(jint, Poll, remove)(TCN_STDARGS, jlong pollset,
- jlong socket)
-{
- apr_pollfd_t fd;
- apr_status_t rv;
- tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *);
- tcn_socket_t *s = J2P(socket, tcn_socket_t *);
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(socket != 0);
-
- if (s->pe == NULL) {
- /* Already removed */
- return APR_NOTFOUND;
- }
- fd.desc_type = APR_POLL_SOCKET;
- fd.desc.s = s->sock;
- fd.client_data = s;
- fd.reqevents = APR_POLLIN | APR_POLLOUT;
-#ifdef TCN_DO_STATISTICS
- p->sp_remove++;
-#endif
-
- rv = apr_pollset_remove(p->pollset, &fd);
- APR_RING_REMOVE(s->pe, link);
- APR_RING_INSERT_TAIL(&p->dead_ring, s->pe, tcn_pfde_t, link);
- s->pe = NULL;
- p->nelts--;
-#ifdef TCN_DO_STATISTICS
- p->sp_removed++;
-#endif
- return rv;
-}
-
-
-TCN_IMPLEMENT_CALL(jint, Poll, poll)(TCN_STDARGS, jlong pollset,
- jlong timeout, jlongArray set,
- jboolean remove)
-{
- const apr_pollfd_t *fd = NULL;
- tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *);
- apr_int32_t i, num = 0;
- apr_status_t rv = APR_SUCCESS;
- apr_time_t now = 0;
- apr_interval_time_t ptime = J2T(timeout);
- UNREFERENCED(o);
- TCN_ASSERT(pollset != 0);
-
-#ifdef TCN_DO_STATISTICS
- p->sp_poll++;
-#endif
-
- if (ptime > 0) {
- tcn_pfde_t *ep;
-
- now = apr_time_now();
- /* Find the minimum timeout */
- APR_RING_FOREACH(ep, &p->poll_ring, tcn_pfde_t, link)
- {
- apr_interval_time_t socket_timeout = 0;
- tcn_socket_t *s = (tcn_socket_t *)ep->fd.client_data;
- if (s->timeout == TCN_NO_SOCKET_TIMEOUT) {
- socket_timeout = p->default_timeout;
- }
- else {
- socket_timeout = s->timeout;
- }
- if (socket_timeout >= 0) {
- apr_interval_time_t t = now - s->last_active;
- if (t >= socket_timeout) {
- ptime = 0;
- break;
- }
- else {
- ptime = TCN_MIN(socket_timeout - t, ptime);
- }
- }
- }
- }
- else if (ptime < 0)
- ptime = 0;
- for (;;) {
- rv = apr_pollset_poll(p->pollset, ptime, &num, &fd);
- if (rv != APR_SUCCESS) {
- if (APR_STATUS_IS_EINTR(rv)) {
-#ifdef TCN_DO_STATISTICS
- p->sp_eintr++;
-#endif
- /* Pass it to the caller - interrupt() was called */
- }
- TCN_ERROR_WRAP(rv);
-#ifdef TCN_DO_STATISTICS
- if (rv == TCN_TIMEUP)
- p->sp_poll_timeout++;
- else
- p->sp_err_poll++;
-#endif
- num = (apr_int32_t)(-rv);
- }
- break;
- }
- /* Shift all PFDs in the Dead Ring to the Free Ring */
- APR_RING_CONCAT(&p->free_ring, &p->dead_ring, tcn_pfde_t, link);
- if (num > 0) {
-#ifdef TCN_DO_STATISTICS
- p->sp_polled += num;
- p->sp_max_polled = TCN_MAX(p->sp_max_polled, num);
-#endif
- if (!remove)
- now = apr_time_now();
- for (i = 0; i < num; i++) {
- tcn_socket_t *s = (tcn_socket_t *)fd->client_data;
- p->set[i*2+0] = (jlong)(fd->rtnevents);
- p->set[i*2+1] = P2J(s);
- /* If a socket is registered for multiple events and the poller has
- multiple events to return it may do as a single pair in this
- array or as multiple pairs depending on implementation. On OSX at
- least, multiple pairs have been observed. In this case do not try
- and remove socket from the pollset for a second time else a crash
- will result. */
- if (remove) {
- if (s->pe) {
- apr_pollset_remove(p->pollset, fd);
- APR_RING_REMOVE(s->pe, link);
- APR_RING_INSERT_TAIL(&p->dead_ring, s->pe, tcn_pfde_t, link);
- s->pe = NULL;
- p->nelts--;
-#ifdef TCN_DO_STATISTICS
- p->sp_removed++;
-#endif
- }
- }
- else {
- /* Update last active with the current time
- * after the poll call.
- */
- s->last_active = now;
- }
- fd ++;
- }
- (*e)->SetLongArrayRegion(e, set, 0, num * 2, p->set);
- }
-
- return (jint)num;
-}
-
-TCN_IMPLEMENT_CALL(jint, Poll, maintain)(TCN_STDARGS, jlong pollset,
- jlongArray set, jboolean remove)
-{
- tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *);
- apr_int32_t i = 0, num = 0;
- apr_time_t now = apr_time_now();
- tcn_pfde_t *ep, *ip;
-
- UNREFERENCED(o);
- TCN_ASSERT(pollset != 0);
-
- /* Check for timeout sockets */
- APR_RING_FOREACH_SAFE(ep, ip, &p->poll_ring, tcn_pfde_t, link)
- {
- apr_interval_time_t timeout = 0;
- tcn_socket_t *s = (tcn_socket_t *)ep->fd.client_data;
- if (s->timeout == TCN_NO_SOCKET_TIMEOUT) {
- timeout = p->default_timeout;
- }
- else {
- timeout = s->timeout;
- }
- if (timeout == -1) {
- continue;
- }
- if ((now - s->last_active) >= timeout) {
- p->set[num++] = P2J(s);
- if (remove) {
- APR_RING_REMOVE(ep, link);
- APR_RING_INSERT_TAIL(&p->dead_ring, ep, tcn_pfde_t, link);
- s->pe = NULL;
- p->nelts--;
-#ifdef TCN_DO_STATISTICS
- p->sp_removed++;
-#endif
- }
- }
- }
- if (num) {
-#ifdef TCN_DO_STATISTICS
- p->sp_maintained += num;
- p->sp_max_maintained = TCN_MAX(p->sp_max_maintained, num);
-#endif
- if (remove) {
- for (i = 0; i < num; i++) {
- apr_pollfd_t fd;
- tcn_socket_t *s = J2P(p->set[i], tcn_socket_t *);
- fd.desc_type = APR_POLL_SOCKET;
- fd.desc.s = s->sock;
- fd.client_data = s;
- fd.reqevents = APR_POLLIN | APR_POLLOUT;
- apr_pollset_remove(p->pollset, &fd);
- }
- }
- (*e)->SetLongArrayRegion(e, set, 0, num, p->set);
- }
- return (jint)num;
-}
-
-TCN_IMPLEMENT_CALL(void, Poll, setTtl)(TCN_STDARGS, jlong pollset,
- jlong default_timeout)
-{
- tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *);
- UNREFERENCED_STDARGS;
- p->default_timeout = J2T(default_timeout);
-}
-
-TCN_IMPLEMENT_CALL(jlong, Poll, getTtl)(TCN_STDARGS, jlong pollset)
-{
- tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *);
- UNREFERENCED_STDARGS;
- return (jlong)p->default_timeout;
-}
-
-TCN_IMPLEMENT_CALL(jint, Poll, pollset)(TCN_STDARGS, jlong pollset,
- jlongArray set)
-{
- tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *);
- apr_int32_t n = 0;
- tcn_pfde_t *ep;
-
- UNREFERENCED(o);
- TCN_ASSERT(pollset != 0);
-
- APR_RING_FOREACH(ep, &p->poll_ring, tcn_pfde_t, link)
- {
- apr_pollfd_t *fd = &ep->fd;
- fd->rtnevents = APR_POLLHUP | APR_POLLIN;
- p->set[n++] = (jlong)(fd->rtnevents);
- p->set[n++] = P2J(fd->client_data);
- }
- if (n > 0)
- (*e)->SetLongArrayRegion(e, set, 0, n, p->set);
- return n / 2;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, Poll, wakeable)(TCN_STDARGS, jlong pollset)
-{
-
- tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *);
- UNREFERENCED_STDARGS;
-
- return p->wakeable;
-}
-
-#if defined(APR_POLLSET_WAKEABLE)
-
-TCN_IMPLEMENT_CALL(jint, Poll, interrupt)(TCN_STDARGS, jlong pollset)
-{
- tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *);
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(pollset != 0);
-
- return (jint)apr_pollset_wakeup(p->pollset);
-}
-#else
-
-TCN_IMPLEMENT_CALL(jint, Poll, interrupt)(TCN_STDARGS, jlong pollset)
-{
-
- UNREFERENCED_STDARGS;
- UNREFERENCED(pollset);
-
- return APR_ENOTIMPL;
-}
-
-#endif
diff --git a/native/src/pool.c b/native/src/pool.c
index 901ed02..45df89b 100644
--- a/native/src/pool.c
+++ b/native/src/pool.c
@@ -18,24 +18,6 @@
extern apr_pool_t *tcn_global_pool;
-static apr_status_t generic_pool_cleanup(void *data)
-{
- apr_status_t rv = APR_SUCCESS;
- tcn_callback_t *cb = (tcn_callback_t *)data;
-
- if (data) {
- JNIEnv *env;
- tcn_get_java_env(&env);
- if (!TCN_IS_NULL(env, cb->obj)) {
- rv = (*(env))->CallIntMethod(env, cb->obj, cb->mid[0],
- NULL);
- TCN_UNLOAD_CLASS(env, cb->obj);
- }
- free(cb);
- }
- return rv;
-}
-
TCN_IMPLEMENT_CALL(jlong, Pool, create)(TCN_STDARGS, jlong parent)
{
apr_pool_t *p = J2P(parent, apr_pool_t *);
@@ -50,24 +32,6 @@ cleanup:
return P2J(n);
}
-TCN_IMPLEMENT_CALL(jlong, Pool, unmanaged)(TCN_STDARGS)
-{
- apr_pool_t *n;
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_pool_create_unmanaged(&n), n);
-cleanup:
- return P2J(n);
-}
-
-TCN_IMPLEMENT_CALL(void, Pool, clear)(TCN_STDARGS, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- UNREFERENCED_STDARGS;
- TCN_ASSERT(pool != 0);
- apr_pool_clear(p);
-}
-
TCN_IMPLEMENT_CALL(void, Pool, destroy)(TCN_STDARGS, jlong pool)
{
apr_pool_t *p = J2P(pool, apr_pool_t *);
@@ -76,182 +40,3 @@ TCN_IMPLEMENT_CALL(void, Pool, destroy)(TCN_STDARGS, jlong pool)
if (tcn_global_pool)
apr_pool_destroy(p);
}
-
-TCN_IMPLEMENT_CALL(jlong, Pool, parentGet)(TCN_STDARGS, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- UNREFERENCED_STDARGS;
- TCN_ASSERT(pool != 0);
- return P2J(apr_pool_parent_get(p));
-}
-
-TCN_IMPLEMENT_CALL(jboolean, Pool, isAncestor)(TCN_STDARGS, jlong a, jlong b)
-{
- apr_pool_t *pa = J2P(a, apr_pool_t *);
- apr_pool_t *pb = J2P(b, apr_pool_t *);
- UNREFERENCED_STDARGS;
- return apr_pool_is_ancestor(pa, pb) ? JNI_TRUE : JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jlong, Pool, palloc)(TCN_STDARGS, jlong pool, jint size)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- UNREFERENCED_STDARGS;
- return P2J(apr_palloc(p, (apr_size_t)size));
-}
-
-TCN_IMPLEMENT_CALL(jlong, Pool, pcalloc)(TCN_STDARGS, jlong pool, jint size)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- UNREFERENCED_STDARGS;
- return P2J(apr_pcalloc(p, (apr_size_t)size));
-}
-
-TCN_IMPLEMENT_CALL(jlong, Pool, cleanupRegister)(TCN_STDARGS, jlong pool,
- jobject obj)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- tcn_callback_t *cb = (tcn_callback_t *)malloc(sizeof(tcn_callback_t));
- jclass cls;
-
- UNREFERENCED(o);
-
- if (cb == NULL) {
- TCN_THROW_OS_ERROR(e);
- return 0;
- }
- cls = (*e)->GetObjectClass(e, obj);
- cb->obj = (*e)->NewGlobalRef(e, obj);
- cb->mid[0] = (*e)->GetMethodID(e, cls, "callback", "()I");
-
- apr_pool_cleanup_register(p, (const void *)cb,
- generic_pool_cleanup,
- apr_pool_cleanup_null);
-
- return P2J(cb);
-}
-
-TCN_IMPLEMENT_CALL(void, Pool, cleanupKill)(TCN_STDARGS, jlong pool,
- jlong data)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- tcn_callback_t *cb = J2P(data, tcn_callback_t *);
-
- UNREFERENCED(o);
- TCN_ASSERT(pool != 0);
- apr_pool_cleanup_kill(p, cb, generic_pool_cleanup);
- (*e)->DeleteGlobalRef(e, cb->obj);
- free(cb);
-}
-
-TCN_IMPLEMENT_CALL(jobject, Pool, alloc)(TCN_STDARGS, jlong pool,
- jint size)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_size_t sz = (apr_size_t)size;
- void *mem;
-
- UNREFERENCED(o);
- TCN_ASSERT(pool != 0);
-
- if ((mem = apr_palloc(p, sz)) != NULL)
- return (*e)->NewDirectByteBuffer(e, mem, (jlong)sz);
- else
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jobject, Pool, calloc)(TCN_STDARGS, jlong pool,
- jint size)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_size_t sz = (apr_size_t)size;
- void *mem;
-
- UNREFERENCED(o);
- TCN_ASSERT(pool != 0);
-
- if ((mem = apr_pcalloc(p, sz)) != NULL)
- return (*e)->NewDirectByteBuffer(e, mem, (jlong)sz);
- else
- return NULL;
-}
-
-static apr_status_t generic_pool_data_cleanup(void *data)
-{
- apr_status_t rv = APR_SUCCESS;
- tcn_callback_t *cb = (tcn_callback_t *)data;
-
- if (data) {
- JNIEnv *env;
- tcn_get_java_env(&env);
-
- if (!TCN_IS_NULL(env, cb->obj)) {
- TCN_UNLOAD_CLASS(env, cb->obj);
- }
- free(cb);
- }
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, Pool, dataSet)(TCN_STDARGS, jlong pool,
- jstring key, jobject data)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_status_t rv = APR_SUCCESS;
- void *old = NULL;
- TCN_ALLOC_CSTRING(key);
-
- UNREFERENCED(o);
- TCN_ASSERT(pool != 0);
- TCN_ASSERT(key != 0);
-
- if (apr_pool_userdata_get(&old, J2S(key), p) == APR_SUCCESS) {
- if (old)
- apr_pool_cleanup_run(p, old, generic_pool_data_cleanup);
- }
- if (data) {
- JNIEnv *e;
- tcn_callback_t *cb = (tcn_callback_t *)malloc(sizeof(tcn_callback_t));
- tcn_get_java_env(&e);
- cb->obj = (*e)->NewGlobalRef(e, data);
- if ((rv = apr_pool_userdata_set(cb, J2S(key), generic_pool_data_cleanup,
- p)) != APR_SUCCESS) {
- (*e)->DeleteGlobalRef(e, cb->obj);
- free(cb);
- }
- }
- else {
- /* Clear the exiting user data */
- rv = apr_pool_userdata_set(NULL, J2S(key), NULL, p);
- }
- TCN_FREE_CSTRING(key);
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(jobject, Pool, dataGet)(TCN_STDARGS, jlong pool,
- jstring key)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- void *old = NULL;
- TCN_ALLOC_CSTRING(key);
- jobject rv = NULL;
-
- UNREFERENCED(o);
- TCN_ASSERT(pool != 0);
- TCN_ASSERT(key != 0);
-
- if (apr_pool_userdata_get(&old, J2S(key), p) == APR_SUCCESS) {
- if (old) {
- tcn_callback_t *cb = (tcn_callback_t *)old;
- rv = cb->obj;
- }
- }
- TCN_FREE_CSTRING(key);
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(void, Pool, cleanupForExec)(TCN_STDARGS)
-{
- UNREFERENCED_STDARGS;
- apr_pool_cleanup_for_exec();
-}
diff --git a/native/src/proc.c b/native/src/proc.c
deleted file mode 100644
index 298f3ba..0000000
--- a/native/src/proc.c
+++ /dev/null
@@ -1,447 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-#include "apr_thread_proc.h"
-#include "apr_version.h"
-
-#define ERRFN_USERDATA_KEY "TCNATIVECHILDERRFN"
-
-static void generic_child_errfn(apr_pool_t *pool, apr_status_t err,
- const char *description)
-{
- void *data;
- tcn_callback_t *cb;
-
- apr_pool_userdata_get(&data, ERRFN_USERDATA_KEY, pool);
- cb = (tcn_callback_t *)data;
- if (cb) {
- JNIEnv *env;
- tcn_get_java_env(&env);
- if (!TCN_IS_NULL(env, cb->obj)) {
- (*(env))->CallVoidMethod(env, cb->obj, cb->mid[0],
- P2J(pool), (jint)err,
- (*(env))->NewStringUTF(env, description),
- NULL);
- }
- }
-}
-
-static apr_status_t child_errfn_pool_cleanup(void *data)
-{
- tcn_callback_t *cb = (tcn_callback_t *)data;
-
- if (data) {
- JNIEnv *env;
- tcn_get_java_env(&env);
- if (!TCN_IS_NULL(env, cb->obj)) {
- TCN_UNLOAD_CLASS(env, cb->obj);
- }
- free(cb);
- }
- return APR_SUCCESS;
-}
-
-TCN_IMPLEMENT_CALL(jlong, Procattr, create)(TCN_STDARGS,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_procattr_t *attr;
-
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_procattr_create(&attr, p), attr);
-
-cleanup:
- return P2J(attr);
-}
-
-TCN_IMPLEMENT_CALL(jint, Procattr, ioSet)(TCN_STDARGS,
- jlong attr, jint in,
- jint out, jint err)
-{
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_procattr_io_set(a, (apr_int32_t)in,
- (apr_int32_t)out, (apr_int32_t)err);
-}
-
-TCN_IMPLEMENT_CALL(jint, Procattr, childInSet)(TCN_STDARGS,
- jlong attr, jlong in,
- jlong parent)
-{
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
- apr_file_t *f = J2P(in, apr_file_t *);
- apr_file_t *p = J2P(parent, apr_file_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_procattr_child_in_set(a, f, p);
-}
-
-TCN_IMPLEMENT_CALL(jint, Procattr, childOutSet)(TCN_STDARGS,
- jlong attr, jlong out,
- jlong parent)
-{
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
- apr_file_t *f = J2P(out, apr_file_t *);
- apr_file_t *p = J2P(parent, apr_file_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_procattr_child_out_set(a, f, p);
-}
-
-TCN_IMPLEMENT_CALL(jint, Procattr, childErrSet)(TCN_STDARGS,
- jlong attr, jlong err,
- jlong parent)
-{
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
- apr_file_t *f = J2P(err, apr_file_t *);
- apr_file_t *p = J2P(parent, apr_file_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_procattr_child_in_set(a, f, p);
-}
-
-TCN_IMPLEMENT_CALL(jint, Procattr, dirSet)(TCN_STDARGS,
- jlong attr,
- jstring dir)
-{
- apr_status_t rv;
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
- TCN_ALLOC_CSTRING(dir);
-
- UNREFERENCED(o);
-
- rv = apr_procattr_dir_set(a, J2S(dir));
- TCN_FREE_CSTRING(dir);
- return (jint) rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, Procattr, cmdtypeSet)(TCN_STDARGS,
- jlong attr, jint cmd)
-{
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_procattr_cmdtype_set(a, (apr_int32_t)cmd);
-}
-
-TCN_IMPLEMENT_CALL(jint, Procattr, detachSet)(TCN_STDARGS,
- jlong attr, jint detach)
-{
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_procattr_detach_set(a, (apr_int32_t)detach);
-}
-
-TCN_IMPLEMENT_CALL(jint, Procattr, errorCheckSet)(TCN_STDARGS,
- jlong attr, jint chk)
-{
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_procattr_error_check_set(a, (apr_int32_t)chk);
-}
-
-TCN_IMPLEMENT_CALL(jint, Procattr, addrspaceSet)(TCN_STDARGS,
- jlong attr, jint addr)
-{
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_procattr_addrspace_set(a, (apr_int32_t)addr);
-}
-
-TCN_IMPLEMENT_CALL(jlong, Proc, alloc)(TCN_STDARGS,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_proc_t *proc;
-
- UNREFERENCED_STDARGS;
- proc = (apr_proc_t *)apr_pcalloc(p, sizeof(apr_proc_t));
-
- return P2J(proc);
-}
-
-#define MAX_ARGS_SIZE 1024
-#define MAX_ENV_SIZE 1024
-
-TCN_IMPLEMENT_CALL(jint, Proc, create)(TCN_STDARGS, jlong proc,
- jstring progname,
- jobjectArray args,
- jobjectArray env,
- jlong attr, jlong pool)
-{
- apr_status_t rv;
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
- apr_proc_t *np = J2P(proc, apr_proc_t *);
- TCN_ALLOC_CSTRING(progname);
- char *s_args[MAX_ARGS_SIZE];
- char *s_env[MAX_ENV_SIZE];
- const char * const *pargs = NULL;
- const char * const *penv = NULL;
- jsize as = 0;
- jsize es = 0;
- jsize i;
-
- UNREFERENCED(o);
- if (args)
- as = (*e)->GetArrayLength(e, args);
- if (env)
- es = (*e)->GetArrayLength(e, env);
- if (as > (MAX_ARGS_SIZE - 1) || es > (MAX_ENV_SIZE - 2)) {
- TCN_FREE_CSTRING(progname);
- return APR_EINVAL;
- }
- if (as) {
- for (i = 0; i < as; i++) {
- jstring str = (*e)->GetObjectArrayElement(e, args, i);
- s_args[i] = tcn_get_string(e, str);
- (*e)->DeleteLocalRef(e, str);
- }
- s_args[i] = NULL;
- pargs = (const char * const *)&s_args[0];
- }
- if (es) {
- for (i = 0; i < es; i++) {
- jstring str = (*e)->GetObjectArrayElement(e, env, i);
- s_env[i] = tcn_get_string(e, str);
- (*e)->DeleteLocalRef(e, str);
- }
-#ifdef WIN32
- s_env[i++] = apr_psprintf(p, TCN_PARENT_IDE "=%d", getpid());
-#endif
- s_env[i] = NULL;
- penv = (const char * const *)&s_env[0];
- }
-#ifdef WIN32
- else {
- char pps[32];
- itoa(getpid(), pps, 10);
- SetEnvironmentVariable(TCN_PARENT_IDE, pps);
- }
-#endif
- rv = apr_proc_create(np, J2S(progname), pargs,
- penv, a, p);
-#ifdef WIN32
- if (!es)
- SetEnvironmentVariable(TCN_PARENT_IDE, NULL);
-#endif
-
- /* Free local resources */
- TCN_FREE_CSTRING(progname);
- for (i = 0; i < as; i++) {
- if (s_args[i])
- free(s_args[i]);
- }
- for (i = 0; i < es; i++) {
- if (s_env[i])
- free(s_env[i]);
- }
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, Proc, wait)(TCN_STDARGS, jlong proc,
- jintArray rvals, jint waithow)
-{
- apr_status_t rv;
- apr_proc_t *p = J2P(proc, apr_proc_t *);
- int exitcode;
- apr_exit_why_e exitwhy;
-
- UNREFERENCED(o);
-
- rv = apr_proc_wait(p, &exitcode, &exitwhy, (apr_wait_how_e)waithow);
- if (rv == APR_SUCCESS && rvals) {
- jsize n = (*e)->GetArrayLength(e, rvals);
- if (n > 1) {
- jint *ints = (*e)->GetIntArrayElements(e, rvals, NULL);
- ints[0] = exitcode;
- ints[1] = exitwhy;
- (*e)->ReleaseIntArrayElements(e, rvals, ints, 0);
- }
- }
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, Proc, waitAllProcs)(TCN_STDARGS,
- jlong proc, jintArray rvals,
- jint waithow, jlong pool)
-{
- apr_status_t rv;
- apr_proc_t *p = J2P(proc, apr_proc_t *);
- apr_pool_t *c = J2P(pool, apr_pool_t *);
- int exitcode;
- apr_exit_why_e exitwhy;
-
- UNREFERENCED(o);
-
- rv = apr_proc_wait_all_procs(p, &exitcode, &exitwhy,
- (apr_wait_how_e)waithow, c);
- if (rv == APR_SUCCESS && rvals) {
- jsize n = (*e)->GetArrayLength(e, rvals);
- if (n > 1) {
- jint *ints = (*e)->GetIntArrayElements(e, rvals, NULL);
- ints[0] = exitcode;
- ints[1] = exitwhy;
- (*e)->ReleaseIntArrayElements(e, rvals, ints, 0);
- }
- }
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, Proc, detach)(TCN_STDARGS, jint daemonize)
-{
-
- UNREFERENCED_STDARGS;
-#if defined(WIN32)
- UNREFERENCED(daemonize);
- return APR_ENOTIMPL;
-#else
- return (jint)apr_proc_detach(daemonize);
-#endif
-}
-
-TCN_IMPLEMENT_CALL(jint, Proc, kill)(TCN_STDARGS, jlong proc, jint sig)
-{
- apr_proc_t *p = J2P(proc, apr_proc_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_proc_kill(p, (int)sig);
-}
-
-TCN_IMPLEMENT_CALL(void, Pool, noteSubprocess)(TCN_STDARGS, jlong pool,
- jlong proc, jint how)
-{
- apr_proc_t *p = J2P(proc, apr_proc_t *);
- apr_pool_t *a = J2P(pool, apr_pool_t *);
-
- UNREFERENCED_STDARGS;
- apr_pool_note_subprocess(a, p, (apr_kill_conditions_e)how);
-}
-
-TCN_IMPLEMENT_CALL(jint, Proc, fork)(TCN_STDARGS,
- jlongArray proc,
- jlong pool)
-{
- apr_status_t rv = APR_EINVAL;
-
-#if APR_HAS_FORK
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_proc_t *f = apr_pcalloc(p, sizeof(apr_proc_t));
-
- UNREFERENCED(o);
-
- rv = apr_proc_fork(f, p);
- if (rv == APR_SUCCESS && proc) {
- jsize n = (*e)->GetArrayLength(e, proc);
- if (n > 0) {
- jlong *rp = (*e)->GetLongArrayElements(e, proc, NULL);
- rp[0] = P2J(f);
- (*e)->ReleaseLongArrayElements(e, proc, rp, 0);
- }
- }
-#else
- UNREFERENCED_STDARGS;
- UNREFERENCED(proc);
- UNREFERENCED(pool);
-
-#endif
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(void, Procattr, errfnSet)(TCN_STDARGS, jlong attr,
- jlong pool, jobject obj)
-{
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- tcn_callback_t *cb = (tcn_callback_t *)malloc(sizeof(tcn_callback_t));
- jclass cls;
-
- UNREFERENCED(o);
-
- if (cb == NULL) {
- return;
- }
- cls = (*e)->GetObjectClass(e, obj);
- cb->obj = (*e)->NewGlobalRef(e, obj);
- cb->mid[0] = (*e)->GetMethodID(e, cls, "callback", "(JILjava/lang/String;)V");
-
- apr_pool_userdata_setn(cb, ERRFN_USERDATA_KEY, child_errfn_pool_cleanup, p);
- apr_procattr_child_errfn_set(a, generic_child_errfn);
-
-}
-
-TCN_IMPLEMENT_CALL(jint, Procattr, userSet)(TCN_STDARGS,
- jlong attr,
- jstring username,
- jstring password)
-{
-
-#if ((APR_MAJOR_VERSION >= 1) && (APR_MINOR_VERSION >= 1))
- apr_status_t rv;
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
- TCN_ALLOC_CSTRING(username);
-#if APR_PROCATTR_USER_SET_REQUIRES_PASSWORD
- TCN_ALLOC_CSTRING(password);
-#else
- const char *cpassword = NULL;
-#endif
- UNREFERENCED(o);
-
- rv = apr_procattr_user_set(a, J2S(username), J2S(password));
- TCN_FREE_CSTRING(username);
-#if APR_PROCATTR_USER_SET_REQUIRES_PASSWORD
- TCN_FREE_CSTRING(password);
-#endif
- return (jint) rv;
-#else
- UNREFERENCED_STDARGS;
- UNREFERENCED(attr);
- UNREFERENCED(username);
- UNREFERENCED(password);
-
- return APR_ENOTIMPL;
-#endif
-}
-
-TCN_IMPLEMENT_CALL(jint, Procattr, groupSet)(TCN_STDARGS,
- jlong attr,
- jstring group)
-{
-
-#if ((APR_MAJOR_VERSION >= 1) && (APR_MINOR_VERSION >= 1))
- apr_status_t rv;
- apr_procattr_t *a = J2P(attr, apr_procattr_t *);
- TCN_ALLOC_CSTRING(group);
-
- UNREFERENCED(o);
-
- rv = apr_procattr_group_set(a, J2S(group));
- TCN_FREE_CSTRING(group);
- return (jint) rv;
-#else
- UNREFERENCED_STDARGS;
- UNREFERENCED(attr);
- UNREFERENCED(group);
-
- return APR_ENOTIMPL;
-#endif
-}
diff --git a/native/src/shm.c b/native/src/shm.c
deleted file mode 100644
index b6ab808..0000000
--- a/native/src/shm.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-#include "apr_shm.h"
-
-TCN_IMPLEMENT_CALL(jlong, Shm, create)(TCN_STDARGS, jlong reqsize,
- jstring filename,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- const char *fname = NULL;
- apr_shm_t *shm;
-
-
- UNREFERENCED(o);
- if (filename)
- fname = (const char *)((*e)->GetStringUTFChars(e, filename, 0));
- TCN_THROW_IF_ERR(apr_shm_create(&shm, (apr_size_t)reqsize,
- fname, p), shm);
-
-cleanup:
- if (fname)
- (*e)->ReleaseStringUTFChars(e, filename, fname);
- return P2J(shm);
-}
-
-TCN_IMPLEMENT_CALL(jint, Shm, remove)(TCN_STDARGS,
- jstring filename,
- jlong pool)
-{
- apr_status_t rv;
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- TCN_ALLOC_CSTRING(filename);
-
-
- UNREFERENCED(o);
- rv = apr_shm_remove(J2S(filename), p);
- TCN_FREE_CSTRING(filename);
-
- return (jint)rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, Shm, destroy)(TCN_STDARGS, jlong shm)
-{
- apr_shm_t *s = J2P(shm, apr_shm_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_shm_destroy(s);
-}
-
-TCN_IMPLEMENT_CALL(jlong, Shm, attach)(TCN_STDARGS,
- jstring filename,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- const char *fname = NULL;
- apr_shm_t *shm;
-
-
- UNREFERENCED(o);
- if (filename)
- fname = (const char *)((*e)->GetStringUTFChars(e, filename, 0));
- TCN_THROW_IF_ERR(apr_shm_attach(&shm, fname, p), shm);
-
-cleanup:
- if (fname)
- (*e)->ReleaseStringUTFChars(e, filename, fname);
- return P2J(shm);
-}
-
-TCN_IMPLEMENT_CALL(jint, Shm, detach)(TCN_STDARGS, jlong shm)
-{
- apr_shm_t *s = J2P(shm, apr_shm_t *);
-
- UNREFERENCED_STDARGS;
- return (jint)apr_shm_detach(s);
-}
-
-TCN_IMPLEMENT_CALL(jlong, Shm, baseaddr)(TCN_STDARGS, jlong shm)
-{
- apr_shm_t *s = J2P(shm, apr_shm_t *);
-
- UNREFERENCED_STDARGS;
- return P2J(apr_shm_baseaddr_get(s));
-}
-
-TCN_IMPLEMENT_CALL(jlong, Shm, size)(TCN_STDARGS, jlong shm)
-{
- apr_shm_t *s = J2P(shm, apr_shm_t *);
-
- UNREFERENCED_STDARGS;
- return (jlong)apr_shm_size_get(s);
-}
-
-TCN_IMPLEMENT_CALL(jobject, Shm, buffer)(TCN_STDARGS, jlong shm)
-{
- apr_shm_t *s = J2P(shm, apr_shm_t *);
- jlong sz = (jlong)apr_shm_size_get(s);
- void *a;
-
- UNREFERENCED(o);
-
- if ((a = apr_shm_baseaddr_get(s)) != NULL)
- return (*e)->NewDirectByteBuffer(e, a, sz);
- else
- return NULL;
-}
diff --git a/native/src/ssl.c b/native/src/ssl.c
index 92414e6..a008ec4 100644
--- a/native/src/ssl.c
+++ b/native/src/ssl.c
@@ -20,7 +20,6 @@
#include "apr_atomic.h"
#include "apr_poll.h"
-#ifdef HAVE_OPENSSL
#include "ssl_private.h"
static int ssl_initialized = 0;
@@ -30,7 +29,6 @@ extern apr_pool_t *tcn_global_pool;
ENGINE *tcn_ssl_engine = NULL;
tcn_pass_cb_t tcn_password_callback;
-#ifdef HAVE_KEYLOG_CALLBACK
static BIO *key_log_file = NULL;
static void ssl_keylog_callback(const SSL *ssl, const char *line)
@@ -40,30 +38,11 @@ static void ssl_keylog_callback(const SSL *ssl, const char *line)
BIO_puts(key_log_file, "\n");
}
}
-#endif
/* From netty-tcnative */
static jclass byteArrayClass;
static jclass stringClass;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-/* Global reference to the pool used by the dynamic mutexes */
-static apr_pool_t *dynlockpool = NULL;
-
-/* Dynamic lock structure */
-struct CRYPTO_dynlock_value {
- apr_pool_t *pool;
- const char* file;
- int line;
- apr_thread_mutex_t *mutex;
-};
-
-#if ! (defined(WIN32) || defined(WIN64))
-apr_threadkey_t *thread_exit_key;
-static int threadkey_initialized = 0;
-#endif
-#endif
-
/*
* supported_ssl_opts is a bitmask that contains all supported SSL_OP_*
* options at compile-time. This is used in hasOp to determine which
@@ -210,29 +189,6 @@ static const jint supported_ssl_opts = 0
#endif
| 0;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-/* OpenSSL Pre-1.1.0 compatibility */
-/* Taken from OpenSSL 1.1.0 snapshot 20160410 */
-int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
-{
- /* q is optional */
- if (p == NULL || g == NULL)
- return 0;
- BN_free(dh->p);
- BN_free(dh->q);
- BN_free(dh->g);
- dh->p = p;
- dh->q = q;
- dh->g = g;
-
- if (q != NULL) {
- dh->length = BN_num_bits(q);
- }
-
- return 1;
-}
-#endif
-
/*
* Grab well-defined DH parameters from OpenSSL, see the BN_get_rfc*
* functions in <openssl/bn.h> for all available primes.
@@ -294,14 +250,12 @@ static void free_dh_params(void)
}
}
-#ifdef HAVE_KEYLOG_CALLBACK
void SSL_callback_add_keylog(SSL_CTX *ctx)
{
if (key_log_file) {
SSL_CTX_set_keylog_callback(ctx, ssl_keylog_callback);
}
}
-#endif
/* Hand out the same DH structure though once generated as we leak
* memory otherwise and freeing the structure up after use would be
@@ -321,10 +275,8 @@ DH *SSL_get_dh_params(unsigned keylen)
return NULL; /* impossible to reach. */
}
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
static void init_bio_methods(void);
static void free_bio_methods(void);
-#endif
TCN_IMPLEMENT_CALL(jint, SSL, version)(TCN_STDARGS)
{
@@ -349,12 +301,6 @@ static apr_status_t ssl_init_cleanup(void *data)
return APR_SUCCESS;
ssl_initialized = 0;
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)) && ! (defined(WIN32) || defined(WIN64))
- if (threadkey_initialized) {
- threadkey_initialized = 0;
- apr_threadkey_private_delete(thread_exit_key);
- }
-#endif
if (tcn_password_callback.cb.obj) {
JNIEnv *env;
tcn_get_java_env(&env);
@@ -362,9 +308,7 @@ static apr_status_t ssl_init_cleanup(void *data)
tcn_password_callback.cb.obj);
}
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
free_bio_methods();
-#endif
free_dh_params();
#ifndef OPENSSL_NO_ENGINE
@@ -375,39 +319,12 @@ static apr_status_t ssl_init_cleanup(void *data)
}
#endif
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
- /* Openssl v1.1+ handles all termination automatically. Do
- * nothing in this case.
- */
-#else
- /*
- * Try to kill the internals of the SSL library.
- */
-#ifdef OPENSSL_FIPS
- FIPS_mode_set(0);
-#endif
- /* Corresponds to OPENSSL_load_builtin_modules() */
- CONF_modules_free();
- /* Corresponds to SSL_library_init: */
- EVP_cleanup();
-#if HAVE_ENGINE_LOAD_BUILTIN_ENGINES
- ENGINE_cleanup();
-#endif
-#ifndef OPENSSL_NO_COMP
- SSL_COMP_free_compression_methods();
-#endif
- CRYPTO_cleanup_all_ex_data();
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- ERR_remove_thread_state(NULL);
-#endif
-#endif
+ /* Openssl v1.1+ handles all termination automatically. */
-#ifdef HAVE_KEYLOG_CALLBACK
if (key_log_file) {
BIO_free(key_log_file);
key_log_file = NULL;
}
-#endif
/* Don't call ERR_free_strings here; ERR_load_*_strings only
* actually load the error strings once per process due to static
@@ -438,182 +355,14 @@ static ENGINE *ssl_try_load_engine(const char *engine)
#endif
/*
- * To ensure thread-safetyness in OpenSSL
+ * To ensure thread-safetyness in LibreSSL
*/
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-static apr_thread_mutex_t **ssl_lock_cs;
-static int ssl_lock_num_locks;
-
-static void ssl_thread_lock(int mode, int type,
- const char *file, int line)
-{
- UNREFERENCED(file);
- UNREFERENCED(line);
- if (type < ssl_lock_num_locks) {
- if (mode & CRYPTO_LOCK) {
- apr_thread_mutex_lock(ssl_lock_cs[type]);
- }
- else {
- apr_thread_mutex_unlock(ssl_lock_cs[type]);
- }
- }
-}
-#endif
-
static unsigned long ssl_thread_id(void)
{
return (unsigned long)tcn_get_thread_id();
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-#if ! (defined(WIN32) || defined(WIN64))
-void SSL_thread_exit(void) {
- ERR_remove_thread_state(NULL);
- apr_threadkey_private_set(NULL, thread_exit_key);
-}
-
-unsigned long SSL_ERR_get() {
- apr_threadkey_private_set(thread_exit_key, thread_exit_key);
- return ERR_get_error();
-}
-
-void SSL_ERR_clear() {
- apr_threadkey_private_set(thread_exit_key, thread_exit_key);
- ERR_clear_error();
-}
-
-static void _ssl_thread_exit(void *data) {
- UNREFERENCED(data);
- SSL_thread_exit();
-}
-#endif
-
-static void ssl_set_thread_id(CRYPTO_THREADID *id)
-{
- CRYPTO_THREADID_set_numeric(id, ssl_thread_id());
-}
-
-static apr_status_t ssl_thread_cleanup(void *data)
-{
- UNREFERENCED(data);
- CRYPTO_THREADID_set_callback(NULL);
- CRYPTO_set_locking_callback(NULL);
- CRYPTO_set_dynlock_create_callback(NULL);
- CRYPTO_set_dynlock_lock_callback(NULL);
- CRYPTO_set_dynlock_destroy_callback(NULL);
-
- dynlockpool = NULL;
-
- /* Let the registered mutex cleanups do their own thing
- */
- return APR_SUCCESS;
-}
-
-/*
- * Dynamic lock creation callback
- */
-static struct CRYPTO_dynlock_value *ssl_dyn_create_function(const char *file,
- int line)
-{
- struct CRYPTO_dynlock_value *value;
- apr_pool_t *p;
- apr_status_t rv;
-
- /*
- * We need a pool to allocate our mutex. Since we can't clear
- * allocated memory from a pool, create a subpool that we can blow
- * away in the destruction callback.
- */
- rv = apr_pool_create(&p, dynlockpool);
- if (rv != APR_SUCCESS) {
- /* TODO log that fprintf(stderr, "Failed to create subpool for dynamic lock"); */
- return NULL;
- }
-
- value = (struct CRYPTO_dynlock_value *)apr_palloc(p,
- sizeof(struct CRYPTO_dynlock_value));
- if (!value) {
- /* TODO log that fprintf(stderr, "Failed to allocate dynamic lock structure"); */
- return NULL;
- }
-
- value->pool = p;
- /* Keep our own copy of the place from which we were created,
- using our own pool. */
- value->file = apr_pstrdup(p, file);
- value->line = line;
- rv = apr_thread_mutex_create(&(value->mutex), APR_THREAD_MUTEX_DEFAULT,
- p);
- if (rv != APR_SUCCESS) {
- /* TODO log that fprintf(stderr, "Failed to create thread mutex for dynamic lock"); */
- apr_pool_destroy(p);
- return NULL;
- }
- return value;
-}
-
-/*
- * Dynamic locking and unlocking function
- */
-
-static void ssl_dyn_lock_function(int mode, struct CRYPTO_dynlock_value *l,
- const char *file, int line)
-{
-
-
- if (mode & CRYPTO_LOCK) {
- apr_thread_mutex_lock(l->mutex);
- }
- else {
- apr_thread_mutex_unlock(l->mutex);
- }
-}
-
-/*
- * Dynamic lock destruction callback
- */
-static void ssl_dyn_destroy_function(struct CRYPTO_dynlock_value *l,
- const char *file, int line)
-{
- apr_status_t rv;
- rv = apr_thread_mutex_destroy(l->mutex);
- if (rv != APR_SUCCESS) {
- /* TODO log that fprintf(stderr, "Failed to destroy mutex for dynamic lock %s:%d", l->file, l->line); */
- }
- /* Trust that whomever owned the CRYPTO_dynlock_value we were
- * passed has no future use for it...
- */
- apr_pool_destroy(l->pool);
-}
-
-static void ssl_thread_setup(apr_pool_t *p)
-{
- int i;
-
- CRYPTO_THREADID_set_callback(ssl_set_thread_id);
- ssl_lock_num_locks = CRYPTO_num_locks();
- ssl_lock_cs = apr_palloc(p, ssl_lock_num_locks * sizeof(*ssl_lock_cs));
-
- for (i = 0; i < ssl_lock_num_locks; i++) {
- apr_thread_mutex_create(&(ssl_lock_cs[i]),
- APR_THREAD_MUTEX_DEFAULT, p);
- }
-
- CRYPTO_set_locking_callback(ssl_thread_lock);
- /* Set up dynamic locking scaffolding for OpenSSL to use at its
- * convenience.
- */
- dynlockpool = p;
- CRYPTO_set_dynlock_create_callback(ssl_dyn_create_function);
- CRYPTO_set_dynlock_lock_callback(ssl_dyn_lock_function);
- CRYPTO_set_dynlock_destroy_callback(ssl_dyn_destroy_function);
-
- apr_pool_cleanup_register(p, NULL, ssl_thread_cleanup,
- apr_pool_cleanup_null);
-}
-#endif
-
static int ssl_rand_choosenum(int l, int h)
{
int i;
@@ -753,7 +502,7 @@ TCN_IMPLEMENT_CALL(jint, SSL, initialize)(TCN_STDARGS, jstring engine)
{
jclass clazz;
jclass sClazz;
-#if !defined(OPENSSL_NO_ENGINE) || OPENSSL_VERSION_NUMBER < 0x10100000L
+#if !defined(OPENSSL_NO_ENGINE)
apr_status_t err = APR_SUCCESS;
#endif
@@ -770,40 +519,12 @@ TCN_IMPLEMENT_CALL(jint, SSL, initialize)(TCN_STDARGS, jstring engine)
TCN_FREE_CSTRING(engine);
return (jint)APR_SUCCESS;
}
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
/* Openssl v1.1+ handles all initialisation automatically, apart
* from hints as to how we want to use the library.
*
* We tell openssl we want to include engine support.
*/
OPENSSL_init_ssl(OPENSSL_INIT_ENGINE_ALL_BUILTIN, NULL);
-#else
- /* We must register the library in full, to ensure our configuration
- * code can successfully test the SSL environment.
- */
- OPENSSL_malloc_init();
- ERR_load_crypto_strings();
- SSL_load_error_strings();
- SSL_library_init();
- OpenSSL_add_all_algorithms();
-#if HAVE_ENGINE_LOAD_BUILTIN_ENGINES
- ENGINE_load_builtin_engines();
-#endif
- OPENSSL_load_builtin_modules();
-
-#if ! (defined(WIN32) || defined(WIN64))
- err = apr_threadkey_private_create(&thread_exit_key, _ssl_thread_exit,
- tcn_global_pool);
- if (err != APR_SUCCESS) {
- ssl_init_cleanup(NULL);
- tcn_ThrowAPRException(e, err);
- return (jint)err;
- }
- threadkey_initialized = 1;
-#endif
- /* Initialize thread support */
- ssl_thread_setup(tcn_global_pool);
-#endif
#ifndef OPENSSL_NO_ENGINE
if (J2S(engine)) {
@@ -844,9 +565,7 @@ TCN_IMPLEMENT_CALL(jint, SSL, initialize)(TCN_STDARGS, jstring engine)
SSL_init_app_data_idx();
init_dh_params();
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
init_bio_methods();
-#endif
/*
* Let us cleanup the ssl library when the library is unloaded
@@ -864,7 +583,6 @@ TCN_IMPLEMENT_CALL(jint, SSL, initialize)(TCN_STDARGS, jstring engine)
sClazz = (*e)->FindClass(e, "java/lang/String");
stringClass = (jclass) (*e)->NewGlobalRef(e, sClazz);
-#ifdef HAVE_KEYLOG_CALLBACK
if (!key_log_file) {
char *key_log_file_name = getenv("SSLKEYLOGFILE");
if (key_log_file_name) {
@@ -878,7 +596,6 @@ TCN_IMPLEMENT_CALL(jint, SSL, initialize)(TCN_STDARGS, jstring engine)
}
}
}
-#endif
return (jint)APR_SUCCESS;
}
@@ -926,10 +643,11 @@ TCN_IMPLEMENT_CALL(void, SSL, randSet)(TCN_STDARGS, jstring file)
TCN_IMPLEMENT_CALL(jint, SSL, fipsModeGet)(TCN_STDARGS)
{
-#ifdef OPENSSL_FIPS
+#if defined(LIBRESSL_VERSION_NUMBER)
UNREFERENCED(o);
- return FIPS_mode();
-#elif (OPENSSL_VERSION_NUMBER > 0x2FFFFFFFL)
+ /* LibreSSL doesn't support FIPS */
+ return 0;
+#else
EVP_MD *md;
const OSSL_PROVIDER *provider;
const char *name;
@@ -949,12 +667,6 @@ TCN_IMPLEMENT_CALL(jint, SSL, fipsModeGet)(TCN_STDARGS)
} else {
return 1;
}
-#else
- UNREFERENCED(o);
- /* FIPS is unavailable */
- tcn_ThrowException(e, "FIPS was not available to tcnative at build time. You will need to re-build tcnative against an OpenSSL with FIPS.");
-
- return 0;
#endif
}
@@ -963,25 +675,8 @@ TCN_IMPLEMENT_CALL(jint, SSL, fipsModeSet)(TCN_STDARGS, jint mode)
int r = 0;
UNREFERENCED(o);
-#ifdef OPENSSL_FIPS
- if(1 != (r = (jint)FIPS_mode_set((int)mode))) {
- /* arrange to get a human-readable error message */
- unsigned long err = SSL_ERR_get();
- char msg[256];
-
- /* ERR_load_crypto_strings() already called in initialize() */
-
- ERR_error_string_n(err, msg, 256);
-
- tcn_ThrowException(e, msg);
- }
-#elif (OPENSSL_VERSION_NUMBER > 0x2FFFFFFFL)
- /* This method should never be called when using OpenSSL 3.x onwards */
- tcn_ThrowException(e, "fipsModeSet is not supported in OpenSSL 3.x onwards.");
-#else
- /* FIPS is unavailable */
- tcn_ThrowException(e, "FIPS was not available to tcnative at build time. You will need to re-build tcnative against an OpenSSL with FIPS.");
-#endif
+ /* This method should never be called when using Tomcat Native 2.x onwards */
+ tcn_ThrowException(e, "fipsModeSet is not supported in Tomcat Native 2.x onwards.");
return r;
}
@@ -1046,13 +741,6 @@ static int jbs_new(BIO *bi)
j->refcount = 1;
BIO_set_shutdown(bi, 1);
BIO_set_init(bi, 0);
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- /* No setter method for OpenSSL 1.1.0 available,
- * but I can't find any functional use of the
- * "num" field there either.
- */
- bi->num = -1;
-#endif
BIO_set_data(bi, (void *)j);
return 1;
@@ -1182,20 +870,6 @@ static long jbs_ctrl(BIO *b, int cmd, long num, void *ptr)
return ret;
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-static BIO_METHOD jbs_methods = {
- BIO_TYPE_FILE,
- "Java Callback",
- jbs_write,
- jbs_read,
- jbs_puts,
- jbs_gets,
- jbs_ctrl,
- jbs_new,
- jbs_free,
- NULL
-};
-#else
static BIO_METHOD *jbs_methods = NULL;
static void init_bio_methods(void)
@@ -1214,15 +888,10 @@ static void free_bio_methods(void)
{
BIO_meth_free(jbs_methods);
}
-#endif
static BIO_METHOD *BIO_jbs()
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- return(&jbs_methods);
-#else
return jbs_methods;
-#endif
}
TCN_IMPLEMENT_CALL(jlong, SSL, newBIO)(TCN_STDARGS, jlong pool,
@@ -1692,24 +1361,6 @@ TCN_IMPLEMENT_CALL(jint, SSL, getPostHandshakeAuthInProgress)(TCN_STDARGS,
#endif
}
-/* Read which protocol was negotiated for the given SSL *. */
-TCN_IMPLEMENT_CALL(jstring, SSL, getNextProtoNegotiated)(TCN_STDARGS,
- jlong ssl /* SSL * */) {
- SSL *ssl_ = J2P(ssl, SSL *);
- const unsigned char *proto;
- unsigned int proto_len;
-
- if (ssl_ == NULL) {
- tcn_ThrowException(e, "ssl is null");
- return NULL;
- }
-
- UNREFERENCED(o);
-
- SSL_get0_next_proto_negotiated(ssl_, &proto, &proto_len);
- return tcn_new_stringn(e, (const char *)proto, (size_t) proto_len);
-}
-
/*** End Twitter API Additions ***/
/*** Apple API Additions ***/
@@ -2058,409 +1709,3 @@ TCN_IMPLEMENT_CALL(jint, SSL, getHandshakeCount)(TCN_STDARGS, jlong ssl)
}
/*** End Apple API Additions ***/
-
-#else /* HAVE_OPENSSL */
-/* OpenSSL is not supported.
- * Create empty stubs.
- */
-
-TCN_IMPLEMENT_CALL(jint, SSL, version)(TCN_STDARGS)
-{
- UNREFERENCED_STDARGS;
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jstring, SSL, versionString)(TCN_STDARGS)
-{
- UNREFERENCED_STDARGS;
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, initialize)(TCN_STDARGS, jstring engine)
-{
- UNREFERENCED(o);
- UNREFERENCED(engine);
- tcn_ThrowAPRException(e, APR_ENOTIMPL);
- return (jint)APR_ENOTIMPL;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSL, randLoad)(TCN_STDARGS, jstring file)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(file);
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSL, randSave)(TCN_STDARGS, jstring file)
-{
- UNREFERENCED_STDARGS;
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSL, randMake)(TCN_STDARGS, jstring file,
- jint length, jboolean base64)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(file);
- UNREFERENCED(length);
- UNREFERENCED(base64);
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(void, SSL, randSet)(TCN_STDARGS, jstring file)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(file);
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, fipsModeGet)(TCN_STDARGS)
-{
- UNREFERENCED(o);
- tcn_ThrowException(e, "FIPS was not available to tcnative at build time. You will need to re-build tcnative against an OpenSSL with FIPS.");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, fipsModeSet)(TCN_STDARGS, jint mode)
-{
- UNREFERENCED(o);
- UNREFERENCED(mode);
- tcn_ThrowException(e, "FIPS was not available to tcnative at build time. You will need to re-build tcnative against an OpenSSL with FIPS.");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSL, newBIO)(TCN_STDARGS, jlong pool,
- jobject callback)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(pool);
- UNREFERENCED(callback);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, closeBIO)(TCN_STDARGS, jlong bio)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(bio);
- return (jint)APR_ENOTIMPL;
-}
-
-TCN_IMPLEMENT_CALL(void, SSL, setPasswordCallback)(TCN_STDARGS,
- jobject callback)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(callback);
-}
-
-TCN_IMPLEMENT_CALL(void, SSL, setPassword)(TCN_STDARGS, jstring password)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(password);
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSL, generateRSATempKey)(TCN_STDARGS, jint idx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(idx);
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSL, loadDSATempKey)(TCN_STDARGS, jint idx,
- jstring file)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(idx);
- UNREFERENCED(file);
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jstring, SSL, getLastError)(TCN_STDARGS)
-{
- UNREFERENCED_STDARGS;
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSL, hasOp)(TCN_STDARGS, jint op)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(op);
- return JNI_FALSE;
-}
-
-/*** Begin Twitter 1:1 API addition ***/
-TCN_IMPLEMENT_CALL(jint, SSL, getLastErrorNumber)(TCN_STDARGS) {
- UNREFERENCED(o);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong /* SSL * */, SSL, newSSL)(TCN_STDARGS,
- jlong ctx /* tcn_ssl_ctxt_t * */,
- jboolean server) {
- UNREFERENCED(o);
- UNREFERENCED(ctx);
- UNREFERENCED(server);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(void, SSL, setBIO)(TCN_STDARGS, jlong ssl, jlong rbio, jlong wbio) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- UNREFERENCED(rbio);
- UNREFERENCED(wbio);
- tcn_ThrowException(e, "Not implemented");
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, pendingWrittenBytesInBIO)(TCN_STDARGS, jlong bio) {
- UNREFERENCED(o);
- UNREFERENCED(bio);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, pendingReadableBytesInSSL)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, writeToBIO)(TCN_STDARGS, jlong bio, jlong wbuf, jint wlen) {
- UNREFERENCED(o);
- UNREFERENCED(bio);
- UNREFERENCED(wbuf);
- UNREFERENCED(wlen);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, readFromBIO)(TCN_STDARGS, jlong bio, jlong rbuf, jint rlen) {
- UNREFERENCED(o);
- UNREFERENCED(bio);
- UNREFERENCED(rbuf);
- UNREFERENCED(rlen);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, writeToSSL)(TCN_STDARGS, jlong ssl, jlong wbuf, jint wlen) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- UNREFERENCED(wbuf);
- UNREFERENCED(wlen);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, readFromSSL)(TCN_STDARGS, jlong ssl, jlong rbuf, jint rlen) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- UNREFERENCED(rbuf);
- UNREFERENCED(rlen);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, getShutdown)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(void, SSL, setShutdown)(TCN_STDARGS, jlong ssl, jint mode) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- UNREFERENCED(mode);
- tcn_ThrowException(e, "Not implemented");
-}
-
-TCN_IMPLEMENT_CALL(void, SSL, freeSSL)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSL, makeNetworkBIO)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(void, SSL, freeBIO)(TCN_STDARGS, jlong bio) {
- UNREFERENCED(o);
- UNREFERENCED(bio);
- tcn_ThrowException(e, "Not implemented");
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, shutdownSSL)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jstring, SSL, getCipherForSSL)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, isInInit)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, doHandshake)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, renegotiate)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, renegotiatePending)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, verifyClientPostHandshake)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, getPostHandshakeAuthInProgress)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jstring, SSL, getNextProtoNegotiated)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return NULL;
-}
-
-/*** End Twitter 1:1 API addition ***/
-
-/*** Begin Apple 1:1 API addition ***/
-
-TCN_IMPLEMENT_CALL(jstring, SSL, getAlpnSelected)(TCN_STDARGS, jlong ssl) {
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jobjectArray, SSL, getPeerCertChain)(TCN_STDARGS, jlong ssl)
-{
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jbyteArray, SSL, getPeerCertificate)(TCN_STDARGS, jlong ssl)
-{
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jstring, SSL, getErrorString)(TCN_STDARGS, jlong number)
-{
- UNREFERENCED(o);
- UNREFERENCED(number);
- tcn_ThrowException(e, "Not implemented");
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jstring, SSL, getVersion)(TCN_STDARGS, jlong ssl)
-{
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSL, getTime)(TCN_STDARGS, jlong ssl)
-{
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(void, SSL, setVerify)(TCN_STDARGS, jlong ssl,
- jint level, jint depth)
-{
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
-}
-
-TCN_IMPLEMENT_CALL(void, SSL, setOptions)(TCN_STDARGS, jlong ssl,
- jint opt)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ssl);
- UNREFERENCED(opt);
- tcn_ThrowException(e, "Not implemented");
-}
-
-TCN_IMPLEMENT_CALL(jint, SSL, getOptions)(TCN_STDARGS, jlong ssl)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-TCN_IMPLEMENT_CALL(jobjectArray, SSL, getCiphers)(TCN_STDARGS, jlong ssl)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-TCN_IMPLEMENT_CALL(jboolean, SSL, setCipherSuites)(TCN_STDARGS, jlong ssl,
- jstring ciphers)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ssl);
- UNREFERENCED(ciphers);
- tcn_ThrowException(e, "Not implemented");
- return JNI_FALSE;
-}
-TCN_IMPLEMENT_CALL(jbyteArray, SSL, getSessionId)(TCN_STDARGS, jlong ssl)
-{
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-TCN_IMPLEMENT_CALL(jint, SSL, getHandshakeCount)(TCN_STDARGS, jlong ssl)
-{
- UNREFERENCED(o);
- UNREFERENCED(ssl);
- tcn_ThrowException(e, "Not implemented");
- return 0;
-}
-/*** End Apple API Additions ***/
-#endif /* HAVE_OPENSSL */
diff --git a/native/src/sslconf.c b/native/src/sslconf.c
index e2ece6f..a3b8cfd 100644
--- a/native/src/sslconf.c
+++ b/native/src/sslconf.c
@@ -19,8 +19,6 @@
#include "tcn.h"
-#ifdef HAVE_OPENSSL
-
#include "ssl_private.h"
#ifdef HAVE_SSL_CONF_CMD
@@ -373,61 +371,3 @@ TCN_IMPLEMENT_CALL(jint, SSLConf, finish)(TCN_STDARGS, jlong cctx)
#endif /* HAVE_SSL_CONF_CMD */
-
-#else /* HAVE_OPENSSL */
-/* OpenSSL is not supported.
- * Create empty stubs.
- */
-
-TCN_IMPLEMENT_CALL(jlong, SSLConf, make)(TCN_STDARGS, jlong pool,
- jint flags)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(pool);
- UNREFERENCED(flags);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(void, SSLConf, free)(TCN_STDARGS, jlong cctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(cctx);
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLConf, check)(TCN_STDARGS, jlong cctx,
- jstring cmd, jstring value)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(cctx);
- UNREFERENCED(cmd);
- UNREFERENCED(value);
- return APR_ENOTIMPL;
-}
-
-TCN_IMPLEMENT_CALL(void, SSLConf, assign)(TCN_STDARGS, jlong cctx,
- jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(cctx);
- UNREFERENCED(ctx);
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLConf, apply)(TCN_STDARGS, jlong cctx,
- jstring cmd, jstring value)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(cctx);
- UNREFERENCED(cmd);
- UNREFERENCED(value);
- return APR_ENOTIMPL;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLConf, finish)(TCN_STDARGS, jlong cctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(cctx);
- return APR_ENOTIMPL;
-}
-
-
-#endif /* HAVE_OPENSSL */
diff --git a/native/src/sslcontext.c b/native/src/sslcontext.c
index 483446d..9bd7e76 100644
--- a/native/src/sslcontext.c
+++ b/native/src/sslcontext.c
@@ -23,7 +23,6 @@
#include "apr_thread_mutex.h"
#include "apr_poll.h"
-#ifdef HAVE_OPENSSL
#include "ssl_private.h"
static jclass byteArrayClass;
@@ -130,7 +129,7 @@ int ssl_callback_ServerNameIndication(SSL *ssl, int *al, tcn_ssl_ctxt_t *c)
return SSL_TLSEXT_ERR_OK;
}
-#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+#if !defined(LIBRESSL_VERSION_NUMBER)
/*
* This callback function is called when the ClientHello is received.
*/
@@ -226,7 +225,7 @@ give_up:
}
return SSL_CLIENT_HELLO_SUCCESS;
}
-#endif /* OPENSSL_VERSION_NUMBER < 0x10101000L */
+#endif
/* Initialize server context */
TCN_IMPLEMENT_CALL(jlong, SSLContext, make)(TCN_STDARGS, jlong pool,
@@ -237,9 +236,7 @@ TCN_IMPLEMENT_CALL(jlong, SSLContext, make)(TCN_STDARGS, jlong pool,
SSL_CTX *ctx = NULL;
jclass clazz;
jclass sClazz;
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
jint prot;
-#endif
UNREFERENCED(o);
if (protocol == SSL_PROTOCOL_NONE) {
@@ -247,73 +244,12 @@ TCN_IMPLEMENT_CALL(jlong, SSLContext, make)(TCN_STDARGS, jlong pool,
goto init_failed;
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- if (protocol == SSL_PROTOCOL_TLSV1_3) {
-#ifdef HAVE_TLSV1_3
- if (mode == SSL_MODE_CLIENT)
- ctx = SSL_CTX_new(TLSv1_3_client_method());
- else if (mode == SSL_MODE_SERVER)
- ctx = SSL_CTX_new(TLSv1_3_server_method());
- else
- ctx = SSL_CTX_new(TLSv1_3_method());
-#endif
- } else if (protocol == SSL_PROTOCOL_TLSV1_2) {
-#ifdef HAVE_TLSV1_2
- if (mode == SSL_MODE_CLIENT)
- ctx = SSL_CTX_new(TLSv1_2_client_method());
- else if (mode == SSL_MODE_SERVER)
- ctx = SSL_CTX_new(TLSv1_2_server_method());
- else
- ctx = SSL_CTX_new(TLSv1_2_method());
-#endif
- } else if (protocol == SSL_PROTOCOL_TLSV1_1) {
-#ifdef HAVE_TLSV1_1
- if (mode == SSL_MODE_CLIENT)
- ctx = SSL_CTX_new(TLSv1_1_client_method());
- else if (mode == SSL_MODE_SERVER)
- ctx = SSL_CTX_new(TLSv1_1_server_method());
- else
- ctx = SSL_CTX_new(TLSv1_1_method());
-#endif
- } else if (protocol == SSL_PROTOCOL_TLSV1) {
- if (mode == SSL_MODE_CLIENT)
- ctx = SSL_CTX_new(TLSv1_client_method());
- else if (mode == SSL_MODE_SERVER)
- ctx = SSL_CTX_new(TLSv1_server_method());
- else
- ctx = SSL_CTX_new(TLSv1_method());
- } else if (protocol == SSL_PROTOCOL_SSLV3) {
- if (mode == SSL_MODE_CLIENT)
- ctx = SSL_CTX_new(SSLv3_client_method());
- else if (mode == SSL_MODE_SERVER)
- ctx = SSL_CTX_new(SSLv3_server_method());
- else
- ctx = SSL_CTX_new(SSLv3_method());
- } else if (protocol == SSL_PROTOCOL_SSLV2) {
- /* requested but not supported */
-#ifndef HAVE_TLSV1_3
- } else if (protocol & SSL_PROTOCOL_TLSV1_3) {
- /* requested but not supported */
-#endif
-#ifndef HAVE_TLSV1_2
- } else if (protocol & SSL_PROTOCOL_TLSV1_2) {
- /* requested but not supported */
-#endif
-#ifndef HAVE_TLSV1_1
- } else if (protocol & SSL_PROTOCOL_TLSV1_1) {
- /* requested but not supported */
-#endif
- } else {
-#endif /* if OPENSSL_VERSION_NUMBER < 0x10100000L */
- if (mode == SSL_MODE_CLIENT)
- ctx = SSL_CTX_new(TLS_client_method());
- else if (mode == SSL_MODE_SERVER)
- ctx = SSL_CTX_new(TLS_server_method());
- else
- ctx = SSL_CTX_new(TLS_method());
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- }
-#endif
+ if (mode == SSL_MODE_CLIENT)
+ ctx = SSL_CTX_new(TLS_client_method());
+ else if (mode == SSL_MODE_SERVER)
+ ctx = SSL_CTX_new(TLS_server_method());
+ else
+ ctx = SSL_CTX_new(TLS_method());
if (!ctx) {
char err[256];
@@ -326,9 +262,7 @@ TCN_IMPLEMENT_CALL(jlong, SSLContext, make)(TCN_STDARGS, jlong pool,
goto init_failed;
}
-#ifdef HAVE_KEYLOG_CALLBACK
SSL_callback_add_keylog(ctx);
-#endif
c->protocol = protocol;
c->mode = mode;
@@ -339,27 +273,6 @@ TCN_IMPLEMENT_CALL(jlong, SSLContext, make)(TCN_STDARGS, jlong pool,
BIO_set_fp(c->bio_os, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
SSL_CTX_set_options(c->ctx, SSL_OP_ALL);
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- /* always disable SSLv2, as per RFC 6176 */
- SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2);
- if (!(protocol & SSL_PROTOCOL_SSLV3))
- SSL_CTX_set_options(c->ctx, SSL_OP_NO_SSLv3);
- if (!(protocol & SSL_PROTOCOL_TLSV1))
- SSL_CTX_set_options(c->ctx, SSL_OP_NO_TLSv1);
-#ifdef HAVE_TLSV1_1
- if (!(protocol & SSL_PROTOCOL_TLSV1_1))
- SSL_CTX_set_options(c->ctx, SSL_OP_NO_TLSv1_1);
-#endif
-#ifdef HAVE_TLSV1_2
- if (!(protocol & SSL_PROTOCOL_TLSV1_2))
- SSL_CTX_set_options(c->ctx, SSL_OP_NO_TLSv1_2);
-#endif
-#ifdef HAVE_TLSV1_3
- if (!(protocol & SSL_PROTOCOL_TLSV1_3))
- SSL_CTX_set_options(c->ctx, SSL_OP_NO_TLSv1_3);
-#endif
-
-#else /* if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) */
/* We first determine the maximum protocol version we should provide */
#ifdef HAVE_TLSV1_3
if (protocol & SSL_PROTOCOL_TLSV1_3) {
@@ -399,7 +312,6 @@ TCN_IMPLEMENT_CALL(jlong, SSLContext, make)(TCN_STDARGS, jlong pool,
prot = SSL3_VERSION;
}
SSL_CTX_set_min_proto_version(ctx, prot);
-#endif /* if OPENSSL_VERSION_NUMBER < 0x10100000L */
/*
* Configure additional context ingredients
@@ -466,7 +378,7 @@ TCN_IMPLEMENT_CALL(jlong, SSLContext, make)(TCN_STDARGS, jlong pool,
SSL_CTX_set_tlsext_servername_callback(c->ctx, ssl_callback_ServerNameIndication);
SSL_CTX_set_tlsext_servername_arg(c->ctx, c);
-#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+#if !defined(LIBRESSL_VERSION_NUMBER)
/*
* The ClientHello callback also allows to retrieve the SNI, but since it
* runs at the earliest possible connection stage we can even set the TLS
@@ -643,9 +555,6 @@ TCN_IMPLEMENT_CALL(jobjectArray, SSLContext, getCiphers)(TCN_STDARGS, jlong ctx)
const char *name;
int i;
jstring c_name;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- SSL *ssl;
-#endif
UNREFERENCED_STDARGS;
@@ -654,25 +563,12 @@ TCN_IMPLEMENT_CALL(jobjectArray, SSLContext, getCiphers)(TCN_STDARGS, jlong ctx)
return NULL;
}
- /* Before OpenSSL 1.1.0, get_ciphers() was only available
+ /* For LibreSSL get_ciphers() iss only available
* on an SSL, not for an SSL_CTX. */
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- ssl = SSL_new(c->ctx);
- if (ssl == NULL) {
- tcn_ThrowException(e, "could not create temporary ssl from ssl context");
- return NULL;
- }
-
- sk = SSL_get_ciphers(ssl);
-#else
sk = SSL_CTX_get_ciphers(c->ctx);
-#endif
len = sk_SSL_CIPHER_num(sk);
if (len <= 0) {
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- SSL_free(ssl);
-#endif
return NULL;
}
@@ -685,9 +581,6 @@ TCN_IMPLEMENT_CALL(jobjectArray, SSLContext, getCiphers)(TCN_STDARGS, jlong ctx)
c_name = (*e)->NewStringUTF(e, name);
(*e)->SetObjectArrayElement(e, array, i, c_name);
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- SSL_free(ssl);
-#endif
return array;
}
@@ -1204,21 +1097,7 @@ TCN_IMPLEMENT_CALL(jboolean, SSLContext, setCertificate)(TCN_STDARGS, jlong ctx,
(eckey = EC_KEY_new_by_curve_name(nid))) {
SSL_CTX_set_tmp_ecdh(c->ctx, eckey);
}
- /*
- * ...otherwise, enable auto curve selection (OpenSSL 1.0.2)
- * or configure NIST P-256 (required to enable ECDHE for earlier versions)
- * ECDH is always enabled in 1.1.0 unless excluded from SSLCipherList
- */
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
- else {
-#if defined(SSL_CTX_set_ecdh_auto)
- SSL_CTX_set_ecdh_auto(c->ctx, 1);
-#else
- eckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
- SSL_CTX_set_tmp_ecdh(c->ctx, eckey);
-#endif
- }
-#endif
+
/* OpenSSL assures us that _free() is NULL-safe */
EC_KEY_free(eckey);
EC_GROUP_free(ecparams);
@@ -1331,15 +1210,6 @@ TCN_IMPLEMENT_CALL(jboolean, SSLContext, setCertificateRaw)(TCN_STDARGS, jlong c
/*
* TODO try to read the ECDH curve name from somewhere...
*/
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
-#if defined(SSL_CTX_set_ecdh_auto)
- SSL_CTX_set_ecdh_auto(c->ctx, 1);
-#else
- eckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
- SSL_CTX_set_tmp_ecdh(c->ctx, eckey);
- EC_KEY_free(eckey);
-#endif
-#endif
#endif
SSL_CTX_set_tmp_dh_callback(c->ctx, SSL_callback_tmp_DH);
cleanup:
@@ -1376,14 +1246,9 @@ TCN_IMPLEMENT_CALL(jboolean, SSLContext, addChainCertificateRaw)(TCN_STDARGS, jl
ERR_error_string(SSL_ERR_get(), err);
tcn_Throw(e, "Error reading certificate (%s)", err);
rv = JNI_FALSE;
-#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20901000L
- } else {
- tcn_Throw(e, "Unable to use Java keystores with LibreSSL");
-#else
} else if (SSL_CTX_add0_chain_cert(c->ctx, certs) <= 0) {
ERR_error_string(SSL_ERR_get(), err);
tcn_Throw(e, "Error adding certificate to chain (%s)", err);
-#endif
rv = JNI_FALSE;
}
@@ -1613,7 +1478,7 @@ static int initProtocols(JNIEnv *e, const tcn_ssl_ctxt_t *c, unsigned char **pro
proto_chars = (*e)->GetStringUTFChars(e, proto_string, 0);
proto_chars_len = strlen(proto_chars);
- if (proto_chars_len > 0 && proto_chars_len <= MAX_ALPN_NPN_PROTO_SIZE) {
+ if (proto_chars_len > 0 && proto_chars_len <= MAX_ALPN_PROTO_SIZE) {
// We need to add +1 as each protocol is prefixed by it's length (unsigned char).
// For all except of the last one we already have the extra space as everything is
// delimited by ','.
@@ -1656,26 +1521,6 @@ static int initProtocols(JNIEnv *e, const tcn_ssl_ctxt_t *c, unsigned char **pro
}
}
-TCN_IMPLEMENT_CALL(void, SSLContext, setNpnProtos)(TCN_STDARGS, jlong ctx, jobjectArray next_protos,
- jint selectorFailureBehavior)
-{
- tcn_ssl_ctxt_t *c = J2P(ctx, tcn_ssl_ctxt_t *);
-
- TCN_ASSERT(ctx != 0);
- UNREFERENCED(o);
-
- if (initProtocols(e, c, &c->next_proto_data, &c->next_proto_len, next_protos) == 0) {
- c->next_selector_failure_behavior = selectorFailureBehavior;
-
- // depending on if it's client mode or not we need to call different functions.
- if (c->mode == SSL_MODE_CLIENT) {
- SSL_CTX_set_next_proto_select_cb(c->ctx, SSL_callback_select_next_proto, (void *)c);
- } else {
- SSL_CTX_set_next_protos_advertised_cb(c->ctx, SSL_callback_next_protos, (void *)c);
- }
- }
-}
-
TCN_IMPLEMENT_CALL(void, SSLContext, setAlpnProtos)(TCN_STDARGS, jlong ctx, jobjectArray alpn_protos,
jint selectorFailureBehavior)
{
@@ -1847,97 +1692,35 @@ TCN_IMPLEMENT_CALL(void, SSLContext, setSessionTicketKeys)(TCN_STDARGS, jlong ct
(*e)->ReleaseByteArrayElements(e, keys, b, 0);
}
-
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+#if defined(LIBRESSL_VERSION_NUMBER)
/*
* Adapted from OpenSSL:
* https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/ssl/ssl_locl.h#L318
*/
-/* Bits for algorithm_mkey (key exchange algorithm) */
-/* RSA key exchange */
-# define SSL_kRSA 0x00000001L
-/* DH cert, RSA CA cert */
-# define SSL_kDHr 0x00000002L
-/* DH cert, DSA CA cert */
-# define SSL_kDHd 0x00000004L
-/* tmp DH key no DH cert */
-# define SSL_kEDH 0x00000008L
-/* forward-compatible synonym */
-# define SSL_kDHE SSL_kEDH
-/* Kerberos5 key exchange */
-# define SSL_kKRB5 0x00000010L
-/* ECDH cert, RSA CA cert */
-# define SSL_kECDHr 0x00000020L
-/* ECDH cert, ECDSA CA cert */
-# define SSL_kECDHe 0x00000040L
-/* ephemeral ECDH */
-# define SSL_kEECDH 0x00000080L
-/* forward-compatible synonym */
-# define SSL_kECDHE SSL_kEECDH
-/* PSK */
-# define SSL_kPSK 0x00000100L
-/* GOST key exchange */
-# define SSL_kGOST 0x00000200L
-/* SRP */
-# define SSL_kSRP 0x00000400L
/* Bits for algorithm_auth (server authentication) */
-/* RSA auth */
-# define SSL_aRSA 0x00000001L
/* DSS auth */
# define SSL_aDSS 0x00000002L
-/* no auth (i.e. use ADH or AECDH) */
-# define SSL_aNULL 0x00000004L
-/* Fixed DH auth (kDHd or kDHr) */
-# define SSL_aDH 0x00000008L
-/* Fixed ECDH auth (kECDHe or kECDHr) */
-# define SSL_aECDH 0x00000010L
-/* KRB5 auth */
-# define SSL_aKRB5 0x00000020L
-/* ECDSA auth*/
-# define SSL_aECDSA 0x00000040L
-/* PSK auth */
-# define SSL_aPSK 0x00000080L
-/* GOST R 34.10-94 signature auth */
-# define SSL_aGOST94 0x00000100L
-/* GOST R 34.10-2001 signature auth */
-# define SSL_aGOST01 0x00000200L
-/* SRP auth */
-# define SSL_aSRP 0x00000400L
/* OpenSSL end */
-#define TCN_SSL_kRSA SSL_kRSA
-#define TCN_SSL_kDHr SSL_kDHr
-#define TCN_SSL_kDHd SSL_kDHd
-#define TCN_SSL_kDHE SSL_kDHE
-#define TCN_SSL_kKRB5 SSL_kKRB5
-#define TCN_SSL_kECDHr SSL_kECDHr
-#define TCN_SSL_kECDHe SSL_kECDHe
-#define TCN_SSL_kECDHE SSL_kECDHE
-
-#define TCN_SSL_aRSA SSL_aRSA
#define TCN_SSL_aDSS SSL_aDSS
-#define TCN_SSL_aNULL SSL_aNULL
-#define TCN_SSL_aDH SSL_aDH
-#define TCN_SSL_aECDH SSL_aECDH
-#define TCN_SSL_aKRB5 SSL_aKRB5
-#define TCN_SSL_aECDSA SSL_aECDSA
#else
+#define TCN_SSL_aDSS NID_auth_dss
+
+#endif
+
#define TCN_SSL_kRSA NID_kx_rsa
#define TCN_SSL_kDHE NID_kx_dhe
#define TCN_SSL_kECDHE NID_kx_ecdhe
#define TCN_SSL_aRSA NID_auth_rsa
-#define TCN_SSL_aDSS NID_auth_dss
#define TCN_SSL_aNULL NID_auth_null
#define TCN_SSL_aECDSA NID_auth_ecdsa
-#endif
-
/*
* Adapted from Android:
* https://android.googlesource.com/platform/external/openssl/+/master/patches/0003-jsse.patch
@@ -1948,24 +1731,13 @@ static const char* SSL_CIPHER_authentication_method(const SSL_CIPHER* cipher){
if (cipher == NULL) {
return "UNKNOWN";
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- kx = cipher->algorithm_mkey;
- auth = cipher->algorithm_auth;
-#else
kx = SSL_CIPHER_get_kx_nid(cipher);
auth = SSL_CIPHER_get_auth_nid(cipher);
-#endif
switch (kx)
{
case TCN_SSL_kRSA:
return SSL_TXT_RSA;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- case TCN_SSL_kDHr:
- return SSL_TXT_DH "_" SSL_TXT_RSA;
- case TCN_SSL_kDHd:
- return SSL_TXT_DH "_" SSL_TXT_DSS;
-#endif
case TCN_SSL_kDHE:
switch (auth)
{
@@ -1978,14 +1750,6 @@ static const char* SSL_CIPHER_authentication_method(const SSL_CIPHER* cipher){
default:
return "UNKNOWN";
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- case TCN_SSL_kKRB5:
- return SSL_TXT_KRB5;
- case TCN_SSL_kECDHr:
- return SSL_TXT_ECDH "_" SSL_TXT_RSA;
- case TCN_SSL_kECDHe:
- return SSL_TXT_ECDH "_" SSL_TXT_ECDSA;
-#endif
case TCN_SSL_kECDHE:
switch (auth)
{
@@ -2004,9 +1768,6 @@ static const char* SSL_CIPHER_authentication_method(const SSL_CIPHER* cipher){
}
static const char* SSL_authentication_method(const SSL* ssl) {
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- return SSL_CIPHER_authentication_method(ssl->s3->tmp.new_cipher);
-#else
/* XXX ssl->s3->tmp.new_cipher is no longer available in OpenSSL 1.1.0 */
/* https://github.com/netty/netty-tcnative/blob/1.1.33/openssl-dynamic/src/main/c/sslcontext.c
* contains a different method, but I think this is not correct.
@@ -2015,7 +1776,6 @@ static const char* SSL_authentication_method(const SSL* ssl) {
/* Not sure whether SSL_get_current_cipher(ssl) returns something useful
* at the point in time we call it. */
return SSL_CIPHER_authentication_method(SSL_get_current_cipher(ssl));
-#endif
}
/* Android end */
@@ -2133,366 +1893,3 @@ TCN_IMPLEMENT_CALL(jboolean, SSLContext, setSessionIdContext)(TCN_STDARGS, jlong
}
/* End of netty-tc-native add */
-#else
-/* OpenSSL is not supported.
- * Create empty stubs.
- */
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, make)(TCN_STDARGS, jlong pool,
- jint protocol, jint mode)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(pool);
- UNREFERENCED(protocol);
- UNREFERENCED(mode);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLContext, free)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return APR_ENOTIMPL;
-}
-
-TCN_IMPLEMENT_CALL(void, SSLContext, setContextId)(TCN_STDARGS, jlong ctx,
- jstring id)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(id);
-}
-
-TCN_IMPLEMENT_CALL(void, SSLContext, setBIO)(TCN_STDARGS, jlong ctx,
- jlong bio, jint dir)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(bio);
- UNREFERENCED(dir);
-}
-
-TCN_IMPLEMENT_CALL(void, SSLContext, setOptions)(TCN_STDARGS, jlong ctx,
- jint opt)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(opt);
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLContext, getOptions)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(void, SSLContext, clearOptions)(TCN_STDARGS, jlong ctx,
- jint opt)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(opt);
-}
-
-TCN_IMPLEMENT_CALL(void, SSLContext, setQuietShutdown)(TCN_STDARGS, jlong ctx,
- jboolean mode)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(mode);
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSLContext, setCipherSuite)(TCN_STDARGS, jlong ctx,
- jstring ciphers)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(ciphers);
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSLContext, setCARevocation)(TCN_STDARGS, jlong ctx,
- jstring file,
- jstring path)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(file);
- UNREFERENCED(path);
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSLContext, setCertificateChainFile)(TCN_STDARGS, jlong ctx,
- jstring file,
- jboolean skipfirst)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(file);
- UNREFERENCED(skipfirst);
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSLContext, setCACertificate)(TCN_STDARGS,
- jlong ctx,
- jstring file,
- jstring path)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(file);
- UNREFERENCED(path);
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(void, SSLContext, setShutdownType)(TCN_STDARGS, jlong ctx,
- jint type)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(type);
-}
-
-TCN_IMPLEMENT_CALL(void, SSLContext, setVerify)(TCN_STDARGS, jlong ctx,
- jint level, jint depth)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(level);
- UNREFERENCED(depth);
-}
-
-TCN_IMPLEMENT_CALL(void, SSLContext, setRandom)(TCN_STDARGS, jlong ctx,
- jstring file)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(file);
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSLContext, setCertificate)(TCN_STDARGS, jlong ctx,
- jstring cert, jstring key,
- jstring password, jint idx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(cert);
- UNREFERENCED(key);
- UNREFERENCED(password);
- UNREFERENCED(idx);
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSLContext, setCertificateRaw)(TCN_STDARGS, jlong ctx,
- jbyteArray javaCert, jbyteArray javaKey,
- jint idx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(javaCert);
- UNREFERENCED(javaKey);
- UNREFERENCED(idx);
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSLContext, addChainCertificateRaw)(TCN_STDARGS, jlong ctx,
- jbyteArray javaCert)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(javaCert);
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, SSLContext, addClientCACertificateRaw)(TCN_STDARGS, jlong ctx,
- jbyteArray javaCert)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(javaCert);
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLContext, setALPN)(TCN_STDARGS, jlong ctx,
- jbyteArray buf, jint len)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(buf);
- UNREFERENCED(len);
- return APR_ENOTIMPL;
-}
-
-/* Start of netty-tc-native add */
-
-TCN_IMPLEMENT_CALL(void, SSLContext, setNpnProtos)(TCN_STDARGS, jlong ctx, jobjectArray next_protos,
- jint selectorFailureBehavior)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(next_protos);
-}
-
-
-TCN_IMPLEMENT_CALL(void, SSLContext, setAlpnProtos)(TCN_STDARGS, jlong ctx, jobjectArray alpn_protos,
- jint selectorFailureBehavior)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(alpn_protos);
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, setSessionCacheMode)(TCN_STDARGS, jlong ctx, jlong mode)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(mode);
- return -1;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, getSessionCacheMode)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return -1;
-}
-
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, setSessionCacheTimeout)(TCN_STDARGS, jlong ctx, jlong timeout)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(timeout);
- return -1;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, getSessionCacheTimeout)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return -1;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, setSessionCacheSize)(TCN_STDARGS, jlong ctx, jlong size)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(size);
- return -1;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, getSessionCacheSize)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return -1;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, sessionNumber)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, sessionConnect)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, sessionConnectGood)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, sessionConnectRenegotiate)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, sessionAccept)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, sessionAcceptGood)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, sessionAcceptRenegotiate)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, sessionHits)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, sessionCbHits)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, sessionTimeouts)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, sessionCacheFull)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, SSLContext, sessionMisses)(TCN_STDARGS, jlong ctx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(void, SSLContext, setSessionTicketKeys)(TCN_STDARGS, jlong ctx, jbyteArray keys)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(keys);
-}
-
-TCN_IMPLEMENT_CALL(void, SSLContext, setCertVerifyCallback)(TCN_STDARGS, jlong ctx, jobject verifier)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(verifier);
-}
-TCN_IMPLEMENT_CALL(jboolean, SSLContext, setSessionIdContext)(TCN_STDARGS, jlong ctx, jbyteArray sidCtx)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(sidCtx);
- return JNI_FALSE;
-}
-/* End of netty-tc-native add */
-
-#endif
diff --git a/native/src/sslinfo.c b/native/src/sslinfo.c
deleted file mode 100644
index 68e4024..0000000
--- a/native/src/sslinfo.c
+++ /dev/null
@@ -1,603 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** SSL info wrapper
- */
-
-#include "tcn.h"
-#include "apr_file_io.h"
-#include "apr_thread_mutex.h"
-#include "apr_poll.h"
-
-#ifdef HAVE_OPENSSL
-#include "ssl_private.h"
-
-static const char *hex_basis = "0123456789ABCDEF";
-
-static char *convert_to_hex(const void *buf, size_t len)
-{
- const unsigned char *p = ( const unsigned char *)buf;
- char *str, *s;
- size_t i;
-
- if ((len < 1) || ((str = malloc(len * 2 + 1)) == NULL))
- return NULL;
- for (i = 0, s = str; i < len; i++) {
- unsigned char c = *p++;
- *s++ = hex_basis[c >> 4];
- *s++ = hex_basis[c & 0x0F];
- }
- *s = '\0';
- return str;
-}
-
-#define DIGIT2NUM(x) (((x)[0] - '0') * 10 + (x)[1] - '0')
-
-static int get_days_remaining(ASN1_UTCTIME *tm)
-{
- apr_time_t then, now = apr_time_now();
- apr_time_exp_t exp = {0};
- int diff;
-
- /* Fail if the time isn't a valid ASN.1 UTCTIME; RFC3280 mandates
- * that the seconds digits are present even though ASN.1
- * doesn't. */
- if (tm->length < 11 || !ASN1_UTCTIME_check(tm))
- return 0;
-
- exp.tm_year = DIGIT2NUM(tm->data);
- exp.tm_mon = DIGIT2NUM(tm->data + 2) - 1;
- exp.tm_mday = DIGIT2NUM(tm->data + 4) + 1;
- exp.tm_hour = DIGIT2NUM(tm->data + 6);
- exp.tm_min = DIGIT2NUM(tm->data + 8);
- exp.tm_sec = DIGIT2NUM(tm->data + 10);
-
- if (exp.tm_year <= 50)
- exp.tm_year += 100;
- if (apr_time_exp_gmt_get(&then, &exp) != APR_SUCCESS)
- return 0;
-
- diff = (int)((apr_time_sec(then) - apr_time_sec(now)) / (60*60*24));
- return diff > 0 ? diff : 0;
-}
-
-static char *get_cert_valid(ASN1_UTCTIME *tm)
-{
- char *result;
- BIO* bio;
- int n;
-
- if ((bio = BIO_new(BIO_s_mem())) == NULL)
- return NULL;
- ASN1_UTCTIME_print(bio, tm);
- n = BIO_pending(bio);
- result = malloc(n+1);
- n = BIO_read(bio, result, n);
- result[n] = '\0';
- BIO_free(bio);
- return result;
-}
-
-static char *get_cert_PEM(X509 *xs)
-{
- char *result = NULL;
- BIO *bio;
-
- if ((bio = BIO_new(BIO_s_mem())) == NULL)
- return NULL;
- if (PEM_write_bio_X509(bio, xs)) {
- int n = BIO_pending(bio);
- result = malloc(n+1);
- n = BIO_read(bio, result, n);
- result[n] = '\0';
- }
- BIO_free(bio);
- return result;
-}
-
-static unsigned char *get_cert_ASN1(X509 *xs, int *len)
-{
- unsigned char *result = NULL;
- BIO *bio;
-
- *len = 0;
- if ((bio = BIO_new(BIO_s_mem())) == NULL)
- return NULL;
- if (i2d_X509_bio(bio, xs)) {
- int n = BIO_pending(bio);
- result = malloc(n);
- n = BIO_read(bio, result, n);
- *len = n;
- }
- BIO_free(bio);
- return result;
-}
-
-
-static char *get_cert_serial(X509 *xs)
-{
- char *result;
- BIO *bio;
- int n;
-
- if ((bio = BIO_new(BIO_s_mem())) == NULL)
- return NULL;
- i2a_ASN1_INTEGER(bio, X509_get_serialNumber(xs));
- n = BIO_pending(bio);
- result = malloc(n+1);
- n = BIO_read(bio, result, n);
- result[n] = '\0';
- BIO_free(bio);
- return result;
-}
-
-static const struct {
- int fid;
- int nid;
-} info_cert_dn_rec[] = {
- { SSL_INFO_DN_COUNTRYNAME, NID_countryName },
- { SSL_INFO_DN_STATEORPROVINCENAME, NID_stateOrProvinceName },
- { SSL_INFO_DN_LOCALITYNAME, NID_localityName },
- { SSL_INFO_DN_ORGANIZATIONNAME, NID_organizationName },
- { SSL_INFO_DN_ORGANIZATIONALUNITNAME, NID_organizationalUnitName },
- { SSL_INFO_DN_COMMONNAME, NID_commonName },
- { SSL_INFO_DN_TITLE, NID_title },
- { SSL_INFO_DN_INITIALS, NID_initials },
- { SSL_INFO_DN_GIVENNAME, NID_givenName },
- { SSL_INFO_DN_SURNAME, NID_surname },
- { SSL_INFO_DN_DESCRIPTION, NID_description },
- { SSL_INFO_DN_UNIQUEIDENTIFIER, NID_x500UniqueIdentifier },
- { SSL_INFO_DN_EMAILADDRESS, NID_pkcs9_emailAddress },
- { 0, 0 }
-};
-
-static char *lookup_ssl_cert_dn(X509_NAME *xsname, int dnidx)
-{
- char *result;
- X509_NAME_ENTRY *xsne;
- int i, j, n, idx = 0;
-
- result = NULL;
-
- for (i = 0; info_cert_dn_rec[i].fid != 0; i++) {
- if (info_cert_dn_rec[i].fid == dnidx) {
-
- for (j = 0; j < X509_NAME_entry_count(xsname); j++) {
- xsne = X509_NAME_get_entry(xsname, j);
- n = OBJ_obj2nid(X509_NAME_ENTRY_get_object(xsne));
- if (n == info_cert_dn_rec[i].nid && idx-- == 0) {
- ASN1_STRING *adata = X509_NAME_ENTRY_get_data(xsne);
- int len = ASN1_STRING_length(adata);
- result = malloc(len + 1);
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- memcpy(result, ASN1_STRING_data(adata), len);
-#else
- memcpy(result, ASN1_STRING_get0_data(adata), len);
-#endif
- result[len] = '\0';
-
-#if APR_CHARSET_EBCDIC
- ap_xlate_proto_from_ascii(result, len);
-#endif /* APR_CHARSET_EBCDIC */
- break;
- }
- }
- break;
- }
- }
- return result;
-}
-
-TCN_IMPLEMENT_CALL(jbyteArray, SSLSocket, getInfoB)(TCN_STDARGS, jlong sock,
- jint what)
-{
- tcn_socket_t *a = J2P(sock, tcn_socket_t *);
- tcn_ssl_conn_t *s;
- jbyteArray array = NULL;
- apr_status_t rv = APR_SUCCESS;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
-
- s = (tcn_ssl_conn_t *)(a->opaque);
- switch (what) {
- case SSL_INFO_SESSION_ID:
- {
- SSL_SESSION *session = SSL_get_session(s->ssl);
- if (session) {
- unsigned int len;
- const unsigned char *id = SSL_SESSION_get_id(session, &len);
- array = tcn_new_arrayb(e, id, len);
- }
- }
- break;
- default:
- rv = APR_EINVAL;
- break;
- }
- if (what & SSL_INFO_CLIENT_MASK) {
- X509 *xs;
- unsigned char *result;
- int len;
- if ((xs = SSL_get_peer_certificate(s->ssl)) != NULL) {
- switch (what) {
- case SSL_INFO_CLIENT_CERT:
- if ((result = get_cert_ASN1(xs, &len))) {
- array = tcn_new_arrayb(e, result, len);
- free(result);
- }
- break;
- }
- X509_free(xs);
- }
- rv = APR_SUCCESS;
- }
- else if (what & SSL_INFO_SERVER_MASK) {
- X509 *xs;
- unsigned char *result;
- int len;
- if ((xs = SSL_get_certificate(s->ssl)) != NULL) {
- switch (what) {
- case SSL_INFO_SERVER_CERT:
- if ((result = get_cert_ASN1(xs, &len))) {
- array = tcn_new_arrayb(e, result, len);
- free(result);
- }
- break;
- }
- /* XXX: No need to call the X509_free(xs); */
- }
- rv = APR_SUCCESS;
- }
- else if (what & SSL_INFO_CLIENT_CERT_CHAIN) {
- X509 *xs;
- unsigned char *result;
- STACK_OF(X509) *sk = SSL_get_peer_cert_chain(s->ssl);
- int len, n = what & 0x0F;
- if (n < sk_X509_num(sk)) {
- xs = sk_X509_value(sk, n);
- if ((result = get_cert_ASN1(xs, &len))) {
- array = tcn_new_arrayb(e, result, len);
- free(result);
- }
- }
- rv = APR_SUCCESS;
- }
- if (rv != APR_SUCCESS)
- tcn_ThrowAPRException(e, rv);
-
- return array;
-}
-
-TCN_IMPLEMENT_CALL(jstring, SSLSocket, getInfoS)(TCN_STDARGS, jlong sock,
- jint what)
-{
- tcn_socket_t *a = J2P(sock, tcn_socket_t *);
- tcn_ssl_conn_t *s;
- jstring value = NULL;
- apr_status_t rv = APR_SUCCESS;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
-
- s = (tcn_ssl_conn_t *)(a->opaque);
- switch (what) {
- case SSL_INFO_SESSION_ID:
- {
- SSL_SESSION *session = SSL_get_session(s->ssl);
- if (session) {
- unsigned int len;
- const unsigned char *id = SSL_SESSION_get_id(session, &len);
- char *hs = convert_to_hex(id, len);
- if (hs) {
- value = tcn_new_string(e, hs);
- free(hs);
- }
- }
- }
- break;
- case SSL_INFO_PROTOCOL:
- value = tcn_new_string(e, SSL_get_version(s->ssl));
- break;
- case SSL_INFO_CIPHER:
- value = tcn_new_string(e, SSL_get_cipher_name(s->ssl));
- break;
- case SSL_INFO_CIPHER_VERSION:
- value = tcn_new_string(e, SSL_get_cipher_version(s->ssl));
- break;
- case SSL_INFO_CIPHER_DESCRIPTION:
- {
- SSL_CIPHER *cipher = (SSL_CIPHER *)SSL_get_current_cipher(s->ssl);
- if (cipher) {
- char buf[256];
- const char *desc = SSL_CIPHER_description(cipher, buf, 256);
- value = tcn_new_string(e, desc);
- }
- }
- break;
- default:
- rv = APR_EINVAL;
- break;
- }
- if (what & (SSL_INFO_CLIENT_S_DN | SSL_INFO_CLIENT_I_DN)) {
- X509 *xs;
- X509_NAME *xsname;
- if ((xs = SSL_get_peer_certificate(s->ssl)) != NULL) {
- char *result;
- int idx = what & 0x0F;
- if (what & SSL_INFO_CLIENT_S_DN)
- xsname = X509_get_subject_name(xs);
- else
- xsname = X509_get_issuer_name(xs);
- if (idx) {
- result = lookup_ssl_cert_dn(xsname, idx);
- if (result) {
- value = tcn_new_string(e, result);
- free(result);
- }
- }
- else
- value = tcn_new_string(e, X509_NAME_oneline(xsname, NULL, 0));
- X509_free(xs);
- }
- rv = APR_SUCCESS;
- }
- else if (what & (SSL_INFO_SERVER_S_DN | SSL_INFO_SERVER_I_DN)) {
- X509 *xs;
- X509_NAME *xsname;
- if ((xs = SSL_get_certificate(s->ssl)) != NULL) {
- char *result;
- int idx = what & 0x0F;
- if (what & SSL_INFO_SERVER_S_DN)
- xsname = X509_get_subject_name(xs);
- else
- xsname = X509_get_issuer_name(xs);
- if (idx) {
- result = lookup_ssl_cert_dn(xsname, what & 0x0F);
- if (result) {
- value = tcn_new_string(e, result);
- free(result);
- }
- }
- else
- value = tcn_new_string(e, X509_NAME_oneline(xsname, NULL, 0));
- /* XXX: No need to call the X509_free(xs); */
- }
- rv = APR_SUCCESS;
- }
- else if (what & SSL_INFO_CLIENT_MASK) {
- X509 *xs;
- ASN1_OBJECT *paobj;
- char *result;
- int nid;
- if ((xs = SSL_get_peer_certificate(s->ssl)) != NULL) {
- switch (what) {
- case SSL_INFO_CLIENT_V_START:
- if ((result = get_cert_valid(X509_get_notBefore(xs)))) {
- value = tcn_new_string(e, result);
- free(result);
- }
- break;
- case SSL_INFO_CLIENT_V_END:
- if ((result = get_cert_valid(X509_get_notAfter(xs)))) {
- value = tcn_new_string(e, result);
- free(result);
- }
- break;
- case SSL_INFO_CLIENT_A_SIG:
-#if defined(LIBRESSL_VERSION_NUMBER)
- value = tcn_new_string(e, "UNKNOWN");
-#else
- nid = X509_get_signature_nid(xs);
- if (nid == NID_undef)
- value = tcn_new_string(e, "UNKNOWN");
- else
- value = tcn_new_string(e, OBJ_nid2ln(nid));
-#endif
- break;
- case SSL_INFO_CLIENT_A_KEY:
- X509_PUBKEY_get0_param(&paobj, NULL, 0, NULL, X509_get_X509_PUBKEY(xs));
- nid = OBJ_obj2nid(paobj);
- if (nid == NID_undef)
- value = tcn_new_string(e, "UNKNOWN");
- else
- value = tcn_new_string(e, OBJ_nid2ln(nid));
- break;
- case SSL_INFO_CLIENT_CERT:
- if ((result = get_cert_PEM(xs))) {
- value = tcn_new_string(e, result);
- free(result);
- }
- break;
- case SSL_INFO_CLIENT_M_SERIAL:
- if ((result = get_cert_serial(xs))) {
- value = tcn_new_string(e, result);
- free(result);
- }
- break;
- }
- X509_free(xs);
- }
- rv = APR_SUCCESS;
- }
- else if (what & SSL_INFO_SERVER_MASK) {
- X509 *xs;
- ASN1_OBJECT *paobj;
- char *result;
- int nid;
- if ((xs = SSL_get_certificate(s->ssl)) != NULL) {
- switch (what) {
- case SSL_INFO_SERVER_V_START:
- if ((result = get_cert_valid(X509_get_notBefore(xs)))) {
- value = tcn_new_string(e, result);
- free(result);
- }
- break;
- case SSL_INFO_SERVER_V_END:
- if ((result = get_cert_valid(X509_get_notAfter(xs)))) {
- value = tcn_new_string(e, result);
- free(result);
- }
- break;
- case SSL_INFO_SERVER_A_SIG:
-#if defined(LIBRESSL_VERSION_NUMBER)
- value = tcn_new_string(e, "UNKNOWN");
-#else
- nid = X509_get_signature_nid(xs);
- if (nid == NID_undef)
- value = tcn_new_string(e, "UNKNOWN");
- else
- value = tcn_new_string(e, OBJ_nid2ln(nid));
-#endif
- break;
- case SSL_INFO_SERVER_A_KEY:
- X509_PUBKEY_get0_param(&paobj, NULL, 0, NULL, X509_get_X509_PUBKEY(xs));
- nid = OBJ_obj2nid(paobj);
- if (nid == NID_undef)
- value = tcn_new_string(e, "UNKNOWN");
- else
- value = tcn_new_string(e, OBJ_nid2ln(nid));
- break;
- case SSL_INFO_SERVER_CERT:
- if ((result = get_cert_PEM(xs))) {
- value = tcn_new_string(e, result);
- free(result);
- }
- break;
- case SSL_INFO_SERVER_M_SERIAL:
- if ((result = get_cert_serial(xs))) {
- value = tcn_new_string(e, result);
- free(result);
- }
- break;
- }
- /* XXX: No need to call the X509_free(xs); */
- }
- rv = APR_SUCCESS;
- }
- else if (what & SSL_INFO_CLIENT_CERT_CHAIN) {
- X509 *xs;
- char *result;
- STACK_OF(X509) *sk = SSL_get_peer_cert_chain(s->ssl);
- int n = what & 0x0F;
- if (n < sk_X509_num(sk)) {
- xs = sk_X509_value(sk, n);
- if ((result = get_cert_PEM(xs))) {
- value = tcn_new_string(e, result);
- free(result);
- }
- }
- rv = APR_SUCCESS;
- }
- if (rv != APR_SUCCESS)
- tcn_ThrowAPRException(e, rv);
-
- return value;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLSocket, getInfoI)(TCN_STDARGS, jlong sock,
- jint what)
-{
- tcn_socket_t *a = J2P(sock, tcn_socket_t *);
- tcn_ssl_conn_t *s;
- apr_status_t rv = APR_SUCCESS;
- jint value = -1;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
-
- s = (tcn_ssl_conn_t *)(a->opaque);
-
- switch (what) {
- case SSL_INFO_CIPHER_USEKEYSIZE:
- case SSL_INFO_CIPHER_ALGKEYSIZE:
- {
- int usekeysize = 0;
- int algkeysize = 0;
- const SSL_CIPHER *cipher = SSL_get_current_cipher(s->ssl);
- if (cipher) {
- usekeysize = SSL_CIPHER_get_bits(cipher, &algkeysize);
- if (what == SSL_INFO_CIPHER_USEKEYSIZE)
- value = usekeysize;
- else
- value = algkeysize;
- }
- }
- break;
- case SSL_INFO_CLIENT_CERT_CHAIN:
- {
- STACK_OF(X509) *sk = SSL_get_peer_cert_chain(s->ssl);
- value = sk_X509_num(sk);
- }
- break;
- default:
- rv = APR_EINVAL;
- break;
- }
- if (what & SSL_INFO_CLIENT_MASK) {
- X509 *xs;
- if ((xs = SSL_get_peer_certificate(s->ssl)) != NULL) {
- switch (what) {
- case SSL_INFO_CLIENT_V_REMAIN:
- value = get_days_remaining(X509_get_notAfter(xs));
- rv = APR_SUCCESS;
- break;
- default:
- rv = APR_EINVAL;
- break;
- }
- X509_free(xs);
- }
- }
-
- if (rv != APR_SUCCESS)
- tcn_ThrowAPRException(e, rv);
- return value;
-}
-
-#else
-/* OpenSSL is not supported.
- * Create empty stubs.
- */
-
-TCN_IMPLEMENT_CALL(jbyteArray, SSLSocket, getInfoB)(TCN_STDARGS, jlong sock,
- jint what)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(sock);
- UNREFERENCED(what);
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jstring, SSLSocket, getInfoS)(TCN_STDARGS, jlong sock,
- jint what)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(sock);
- UNREFERENCED(what);
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLSocket, getInfoI)(TCN_STDARGS, jlong sock,
- jint what)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(sock);
- UNREFERENCED(what);
- return 0;
-}
-
-#endif
diff --git a/native/src/sslnetwork.c b/native/src/sslnetwork.c
deleted file mode 100644
index 6e5960f..0000000
--- a/native/src/sslnetwork.c
+++ /dev/null
@@ -1,821 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** SSL network wrapper
- */
-
-#include "tcn.h"
-#include "apr_thread_mutex.h"
-#include "apr_poll.h"
-
-
-#ifdef HAVE_OPENSSL
-#include "ssl_private.h"
-
-#ifdef TCN_DO_STATISTICS
-#include "apr_atomic.h"
-
-static volatile apr_uint32_t ssl_created = 0;
-static volatile apr_uint32_t ssl_closed = 0;
-static volatile apr_uint32_t ssl_cleared = 0;
-static volatile apr_uint32_t ssl_accepted = 0;
-
-void ssl_network_dump_statistics()
-{
- fprintf(stderr, "SSL Network Statistics ..\n");
- fprintf(stderr, "Sockets created : %d\n", ssl_created);
- fprintf(stderr, "Sockets accepted : %d\n", ssl_accepted);
- fprintf(stderr, "Sockets closed : %d\n", ssl_closed);
- fprintf(stderr, "Sockets cleared : %d\n", ssl_cleared);
-}
-
-#endif
-
-static int ssl_smart_shutdown(SSL *ssl, int shutdown_type)
-{
- int i;
- int rc = 0;
-
- switch (shutdown_type) {
- case SSL_SHUTDOWN_TYPE_UNCLEAN:
- /* perform no close notify handshake at all
- * (violates the SSL/TLS standard!)
- */
- shutdown_type = SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN;
- break;
- case SSL_SHUTDOWN_TYPE_ACCURATE:
- /* send close notify and wait for clients close notify
- * (standard compliant, but usually causes connection hangs)
- */
- shutdown_type = 0;
- break;
- default:
- /*
- * case SSL_SHUTDOWN_TYPE_UNSET:
- * case SSL_SHUTDOWN_TYPE_STANDARD:
- * send close notify, but don't wait for clients close notify
- * (standard compliant and safe, so it's the DEFAULT!)
- */
- shutdown_type = SSL_RECEIVED_SHUTDOWN;
- break;
- }
-
- SSL_set_shutdown(ssl, shutdown_type);
- /*
- * Repeat the calls, because SSL_shutdown internally dispatches through a
- * little state machine. Usually only one or two interation should be
- * needed, so we restrict the total number of restrictions in order to
- * avoid process hangs in case the client played bad with the socket
- * connection and OpenSSL cannot recognize it.
- * max 2x pending + 2x data = 4
- */
- for (i = 0; i < 4; i++) {
- if ((rc = SSL_shutdown(ssl)))
- break;
- }
- return rc;
-}
-
-static apr_status_t ssl_cleanup(void *data)
-{
- tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)data;
-
- if (con) {
- /* Pollset was already destroyed by
- * the pool cleanup/destroy.
- */
- con->pollset = NULL;
- if (con->ssl) {
- SSL *ssl = con->ssl;
- con->ssl = NULL;
- ssl_smart_shutdown(ssl, con->shutdown_type);
- SSL_free(ssl);
- }
- if (con->peer) {
- X509_free(con->peer);
- con->peer = NULL;
- }
- }
-
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&ssl_cleared);
-#endif
- return APR_SUCCESS;
-}
-
-static tcn_ssl_conn_t *ssl_create(JNIEnv *env, tcn_ssl_ctxt_t *ctx, apr_pool_t *pool)
-{
- tcn_ssl_conn_t *con;
- SSL *ssl;
-
- if ((con = apr_pcalloc(pool, sizeof(tcn_ssl_conn_t))) == NULL) {
- tcn_ThrowAPRException(env, apr_get_os_error());
- return NULL;
- }
- if ((ssl = SSL_new(ctx->ctx)) == NULL) {
- char err[256];
- ERR_error_string(SSL_ERR_get(), err);
- tcn_Throw(env, "SSL_new failed (%s)", err);
- con = NULL;
- return NULL;
- }
- SSL_clear(ssl);
- con->pool = pool;
- con->ctx = ctx;
- con->ssl = ssl;
- con->shutdown_type = ctx->shutdown_type;
- apr_pollset_create(&(con->pollset), 1, pool, 0);
-
- SSL_set_app_data(ssl, (void *)con);
-
- /* store for later usage in SSL_callback_SSL_verify */
- SSL_set_app_data2(ssl, ctx);
-
- if (ctx->mode) {
- /*
- * Configure callbacks for SSL connection
- */
- SSL_set_session_id_context(ssl, &(ctx->context_id[0]),
- sizeof ctx->context_id);
- }
- SSL_set_verify_result(ssl, X509_V_OK);
- SSL_rand_seed(ctx->rand_file);
-
-#ifdef TCN_DO_STATISTICS
- ssl_created++;
-#endif
- return con;
-}
-
-#ifdef WIN32
-#define APR_INVALID_SOCKET INVALID_SOCKET
-#else
-#define APR_INVALID_SOCKET -1
-#endif
-
-static apr_status_t wait_for_io_or_timeout(tcn_ssl_conn_t *con,
- int for_what,
- apr_interval_time_t timeout)
-{
- apr_pollfd_t pfd;
- int type;
- apr_status_t status;
- apr_os_sock_t sock;
-
- if (!con->pollset)
- return APR_ENOPOLL;
- if (!con->sock)
- return APR_ENOTSOCK;
- if (con->reneg_state == RENEG_ABORT) {
- con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
- return APR_ECONNABORTED;
- }
-
- /* Check if the socket was already closed
- */
- apr_os_sock_get(&sock, con->sock);
- if (sock == APR_INVALID_SOCKET)
- return APR_ENOTSOCK;
-
- /* Figure out the the poll direction */
- switch (for_what) {
- case SSL_ERROR_WANT_WRITE:
- case SSL_ERROR_WANT_CONNECT:
- case SSL_ERROR_WANT_ACCEPT:
- type = APR_POLLOUT;
- break;
- case SSL_ERROR_WANT_READ:
- type = APR_POLLIN;
- break;
- default:
- return APR_EINVAL;
- break;
- }
- if (timeout <= 0) {
- /* Waiting on zero or infinite timeouts is not allowed
- */
- return APR_EAGAIN;
- }
- pfd.desc_type = APR_POLL_SOCKET;
- pfd.desc.s = con->sock;
- pfd.reqevents = type;
-
- /* Remove the object if it was in the pollset, then add in the new
- * object with the correct reqevents value. Ignore the status result
- * on the remove, because it might not be in there (yet).
- */
- apr_pollset_remove(con->pollset, &pfd);
-
- /* ### check status code */
- apr_pollset_add(con->pollset, &pfd);
-
- do {
- int numdesc;
- const apr_pollfd_t *pdesc;
-
- status = apr_pollset_poll(con->pollset, timeout, &numdesc, &pdesc);
- if (numdesc == 1 && (pdesc[0].rtnevents & type) != 0)
- return APR_SUCCESS;
- } while (APR_STATUS_IS_EINTR(status));
-
- return status;
-}
-
-static apr_status_t APR_THREAD_FUNC
-ssl_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t)
-{
- tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
- return apr_socket_timeout_set(con->sock, t);
-}
-
-static apr_status_t APR_THREAD_FUNC
-ssl_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t)
-{
- tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
- return apr_socket_timeout_get(con->sock, t);
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-ssl_socket_opt_set(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on)
-{
- tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
- return apr_socket_opt_set(con->sock, opt, on);
-}
-
-static APR_INLINE apr_status_t APR_THREAD_FUNC
-ssl_socket_opt_get(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on)
-{
- tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
- return apr_socket_opt_get(con->sock, opt, on);
-}
-
-static apr_status_t APR_THREAD_FUNC
-ssl_socket_shutdown(apr_socket_t *sock, apr_shutdown_how_e how)
-{
- apr_status_t rv = APR_SUCCESS;
- tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
-
- if (con->ssl) {
- SSL *ssl = con->ssl;
- con->ssl = NULL;
- if (how < 1)
- how = con->shutdown_type;
- rv = ssl_smart_shutdown(ssl, how);
- /* TODO: Translate OpenSSL Error codes */
- SSL_free(ssl);
- }
- return rv;
-}
-
-static apr_status_t APR_THREAD_FUNC
-ssl_socket_close(apr_socket_t *sock)
-{
- tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
- apr_status_t rv = APR_SUCCESS;
-
-#ifdef TCN_DO_STATISTICS
- apr_atomic_inc32(&ssl_closed);
-#endif
- if (con->ssl) {
- SSL *ssl = con->ssl;
- con->ssl = NULL;
- rv = ssl_smart_shutdown(ssl, con->shutdown_type);
- SSL_free(ssl);
- }
- if (con->peer) {
- X509_free(con->peer);
- con->peer = NULL;
- }
- return rv;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLSocket, handshake)(TCN_STDARGS, jlong sock)
-{
- tcn_socket_t *ss = J2P(sock, tcn_socket_t *);
- tcn_ssl_conn_t *con;
- apr_interval_time_t timeout;
- int s, i;
- long vr;
- apr_status_t rv;
- X509 *peer;
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(sock != 0);
- if (ss->net->type != TCN_SOCKET_SSL)
- return APR_EINVAL;
- con = (tcn_ssl_conn_t *)ss->opaque;
-
- apr_socket_timeout_get(con->sock, &timeout);
- while (!SSL_is_init_finished(con->ssl)) {
- SSL_ERR_clear();
- if ((s = SSL_do_handshake(con->ssl)) <= 0) {
- if (!con->ssl)
- return APR_ENOTSOCK;
- rv = apr_get_netos_error();
- i = SSL_get_error(con->ssl, s);
- switch (i) {
- case SSL_ERROR_NONE:
- con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
- return APR_SUCCESS;
- break;
- case SSL_ERROR_WANT_READ:
- case SSL_ERROR_WANT_WRITE:
- if ((rv = wait_for_io_or_timeout(con, i, timeout)) != APR_SUCCESS) {
- con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
- return rv;
- }
- break;
- case SSL_ERROR_SYSCALL:
- if (APR_STATUS_IS_EAGAIN(rv)) {
- return APR_EAGAIN;
- }
-#if !defined(_WIN32)
- else if (APR_STATUS_IS_EINTR(rv)) {
- /* Interrupted by signal */
- continue;
- }
-#endif
- /* Fall through */
- default:
- /*
- * Anything else is a fatal error
- */
- con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
- return SSL_TO_APR_ERROR(i);
- break;
- }
- }
- if (!con->ssl)
- return APR_ENOTSOCK;
-
- /*
- * Check for failed client authentication
- */
- if (con->ctx->verify_mode != SSL_VERIFY_NONE &&
- (vr = SSL_get_verify_result(con->ssl)) != X509_V_OK) {
-
- if (SSL_VERIFY_ERROR_IS_OPTIONAL(vr) &&
- con->ctx->verify_mode == SSL_CVERIFY_OPTIONAL_NO_CA) {
- /* TODO: Log optionalNoCA */
- } else {
- /* TODO: Log SSL client authentication failed */
- con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
- /* TODO: Figure out the correct return value */
- return APR_EGENERAL;
- }
- }
-
- /*
- * Remember the peer certificate
- */
- if ((peer = SSL_get_peer_certificate(con->ssl)) != NULL) {
- if (con->peer)
- X509_free(con->peer);
- con->peer = peer;
- }
- }
- return APR_SUCCESS;
-}
-
-static apr_status_t APR_THREAD_FUNC
-ssl_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len)
-{
- tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
- int s, i, rd = (int)(*len);
- apr_status_t rv;
- apr_interval_time_t timeout;
-
- *len = 0;
- if (con->reneg_state == RENEG_ABORT) {
- con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
- return APR_ECONNABORTED;
- }
- apr_socket_timeout_get(con->sock, &timeout);
- for (;;) {
- SSL_ERR_clear();
- if ((s = SSL_read(con->ssl, buf, rd)) <= 0) {
- if (!con->ssl)
- return APR_ENOTSOCK;
- rv = apr_get_netos_error();
- i = SSL_get_error(con->ssl, s);
- /* Special case if the "close notify" alert send by peer */
- if (s == 0 && (SSL_get_shutdown(con->ssl) & SSL_RECEIVED_SHUTDOWN)) {
- con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
- return APR_EOF;
- }
- switch (i) {
- case SSL_ERROR_WANT_READ:
- case SSL_ERROR_WANT_WRITE:
- if ((rv = wait_for_io_or_timeout(con, i, timeout)) != APR_SUCCESS) {
- con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
- return rv;
- }
- break;
- case SSL_ERROR_SYSCALL:
- if (APR_STATUS_IS_EPIPE(rv) || APR_STATUS_IS_ECONNRESET(rv)) {
- con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
- return APR_EOF;
- }
- else if (APR_STATUS_IS_EAGAIN(rv)) {
- return APR_EAGAIN;
- }
-#if !defined(_WIN32)
- else if (APR_STATUS_IS_EINTR(rv)) {
- /* Interrupted by signal
- */
- continue;
- }
-#endif
- /* Fall through */
- case SSL_ERROR_ZERO_RETURN:
- if (s == 0) {
- con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
- return APR_EOF;
- }
- /* Fall through */
- default:
- con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
- return APR_EGENERAL;
- break;
- }
- }
- else {
- *len = s;
- con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
- break;
- }
- }
- return APR_SUCCESS;
-}
-
-static apr_status_t APR_THREAD_FUNC
-ssl_socket_send(apr_socket_t *sock, const char *buf,
- apr_size_t *len)
-{
- tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
- int s, i, wr = (int)(*len);
- apr_status_t rv;
- apr_interval_time_t timeout;
-
- *len = 0;
- if (con->reneg_state == RENEG_ABORT) {
- con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
- return APR_ECONNABORTED;
- }
- if (!SSL_is_init_finished(con->ssl)) {
- /* XXX: Is this a correct retval ? */
- return APR_EINPROGRESS;
- }
- if (wr == 0) {
- /* According to docs calling SSL_write() with num=0 bytes
- * to be sent the behaviour is undefined.
- */
- return APR_EINVAL;
- }
- apr_socket_timeout_get(con->sock, &timeout);
- for (;;) {
- SSL_ERR_clear();
- if ((s = SSL_write(con->ssl, buf, wr)) <= 0) {
- if (!con->ssl)
- return APR_ENOTSOCK;
- rv = apr_get_netos_error();
- i = SSL_get_error(con->ssl, s);
- switch (i) {
- case SSL_ERROR_WANT_READ:
- case SSL_ERROR_WANT_WRITE:
- if ((rv = wait_for_io_or_timeout(con, i, timeout)) != APR_SUCCESS) {
- con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
- return rv;
- }
- break;
- case SSL_ERROR_SYSCALL:
- if (s == -1) {
- if (APR_STATUS_IS_EPIPE(rv) || APR_STATUS_IS_ECONNRESET(rv)) {
- con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
- return APR_EOF;
- }
-#if !defined(_WIN32)
- else if (APR_STATUS_IS_EINTR(rv)) {
- /* Interrupted by signal
- */
- continue;
- }
-#endif
- }
- con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
- return rv;
- break;
- case SSL_ERROR_SSL:
- /* Probably caused by buffer missmatch */
- rv = APR_EINVAL;
- case SSL_ERROR_ZERO_RETURN:
- if (s == 0) {
- con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
- return APR_EOF;
- }
- /* Fall through */
- default:
- con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
- return rv;
- break;
- }
- }
- else {
- *len = s;
- break;
- }
- }
- return APR_SUCCESS;
-}
-
-static apr_status_t APR_THREAD_FUNC
-ssl_socket_sendv(apr_socket_t *sock,
- const struct iovec *vec,
- apr_int32_t nvec, apr_size_t *len)
-{
- tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
- apr_status_t rv;
- apr_size_t written = 0;
- apr_int32_t i;
-
- for (i = 0; i < nvec; i++) {
- apr_size_t rd = vec[i].iov_len;
- if ((rv = ssl_socket_send((apr_socket_t *)con,
- vec[i].iov_base, &rd)) != APR_SUCCESS) {
- *len = written;
- return rv;
- }
- written += rd;
- }
- *len = written;
- return APR_SUCCESS;
-}
-
-static tcn_nlayer_t ssl_socket_layer = {
- TCN_SOCKET_SSL,
- ssl_cleanup,
- ssl_socket_close,
- ssl_socket_shutdown,
- ssl_socket_opt_get,
- ssl_socket_opt_set,
- ssl_socket_timeout_get,
- ssl_socket_timeout_set,
- ssl_socket_send,
- ssl_socket_sendv,
- ssl_socket_recv
-};
-
-
-TCN_IMPLEMENT_CALL(jint, SSLSocket, attach)(TCN_STDARGS, jlong ctx,
- jlong sock)
-{
- tcn_ssl_ctxt_t *c = J2P(ctx, tcn_ssl_ctxt_t *);
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- tcn_ssl_conn_t *con;
- apr_os_sock_t oss;
- apr_status_t rv;
-
- UNREFERENCED(o);
- TCN_ASSERT(ctx != 0);
- TCN_ASSERT(sock != 0);
-
- if (!s->sock)
- return APR_ENOTSOCK;
-
- if ((rv = apr_os_sock_get(&oss, s->sock)) != APR_SUCCESS)
- return rv;
- if (oss == APR_INVALID_SOCKET)
- return APR_ENOTSOCK;
-
- if ((con = ssl_create(e, c, s->pool)) == NULL)
- return APR_EGENERAL;
- con->sock = s->sock;
-
- SSL_set_fd(con->ssl, (int)oss);
- if (c->mode)
- SSL_set_accept_state(con->ssl);
- else
- SSL_set_connect_state(con->ssl);
- /* Change socket type */
- s->net = &ssl_socket_layer;
- s->opaque = con;
-
- return APR_SUCCESS;
-}
-
-static int ssl_do_renegotiate(tcn_ssl_conn_t *con, int use_pha)
-{
- int retVal;
- int error = 0;
- char peekbuf[1];
- apr_interval_time_t timeout;
-
- apr_socket_timeout_get(con->sock, &timeout);
-
- /* Trigger reading of the certs from the client.
- * Peeking 0 bytes actually works.
- * Before TLS 1.3 this will result in a renegotiation.
- * for TLS 1.3 in PHA.
- * See: http://marc.info/?t=145493359200002&r=1&w=2
- *
- * This will normally return SSL_ERROR_WANT_READ whether the renegotiation
- * has been completed or not. Afterwards, need to determine if I/O needs to
- * be triggered or not.
- */
- retVal = SSL_peek(con->ssl, peekbuf, 0);
- if (retVal < 1) {
- error = SSL_get_error(con->ssl, retVal);
- }
-
- // If the certs have not been received, then need to wait for I/O
- while ((use_pha && con->pha_state == PHA_STARTED) || (!use_pha && SSL_renegotiate_pending(con->ssl))) {
- // SSL_ERROR_WANT_READ is expected. Anything else is an error.
- if (error == SSL_ERROR_WANT_READ) {
- retVal = wait_for_io_or_timeout(con, error, timeout);
- /*
- * Since this is blocking I/O, anything other than APR_SUCCESS is an
- * error.
- */
- if (retVal != APR_SUCCESS) {
- con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
- return retVal;
- }
- } else {
- return APR_EGENERAL;
- }
-
- // Re-try SSL_peek after I/O
- retVal = SSL_peek(con->ssl, peekbuf, 0);
- if (retVal < 1) {
- error = SSL_get_error(con->ssl, retVal);
- } else {
- /*
- * Reset error to handle case where SSL_Peek returns 0 but
- * the pha resp. renegotiation state has not changed.
- * This will trigger an error to be returned.
- */
- error = 0;
- }
- }
- return APR_SUCCESS;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLSocket, renegotiate)(TCN_STDARGS,
- jlong sock)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- tcn_ssl_conn_t *con;
- int retVal;
-#if defined(SSL_OP_NO_TLSv1_3)
- const SSL_SESSION *session;
-#endif
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(sock != 0);
- con = (tcn_ssl_conn_t *)s->opaque;
-
-#if defined(SSL_OP_NO_TLSv1_3)
- session = SSL_get_session(con->ssl);
- if (SSL_SESSION_get_protocol_version(session) == TLS1_3_VERSION) {
- // TLS 1.3 renegotiation
- retVal = SSL_verify_client_post_handshake(con->ssl);
- if (retVal <= 0) {
- return APR_EGENERAL;
- }
-
- con->pha_state = PHA_STARTED;
-
- // Need to trigger a write operation to sent the cert request to the
- // client. As per OpenSSL docs, use SSL_do_handshake() for this.
- retVal = SSL_do_handshake(con->ssl);
- if (retVal <= 0) {
- return APR_EGENERAL;
- }
- retVal = ssl_do_renegotiate(con, 1);
- if (retVal != APR_SUCCESS) {
- return retVal;
- }
-
- } else {
-#endif
- // TLS 1.2 and earlier renegotiation
-
- /* Toggle the renegotiation state to allow the new
- * handshake to proceed.
- */
- con->reneg_state = RENEG_ALLOW;
-
- // Schedule a renegotiation request
- retVal = SSL_renegotiate(con->ssl);
- if (retVal <= 0) {
- return APR_EGENERAL;
- }
- retVal = ssl_do_renegotiate(con, 0);
- if (retVal != APR_SUCCESS) {
- return retVal;
- }
-
- con->reneg_state = RENEG_REJECT;
-#if defined(SSL_OP_NO_TLSv1_3)
- }
-#endif
- return APR_SUCCESS;
-}
-
-TCN_IMPLEMENT_CALL(void, SSLSocket, setVerify)(TCN_STDARGS,
- jlong sock,
- jint cverify,
- jint depth)
-{
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- tcn_ssl_conn_t *con;
- int verify = SSL_VERIFY_NONE;
-
- UNREFERENCED_STDARGS;
- TCN_ASSERT(sock != 0);
- con = (tcn_ssl_conn_t *)s->opaque;
-
- if (cverify == SSL_CVERIFY_UNSET)
- cverify = SSL_CVERIFY_NONE;
- if (depth > 0)
- SSL_set_verify_depth(con->ssl, depth);
-
- if (cverify == SSL_CVERIFY_REQUIRE)
- verify |= SSL_VERIFY_PEER_STRICT;
- if ((cverify == SSL_CVERIFY_OPTIONAL) ||
- (cverify == SSL_CVERIFY_OPTIONAL_NO_CA))
- verify |= SSL_VERIFY_PEER;
-
- SSL_set_verify(con->ssl, verify, NULL);
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLSocket, getALPN)(TCN_STDARGS, jlong sock, jbyteArray buf)
-{
- const unsigned char *alpn;
- unsigned alpn_len;
- int len;
- tcn_socket_t *s = J2P(sock, tcn_socket_t *);
- tcn_ssl_conn_t *tcssl = (tcn_ssl_conn_t *)s->opaque;
- int bufLen = (*e)->GetArrayLength(e, buf);
-
- SSL_get0_alpn_selected(tcssl->ssl, &alpn, &alpn_len);
-
- if (alpn_len == 0 || bufLen < alpn_len) {
- return 0;
- }
- len = (int)alpn_len;
- (*e)->SetByteArrayRegion(e, buf, 0, len, (jbyte *)alpn);
-
- return len;
-}
-
-#else
-/* OpenSSL is not supported.
- * Create empty stubs.
- */
-
-TCN_IMPLEMENT_CALL(jint, SSLSocket, handshake)(TCN_STDARGS, jlong sock)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(sock);
- return (jint)APR_ENOTIMPL;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLSocket, attach)(TCN_STDARGS, jlong ctx,
- jlong sock)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(ctx);
- UNREFERENCED(sock);
- return (jint)APR_ENOTIMPL;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLSocket, renegotiate)(TCN_STDARGS,
- jlong sock)
-{
- UNREFERENCED_STDARGS;
- UNREFERENCED(sock);
- return (jint)APR_ENOTIMPL;
-}
-
-TCN_IMPLEMENT_CALL(jint, SSLSocket, getALPN)(TCN_STDARGS, jlong sock, jbyteArray buf)
-{
- UNREFERENCED(sock);
- UNREFERENCED(buf);
- return (jint)APR_ENOTIMPL;
-}
-
-#endif
diff --git a/native/src/sslutils.c b/native/src/sslutils.c
index c3bd41a..db44862 100644
--- a/native/src/sslutils.c
+++ b/native/src/sslutils.c
@@ -19,7 +19,6 @@
#include "tcn.h"
-#ifdef HAVE_OPENSSL
#include "apr_poll.h"
#include "ssl_private.h"
@@ -447,17 +446,6 @@ void SSL_callback_handshake(const SSL *ssl, int where, int rc)
}
}
-int SSL_callback_next_protos(SSL *ssl, const unsigned char **data,
- unsigned int *len, void *arg)
-{
- tcn_ssl_ctxt_t *ssl_ctxt = arg;
-
- *data = ssl_ctxt->next_proto_data;
- *len = ssl_ctxt->next_proto_len;
-
- return SSL_TLSEXT_ERR_OK;
-}
-
/* The code here is inspired by nghttp2
*
* See https://github.com/tatsuhiro-t/nghttp2/blob/ae0100a9abfcf3149b8d9e62aae216e946b517fb/src/shrpx_ssl.cc#L244 */
@@ -516,13 +504,6 @@ int select_next_proto(SSL *ssl, const unsigned char **out, unsigned char *outlen
return SSL_TLSEXT_ERR_NOACK;
}
-int SSL_callback_select_next_proto(SSL *ssl, unsigned char **out, unsigned char *outlen,
- const unsigned char *in, unsigned int inlen,
- void *arg) {
- tcn_ssl_ctxt_t *ssl_ctxt = arg;
- return select_next_proto(ssl, (const unsigned char **) out, outlen, in, inlen, ssl_ctxt->next_proto_data, ssl_ctxt->next_proto_len, ssl_ctxt->next_selector_failure_behavior);
-}
-
int SSL_callback_alpn_select_proto(SSL* ssl, const unsigned char **out, unsigned char *outlen,
const unsigned char *in, unsigned int inlen, void *arg) {
tcn_ssl_ctxt_t *ssl_ctxt = arg;
@@ -543,15 +524,11 @@ static int ssl_verify_OCSP(X509_STORE_CTX *ctx)
* may yield NULL. Return early, but leave the ctx error as is. */
return OCSP_STATUS_UNKNOWN;
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- else if (cert->valid && X509_check_issued(cert,cert) == X509_V_OK) {
-#else
/* No need to check cert->valid, because ssl_verify_OCSP() only
* is called if OpenSSL already successfully verified the certificate
* (parameter "ok" in SSL_callback_SSL_verify() must be true).
*/
else if (X509_check_issued(cert,cert) == X509_V_OK) {
-#endif
/* don't do OCSP checking for valid self-issued certs */
X509_STORE_CTX_set_error(ctx, X509_V_OK);
return OCSP_STATUS_UNKNOWN;
@@ -864,9 +841,6 @@ static OCSP_RESPONSE *parse_ocsp_resp(char *buf, int len)
BIO_write(mem, buf, len); /* write the buffer to the bio */
if (BIO_gets(mem, tmpbuf, 512) <= 0) {
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- OCSPerr(OCSP_F_OCSP_SENDREQ_BIO,OCSP_R_SERVER_RESPONSE_PARSE_ERROR);
-#endif
goto err;
}
/* Parse the HTTP response. This will look like this:
@@ -992,7 +966,7 @@ static OCSP_RESPONSE *get_ocsp_response(apr_pool_t *p, X509 *cert, X509 *issuer,
int ok = 0;
apr_socket_t *apr_sock = NULL;
apr_pool_t *mp;
-#if OPENSSL_VERSION_NUMBER < 0x30000000L
+#ifdef LIBRESSL_VERSION_NUMBER
if (OCSP_parse_url(url, &hostname, &c_port, &path, &use_ssl) == 0)
#else
if (OSSL_HTTP_parse_url(url, &use_ssl, NULL, &hostname, &c_port, NULL, &path, NULL, NULL) == 0)
@@ -1126,4 +1100,3 @@ static int ssl_ocsp_request(X509 *cert, X509 *issuer, X509_STORE_CTX *ctx)
}
#endif /* HAVE_OCSP */
-#endif /* HAVE_OPENSSL */
diff --git a/native/src/stdlib.c b/native/src/stdlib.c
deleted file mode 100644
index 78a95e5..0000000
--- a/native/src/stdlib.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-
-extern int tcn_parent_pid;
-
-TCN_IMPLEMENT_CALL(jlong, Stdlib, malloc)(TCN_STDARGS, jint size)
-{
- UNREFERENCED_STDARGS;
- if (size)
- return P2J(malloc((size_t)size));
- else
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, Stdlib, realloc)(TCN_STDARGS, jlong mem, jint size)
-{
- void *ptr = J2P(mem, void *);
- UNREFERENCED_STDARGS;
- if (size)
- return P2J(realloc(ptr, (size_t)size));
- else
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(jlong, Stdlib, calloc)(TCN_STDARGS, jint num, jint size)
-{
- UNREFERENCED_STDARGS;
- if (num && size)
- return P2J(calloc((size_t)num, (size_t)size));
- else
- return 0;
-}
-
-TCN_IMPLEMENT_CALL(void, Stdlib, free)(TCN_STDARGS, jlong mem)
-{
- void *ptr = J2P(mem, void *);
-
- UNREFERENCED_STDARGS;
- if (ptr)
- free(ptr);
-}
-
-TCN_IMPLEMENT_CALL(jboolean, Stdlib, memread)(TCN_STDARGS,
- jbyteArray dst,
- jlong src, jint sz)
-{
- jbyte *s = J2P(src, jbyte *);
- jbyte *dest = (*e)->GetPrimitiveArrayCritical(e, dst, NULL);
-
- UNREFERENCED(o);
- if (s && dest) {
- memcpy(dest, s, (size_t)sz);
- (*e)->ReleasePrimitiveArrayCritical(e, dst, dest, 0);
- return JNI_TRUE;
- }
- else
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, Stdlib, memwrite)(TCN_STDARGS, jlong dst,
- jbyteArray src, jint sz)
-{
- jbyte *dest = J2P(dst, jbyte *);
- jbyte *s = (*e)->GetPrimitiveArrayCritical(e, src, NULL);
-
- UNREFERENCED(o);
- if (s && dest) {
- memcpy(dest, s, (size_t)sz);
- (*e)->ReleasePrimitiveArrayCritical(e, src, s, JNI_ABORT);
- return JNI_TRUE;
- }
- else
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jboolean, Stdlib, memset)(TCN_STDARGS, jlong dst,
- jint c, jint sz)
-{
- jbyte *dest = J2P(dst, jbyte *);
-
- UNREFERENCED_STDARGS;
- if (memset(dest, (int)c, (size_t)sz))
- return JNI_TRUE;
- else
- return JNI_FALSE;
-}
-
-TCN_IMPLEMENT_CALL(jint, Stdlib, getpid)(TCN_STDARGS)
-{
- UNREFERENCED_STDARGS;
- return (jint)getpid();
-}
-
-TCN_IMPLEMENT_CALL(jint, Stdlib, getppid)(TCN_STDARGS)
-{
- UNREFERENCED_STDARGS;
- return (jint)tcn_parent_pid;
-}
-
diff --git a/native/src/thread.c b/native/src/thread.c
deleted file mode 100644
index 6696dc0..0000000
--- a/native/src/thread.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-
-TCN_IMPLEMENT_CALL(jlong, Thread, current)(TCN_STDARGS)
-{
- UNREFERENCED_STDARGS;
- return (jlong)tcn_get_thread_id();
-}
-
diff --git a/native/src/user.c b/native/src/user.c
deleted file mode 100644
index bc4b420..0000000
--- a/native/src/user.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "tcn.h"
-#include "apr_user.h"
-#include "apr_network_io.h"
-
-TCN_IMPLEMENT_CALL(jlong, User, uidCurrent)(TCN_STDARGS, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_uid_t uid;
- apr_gid_t gid;
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_uid_current(&uid, &gid, p), uid);
-
-cleanup:
- return (jlong)uid;
-}
-
-TCN_IMPLEMENT_CALL(jlong, User, gidCurrent)(TCN_STDARGS, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_uid_t uid;
- apr_gid_t gid;
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_uid_current(&uid, &gid, p), gid);
-
-cleanup:
- return (jlong)gid;
-}
-
-TCN_IMPLEMENT_CALL(jlong, User, uid)(TCN_STDARGS, jstring uname, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_uid_t uid;
- apr_gid_t gid;
- TCN_ALLOC_CSTRING(uname);
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_uid_get(&uid, &gid, J2S(uname), p), uid);
-
-cleanup:
- TCN_FREE_CSTRING(uname);
- return (jlong)uid;
-}
-
-TCN_IMPLEMENT_CALL(jlong, User, usergid)(TCN_STDARGS, jstring uname,
- jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_uid_t uid;
- apr_gid_t gid;
- TCN_ALLOC_CSTRING(uname);
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_uid_get(&uid, &gid, J2S(uname), p), gid);
-
-cleanup:
- TCN_FREE_CSTRING(uname);
- return (jlong)gid;
-}
-
-TCN_IMPLEMENT_CALL(jlong, User, gid)(TCN_STDARGS, jstring gname, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_gid_t gid;
- TCN_ALLOC_CSTRING(gname);
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR( apr_gid_get(&gid, J2S(gname), p), gid);
-
-cleanup:
- TCN_FREE_CSTRING(gname);
- return (jlong)gid;
-}
-
-TCN_IMPLEMENT_CALL(jstring, User, username)(TCN_STDARGS, jlong userid, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_uid_t uid = (apr_uid_t)userid;
- char *uname = NULL;
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_uid_name_get(&uname, uid, p), uname);
-
-cleanup:
- if (uname)
- return AJP_TO_JSTRING(uname);
- else
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jstring, User, groupname)(TCN_STDARGS, jlong grpid, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- apr_gid_t gid = (apr_uid_t)grpid;
- char *gname = NULL;
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_gid_name_get(&gname, gid, p), gname);
-
-cleanup:
- if (gname)
- return AJP_TO_JSTRING(gname);
- else
- return NULL;
-}
-
-TCN_IMPLEMENT_CALL(jint, User,uidcompare)(TCN_STDARGS, jlong left, jlong right)
-{
-
- UNREFERENCED_STDARGS;
- return (int)apr_uid_compare((apr_uid_t)left,
- (apr_uid_t)right);
-}
-
-TCN_IMPLEMENT_CALL(jint, User,gidcompare)(TCN_STDARGS, jlong left, jlong right)
-{
-
- UNREFERENCED_STDARGS;
- return (int)apr_gid_compare((apr_gid_t)left,
- (apr_gid_t)right);
-}
-
-TCN_IMPLEMENT_CALL(jstring, User, homepath)(TCN_STDARGS, jstring uname, jlong pool)
-{
- apr_pool_t *p = J2P(pool, apr_pool_t *);
- char *dirname = NULL;
- TCN_ALLOC_CSTRING(uname);
-
- UNREFERENCED(o);
- TCN_THROW_IF_ERR(apr_uid_homepath_get(&dirname, J2S(uname),
- p), dirname);
-
-cleanup:
- TCN_FREE_CSTRING(uname);
- if (dirname)
- return AJP_TO_JSTRING(dirname);
- else
- return NULL;
-}
-
diff --git a/native/srclib/BUILDING b/native/srclib/BUILDING
index c116a11..cb5b3b8 100644
--- a/native/srclib/BUILDING
+++ b/native/srclib/BUILDING
@@ -1,9 +1,6 @@
Building apr on windows
-----------------------
-Apply apr-enable-ipv6.patch.
-This will enable IPV6 support for windows builds.
-
Open Visual Studio command prompt and execute
nmake -f NMAKEMakefile BUILD_CPU=x86 APR_DECLARE_STATIC=1
@@ -15,10 +12,10 @@ environment before calling nmake so that correct
compiler is setup for the target architecture.
-Building OpenSSL 1.1.1 and later
+Building OpenSSL 3.0.0 and later
----------------------------------
-Apply openssl-msvcrt-1.1.1.patch
+Apply openssl-msvcrt-3.0.x.patch
This patch makes sure that static version of OpenSSL libraries
is linked to msvcrt.dll instead statically linking msvcrt.
diff --git a/native/srclib/VERSIONS b/native/srclib/VERSIONS
index 4fb768f..b5c4cd7 100644
--- a/native/srclib/VERSIONS
+++ b/native/srclib/VERSIONS
@@ -1,44 +1,11 @@
The current minimum versions are:
-- OpenSSL 1.0.2
-- APR 1.4.3
+- OpenSSL 3.0.0
+- APR 1.7.0
The following version of the libraries are recommended:
-- APR 1.7.0 or later, http://apr.apache.org
-- OpenSSL 1.1.1q or later, http://www.openssl.org
+- APR 1.7.4 or later, http://apr.apache.org
+- OpenSSL 3.0.9 or later, http://www.openssl.org
Older versions should also work but are not as thoroughly tested by the Tomcat
Native team
-
-
-It is current anticipated that Tomcat Native releases will transition to 1.3.x
-after April 2021 when the minimum version will become OpenSSL 1.1.0 and
-APR 1.5.2.
-
-
-The minimum version of OpenSSL is driven by the version of OpenSSL used by
-downstream distributions.
-
-The current state of OpenSSL in Debian is:
-- OpenSSL 1.1.0l in Debian 9 (EOL end June 2022)
-- OpenSSL 1.1.1n in Debian 10 (EOL end June 2024)
-- OpenSSL 1.1.1n in Debian 11 (EOL end June 2026)
-
-And in Ubuntu:
-- OpenSSL 1.0.2g in Ubuntu 16.04 LTS (EOL in April 2021)
-- OpenSSL 1.1.1 in Ubuntu 18.04 LTS (EOL in April 2028)
-- OpenSSL 1.1.1f in Ubuntu 20.04 LTS (EOL in April 2030)
-- OpenSSL 3.0.2 in Ubuntu 22.04 LTS (EOL in April 2032)
-
-The minimum version of APR is driven by the version of APR used by
-downstream distributions.
-
-The current state of APR in Debian is:
-- APR 1.5.2 in Debian 9 (EOL in June 2022)
-- APR 1.6.5 in Debian 10
-
-And in Ubuntu:
-- APR 1.5.2 in Ubuntu 16.04 LTS (EOL in April 2021)
-- APR 1.6.3 in Ubuntu 18.04 LTS (EOL in April 2028)
-- APR 1.6.5 in Ubuntu 20.04 LTS (EOL in April 2030)
-- APR 1.7.0 in Ubuntu 22.04 LTS (EOL in April 2032)
diff --git a/native/srclib/apr/apr-enable-ipv6.patch b/native/srclib/apr/apr-enable-ipv6.patch
deleted file mode 100644
index a58721c..0000000
--- a/native/srclib/apr/apr-enable-ipv6.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- /include/apr.hw
-+++ /include/apr.hw
-@@ -367,7 +367,7 @@
- /* If we have a TCP implementation that can be "corked", what flag
- * do we use?
- */
--#define APR_TCP_NOPUSH_FLAG @apr_tcp_nopush_flag@
-+#define APR_TCP_NOPUSH_FLAG 0
-
- /* Is the TCP_NODELAY socket option inherited from listening sockets?
- */
diff --git a/native/srclib/apr/win-ipv6.patch b/native/srclib/apr/win-ipv6.patch
deleted file mode 100644
index 1039872..0000000
--- a/native/srclib/apr/win-ipv6.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-Index: apr/apr/branches/1.7.x/include/arch/win32/apr_arch_misc.h
-===================================================================
---- apr/apr/branches/1.7.x/include/arch/win32/apr_arch_misc.h (revision 1890229)
-+++ apr/apr/branches/1.7.x/include/arch/win32/apr_arch_misc.h (revision 1890230)
-@@ -110,7 +110,11 @@
- APR_WIN_XP_SP2 = 62,
- APR_WIN_2003 = 70,
- APR_WIN_VISTA = 80,
-- APR_WIN_7 = 90
-+ APR_WIN_7 = 90,
-+ APR_WIN_7_SP1 = 91,
-+ APR_WIN_8 = 100,
-+ APR_WIN_8_1 = 110,
-+ APR_WIN_10 = 120
- } apr_oslevel_e;
-
- extern APR_DECLARE_DATA apr_oslevel_e apr_os_level;
-Index: apr/apr/branches/1.7.x/misc/win32/misc.c
-===================================================================
---- apr/apr/branches/1.7.x/misc/win32/misc.c (revision 1890229)
-+++ apr/apr/branches/1.7.x/misc/win32/misc.c (revision 1890230)
-@@ -27,25 +27,15 @@
- {
- if (apr_os_level == APR_WIN_UNK)
- {
-- static OSVERSIONINFO oslev;
-- oslev.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-- GetVersionEx(&oslev);
-+ OSVERSIONINFOEXW oslev;
-+ oslev.dwOSVersionInfoSize = sizeof(oslev);
-+ if (!GetVersionExW((OSVERSIONINFOW*) &oslev)) {
-+ return apr_get_os_error();
-+ }
-
- if (oslev.dwPlatformId == VER_PLATFORM_WIN32_NT)
- {
-- static unsigned int servpack = 0;
-- TCHAR *pservpack;
-- if ((pservpack = oslev.szCSDVersion)) {
-- while (*pservpack && !apr_isdigit(*pservpack)) {
-- pservpack++;
-- }
-- if (*pservpack)
--#ifdef _UNICODE
-- servpack = _wtoi(pservpack);
--#else
-- servpack = atoi(pservpack);
--#endif
-- }
-+ unsigned int servpack = oslev.wServicePackMajor;
-
- if (oslev.dwMajorVersion < 3) {
- apr_os_level = APR_WIN_UNSUP;
-@@ -99,11 +89,19 @@
- else if (oslev.dwMajorVersion == 6) {
- if (oslev.dwMinorVersion == 0)
- apr_os_level = APR_WIN_VISTA;
-+ else if (oslev.dwMinorVersion == 1) {
-+ if (servpack < 1)
-+ apr_os_level = APR_WIN_7;
-+ else
-+ apr_os_level = APR_WIN_7_SP1;
-+ }
-+ else if (oslev.dwMinorVersion == 2)
-+ apr_os_level = APR_WIN_8;
- else
-- apr_os_level = APR_WIN_7;
-+ apr_os_level = APR_WIN_8_1;
- }
- else {
-- apr_os_level = APR_WIN_XP;
-+ apr_os_level = APR_WIN_10;
- }
- }
- #ifndef WINNT
-@@ -151,7 +149,7 @@
-
- *level = apr_os_level;
-
-- if (apr_os_level < APR_WIN_UNSUP) {
-+ if (apr_os_level <= APR_WIN_UNSUP) {
- return APR_EGENERAL;
- }
-
-Index: apr/apr/branches/1.7.x/network_io/win32/sockets.c
-===================================================================
---- apr/apr/branches/1.7.x/network_io/win32/sockets.c (revision 1890229)
-+++ apr/apr/branches/1.7.x/network_io/win32/sockets.c (revision 1890230)
-@@ -24,6 +24,13 @@
- #include "apr_arch_inherit.h"
- #include "apr_arch_misc.h"
-
-+/* Borrow the definition of SOMAXCONN_HINT() from Windows SDK 8,
-+ * in case the SDK we are building against doesn't have it.
-+ */
-+#ifndef SOMAXCONN_HINT
-+#define SOMAXCONN_HINT(b) (-(b))
-+#endif
-+
- static char generic_inaddr_any[16] = {0}; /* big enough for IPv4 or IPv6 */
-
- static apr_status_t socket_cleanup(void *sock)
-@@ -223,7 +230,21 @@
- APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock,
- apr_int32_t backlog)
- {
-- if (listen(sock->socketdes, backlog) == SOCKET_ERROR)
-+ int backlog_val;
-+
-+ if (apr_os_level >= APR_WIN_8) {
-+ /* Starting from Windows 8, listen() accepts a special SOMAXCONN_HINT()
-+ * arg that allows setting the listen backlog value to a larger
-+ * value than the predefined Winsock 2 limit (several hundred).
-+ * https://blogs.msdn.microsoft.com/winsdk/2015/06/01/winsocks-listen-backlog-offers-more-flexibility-in-windows-8/
-+ */
-+ backlog_val = SOMAXCONN_HINT(backlog);
-+ }
-+ else {
-+ backlog_val = backlog;
-+ }
-+
-+ if (listen(sock->socketdes, backlog_val) == SOCKET_ERROR)
- return apr_get_netos_error();
- else
- return APR_SUCCESS;
diff --git a/native/srclib/openssl/openssl-msvcrt-1.1.1.patch b/native/srclib/openssl/openssl-msvcrt-1.1.1.patch
deleted file mode 100644
index d0d8961..0000000
--- a/native/srclib/openssl/openssl-msvcrt-1.1.1.patch
+++ /dev/null
@@ -1,74 +0,0 @@
---- Configurations/10-main.conf
-+++ Configurations/10-main.conf
-@@ -1268,7 +1268,7 @@
- # prefer [non-debug] openssl.exe to be free from Micorosoft RTL
- # redistributable.
- bin_cflags => add(picker(debug => "/MDd",
-- release => sub { $disabled{shared} ? "/MT" : () },
-+ release => "/MD",
- )),
- bin_lflags => add("/subsystem:console /opt:ref"),
- ex_libs => add(sub {
---- crypto/engine/eng_openssl.c
-+++ crypto/engine/eng_openssl.c
-@@ -9,6 +9,7 @@
- */
-
- #include <stdio.h>
-+#include "e_os.h"
- #include <openssl/crypto.h>
- #include "internal/cryptlib.h"
- #include "internal/engine.h"
---- crypto/o_time.c
-+++ crypto/o_time.c
-@@ -41,10 +41,6 @@
- if (gmtime_r(timer, result) == NULL)
- return NULL;
- ts = result;
--#elif defined (OPENSSL_SYS_WINDOWS) && defined(_MSC_VER) && _MSC_VER >= 1400
-- if (gmtime_s(result, timer))
-- return NULL;
-- ts = result;
- #else
- ts = gmtime(timer);
- if (ts == NULL)
---- engines/e_capi.c
-+++ engines/e_capi.c
-@@ -15,6 +15,7 @@
- # include <wincrypt.h>
-
- # include <stdio.h>
-+# include "e_os.h"
- # include <string.h>
- # include <stdlib.h>
- # include <malloc.h>
---- test/testutil/basic_output.c
-+++ test/testutil/basic_output.c
-@@ -10,6 +10,7 @@
- #include "../testutil.h"
- #include "output.h"
- #include "tu_local.h"
-+#include "../../e_os.h"
-
- #include <openssl/crypto.h>
- #include <openssl/bio.h>
---- e_os.h
-+++ e_os.h
-@@ -149,7 +149,7 @@
- # endif
- # include <malloc.h>
- # if defined(_MSC_VER) && !defined(_WIN32_WCE) && !defined(_DLL) && defined(stdin)
--# if _MSC_VER>=1300 && _MSC_VER<1600
-+# ifdef _WIN64
- # undef stdin
- # undef stdout
- # undef stderr
-@@ -157,7 +157,7 @@
- # define stdin (&__iob_func()[0])
- # define stdout (&__iob_func()[1])
- # define stderr (&__iob_func()[2])
--# elif _MSC_VER<1300 && defined(I_CAN_LIVE_WITH_LNK4049)
-+# else
- # undef stdin
- # undef stdout
- # undef stderr
diff --git a/native/tcnative.dsp b/native/tcnative.dsp
index 8a11967..56c9db8 100644
--- a/native/tcnative.dsp
+++ b/native/tcnative.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /Zi /O2 /Oy- /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
-# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./srclib/apr/include" /I "./srclib/apr/include/arch/win32" /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "./srclib/openssl/inc32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "APR_DECLARE_STATIC" /D "NO_IDEA" /D "NO_RC5" /D "NO_MDC2" /D "OPENSSL_NO_IDEA" /D "OPENSSL_NO_RC5" /D "OPENSSL_NO_MDC2" /D "HAVE_OPENSSL" /D HAVE_SSL_SET_STATE=1 /Fd"LibR\tcnative_src" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./srclib/apr/include" /I "./srclib/apr/include/arch/win32" /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "./srclib/openssl/inc32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "APR_DECLARE_STATIC" /D "NO_IDEA" /D "NO_RC5" /D "NO_MDC2" /D "OPENSSL_NO_IDEA" /D "OPENSSL_NO_RC5" /D "OPENSSL_NO_MDC2" /D HAVE_SSL_SET_STATE=1 /Fd"LibR\tcnative_src" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
-# ADD CPP /nologo /MDd /W4 /GX /Zi /Od /I "./include" /I "./srclib/apr/include" /I "./srclib/apr/include/arch/win32" /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "./srclib/openssl/inc32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "APR_DECLARE_STATIC" /D "NO_IDEA" /D "NO_RC5" /D "NO_MDC2" /D "OPENSSL_NO_IDEA" /D "OPENSSL_NO_RC5" /D "OPENSSL_NO_MDC2" /D "HAVE_OPENSSL" /D HAVE_SSL_SET_STATE=1 /Fd"LibD\tcnative_src" /FD /c
+# ADD CPP /nologo /MDd /W4 /GX /Zi /Od /I "./include" /I "./srclib/apr/include" /I "./srclib/apr/include/arch/win32" /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "./srclib/openssl/inc32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "APR_DECLARE_STATIC" /D "NO_IDEA" /D "NO_RC5" /D "NO_MDC2" /D "OPENSSL_NO_IDEA" /D "OPENSSL_NO_RC5" /D "OPENSSL_NO_MDC2" /D HAVE_SSL_SET_STATE=1 /Fd"LibD\tcnative_src" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -92,74 +92,22 @@ LINK32=link.exe
# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\src\address.c
-# End Source File
-# Begin Source File
-
SOURCE=.\src\bb.c
# End Source File
# Begin Source File
-SOURCE=.\src\dir.c
-# End Source File
-# Begin Source File
-
SOURCE=.\src\error.c
# End Source File
# Begin Source File
-SOURCE=.\src\file.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\info.c
-# End Source File
-# Begin Source File
-
SOURCE=.\src\jnilib.c
# End Source File
# Begin Source File
-SOURCE=.\src\lock.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\misc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\mmap.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\multicast.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\network.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\os.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\poll.c
-# End Source File
-# Begin Source File
-
SOURCE=.\src\pool.c
# End Source File
# Begin Source File
-SOURCE=.\src\proc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\shm.c
-# End Source File
-# Begin Source File
-
SOURCE=.\src\ssl.c
# End Source File
# Begin Source File
@@ -172,28 +120,8 @@ SOURCE=.\src\sslconf.c
# End Source File
# Begin Source File
-SOURCE=.\src\sslinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\sslnetwork.c
-# End Source File
-# Begin Source File
-
SOURCE=.\src\sslutils.c
# End Source File
-# Begin Source File
-
-SOURCE=.\src\stdlib.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\thread.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\src\user.c
-# End Source File
# End Group
# Begin Group "Generated Files"
@@ -224,14 +152,6 @@ SOURCE=.\include\tcn_version.h
# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\os\win32\ntpipe.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\os\win32\registry.c
-# End Source File
-# Begin Source File
-
SOURCE=.\os\win32\system.c
# End Source File
# End Group
diff --git a/native/tcnative.spec b/native/tcnative.spec
index 19ffb8b..27acbe0 100644
--- a/native/tcnative.spec
+++ b/native/tcnative.spec
@@ -15,20 +15,20 @@
# limitations under the License.
#
-%define tcnver 1
+%define tcnver 2
%define aprmajor 1
-%define aprminor 4
+%define aprminor 7
Summary: Tomcat Native Java library
Name: tcnative
-Version: 1.2.35
+Version: 2.0.4
Release: 1
License: Apache Software License
Group: System Environment/Libraries
URL: http://apr.apache.org/
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
-BuildPrereq: autoconf, libtool, doxygen, apr-devel >= %{aprmajor}.%{aprminor}.0, openssl >= 1.0.2
+BuildPrereq: autoconf, libtool, doxygen, apr-devel >= %{aprmajor}.%{aprminor}.0, openssl >= 3.0.0
%description
The mission of the Tomcat Native Library (TCN) is to provide a
@@ -38,7 +38,7 @@ contains additional utility interfaces for Java.
%package devel
Group: Development/Libraries
Summary: Tomcat Native development kit
-Requires: tcnative = %{version}-%{release}, apr-devel >= %{aprmajor}.%{aprminor}.0, openssl-devel >= 1.0.2
+Requires: tcnative = %{version}-%{release}, apr-devel >= %{aprmajor}.%{aprminor}.0, openssl-devel >= 3.0.0
%description devel
The mission of the Tomcat Native Library (TCN) is to provide a
@@ -90,6 +90,8 @@ rm -rf $RPM_BUILD_ROOT
%doc --parents html
%changelog
+* Tue Jun 30 2022 Mark Thomas <markt@apache.org> 2.0.0-1
+- update for tcnative 2.0
* Sat Oct 31 2015 Rainer Jung <rjung@apache.org> 1.2.0-1
- update for tcnative 1.2
* Tue Jun 22 2004 Mladen Turk <mturk@jboss.com> 1.0.0-1
diff --git a/test/org/apache/tomcat/jni/AbstractJniTest.java b/test/org/apache/tomcat/jni/AbstractJniTest.java
deleted file mode 100644
index 84ed1ac..0000000
--- a/test/org/apache/tomcat/jni/AbstractJniTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-
-public abstract class AbstractJniTest {
-
- private boolean nativeLibraryPresent = false;
-
- @Before
- public void initBase() throws Exception {
- try {
- Library.initialize(null);
- nativeLibraryPresent = true;
- } catch (LibraryNotFoundError lnfe) {
- nativeLibraryPresent = false;
- }
- Assume.assumeTrue("APR Library not found", nativeLibraryPresent);
- }
-
-
- @After
- public void destroyBase() {
- if (nativeLibraryPresent) {
- Library.terminate();
- }
- }
-
-}
diff --git a/test/org/apache/tomcat/jni/TestFile.java b/test/org/apache/tomcat/jni/TestFile.java
deleted file mode 100644
index 433939f..0000000
--- a/test/org/apache/tomcat/jni/TestFile.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-
-public class TestFile extends AbstractJniTest {
-
- @Test
- public void testInfoGet() throws Exception {
- String testFile = "test/org/apache/tomcat/jni/TestFile.java";
- java.io.File file = new java.io.File(testFile);
- Assert.assertTrue("File " + testFile + " does not exist!", file.exists());
-
- Library.initialize(null);
- long pool = Pool.create(0L);
- int openFlags = File.APR_FOPEN_READ | File.APR_FOPEN_BUFFERED | File.APR_FOPEN_XTHREAD;
- int openPermissions = File.APR_FPROT_OS_DEFAULT;
- int statFlags = File.APR_FINFO_MIN;
- long fd = File.open(testFile, openFlags, openPermissions, pool);
- FileInfo fileInfo = new FileInfo();
- for (int i = 0; i < 100000; i++) {
- org.apache.tomcat.jni.File.infoGet(fileInfo, statFlags, fd);
- @SuppressWarnings("unused")
- String info = inspectFileInfo(fileInfo);
- }
- }
-
- public static String inspectFileInfo(FileInfo fileInfo) {
- String result = fileInfo.toString() + " : {" +
- String.format("\n pool : %d", Long.valueOf(fileInfo.pool)) +
- String.format("\n valid : %d", Integer.valueOf(fileInfo.valid)) +
- String.format("\n protection : %d", Integer.valueOf(fileInfo.protection)) +
- String.format("\n filetype : %d", Integer.valueOf(fileInfo.filetype)) +
- String.format("\n user : %d", Integer.valueOf(fileInfo.user)) +
- String.format("\n group : %d", Integer.valueOf(fileInfo.group)) +
- String.format("\n inode : %d", Integer.valueOf(fileInfo.inode)) +
- String.format("\n device : %d", Integer.valueOf(fileInfo.device)) +
- String.format("\n nlink : %d", Integer.valueOf(fileInfo.nlink)) +
- String.format("\n size : %d", Long.valueOf(fileInfo.size)) +
- String.format("\n csize : %d", Long.valueOf(fileInfo.csize)) +
- String.format("\n atime : %d", Long.valueOf(fileInfo.atime)) +
- String.format("\n mtime : %d", Long.valueOf(fileInfo.mtime)) +
- String.format("\n ctime : %d", Long.valueOf(fileInfo.ctime)) +
- String.format("\n fname : %s", fileInfo.fname) +
- String.format("\n name : %s", fileInfo.name) +
- String.format("\n filehand : %d", Long.valueOf(fileInfo.filehand)) +
- "\n}";
- return result;
- }
-}
\ No newline at end of file
diff --git a/test/org/apache/tomcat/jni/TestSocketServer.java b/test/org/apache/tomcat/jni/TestSocketServer.java
deleted file mode 100644
index d1ea90d..0000000
--- a/test/org/apache/tomcat/jni/TestSocketServer.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-import java.io.OutputStream;
-import java.util.concurrent.CountDownLatch;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests for server-side sockets.
- */
-public class TestSocketServer extends AbstractJniTest {
-
- private static final String HOST = "localhost";
- private static final long ERROR_MARGIN;
-
- private int port = 0;
- private long serverSocket = 0;
- private long clientSocket = 0;
-
- // Determine the resolution of System.nanoTime() so an appropriate error
- // margin can be used in tests that use nanoTime()
- static {
- long start = System.nanoTime();
- long end = System.nanoTime();
- while (end == start) {
- end = System.nanoTime();
- }
- ERROR_MARGIN = 2 * (end - start);
- }
-
-
- @Before
- public void init() throws Exception {
- long serverPool = Pool.create(0);
- long inetAddress = Address.info(HOST, Socket.APR_INET,
- 0, 0, serverPool);
- serverSocket = Socket.create(Socket.APR_INET, Socket.SOCK_STREAM,
- Socket.APR_PROTO_TCP, serverPool);
- if (OS.IS_UNIX) {
- Socket.optSet(serverSocket, Socket.APR_SO_REUSEADDR, 1);
- }
- int rc = Socket.bind(serverSocket, inetAddress);
- Assert.assertEquals("Can't bind: " + Error.strerror(rc), 0, rc);
- Socket.listen(serverSocket, 5);
- if (!OS.IS_UNIX) {
- Socket.optSet(serverSocket, Socket.APR_SO_REUSEADDR, 1);
- }
-
- long localAddress = Address.get(Socket.APR_LOCAL, serverSocket);
- port = Address.getInfo(localAddress).port;
- }
-
-
- @After
- public void destroy() {
- if (clientSocket != 0) {
- Socket.close(clientSocket);
- Socket.destroy(clientSocket);
- }
- if (serverSocket != 0) {
- Socket.close(serverSocket);
- Socket.destroy(serverSocket);
- }
- }
-
-
- @Test
- public void testPort() {
- Assert.assertTrue(port > 0);
- }
-
-
- @Test
- public void testBlockingReadFromClientWithTimeout() throws Exception {
- /* Start the client that connects to the server */
- Client client = new Client(port);
- client.start();
-
- /* Accept the client connection */
- clientSocket = Socket.accept(serverSocket);
-
- /* Configure a 1s timeout for reading from client */
- Socket.timeoutSet(clientSocket, 1000000);
- long timeout = Socket.timeoutGet(clientSocket);
- Assert.assertEquals("Socket.timeoutGet clientSocket failed", 1000000, timeout);
-
- byte [] buf = new byte[1];
- long start = System.nanoTime();
- while (Socket.recv(clientSocket, buf, 0, 1) == 1) {
- }
- long wait = System.nanoTime() - start;
- Assert.assertFalse("Socket.timeoutSet failed (<1s) [" + wait + "] +-[" + ERROR_MARGIN + "]",
- wait < 1000000000 - ERROR_MARGIN);
- Assert.assertFalse("Socket.timeoutSet failed (>2s) [" + wait + "] +-[" + ERROR_MARGIN + "]",
- wait > 2000000000 + ERROR_MARGIN);
-
- client.countDown();
- client.join();
- }
-
-
- @Test
- public void testNonBlockingReadFromClient() throws Exception {
- /* Start the client that connects to the server */
- Client client = new Client(port);
- client.start();
-
- /* Accept the client connection */
- clientSocket = Socket.accept(serverSocket);
-
- /* Configure the connection for non-blocking */
- Socket.optSet(clientSocket, Socket.APR_SO_NONBLOCK, 1);
- int val = Socket.optGet(clientSocket, Socket.APR_SO_NONBLOCK);
- Assert.assertEquals("Socket.optGet clientSocket failed", 1, val);
-
- byte [] buf = new byte[1];
- long start = System.nanoTime();
- while (Socket.recv(clientSocket, buf, 0, 1) == 1) {
- }
- long wait = System.nanoTime() - start;
- Assert.assertFalse("non_blocking client Socket.APR_SO_NONBLOCK failed (>2ms) [" + wait +
- "] +-[" + ERROR_MARGIN + "]", wait > 2000000 + ERROR_MARGIN);
-
- client.countDown();
- client.join();
- }
-
-
- @Test
- public void testNonBlockingReadThenBlockingReadFromClient() throws Exception {
- /* Start the client that connects to the server */
- Client client = new Client(port);
- client.start();
-
- /* Accept the client connection */
- clientSocket = Socket.accept(serverSocket);
-
- /* Configure the connection for non-blocking */
- Socket.optSet(clientSocket, Socket.APR_SO_NONBLOCK, 1);
-
- byte [] buf = new byte[1];
- long start = System.nanoTime();
- while (Socket.recv(clientSocket, buf, 0, 1) == 1) {
- }
- long wait = System.nanoTime() - start;
- Assert.assertFalse("non_blocking client Socket.APR_SO_NONBLOCK failed (>1ms) [" + wait +
- "] +-[" + ERROR_MARGIN + "]", wait > 1000000 + ERROR_MARGIN);
-
- /* Configure for blocking */
- Socket.optSet(clientSocket, Socket.APR_SO_NONBLOCK, 0);
- Socket.timeoutSet(clientSocket, 2000);
- start = System.nanoTime();
- while (Socket.recv(clientSocket, buf, 0, 1) == 1) {
- }
- wait = System.nanoTime() - start;
- Assert.assertFalse("non_blocking client Socket.APR_SO_NONBLOCK false failed (<1ms) [" +
- wait + "] +-[" + ERROR_MARGIN + "]", wait < 1000000 - ERROR_MARGIN);
-
- client.countDown();
- client.join();
- }
-
-
- @Test
- public void testNonBlockingAcceptWithNoClient() throws Exception {
- Socket.optSet(serverSocket, Socket.APR_SO_NONBLOCK, 1);
- int val = Socket.optGet(serverSocket, Socket.APR_SO_NONBLOCK);
- Assert.assertEquals("Socket.optGet serverSocket failed", 1, val);
-
- long start = System.nanoTime();
- boolean ok = false;
- try {
- Socket.accept(serverSocket);
- } catch (Exception ex) {
- ok = true;
- }
- long wait = System.nanoTime() - start;
- Assert.assertTrue("Timeout failed", ok);
- Assert.assertFalse("non_blocking accept Socket.APR_SO_NONBLOCK failed (>10ms) [" + wait +
- "] +-[" + ERROR_MARGIN + "]", wait > 10000000 + ERROR_MARGIN);
- }
-
-
- /**
- * Simple client that connects, sends a single byte then closes the
- * connection.
- */
- private static class Client extends java.lang.Thread {
-
- private final int port;
- private final CountDownLatch complete = new CountDownLatch(1);
-
- public Client(int port) throws Exception {
- this.port = port;
- }
-
- public void countDown() {
- complete.countDown();
- }
-
- @Override
- public void run() {
-
- try (java.net.Socket sock = new java.net.Socket(TestSocketServer.HOST, port)) {
- OutputStream os = sock.getOutputStream();
- os.write('A');
- os.flush();
- complete.await();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }
-}
diff --git a/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java b/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java
deleted file mode 100644
index 866ba77..0000000
--- a/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jni;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.NetworkInterface;
-import java.util.Enumeration;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests for server-side sockets using any local address (0.0.0.0 or ::).
- */
-public class TestSocketServerAnyLocalAddress extends AbstractJniTest {
-
- // Excessive but allows for slow systems
- private static final int TIMEOUT_MICROSECONDS = 10 * 1000 * 1000;
-
- private long serverSocket = 0;
- private long clientSocket = 0;
-
-
- @Before
- public void init() throws Exception {
- long serverPool = Pool.create(0);
- long inetAddress = Address.info(null, Socket.APR_UNSPEC,
- 0, 0, serverPool);
- serverSocket = Socket.create(Address.getInfo(inetAddress).family, Socket.SOCK_STREAM,
- Socket.APR_PROTO_TCP, serverPool);
- if (OS.IS_UNIX) {
- Socket.optSet(serverSocket, Socket.APR_SO_REUSEADDR, 1);
- }
- int rc = Socket.bind(serverSocket, inetAddress);
- Assert.assertEquals("Can't bind: " + Error.strerror(rc), 0, rc);
- Socket.listen(serverSocket, 5);
- if (!OS.IS_UNIX) {
- Socket.optSet(serverSocket, Socket.APR_SO_REUSEADDR, 1);
- }
- }
-
-
- @After
- public void destroy() {
- if (clientSocket != 0) {
- Socket.close(clientSocket);
- Socket.destroy(clientSocket);
- }
- if (serverSocket != 0) {
- Socket.close(serverSocket);
- Socket.destroy(serverSocket);
- }
- }
-
-
- @Test
- public void testWithClient() throws Exception {
- /* Start the client that connects to the server */
- Client client = new Client(serverSocket);
- client.start();
-
- boolean running = true;
- while (running) {
- /* Accept the client connection */
- clientSocket = Socket.accept(serverSocket);
-
- /* Configure a 10s timeout for reading from client */
- Socket.timeoutSet(clientSocket, TIMEOUT_MICROSECONDS);
-
- byte [] buf = new byte[1];
- while (Socket.recv(clientSocket, buf, 0, 1) == 1) {
- // If 'A' was read, echo back 'Z'
- if (buf[0] == 'A') {
- buf[0] = 'Z';
- Socket.send(clientSocket, buf, 0, 1);
- }
- }
- if (buf[0] == 'E') {
- running = false;
- } else if (buf[0] == 'Z') {
- // NO-OP - connection closing
- } else {
- Assert.fail("Unexpected data [" + (char) buf[0] + "]");
- }
- }
-
- client.join();
- }
-
-
- /**
- * Simple client that connects, sends a single byte then closes the
- * connection.
- */
- private static class Client extends java.lang.Thread {
-
- private final long serverSocket;
-
- public Client(long serverSocket) throws Exception {
- this.serverSocket = serverSocket;
- }
-
- @Override
- public void run() {
-
- try {
- InetSocketAddress connectAddress = getConnectAddress(serverSocket);
- java.net.Socket sock = new java.net.Socket();
- sock.connect(connectAddress, TIMEOUT_MICROSECONDS);
- sock.setSoTimeout(TIMEOUT_MICROSECONDS);
- OutputStream ou = sock.getOutputStream();
- InputStream in = sock.getInputStream();
- ou.write('A');
- ou.flush();
- int rep = in.read();
- sock.close();
- if (rep != 'Z') {
- throw new Exception("Read wrong data [" + rep + "]");
- }
-
- sock = new java.net.Socket();
- sock.connect(connectAddress, TIMEOUT_MICROSECONDS);
- sock.setSoTimeout(TIMEOUT_MICROSECONDS);
- ou = sock.getOutputStream();
- ou.write('E');
- ou.flush();
- sock.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-
- /*
- * Assumes server is listening on any local address
- */
- private static InetSocketAddress getConnectAddress(long serverSocket) throws Exception {
- long sa = Address.get(Socket.APR_LOCAL, serverSocket);
- Sockaddr addr = Address.getInfo(sa);
- InetSocketAddress localAddress;
- if (addr.family == Socket.APR_INET6) {
- localAddress = new InetSocketAddress("::", addr.port);
- } else {
- localAddress = new InetSocketAddress("0.0.0.0", addr.port);
- }
-
- // Need a local address of the same type (IPv4 or IPV6) as the
- // configured bind address since the connector may be configured
- // to not map between types.
- InetAddress loopbackConnectAddress = null;
- InetAddress linkLocalConnectAddress = null;
-
- Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
- while (networkInterfaces.hasMoreElements()) {
- NetworkInterface networkInterface = networkInterfaces.nextElement();
- Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
- while (inetAddresses.hasMoreElements()) {
- InetAddress inetAddress = inetAddresses.nextElement();
- if (localAddress.getAddress().getClass().isAssignableFrom(inetAddress.getClass())) {
- if (inetAddress.isLoopbackAddress()) {
- if (loopbackConnectAddress == null) {
- loopbackConnectAddress = inetAddress;
- }
- } else if (inetAddress.isLinkLocalAddress()) {
- if (linkLocalConnectAddress == null) {
- linkLocalConnectAddress = inetAddress;
- }
- } else {
- // Use a non-link local, non-loop back address by default
- return new InetSocketAddress(inetAddress, localAddress.getPort());
- }
- }
- }
- }
- // Prefer loop back over link local since on some platforms (e.g.
- // OSX) some link local addresses are not included when listening on
- // all local addresses.
- if (loopbackConnectAddress != null) {
- return new InetSocketAddress(loopbackConnectAddress, localAddress.getPort());
- }
- if (linkLocalConnectAddress != null) {
- return new InetSocketAddress(linkLocalConnectAddress, localAddress.getPort());
- }
- // Fallback
- return new InetSocketAddress("localhost", localAddress.getPort());
- }
- }
-}
diff --git a/xdocs/index.xml b/xdocs/index.xml
index cc2d518..e6b79fa 100644
--- a/xdocs/index.xml
+++ b/xdocs/index.xml
@@ -33,37 +33,19 @@
<p>
The Apache Tomcat Native Library is an optional component for use with
- Apache Tomcat that allows Tomcat to use certain native resources
- for performance, compatibility, etc.
+ Apache Tomcat that allows Tomcat to use OpenSSL as a replacement for JSSE
+ to support TLS connections.
</p>
- <p>
- Specifically, the Apache Tomcat Native Library gives Tomcat access to
- the Apache Portable Runtime (APR) library's network connection (socket)
- implementation and random-number generator.
- See the Apache Tomcat documentation for more information on how to
- configure Tomcat to use the APR connector.
- </p>
-
- <p>
- Features of the APR connector:
- </p>
- <ul>
- <li>Non-blocking I/O for Keep-Alive requests (between requests)</li>
- <li>Uses OpenSSL for TLS/SSL capabilities (if supported by linked APR library)</li>
- <li>FIPS 140-2 support for TLS/SSL (if supported by linked OpenSSL library)</li>
- <li>Support for IPv4, IPv6 and Unix Domain Sockets</li>
- </ul>
-
</section>
<section name="Headlines">
<ul>
-<li><a href="news/2022.html#20220614">14 June 2022 - <b>TC-Native-1.2.34
+<li><a href="news/2023.html#20230213">13 February 2023 - <b>TC-Native-2.0.3
released</b></a>
<p>The Apache Tomcat team is proud to announce the immediate availability of
-Tomcat Native 1.2.34 Stable.</p>
+Tomcat Native 2.0.3 Stable.</p>
<p>
The sources and the binaries for selected platforms are available from the
<a href="../download-native.cgi">Download page</a>.
@@ -113,21 +95,21 @@ list of changes.
<p>
to create the includes and makefiles to be able to build tc-native.<br/>
Where:<br/>
- <code>$HOME/APR</code> is something like /usr/bin/apr-1-config or the path where apr is
- installed.<br/>
- <code>$JAVA_HOME</code> is something /home/jfclere/JAVA/jdk1.7.0_80 path to a JDK
- installation. Any JDK should work but it is advisable to use the same
- JVM version the JVM you use with Tomcat.<br/>
+ <code>$HOME/APR</code> is something like /usr/bin/apr-1-config or the path
+ where apr is installed.<br/>
+ <code>$JAVA_HOME</code> is something like /home/jfclere/JAVA/jdk11 or the
+ path to a JDK installation. Any JDK should work but it is advisable to use
+ the same JVM version the JVM you use with Tomcat.<br/>
<code>$HOME/OPENSSL</code> is the path where OpenSSL is installed.<br/>
<code>$CATALINA_HOME</code> is the path where the produced libraries will be
- installed. Something like $HOME/apache-tomcat-8.0.47/<br/>
+ installed. Something like $HOME/apache-tomcat-10.1.0<br/>
<br/>
The configure is able to guess most of OpenSSL standard installations.
So most of the time the following will be enough:
</p>
<source
>./configure --with-apr=/usr/bin/apr-1-config \
- --with-java-home=/home/jfclere/JAVA/jdk1.7.0_80/ \
+ --with-java-home=/home/jfclere/JAVA/jdk11 \
--with-ssl=yes \
--prefix=$CATALINA_HOME</source>
<p>
@@ -176,13 +158,6 @@ list of changes.
Please see the Apache Tomcat documentation for configuration specifics.
</p>
- <p>
- When using Unix Domain Sockets a cleanup is registered to delete the
- socket on destruction of the socket, or shutdown of the application.
- Should the application terminate abnormally, the socket deletion will
- need to be handled by the caller or by the administrator.
- </p>
-
</subsection>
<subsection name="UNIX">
@@ -193,21 +168,17 @@ list of changes.
<source>LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CATALINA_HOME/lib
export LD_LIBRARY_PATH</source>
<p>
- Start tomcat and check for the messages like this ones:
+ Start tomcat and check for the messages like these ones:
</p>
<source wrapped="true"
->Nov 29, 2020 12:27:41 PM org.apache.catalina.core.AprLifecycleListener init
-INFO: Loaded APR based Apache Tomcat Native library 1.x.y.
-Nov 29, 2020 12:27:41 PM org.apache.catalina.core.AprLifecycleListener init
-INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true], UDS [true].
-Nov 29, 2020 12:27:41 PM org.apache.coyote.http11.Http11AprProtocol init
-INFO: Initializing Coyote HTTP/1.1 on http-8080</source>
+>15-Jun-2022 11:06:23.274 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [2.0.0-dev] using APR version [1.7.0]
+15-Jun-2022 11:06:23.298 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 3.0.4-dev 3 May 2022]</source>
<p>
Refer to the tomcat documentation to configure the connectors (See
- <a href="http://tomcat.apache.org/tomcat-10.0-doc/apr.html">Tomcat 10.0.x</a>,
- <a href="http://tomcat.apache.org/tomcat-9.0-doc/apr.html">Tomcat 9.0.x</a> and
- <a href="http://tomcat.apache.org/tomcat-8.5-doc/apr.html">Tomcat 8.5.x</a>)
+ <a href="https://tomcat.apache.org/tomcat-10.1-doc/config/http.html">Tomcat 10.1.x</a>,
+ <a href="https://tomcat.apache.org/tomcat-9.0-doc/config/http.html">Tomcat 9.0.x</a> and
+ <a href="https://tomcat.apache.org/tomcat-8.5-doc/config/http.html">Tomcat 8.5.x</a>)
</p>
</subsection>
@@ -220,15 +191,11 @@ INFO: Initializing Coyote HTTP/1.1 on http-8080</source>
<source wrapped="true"
>set PATH=%PATH;C:\cygwin\home\support\tomcat-native-current-win32-src\jni\native\Debug;C:\cygwin\home\support\tomcat-native-current-win32-src\jni\apr\Debug;C:\OpenSSL\lib\VC</source>
<p>
- Start tomcat and check for the messages like this ones:
+ Start tomcat and check for the messages like these ones:
</p>
- <source wrapped="true"
->Nov 29, 2020 2:48:17 PM org.apache.catalina.core.AprLifecycleListener init
-INFO: Loaded APR based Apache Tomcat Native library 1.x.y.
-Nov 29, 2020 2:48:17 PM org.apache.catalina.core.AprLifecycleListener init
-INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true], UDS [false].
-Nov 29, 2020 2:48:18 PM org.apache.coyote.http11.Http11AprProtocol init
-INFO: Initializing Coyote HTTP/1.1 on http-8080</source>
+ <source wrapped="true"
+>15-Jun-2022 11:06:23.274 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [2.0.0-dev] using APR version [1.7.0]
+15-Jun-2022 11:06:23.298 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 3.0.4-dev 3 May 2022]</source>
</subsection>
diff --git a/xdocs/miscellaneous/changelog.xml b/xdocs/miscellaneous/changelog.xml
index ea11989..eecc6a2 100644
--- a/xdocs/miscellaneous/changelog.xml
+++ b/xdocs/miscellaneous/changelog.xml
@@ -27,658 +27,94 @@
<section name="Preface">
<p>
- This is the Changelog for Tomcat Native 1.2.
+ This is the Changelog for Apache Tomcat Native 2.0.x. The Tomcat Native 2.0.x
+ branch started from the 1.2.33 tag.
</p>
</section>
-<section name="Changes in 1.2.35">
+<section name="Changes in 2.0.4">
<changelog>
- <docs>
- Document the TLS rengotiation behaviour. (markt)
- </docs>
- <docs>
- Add HOWTO-RELEASE.txt that describes the release process. (markt)
- </docs>
- <update>
- Update recommended OpenSSL version to 1.1.1q or later. (markt)
- </update>
- </changelog>
-</section>
-<section name="Changes in 1.2.34">
- <changelog>
- <scode>
- Refactor library initialization so it is compatible with Tomcat 10.1.x
- onwards where a number of Java classes have been removed. (markt)
- </scode>
- <add>
- Map the OpenSSL 3.x FIPS behaviour to the OpenSSL 1.x API to allow clients
- to determine if the FIPS provider is being used when Tomcat Native is
- compiled against OpenSSL 3.x. (markt)
- </add>
- </changelog>
-</section>
-<section name="Changes in 1.2.33">
- <changelog>
- <fix>
- <bug>66035</bug>: Fix crash when attempting to read TLS session ID after a
- handshake failure. (schultz/markt)
- </fix>
- <fix>
- Enable <code>download_deps.sh</code> to be called from any directory. Pull
- request <pr>12</pr> provided by Dimitrios Soumis. (markt)
- </fix>
- <update>
- Update recommended OpenSSL version to 1.1.1o or later. (markt)
- </update>
- </changelog>
-</section>
-<section name="Changes in 1.2.32">
- <changelog>
- <update>
- Update recommended OpenSSL version to 1.1.1n or later. (markt)
- </update>
- <fix>
- Fix release script so it works with the current git layout. (markt)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.31">
- <changelog>
- <fix>
- <bug>65441</bug>: Correct previous fix that enabled building to continue
- with OpenSSL 3.x. Patch provided by lzsiga. (markt)
- </fix>
- <fix>
- <bug>65659</bug>: Remove remaining reference to <code>pkg-config</code>
- which is no longer included in the Tomcat Native distribution. (markt)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.30">
- <changelog>
- <add>
- <bug>65181</bug>: Additional changes required to provided support for
- using OpenSSL Engines that use proprietary key formats. Based on a patch
- provided by Edin Hodzic. (markt)
- </add>
- <fix>
- <bug>65329</bug>: Correct handling of <code>WINVER</code> in make file to
- use correct constant for Windows 7. Add constants for Windows 8,
- Windows 8.1 and Windows 10. Rename <code>WINNT</code> to
- <code>WIN2k</code> as it is used for Windows 2000 upwards, not Windows NT
- upwards. (markt)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.29 (not released)">
- <changelog>
- <fix>
- Add a patch for APR that fixes an issue where some Windows systems in some
- configurations would only listen on IPv6 addresses on dual stack systems
- even though configured to listen on both IPv6 and IPv4 addresses.
- (michaelo)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.28">
- <changelog>
- <fix>
- Correct a regression in the fix for <bug>65181</bug> that prevented an
- error message from being displayed if an invalid key file was provided
- and no OpenSSL Engine was configured. (markt)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.27">
- <changelog>
- <add>
- <bug>65181</bug>: Improve support for using OpenSSL Engines that use
- proprietary key formats. Patch provided by Edin Hodzic. (markt)
- </add>
- <update>
- Update recommended OpenSSL version to 1.1.1k or later. (markt)
- </update>
- </changelog>
-</section>
-<section name="Changes in 1.2.26">
- <changelog>
- <fix>
- Enable building to continue against OpenSSL 3.x and 1.1.1. (markt)
- </fix>
- <add>
- <bug>64942</bug>: Expose support for Unix Domain Sockets in APR v1.6 and up. (minfrin)
- </add>
- <update>
- Update recommended OpenSSL version to 1.1.1i or later. (markt)
- </update>
- </changelog>
-</section>
-<section name="Changes in 1.2.25">
- <changelog>
- <fix>
- Incomplete name mangling fix for C++ compilers in tcn_api.h. (michaelo)
- </fix>
- <update>
- Improve OS-specific header include for native thread id. (michaelo)
- </update>
- <fix>
- Disable keylog callback support for LibreSSL. (michaelo)
- </fix>
- <add>
- Add support for <code>SSLContext.addChainCertificateRaw()</code> with
- LibreSSL 2.9.1 and up. (michaelo)
- </add>
- <add>
- Add support for HP-UX's _lwp_self() in our
- ssl_thread_id(void). (michaelo)
- </add>
- <remove>
- Remove default option passed for rpath to linker on HP-UX. (michaelo)
- </remove>
- <add>
- Add an option to allow the OCSP responder check to be bypassed. Note that
- if OCSP is enabled, a missing responder is now treated as an error.
- (jfclere)
- </add>
- <fix>
- <bug>64429</bug>: Fix compilation with LibreSSL. (markt)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.24">
- <changelog>
- <fix>
- <bug>63671</bug>: libtcnative does not compile with OpenSSL < 1.1.0
- and APR w/o threading support. (michaelo)
- </fix>
- <fix>
- Correct configure message for OpenSSL libdir. (michaelo)
- </fix>
- <update>
- <bug>64260</bug>: Clean up install target. (michaelo)
- </update>
- <fix>
- <bug>64315</bug>: configure output for OpenSSL wrong/incomplete sometimes.
- (michaelo)
- </fix>
- <update>
- Drop obsolete build time workarounds for HP-UX. (michaelo)
- </update>
- <add>
- Add support for FreeBSD's pthread_getthreadid_np() in our
- ssl_thread_id(void). (michaelo)
- </add>
- <update>
- <bug>63701</bug>: Use new OpenSSL initialisation process when building with
- OpenSSL 1.1.0 onwards. (mturk)
- </update>
- <add>
- <bug>64316</bug>: Introduce tcn_get_thread_id(void) to reduce code
- duplication. (michaelo)
- </add>
- <fix>
- Fix linking against OpenSSL in non-standard locations on FreeBSD.
- (michaelo)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.23">
- <changelog>
- <fix>
- Make file fixes to enable building with APR 1.7.x. (markt)
- </fix>
- <fix>
- Switch to Windows 7 as the default target. (markt)
- </fix>
- <update>
- Update minimum OpenSSL version to 1.0.2r. (markt)
- </update>
- </changelog>
-</section>
-<section name="Changes in 1.2.22">
- <changelog>
- <fix>
- <bug>63159</bug>: Unable to complete build when build directory is
- outside of the source tree. Patch provided by Bob Huemmer. (markt)
- </fix>
- <fix>
- <bug>63356</bug>: Fix client certificate authentication when a certificate
- contains an AIA extension without an OCSP URI. Patch provided by Milind
- Takawale. (markt)
- </fix>
- <fix>
- <bug>63500</bug>: Fix JVM crash on Connector start when a certificate
- revocation file or path is specified for OpenSSL. (markt)
- </fix>
- <add>
- Add support for TLS key logging when using OpenSSL 1.1.1 or later. If the
- environment variable SSLKEYLOGFILE is set then the TLS keys will be logged
- to that file. Patch provided by John Kelly. (markt)
- </add>
- <fix>
- Update build script after migration of soucre repository from Subversion
- to Git. (markt)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.21">
- <changelog>
- <fix>
- Correct a possible JVM crash during shutdown caused by a bug in the fix
- for the per connection memory leak included in 1.2.20. (rjung)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.20">
- <changelog>
- <fix>
- Update includedir name to tomcat-native instead of apr. (csutherl)
- </fix>
- <fix>
- Fix a minor memory leak. It occurred every time a TLS connector was
- started so the impact was very unlikely to be noticed. (markt)
- </fix>
- <fix>
- Fix some minor memory leaks that could occur after error conditions during
- TLS connector initialisation. (markt)
- </fix>
- <fix>
- Fix a per connection memory leak when using OpenSSL BIO. This is typically
- used when OpenSSL is providing the TLS support for NIO or NIO2. (markt)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.19">
- <changelog>
- <fix>
- <bug>62892</bug>: Fix memory leaks in OCSP handling. (jfclere)
- </fix>
- <fix>
- <bug>62944</bug>: Fix copy/paste error that prevented TLS 1.0 and TLS 1.1
- from being used if TLS 1.3 was available. Patch provided by Dean Rasheed.
- (markt)
- </fix>
- <fix>
- Include OpenSSL licensing information in the Tomcat Native binaries for
- Windows that are built with OpenSSL. (markt)
- </fix>
- <update>
- Update recommended OpenSSL version to 1.0.2q or later. (markt)
- </update>
- </changelog>
-</section>
-<section name="Changes in 1.2.18">
- <changelog>
- <fix>
- <bug>62641</bug>: libtool invocations should use --tag=CC. (michaelo)
- </fix>
- <scode>
- Remove support for Netware as there has not been a supported Netware
- platform for a number of years. (markt)
- </scode>
- <add>
- <bug>62748</bug>: Add support for TLS 1.3 when built with OpenSSL 1.1.1 or
- equivalent. (schultz/markt)
- </add>
- <add>
- Expose the API necessary for CLIENT-CERT authentication to be correctly
- supported when using Tomcat's JSSE implementation backed by OpenSSL.
- (markt)
- </add>
- </changelog>
-</section>
-<section name="Changes in 1.2.17">
- <changelog>
- <fix>
- <bug>62094</bug>: Certificate verification using CRL with
- Tomcat APR connector does not work. (jfclere)
- </fix>
- <fix>
- <bug>62122</bug>: undefined symbol: SSL_COMP_free_compression_methods. (jfclere)
- </fix>
- <fix>
- <bug>62221</bug>: OCSP response processing uses always the first
- entry in the response. (jfclere)
- </fix>
- <fix>
- Further clean-up in the OCSP extension logic. (jfclere)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.16">
- <changelog>
- <fix>
- Further clean-up in the parsing of the OCSP extension. (markt)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.15">
- <changelog>
- <update>
- Update recommended OpenSSL version to 1.0.2m. (markt)
- </update>
- <fix>
- Correctly calculate field lengths when parsing the OCSP extension so
- that longer values are read correctly. (markt)
- </fix>
- <update>
- Update the recommended APR version to 1.6.3 or later. (markt)
- </update>
- </changelog>
-</section>
-<section name="Changes in 1.2.14">
- <changelog>
- <fix>
- Fix a small memory leak during certificate initialization. (rjung)
- </fix>
- <fix>
- Replace use of deprecated <code>ASN1_STRING_data</code> with
- <code>ASN1_STRING_get0_data</code> when building against
- OpenSSL 1.1.0 and newer. (rjung)
- </fix>
- <fix>
- Fix a thread local key leak. Only relevant when doing
- SSL.initialize() and Library.terminate() a lot of times. (rjung)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.13">
- <changelog>
- <fix>
- Add missing source files to Visual Studio project files. (wrowe)
- </fix>
- <add>
- Add support for the OpenSSL SSL_CONF API. (rjung)
- </add>
- <add>
- Add SSLContext.getCiphers(). (rjung)
- </add>
- <add>
- Add method to add a single CA certificate to the list of CA certificates
- which are accepted as issuers of client certificates. (rjung)
- </add>
- <fix>
- Fix an error not announcing the correct CA list for client certificates
- during TLS handshake. (rjung)
- </fix>
- <fix>
- Fix renegotiation to obtain a client certificate from a user agent.
- (markt)
- </fix>
- <fix>
- <bug>58434</bug>: Allow Tomcat Native to be compiled with LibreSSL. Note
- that some features may not be available when using LibreSSL. (markt)
- </fix>
- <fix>
- <bug>60290</bug>: When building Tomcat Native, don't ignore the value of
- <code>CC</code> if explicitly set. Patch provided by Michael Osipov.
- (markt)
- </fix>
- <fix>
- <bug>60301</bug>: When building Tomcat Native, allow the user to override
- the libtool specified by APR by setting the <code>LIBTOOL</code>
- environment variable. (markt)
- </fix>
<update>
- Update build to use APR 1.6.x, with 1.6.2 recommended. (markt)
+ Update the recommended minimum version of APR to 1.7.4. (markt)
</update>
<update>
- Update recommended OpenSSL version to 1.0.2l. (markt)
+ Update the recommended minimum version of OpenSSL to 3.0.9. (markt)
</update>
</changelog>
</section>
-<section name="Changes in 1.2.12">
- <changelog>
- <fix>
- Correct a regression in the fix for <bug>59797</bug> that triggered a JVM
- crash on shutdown in some Tomcat unit tests when using the APR/native
- connector. (markt)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.11">
+<section name="Changes in 2.0.3">
<changelog>
- <fix>
- <bug>52627</bug>: Prevent a crash in <code>File.infoGet()</code> caused by
- the use of uninitialised variables. Based on patch by Ilya Maykov. (markt)
- </fix>
- <fix>
- <bug>55113</bug>: Document the process for creating a static tc-native
- library with a FIPS-enabled OpenSSL and update the nmake make file to
- support the process. (markt)
- </fix>
- <fix>
- <bug>55114</bug>: Clean up building instructions for the native component
- and expand the instructions for building for Windows platforms. (markt)
- </fix>
- <fix>
- <bug>55938</bug>: Resolve remaining clang-analyzer warnings. Note that the
- use of <code>-1</code> to indicate the full array in
- <code>File.(read|write)[Full]</code> has been removed since it was only
- partially implemented and the implementation was faulty. (markt)
- </fix>
- <fix>
- <bug>58082</bug>: Update unit tests to use JUnit 4. Refactor unit tests
- into separate tests and use an external to reference them in the same way
- an external is used to reference the main code. (markt)
- </fix>
- <fix>
- <bug>59797</bug>: Ensure that the per thread error hash maintained by
- OpenSSL is cleaned up as individual threads exit to ensure it does not
- grow too large. Patch provided by Nate Clark. (markt)
- </fix>
- <fix>
- <bug>59996</bug>: Correctly handle building tc-native on a 64-bit system
- when using an OpenSSL distribution that is not in <code>/usr</code>.
- (csutherl)
- </fix>
- <fix>
- <bug>60388</bug>: The --disable-maintainer-mode option of the configure
- script no longer enables the maintainer mode. (ebourg)
- </fix>
<update>
- Update minimum recommended OpenSSL version to 1.0.2k. (markt)
+ Update the recommended minimum version of APR to 1.7.2. (markt)
</update>
- </changelog>
-</section>
-<section name="Changes in 1.2.10">
- <changelog>
<update>
- Update minimum recommended OpenSSL version to 1.0.2j. (markt)
+ Update the recommended minimum version of OpenSSL to 3.0.8. (markt)
</update>
</changelog>
</section>
-<section name="Changes in 1.2.9">
+<section name="Changes in 2.0.2">
<changelog>
<update>
- Update minimum recommended OpenSSL version to 1.0.2i. (markt)
+ Update the minimum supported version of LibreSSL to 3.5.2. Based on pull
+ request <pr>13</pr> provided by orbea. (markt)
</update>
- </changelog>
-</section>
-<section name="Changes in 1.2.8">
- <changelog>
- <fix>
- <bug>59616</bug>: Correct the Windows build files so that OCSP is
- correctly enabled and disabled in the respective Windows binaries. (markt)
- </fix>
- <fix>
- Correctly handle OS level EAGAIN return codes during non-blocking TLS I/O.
- (markt)
- </fix>
<fix>
- Correct a potential performance problem identified by Nate Clark due to
- Tomcat Native providing OpenSSL with thread identifiers poorly suited to
- the hash function used by OpenSSL when selecting a bucket for the hash
- that holds the per thread error data. Tomcat Native on Windows and on
- Solaris were not affected. A fix has been applied for OSX and Linux. Other
- platforms may still be affected. (markt/rjung)
+ Fix build when building with rlibtool. Pull request <pr>14</pr> provided
+ by orbea. (markt)
</fix>
</changelog>
</section>
-<section name="Changes in 1.2.7">
+
+<section name="Changes in 2.0.1">
<changelog>
<update>
- Update minimum recommended OpenSSL version to 1.0.2h. (markt)
+ Update recommended OpenSSL version to 3.0.5 or later. (markt)
</update>
</changelog>
</section>
-<section name="Changes in 1.2.6">
+<section name="Changes in 2.0.0">
<changelog>
<update>
- Change the OpenSSL version check in <code>configure</code>
- to be fatal. (rjung)
- </update>
- <update>
- Use new OpenSSL 1.1.0 protocol version max and min API
- when creating a new SSL context. (rjung)
+ Update the minimum required version of OpenSSL to 3.0.0 and make it a
+ madatory dependency. (markt)
</update>
<update>
- Improve renegotiation code and make it compatible with
- OpenSSL 1.1.0. (rjung)
+ Update the minimum required version of APR to 1.7.0. (markt)
</update>
- <scode>
- OpenSSL 1.1.0 compatibility updates. (rjung)
- </scode>
- <fix>
- Fix some compiler warnings in native ssl code. (rjung)
- </fix>
+ <design>
+ Remove NPN support as NPN was never standardised and browser support was
+ removed in 2019. (markt)
+ </design>
<add>
- Add support for using Java keystores for certificate chains. (markt)
+ Add support for using OpenSSL when the FIPS provider is configured as the
+ default provider. (markt)
</add>
+ <design>
+ Remove all API methods (and supporting code) that are not used by Tomcat
+ 10.1.x to support the use of OpenSSL as a replacement for JSSE to provide
+ TLS functionality. (markt)
+ </design>
+ <docs>
+ Document the TLS rengotiation behaviour. (markt)
+ </docs>
<update>
- Remove the explicit CRL check when verifying certificates.
- The checks were already part of the internal certification
- verification since OpenSSL 0.9.7. Backport from mod_ssl.
- (rjung)
+ Update the minimum required Java version to Java 11. (markt)
</update>
- </changelog>
-</section>
-<section name="Changes in 1.2.5">
- <changelog>
<update>
- Enable OpenSSL version check in <code>configure</code> by
- default. It can be turned off using
- <code>--disable-openssl-version-check</code>. (rjung)
+ Remove support for Windows 2000, Windows XP, Windows Server 2003, Windows
+ Vista and Windows Server 2008. The minimum Windows version is now Windows
+ 7 / Windows Server 2008 R2. (markt)
</update>
+ <docs>
+ Add HOWTO-RELEASE.txt that describes the release process. (markt)
+ </docs>
<fix>
- <bug>59024</bug>: Native function <code>versionString()</code> and
- for OpenSSL 1.1.0 also <code>version()</code> (both in in ssl.c) now
- return the OpenSSL run time version, not the compile time version.
- (rjung)
- </fix>
- <scode>
- Track changes in the OpenSSL master branch so it is possible to build
- Tomcat Native with that branch. (billbarker)
- </scode>
- </changelog>
-</section>
-<section name="Changes in 1.2.4">
- <changelog>
- <fix>
- SSL.getHandshakeCount(), which was unused, now returns the handshake
- completed count rather than the handshake started count. (remm)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.3">
- <changelog>
- <fix>
- Remove Java classes that do not have C implementation code
- for their native methods in the current library. They were
- used for NPN support which is superseded by ALPN support
- in the current code. (kkolinko)
- </fix>
- <fix>
- Fix typo in declaration of a stub method used when the library is
- compiled without OpenSSL support. (kkolinko)
- </fix>
- <fix>
- Fix the signature of the implementation of the native SSL method
- newSSL() in the case when OPENSSL is not available. (rjung)
- </fix>
- <fix>
- Fix the signature of the implementation of the native SSLSocket
- method getInfoB() to return jbyteArray instead of jobject.
- This is consistent with what it actually returns and how
- the native Java method is declared. (rjung)
- </fix>
- <add>
- Add support for using Java keystores for certificates and keys. (jfclere)
- </add>
- <scode>
- Remove code that performs a read after a renegotiation that appears to be
- unnecessary with OpenSSL 1.0.2. (billbarker)
- </scode>
- <add>
- Expose <code>SSL_renegotiate</code> to the Java API. (remm)
- </add>
- </changelog>
-</section>
-<section name="Changes in 1.2.2">
- <changelog>
- <fix>
- Fix broken debug and maintainer mode build. (rjung)
- </fix>
- <fix>
- Forward port additional fixes to the OpenSSL I/O to align it with
- non-OpenSSL I/O. (markt)
- </fix>
- </changelog>
-</section>
-<section name="Changes in 1.2.1">
- <changelog>
- <fix>
- <bug>58566</bug>: Enable Tomcat Native 1.2.x to work with Tomcat releases
- that do not have the necessary Java code to support SNI. (markt)
- </fix>
- <update>
- Minor rework of "buildconf" script. (rjung)
- </update>
- <fix>
- Fix APR dependency version expression in RPM spec file. (rjung)
- </fix>
- <fix>
- Fix major library version number in Windows build files, RPM spec file
- and build description. (rjung)
- </fix>
- <fix>
- Remove files "KEYS" and "download_deps.sh" from Windows (zip)
- source distribution. (rjung)
- </fix>
- <fix>
- Fix "unused variable" compiler warning. (rjung)
+ Fix the autoconf warnings when creating a release. (markt)
</fix>
</changelog>
</section>
-<section name="Changes in 1.2.0">
- <changelog>
- <add>
- Add support for TLS extension ALPN. (markt)
- </add>
- <add>
- Add support for TLS extension SNI (Server Name Indication).
- (markt)
- </add>
- <add>
- Add support for OpenSSL BIO. (jfclere)
- </add>
- <add>
- Support wakeable pollsets and add Poll.interrupt() API.
- (mturk)
- </add>
- <add>
- Add Pool.unmanaged() API. (mturk)
- </add>
- <update>
- APIs SSL.generateRSATempKey() and SSL.loadDSATempKey()
- have been removed. (rjung)
- </update>
- <update>
- The minimum required APR version is 1.4.3.
- </update>
- <update>
- The minimum required OpenSSL version is 1.0.2.
- </update>
- </changelog>
+<section name="Changes in 1.2.x">
+<p>Please see the <a href="../../native-1.2-doc/miscellaneous/changelog.html">1.2.x
+ changelog</a>.</p>
</section>
<section name="Changes in 1.1.x">
<p>Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">1.1.x
diff --git a/xdocs/miscellaneous/project.xml b/xdocs/miscellaneous/project.xml
index 1153ee1..786b211 100644
--- a/xdocs/miscellaneous/project.xml
+++ b/xdocs/miscellaneous/project.xml
@@ -36,20 +36,6 @@
<menu name="News">
<item name="2022" href="../news/2022.html"/>
- <item name="2021" href="../news/2021.html"/>
- <item name="2020" href="../news/2020.html"/>
- <item name="2019" href="../news/2019.html"/>
- <item name="2018" href="../news/2018.html"/>
- <item name="2017" href="../news/2017.html"/>
- <item name="2016" href="../news/2016.html"/>
- <item name="2015" href="../news/2015.html"/>
- <item name="2014" href="../news/2014.html"/>
- <item name="2013" href="../news/2013.html"/>
- <item name="2012" href="../news/2012.html"/>
- <item name="2011" href="../news/2011.html"/>
- <item name="2010" href="../news/2010.html"/>
- <item name="2009" href="../news/2009.html"/>
- <item name="2008" href="../news/2008.html"/>
</menu>
</body>
diff --git a/xdocs/news/2008.xml b/xdocs/news/2008.xml
deleted file mode 100644
index 20e2d46..0000000
--- a/xdocs/news/2008.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2008.html">
-
- &project;
-
- <properties>
- <title>2008 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2008 News & Status">
-<subsection anchor="20081118.1" name="18 November - TC-Native-1.1.16 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.16. This is a stable release adding some bug fixes.
-</p>
-</subsection>
-<subsection anchor="20080911.1" name="11 September - TC-Native-1.1.15 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.15. This is a stable release adding some bug fixes.
-</p>
-</subsection>
-<subsection anchor="20080704.1" name="4 July - TC-Native-1.1.14 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.14. This is a stable release adding some bug fixes.
-</p>
-</subsection>
-<subsection anchor="20080115.1" name="15 February - TC-Native-1.1.13 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.13. This is a stable release adding few new features
-and some bug fixes.
-</p><p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2009.xml b/xdocs/news/2009.xml
deleted file mode 100644
index 7bd0592..0000000
--- a/xdocs/news/2009.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2009.html">
-
- &project;
-
- <properties>
- <title>2009 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2009 News & Status">
-<subsection anchor="20091123.1" name="23 November - TC-Native-1.1.18 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.18. This is a stable release adding some bug fixes.
-</p><p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2010.xml b/xdocs/news/2010.xml
deleted file mode 100644
index e407bd7..0000000
--- a/xdocs/news/2010.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2010.html">
-
- &project;
-
- <properties>
- <title>2010 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2010 News & Status">
-<subsection anchor="20100217.1" name="17 February - TC-Native-1.1.20 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.20. This is a stable release adding some bug fixes.
-</p>
-</subsection>
-<subsection anchor="20100108.1" name="8 January - TC-Native-1.1.19 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.19. This is a stable release adding some bug fixes.
-</p><p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2012.xml b/xdocs/news/2012.xml
deleted file mode 100644
index 902d48f..0000000
--- a/xdocs/news/2012.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2012.html">
-
- &project;
-
- <properties>
- <title>2012 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2012 News & Status">
-<subsection anchor="20120613.1" name="13 June - TC-Native-1.1.24 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.24. This is a feature-add release adding support for
-per-socket Poller timeouts.
-</p>
-<p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</subsection>
-<subsection anchor="20120302.1" name="02 March - TC-Native-1.1.23 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.23. This is a stable release adding some bug fixes and
-experimental support for OCSP and PKCS12 certificates.
-</p>
-<p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2013.xml b/xdocs/news/2013.xml
deleted file mode 100644
index 55230ba..0000000
--- a/xdocs/news/2013.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2013.html">
-
- &project;
-
- <properties>
- <title>2013 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2013 News & Status">
-<subsection anchor="20131015.1" name="15 October - TC-Native-1.1.29 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.29. This is a bug fixing release.
-</p>
-</subsection>
-<subsection anchor="20130916.1" name="16 September - TC-Native-1.1.28 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.28. This is a bug fixing release.
-</p>
-<p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</subsection>
-<subsection anchor="20130212.1" name="12 February - TC-Native-1.1.27 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.27. This is a bug fixing release.
-</p>
-<p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2014.xml b/xdocs/news/2014.xml
deleted file mode 100644
index 76e6a76..0000000
--- a/xdocs/news/2014.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2014.html">
-
- &project;
-
- <properties>
- <title>2014 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2014 News & Status">
- <subsection anchor="20141023.1" name="23 October 2014 - TC-Native-1.1.32 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.1.32. This release add support for TLSv1.1 and TLSv1.2 and
- includes Windows binaries built with OpenSSL 1.0.1j and APR 1.5.1.
- </p>
- </subsection>
- <subsection anchor="20140707.1" name="7 July 2014 - TC-Native-1.1.31 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.1.31. This is a bug fixing release and includes Windows
- binaries built with OpenSSL 1.0.1h.
- </p>
- </subsection>
- <subsection anchor="20140415.1" name="15 April - TC-Native-1.1.30 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.1.30. This is a bug fixing release with added support for
- EC ciphers if supported by OpenSSL.
- </p>
- </subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2015.xml b/xdocs/news/2015.xml
deleted file mode 100644
index c5c8211..0000000
--- a/xdocs/news/2015.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2015.html">
-
- &project;
-
- <properties>
- <title>2015 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2015 News & Status">
- <subsection anchor="20151215" name="12 Dec 2015 - TC-Native-1.2.3 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.3. This is a bug fix release and includes Windows
- binaries built with OpenSSL 1.0.2e and APR 1.5.1.
- </p>
- </subsection>
- <subsection anchor="20151109" name="9 Nov 2015 - TC-Native-1.2.2 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.2. This is a bug fix release and includes Windows
- binaries built with OpenSSL 1.0.2d and APR 1.5.1.
- </p>
- </subsection>
- <subsection anchor="20151028" name="28 Oct 2015 - TC-Native-1.2.0 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.0. This is the first release of the 1.2.x series that
- provides ALPN, SNI and OpenSSl BIO support. It includes Windows binaries built
- with OpenSSL 1.0.2d and APR 1.5.1.
- </p>
- </subsection>
- <subsection anchor="20150323.1" name="23 March 2015 - TC-Native-1.1.33 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.1.33. This is a bug fixing release and includes Windows
- binaries built with OpenSSL 1.0.1m and APR 1.5.1.
- </p>
- </subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2016.xml b/xdocs/news/2016.xml
deleted file mode 100644
index 4a5fd66..0000000
--- a/xdocs/news/2016.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2016.html">
-
- &project;
-
- <properties>
- <title>2016 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2016 News & Status">
- <subsection anchor="20161005" name="5 October 2016 - TC-Native-1.2.10 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.10. This is a release to update dependencies for the
- Windows binaries and includes Windows binaries built with OpenSSL 1.0.2j and
- APR 1.5.2.
- </p>
- </subsection>
- <subsection anchor="20160702" name="2 July 2016 - TC-Native-1.2.8 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.8. This is a bug fix release release and includes Windows
- binaries built with OpenSSL 1.0.2h and APR 1.5.2.
- </p>
- </subsection>
- <subsection anchor="20160508" name="8 May 2016 - TC-Native-1.2.7 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.7. This is a release to update dependencies for the
- Windows binaries and includes Windows binaries built with OpenSSL 1.0.2h and
- APR 1.5.2.
- </p>
- </subsection>
- <subsection anchor="20160426" name="26 Apr 2016 - TC-Native-1.2.6 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.6. This is a bug fix release and includes Windows
- binaries built with OpenSSL 1.0.2g and APR 1.5.2.
- </p>
- </subsection>
- <subsection anchor="20160307" name="7 Mar 2016 - TC-Native-1.2.5 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.5. This is a bug fix release and includes Windows
- binaries built with OpenSSL 1.0.2g and APR 1.5.1.
- </p>
- </subsection>
- <subsection anchor="20160111" name="11 Jan 2016 - TC-Native-1.2.4 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.4. This is a bug fix release and includes Windows
- binaries built with OpenSSL 1.0.2e and APR 1.5.1.
- </p>
- </subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2017.xml b/xdocs/news/2017.xml
deleted file mode 100644
index 405b06e..0000000
--- a/xdocs/news/2017.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2017.html">
-
- &project;
-
- <properties>
- <title>2017 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2017 News & Status">
- <subsection anchor="20171120" name="20 Nov 2017 - TC-Native-1.2.16 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.16. This is a bugfix release that also updates the
- dependencies for the Windows binaries and includes Windows binaries built with
- OpenSSL 1.0.2m and APR 1.6.3.
- </p>
- </subsection>
- <subsection anchor="20170904" name="4 Sep 2017 - TC-Native-1.2.14 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.14. This is a bugfix release that also updates the
- dependencies for the Windows binaries and includes Windows binaries built with
- OpenSSL 1.0.2l and APR 1.6.2.
- </p>
- </subsection>
- <subsection anchor="20170221" name="21 Feb 2017 - TC-Native-1.2.12 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability
- of Tomcat Native 1.2.12. This is a release to update dependencies for the
- Windows binaries and includes Windows binaries built with OpenSSL 1.0.2k and
- APR 1.5.2.
- </p>
- </subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2018.xml b/xdocs/news/2018.xml
deleted file mode 100644
index 2da1fdd..0000000
--- a/xdocs/news/2018.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2018.html">
-
- &project;
-
- <properties>
- <title>2018 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2018 News & Status">
- <subsection anchor="20181204" name="4 Dec 2018 - TC-Native-1.2.19 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.19. This is a bugfix release that also updates the
- dependencies for the Windows binaries and includes Windows binaries built
- with OpenSSL 1.0.2q/APR 1.6.5 and 1.1.1a/APR 1.6.5.
- </p>
- </subsection>
- <subsection anchor="20181020" name="20 Oct 2018 - TC-Native-1.2.18 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.18. This is a feature and bugfix release that adds TLSv1.3
- support when built with OpenSSL 1.1.1. It also includes Windows binaries built
- with OpenSSL 1.0.2p/APR 1.6.5 and 1.1.1/APR 1.6.5.
- </p>
- </subsection>
- <subsection anchor="20180613" name="13 Jun 2018 - TC-Native-1.2.17 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.17. This is a bugfix release that also updates the
- dependencies for the Windows binaries and includes Windows binaries built with
- OpenSSL 1.0.2o and APR 1.6.3.
- </p>
- </subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2019.xml b/xdocs/news/2019.xml
deleted file mode 100644
index 7c8fa58..0000000
--- a/xdocs/news/2019.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2019.html">
-
- &project;
-
- <properties>
- <title>2019 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2019 News & Status">
- <subsection anchor="20190702" name="07 Jul 2019 - TC-Native-1.2.23 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.23. This is a bugfix release.
- </p>
- </subsection>
- <subsection anchor="20190131" name="31 Jan 2019 - TC-Native-1.2.21 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.21. This is a bugfix release.
- </p>
- </subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2020.xml b/xdocs/news/2020.xml
deleted file mode 100644
index 3f96ff0..0000000
--- a/xdocs/news/2020.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2020.html">
-
- &project;
-
- <properties>
- <title>2020 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2020 News & Status">
- <subsection anchor="20201221" name="21 Dec 2020 - TC-Native-1.2.26 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.26. This is a bugfix release.
- </p>
- </subsection>
- <subsection anchor="20200903" name="3 Sep 2020 - TC-Native-1.2.25 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.25. This is a bugfix release.
- </p>
- </subsection>
- <subsection anchor="20200429" name="29 Apr 2020 - TC-Native-1.2.24 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.24. This is a bugfix release.
- </p>
- </subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2021.xml b/xdocs/news/2021.xml
deleted file mode 100644
index 91263b1..0000000
--- a/xdocs/news/2021.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="2021.html">
-
- &project;
-
- <properties>
- <title>2021 News and Status</title>
- </properties>
-
-<body>
-
-<section name="2021 News & Status">
- <subsection anchor="20210901" name="1 Sep 2021 - TC-Native-1.2.31 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.31. This is a bugfix release.
- </p>
- </subsection>
- <subsection anchor="20210604" name="4 Jun 2021 - TC-Native-1.2.30 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.30. This is a bugfix release.
- </p>
- </subsection>
- <subsection anchor="20210406" name="6 Apr 2021 - TC-Native-1.2.28 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.28. This is a bugfix release.
- </p>
- </subsection>
- <subsection anchor="20210329" name="29 Mar 2021 - TC-Native-1.2.27 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.27. This is a bugfix release.
- </p>
- </subsection>
-</section>
-</body>
-</document>
diff --git a/xdocs/news/2022.xml b/xdocs/news/2022.xml
index 0d27c55..fbfe51d 100644
--- a/xdocs/news/2022.xml
+++ b/xdocs/news/2022.xml
@@ -26,24 +26,23 @@
<title>2022 News and Status</title>
</properties>
-<body>
+ <body>
+
+ <section name="2022 News & Status">
+
+ <subsection anchor="20220811" name="11 November 2022 - TC-Native-2.0.2 released">
+ <p>The Apache Tomcat team is proud to announce the immediate
+ availability of Tomcat Native 2.0.2.</p>
+ </subsection>
+
+ <subsection anchor="20220712" name="12 July 2022 - TC-Native-2.0.1 released">
+ <p>The Apache Tomcat team is proud to announce the immediate
+ availability of Tomcat Native 2.0.1. This is the first release of the
+ 2.0.x branch.</p>
+ </subsection>
+
+ </section>
+
+ </body>
-<section name="2022 News & Status">
- <subsection anchor="20220614" name="14 June 2022 - TC-Native-1.2.34 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.34. This is a bugfix release.
- </p>
- </subsection>
- <subsection anchor="20220509" name="5 May 2022 - TC-Native-1.2.33 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.33. This is a bugfix release.
- </p>
- </subsection>
- <subsection anchor="20220322" name="22 Mar 2022 - TC-Native-1.2.32 released">
- <p>The Apache Tomcat team is proud to announce the immediate availability of
- Tomcat Native 1.2.32. This is a bugfix release.
- </p>
- </subsection>
-</section>
-</body>
</document>
diff --git a/xdocs/news/2011.xml b/xdocs/news/2023.xml
similarity index 65%
rename from xdocs/news/2011.xml
rename to xdocs/news/2023.xml
index e247201..a39040b 100644
--- a/xdocs/news/2011.xml
+++ b/xdocs/news/2023.xml
@@ -18,25 +18,25 @@
<!DOCTYPE document [
<!ENTITY project SYSTEM "project.xml">
]>
-<document url="2011.html">
+<document url="2023.html">
&project;
<properties>
- <title>2011 News and Status</title>
+ <title>2023 News and Status</title>
</properties>
-<body>
+ <body>
+
+ <section name="2023 News & Status">
+
+ <subsection anchor="20230213" name="13 February 2023 - TC-Native-2.0.3 released">
+ <p>The Apache Tomcat team is proud to announce the immediate
+ availability of Tomcat Native 2.0.3.</p>
+ </subsection>
+
+ </section>
+
+ </body>
-<section name="2011 News & Status">
-<subsection anchor="20110808.1" name="08 August - TC-Native-1.1.22 released">
-<p>The Apache Tomcat team is proud to announce the immediate availability
-of Tomcat Native 1.1.22. This is a stable release adding some bug fixes.
-</p>
-<p>
- Please see the <a href="../../native-1.1-doc/miscellaneous/changelog.html">ChangeLog</a> for a full list of changes.
-</p>
-</subsection>
-</section>
-</body>
</document>
diff --git a/xdocs/news/project.xml b/xdocs/news/project.xml
index 20c66ba..ec408b7 100644
--- a/xdocs/news/project.xml
+++ b/xdocs/news/project.xml
@@ -35,21 +35,8 @@
</menu>
<menu name="News">
+ <item name="2023" href="../news/2023.html"/>
<item name="2022" href="../news/2022.html"/>
- <item name="2021" href="../news/2021.html"/>
- <item name="2020" href="../news/2020.html"/>
- <item name="2019" href="../news/2019.html"/>
- <item name="2018" href="../news/2018.html"/>
- <item name="2017" href="../news/2017.html"/>
- <item name="2016" href="../news/2016.html"/>
- <item name="2015" href="../news/2015.html"/>
- <item name="2014" href="../news/2014.html"/>
- <item name="2013" href="../news/2013.html"/>
- <item name="2012" href="../news/2012.html"/>
- <item name="2011" href="../news/2011.html"/>
- <item name="2010" href="../news/2010.html"/>
- <item name="2009" href="../news/2009.html"/>
- <item name="2008" href="../news/2008.html"/>
</menu>
</body>
diff --git a/xdocs/project.xml b/xdocs/project.xml
index 9184f96..187634c 100644
--- a/xdocs/project.xml
+++ b/xdocs/project.xml
@@ -36,20 +36,6 @@
<menu name="News">
<item name="2022" href="news/2022.html"/>
- <item name="2021" href="news/2021.html"/>
- <item name="2020" href="news/2020.html"/>
- <item name="2019" href="news/2019.html"/>
- <item name="2018" href="news/2018.html"/>
- <item name="2017" href="news/2017.html"/>
- <item name="2016" href="news/2016.html"/>
- <item name="2015" href="news/2015.html"/>
- <item name="2014" href="news/2014.html"/>
- <item name="2013" href="news/2013.html"/>
- <item name="2012" href="news/2012.html"/>
- <item name="2011" href="news/2011.html"/>
- <item name="2010" href="news/2010.html"/>
- <item name="2009" href="news/2009.html"/>
- <item name="2008" href="news/2008.html"/>
</menu>
</body>
</project>
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/lib/debug/.build-id/16/a40ae37c1e2b3b65f67928d91ab2c96daf121f.debug -rw-r--r-- root/root /usr/lib/x86_64-linux-gnu/libtcnative-2.a -rw-r--r-- root/root /usr/lib/x86_64-linux-gnu/libtcnative-2.so.0.0.4 lrwxrwxrwx root/root /usr/lib/x86_64-linux-gnu/libtcnative-2.so -> libtcnative-2.so.0.0.4 lrwxrwxrwx root/root /usr/lib/x86_64-linux-gnu/libtcnative-2.so.0 -> libtcnative-2.so.0.0.4
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/lib/debug/.build-id/21/7bdbfcb10d59c4756489838ff5a9a2b14503c3.debug -rw-r--r-- root/root /usr/lib/x86_64-linux-gnu/libtcnative-1.a -rw-r--r-- root/root /usr/lib/x86_64-linux-gnu/libtcnative-1.so.0.2.35 lrwxrwxrwx root/root /usr/lib/x86_64-linux-gnu/libtcnative-1.so -> libtcnative-1.so.0.2.35 lrwxrwxrwx root/root /usr/lib/x86_64-linux-gnu/libtcnative-1.so.0 -> libtcnative-1.so.0.2.35
Control files of package libtcnative-1: lines which differ (wdiff format)
Depends: libapr1 (>= 1.4.8-2~), libc6 (>= 2.34), 2.14), libssl3 (>= 3.0.0)
Control files of package libtcnative-1-dbgsym: lines which differ (wdiff format)
Build-Ids: 217bdbfcb10d59c4756489838ff5a9a2b14503c3 16a40ae37c1e2b3b65f67928d91ab2c96daf121f