package init

This commit is contained in:
root 2020-06-19 18:51:21 +08:00
parent 14c88765f6
commit f4621558bc
4 changed files with 139 additions and 0 deletions

View File

@ -0,0 +1,53 @@
From 91514ca0a2979ba778d27220ced0cd312e2cd2d2 Mon Sep 17 00:00:00 2001
From: Alexander Scheel <ascheel@redhat.com>
Date: Tue, 29 Oct 2019 10:43:56 -0400
Subject: [PATCH] Fix NativeProxy reference tracker
In eb5df01003d74b57473eacb84e538d31f5bb06ca, I introduced a bug by
setting mPointer after trying to add NativeProxy to the registry. In
most instances this won't matter, however, if another instance exists in
the HashSet with the same hash value, the equals comparator will be
used, triggering a NPE.
Signed-off-by: Alexander Scheel <ascheel@redhat.com>
---
org/mozilla/jss/util/NativeProxy.java | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/org/mozilla/jss/util/NativeProxy.java b/org/mozilla/jss/util/NativeProxy.java
index 1c6d1aa5..a0811f76 100644
--- a/org/mozilla/jss/util/NativeProxy.java
+++ b/org/mozilla/jss/util/NativeProxy.java
@@ -40,8 +40,8 @@ public abstract class NativeProxy implements AutoCloseable
*/
public NativeProxy(byte[] pointer) {
assert(pointer!=null);
- registry.add(this);
mPointer = pointer;
+ registry.add(this);
if (saveStacktraces) {
mTrace = Arrays.toString(Thread.currentThread().getStackTrace());
@@ -61,15 +61,12 @@ public abstract class NativeProxy implements AutoCloseable
if( ! (obj instanceof NativeProxy) ) {
return false;
}
- if( ((NativeProxy)obj).mPointer.length != mPointer.length) {
+ if (((NativeProxy)obj).mPointer == null) {
+ /* If mPointer is null, we have no way to compare the values
+ * of the pointers, so assume they're unequal. */
return false;
}
- for(int i=0; i < mPointer.length; i++) {
- if(mPointer[i] != ((NativeProxy)obj).mPointer[i]) {
- return false;
- }
- }
- return true;
+ return Arrays.equals(((NativeProxy)obj).mPointer, mPointer);
}
/**
--
2.21.0

BIN
jss-4.6.2.tar.gz Normal file

Binary file not shown.

82
jss.spec Normal file
View File

@ -0,0 +1,82 @@
Name: jss
Summary: Java Security Services
URL: http://www.dogtagpki.org/wiki/JSS
License: MPLv1.1 or GPLv2+ or LGPLv2+
Version: 4.6.2
Release: 3
Source: https://github.com/dogtagpki/jss/archive/v%{version}/jss-%{version}.tar.gz
Patch0001: 0001-Fix-NativeProxy-reference-tracker.patch
BuildRequires: git make cmake gcc-c++ nspr-devel >= 4.13.1 nss-devel >= 3.30 nss-tools >= 3.30 java-devel
BuildRequires: jpackage-utils slf4j glassfish-jaxb-api slf4j-jdk14 apache-commons-lang apache-commons-codec
BuildRequires: junit
Requires: nss >= 3.30 java-headless jpackage-utils slf4j glassfish-jaxb-api
Requires: slf4j-jdk14 apache-commons-lang apache-commons-codec
Conflicts: ldapjdk < 4.20 idm-console-framework < 1.2 tomcatjss < 7.3.4 pki-base < 10.6.5
%description
JSS offers a implementation for java-based applications to use native NSS.
%package help
Summary: JSS Javadocs
Requires: jss = %{version}-%{release}
Provides: jss-javadoc = %{version}-%{release}
Obsoletes: jss-javadoc < %{version}-%{release}
%description help
API documentation for JSS.
%prep
%autosetup -n jss-%{version} -p 1 -S git
%build
%set_build_flags
[ -z "$JAVA_HOME" ] && export JAVA_HOME=%{_jvmdir}/java
export BUILD_OPT=1
export CFLAGS="-g $RPM_OPT_FLAGS"
modutil -dbdir /etc/pki/nssdb -chkfips true | grep -q enabled && export FIPS_ENABLED=1
rm -rf build && install -d build && cd build
%cmake -DJAVA_HOME=%{java_home} -DJAVA_LIB_INSTALL_DIR=%{_jnidir} ..
%make_build all
%make_build javadoc || true
%install
mkdir -p $RPM_BUILD_ROOT%{_jnidir}
chmod 755 $RPM_BUILD_ROOT%{_jnidir}
cp build/jss4.jar ${RPM_BUILD_ROOT}%{_jnidir}
chmod 644 ${RPM_BUILD_ROOT}%{_jnidir}/jss4.jar
mkdir -p $RPM_BUILD_ROOT%{_libdir}/jss
chmod 755 $RPM_BUILD_ROOT%{_libdir}/jss
cp build/libjss4.so ${RPM_BUILD_ROOT}%{_libdir}/jss
chmod 755 ${RPM_BUILD_ROOT}%{_libdir}/jss/libjss4.so
pushd ${RPM_BUILD_ROOT}%{_libdir}/jss
ln -fs %{_jnidir}/jss4.jar jss4.jar
popd
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/jss-%{version}
chmod 755 $RPM_BUILD_ROOT%{_javadocdir}/jss-%{version}
cp -rp build/docs/* jss.html *.txt $RPM_BUILD_ROOT%{_javadocdir}/jss-%{version}
%files
%defattr(-,root,root,-)
%doc jss.html MPL-1.1.txt gpl.txt lgpl.txt
%{_libdir}/*
%{_jnidir}/*
%files help
%defattr(-,root,root,-)
%{_javadocdir}/jss-%{version}/
%changelog
* Thu Apr 16 2020 lizhenhua <lizhenhua21@huawei.com> - 4.6.2-3
- Package init

4
jss.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: dogtagpki/jss
tag_prefix: ^v
seperator: .