Merge
This commit is contained in:
commit
d7f9679696
@ -124,3 +124,4 @@ cfbbdb77eac0397b03eb99ee2e07ea00e0a7b81e jdk7-b142
|
|||||||
d91364304d7c4ecd34caffdba2b840aeb0d10b51 jdk7-b147
|
d91364304d7c4ecd34caffdba2b840aeb0d10b51 jdk7-b147
|
||||||
f42e3d9394b40a423d345b8da22687b5462e5f25 jdk8-b01
|
f42e3d9394b40a423d345b8da22687b5462e5f25 jdk8-b01
|
||||||
69f592185747226a9c765a9fe139c1d34d616f9c jdk8-b02
|
69f592185747226a9c765a9fe139c1d34d616f9c jdk8-b02
|
||||||
|
587bb549dff83131b65f40aa51864f69562f34a7 jdk8-b03
|
||||||
|
@ -176,3 +176,4 @@ c149193c768b8b7233da4c3a3fdc0756b975848e hs21-b13
|
|||||||
c149193c768b8b7233da4c3a3fdc0756b975848e jdk7-b143
|
c149193c768b8b7233da4c3a3fdc0756b975848e jdk7-b143
|
||||||
0cc8a70952c368e06de2adab1f2649a408f5e577 jdk8-b01
|
0cc8a70952c368e06de2adab1f2649a408f5e577 jdk8-b01
|
||||||
31e253c1da429124bb87570ab095d9bc89850d0a jdk8-b02
|
31e253c1da429124bb87570ab095d9bc89850d0a jdk8-b02
|
||||||
|
3a2fb61165dfc72e398179a2796d740c8da5b8c0 jdk8-b03
|
||||||
|
@ -124,3 +124,4 @@ efbf75c24b0f31847c9c403f6dc07dc80551908d jdk7-b143
|
|||||||
f097ca2434b1412b12ab4a5c2397ce271bf681e7 jdk7-b147
|
f097ca2434b1412b12ab4a5c2397ce271bf681e7 jdk7-b147
|
||||||
2cdbbc4a63592be7f1556fffe37b1253a77bd481 jdk8-b01
|
2cdbbc4a63592be7f1556fffe37b1253a77bd481 jdk8-b01
|
||||||
13e70aa1398eb959c54bc68b783ca0eef1286ad2 jdk8-b02
|
13e70aa1398eb959c54bc68b783ca0eef1286ad2 jdk8-b02
|
||||||
|
7989ee9fe673a87f4db3917fa6a005732a6a9b85 jdk8-b03
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,8 +27,13 @@ BUILDDIR = ../..
|
|||||||
PRODUCT = oracle
|
PRODUCT = oracle
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
SUBDIRS = net
|
#
|
||||||
include $(BUILDDIR)/common/Subdirs.gmk
|
# Files to compile
|
||||||
|
#
|
||||||
|
AUTO_FILES_JAVA_DIRS = com/oracle
|
||||||
|
|
||||||
|
#
|
||||||
|
# Rules
|
||||||
|
#
|
||||||
|
include $(BUILDDIR)/common/Classes.gmk
|
||||||
|
|
||||||
all build clean clobber::
|
|
||||||
$(SUBDIRS-loop)
|
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
#
|
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License version 2 only, as
|
|
||||||
# published by the Free Software Foundation. Oracle designates this
|
|
||||||
# particular file as subject to the "Classpath" exception as provided
|
|
||||||
# by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
#
|
|
||||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
# version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
# accompanied this code).
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License version
|
|
||||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
#
|
|
||||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
# or visit www.oracle.com if you need additional information or have any
|
|
||||||
# questions.
|
|
||||||
#
|
|
||||||
|
|
||||||
BUILDDIR = ../../..
|
|
||||||
PRODUCT = oracle
|
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
|
||||||
|
|
||||||
#
|
|
||||||
# Files to compile
|
|
||||||
#
|
|
||||||
AUTO_FILES_JAVA_DIRS = com/oracle/net
|
|
||||||
|
|
||||||
#
|
|
||||||
# Rules
|
|
||||||
#
|
|
||||||
include $(BUILDDIR)/common/Classes.gmk
|
|
||||||
|
|
@ -113,6 +113,9 @@ ifndef OPENJDK
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
JAVAC_MAX_WARNINGS = false
|
||||||
|
JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
|
||||||
|
JAVAC_WARNINGS_FATAL = true
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,6 +28,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
BUILDDIR = ../../..
|
BUILDDIR = ../../..
|
||||||
|
SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
|
||||||
|
SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
SUBDIRS = toolkit cosnaming ldap rmi dns
|
SUBDIRS = toolkit cosnaming ldap rmi dns
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,6 +28,10 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
BUILDDIR = ../../..
|
BUILDDIR = ../../..
|
||||||
|
SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=false
|
||||||
|
# TODO: Workaround for CR 7063027. Remove -path eventually.
|
||||||
|
SUBDIRS_MAKEFLAGS += JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation,-path
|
||||||
|
SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
SUBDIRS = auth
|
SUBDIRS = auth
|
||||||
|
@ -60,7 +60,8 @@ EXCLUDE_PROPWARN_PKGS = com.sun.java.swing.plaf.windows \
|
|||||||
# with a new module system (being discussed for JDK 8).
|
# with a new module system (being discussed for JDK 8).
|
||||||
#
|
#
|
||||||
EXPORTED_PRIVATE_PKGS = com.sun.servicetag \
|
EXPORTED_PRIVATE_PKGS = com.sun.servicetag \
|
||||||
com.oracle.net
|
com.oracle.net \
|
||||||
|
com.oracle.nio
|
||||||
|
|
||||||
# 64-bit solaris has a few special cases. We define the variable
|
# 64-bit solaris has a few special cases. We define the variable
|
||||||
# SOLARIS64 for use in this Makefile to easily test those cases
|
# SOLARIS64 for use in this Makefile to easily test those cases
|
||||||
|
@ -34,6 +34,7 @@ LIBRARY = java
|
|||||||
PRODUCT = java
|
PRODUCT = java
|
||||||
SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
|
SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
|
||||||
SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
|
SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
|
||||||
|
JAVAC_MAX_WARNINGS=true
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
# windows compiler flags
|
# windows compiler flags
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
BUILDDIR = ../..
|
BUILDDIR = ../..
|
||||||
PACKAGE = java.security
|
PACKAGE = java.security
|
||||||
PRODUCT = sun
|
PRODUCT = sun
|
||||||
|
JAVAC_MAX_WARNINGS = false
|
||||||
|
JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
|
||||||
|
JAVAC_WARNINGS_FATAL = true
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -76,63 +76,3 @@ FILES_java = \
|
|||||||
sun/nio/cs/UTF_32BE_BOM.java \
|
sun/nio/cs/UTF_32BE_BOM.java \
|
||||||
sun/nio/cs/UTF_32LE_BOM.java
|
sun/nio/cs/UTF_32LE_BOM.java
|
||||||
|
|
||||||
|
|
||||||
FILES_java += \
|
|
||||||
sun/io/Converters.java \
|
|
||||||
sun/io/ByteToCharConverter.java \
|
|
||||||
sun/io/ByteToCharASCII.java \
|
|
||||||
sun/io/ByteToCharUTF8.java \
|
|
||||||
sun/io/ByteToCharUTF16.java \
|
|
||||||
sun/io/ByteToCharUnicode.java \
|
|
||||||
sun/io/ByteToCharUnicodeBig.java \
|
|
||||||
sun/io/ByteToCharUnicodeBigUnmarked.java \
|
|
||||||
sun/io/ByteToCharUnicodeLittle.java \
|
|
||||||
sun/io/ByteToCharUnicodeLittleUnmarked.java \
|
|
||||||
sun/io/CharToByteConverter.java \
|
|
||||||
sun/io/CharToByteASCII.java \
|
|
||||||
sun/io/CharToByteUTF8.java \
|
|
||||||
sun/io/CharToByteUTF16.java \
|
|
||||||
sun/io/CharToByteUnicode.java \
|
|
||||||
sun/io/CharToByteUnicodeBig.java \
|
|
||||||
sun/io/CharToByteUnicodeBigUnmarked.java \
|
|
||||||
sun/io/CharToByteUnicodeLittle.java \
|
|
||||||
sun/io/CharToByteUnicodeLittleUnmarked.java \
|
|
||||||
sun/io/CharacterEncoding.java \
|
|
||||||
sun/io/ConversionBufferFullException.java \
|
|
||||||
sun/io/MalformedInputException.java \
|
|
||||||
sun/io/UnknownCharacterException.java \
|
|
||||||
sun/io/ByteToCharISO8859_1.java \
|
|
||||||
sun/io/CharToByteISO8859_1.java \
|
|
||||||
sun/io/ByteToCharISO8859_2.java \
|
|
||||||
sun/io/CharToByteISO8859_2.java \
|
|
||||||
sun/io/ByteToCharISO8859_4.java \
|
|
||||||
sun/io/CharToByteISO8859_4.java \
|
|
||||||
sun/io/ByteToCharISO8859_5.java \
|
|
||||||
sun/io/CharToByteISO8859_5.java \
|
|
||||||
sun/io/ByteToCharISO8859_7.java \
|
|
||||||
sun/io/CharToByteISO8859_7.java \
|
|
||||||
sun/io/ByteToCharISO8859_9.java \
|
|
||||||
sun/io/CharToByteISO8859_9.java \
|
|
||||||
sun/io/ByteToCharISO8859_13.java \
|
|
||||||
sun/io/CharToByteISO8859_13.java \
|
|
||||||
sun/io/ByteToCharISO8859_15.java \
|
|
||||||
sun/io/CharToByteISO8859_15.java \
|
|
||||||
sun/io/ByteToCharCp1250.java \
|
|
||||||
sun/io/CharToByteCp1250.java \
|
|
||||||
sun/io/ByteToCharCp1251.java \
|
|
||||||
sun/io/CharToByteCp1251.java \
|
|
||||||
sun/io/ByteToCharCp1252.java \
|
|
||||||
sun/io/CharToByteCp1252.java \
|
|
||||||
sun/io/ByteToCharCp1253.java \
|
|
||||||
sun/io/CharToByteCp1253.java \
|
|
||||||
sun/io/ByteToCharCp1254.java \
|
|
||||||
sun/io/CharToByteCp1254.java \
|
|
||||||
sun/io/ByteToCharCp1257.java \
|
|
||||||
sun/io/CharToByteCp1257.java \
|
|
||||||
sun/io/ByteToCharKOI8_R.java \
|
|
||||||
sun/io/CharToByteKOI8_R.java \
|
|
||||||
sun/io/ByteToCharSingleByte.java \
|
|
||||||
sun/io/CharToByteSingleByte.java
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,8 +31,7 @@ BUILDDIR = ../..
|
|||||||
PACKAGE = sun.nio
|
PACKAGE = sun.nio
|
||||||
PRODUCT = sun
|
PRODUCT = sun
|
||||||
|
|
||||||
JAVAC_MAX_WARNINGS = false
|
JAVAC_MAX_WARNINGS = true
|
||||||
JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
|
|
||||||
JAVAC_WARNINGS_FATAL = true
|
JAVAC_WARNINGS_FATAL = true
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
|
@ -128,6 +128,8 @@ ifndef OPENJDK
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
JAVAC_MAX_WARNINGS = true
|
||||||
|
JAVAC_WARNINGS_FATAL = true
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,6 +28,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
BUILDDIR = ../..
|
BUILDDIR = ../..
|
||||||
|
JAVAC_MAX_WARNINGS = true
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -29,277 +29,6 @@
|
|||||||
# Core character converters are built from make/java/java.
|
# Core character converters are built from make/java/java.
|
||||||
#
|
#
|
||||||
|
|
||||||
FILES_src = \
|
|
||||||
sun/io/ByteToCharDoubleByte.java \
|
|
||||||
sun/io/ByteToCharDBCS_ASCII.java \
|
|
||||||
sun/io/ByteToCharDBCS_EBCDIC.java \
|
|
||||||
sun/io/ByteToCharEUC.java \
|
|
||||||
sun/io/CharToByteDoubleByte.java \
|
|
||||||
sun/io/CharToByteDBCS_ASCII.java \
|
|
||||||
sun/io/CharToByteDBCS_EBCDIC.java \
|
|
||||||
sun/io/CharToByteEUC.java \
|
|
||||||
sun/io/ByteToCharBig5.java \
|
|
||||||
sun/io/ByteToCharBig5_Solaris.java \
|
|
||||||
sun/io/ByteToCharBig5_HKSCS.java \
|
|
||||||
sun/io/ByteToCharMS950_HKSCS.java \
|
|
||||||
sun/io/ByteToCharGB18030.java \
|
|
||||||
sun/io/ByteToCharGB18030DB.java \
|
|
||||||
sun/io/ByteToCharCp037.java \
|
|
||||||
sun/io/ByteToCharCp1006.java \
|
|
||||||
sun/io/ByteToCharCp1025.java \
|
|
||||||
sun/io/ByteToCharCp1026.java \
|
|
||||||
sun/io/ByteToCharCp1046.java \
|
|
||||||
sun/io/ByteToCharCp1047.java \
|
|
||||||
sun/io/ByteToCharCp1097.java \
|
|
||||||
sun/io/ByteToCharCp1098.java \
|
|
||||||
sun/io/ByteToCharCp1112.java \
|
|
||||||
sun/io/ByteToCharCp1122.java \
|
|
||||||
sun/io/ByteToCharCp1123.java \
|
|
||||||
sun/io/ByteToCharCp1124.java \
|
|
||||||
sun/io/ByteToCharCp1140.java \
|
|
||||||
sun/io/ByteToCharCp1141.java \
|
|
||||||
sun/io/ByteToCharCp1142.java \
|
|
||||||
sun/io/ByteToCharCp1143.java \
|
|
||||||
sun/io/ByteToCharCp1144.java \
|
|
||||||
sun/io/ByteToCharCp1145.java \
|
|
||||||
sun/io/ByteToCharCp1146.java \
|
|
||||||
sun/io/ByteToCharCp1147.java \
|
|
||||||
sun/io/ByteToCharCp1148.java \
|
|
||||||
sun/io/ByteToCharCp1149.java \
|
|
||||||
sun/io/ByteToCharCp1255.java \
|
|
||||||
sun/io/ByteToCharCp1256.java \
|
|
||||||
sun/io/ByteToCharCp1258.java \
|
|
||||||
sun/io/ByteToCharCp1381.java \
|
|
||||||
sun/io/ByteToCharCp1383.java \
|
|
||||||
sun/io/ByteToCharCp273.java \
|
|
||||||
sun/io/ByteToCharCp277.java \
|
|
||||||
sun/io/ByteToCharCp278.java \
|
|
||||||
sun/io/ByteToCharCp280.java \
|
|
||||||
sun/io/ByteToCharCp284.java \
|
|
||||||
sun/io/ByteToCharCp285.java \
|
|
||||||
sun/io/ByteToCharCp297.java \
|
|
||||||
sun/io/ByteToCharCp33722.java \
|
|
||||||
sun/io/ByteToCharCp420.java \
|
|
||||||
sun/io/ByteToCharCp424.java \
|
|
||||||
sun/io/ByteToCharCp437.java \
|
|
||||||
sun/io/ByteToCharCp500.java \
|
|
||||||
sun/io/ByteToCharCp737.java \
|
|
||||||
sun/io/ByteToCharCp775.java \
|
|
||||||
sun/io/ByteToCharCp833.java \
|
|
||||||
sun/io/ByteToCharCp834.java \
|
|
||||||
sun/io/ByteToCharCp838.java \
|
|
||||||
sun/io/ByteToCharCp850.java \
|
|
||||||
sun/io/ByteToCharCp852.java \
|
|
||||||
sun/io/ByteToCharCp855.java \
|
|
||||||
sun/io/ByteToCharCp856.java \
|
|
||||||
sun/io/ByteToCharCp857.java \
|
|
||||||
sun/io/ByteToCharCp858.java \
|
|
||||||
sun/io/ByteToCharCp860.java \
|
|
||||||
sun/io/ByteToCharCp861.java \
|
|
||||||
sun/io/ByteToCharCp862.java \
|
|
||||||
sun/io/ByteToCharCp863.java \
|
|
||||||
sun/io/ByteToCharCp864.java \
|
|
||||||
sun/io/ByteToCharCp865.java \
|
|
||||||
sun/io/ByteToCharCp866.java \
|
|
||||||
sun/io/ByteToCharCp868.java \
|
|
||||||
sun/io/ByteToCharCp869.java \
|
|
||||||
sun/io/ByteToCharCp870.java \
|
|
||||||
sun/io/ByteToCharCp871.java \
|
|
||||||
sun/io/ByteToCharCp874.java \
|
|
||||||
sun/io/ByteToCharCp875.java \
|
|
||||||
sun/io/ByteToCharCp918.java \
|
|
||||||
sun/io/ByteToCharCp921.java \
|
|
||||||
sun/io/ByteToCharCp922.java \
|
|
||||||
sun/io/ByteToCharCp930.java \
|
|
||||||
sun/io/ByteToCharCp933.java \
|
|
||||||
sun/io/ByteToCharCp935.java \
|
|
||||||
sun/io/ByteToCharCp937.java \
|
|
||||||
sun/io/ByteToCharCp939.java \
|
|
||||||
sun/io/ByteToCharCp942.java \
|
|
||||||
sun/io/ByteToCharCp942C.java \
|
|
||||||
sun/io/ByteToCharCp943.java \
|
|
||||||
sun/io/ByteToCharCp943C.java \
|
|
||||||
sun/io/ByteToCharCp948.java \
|
|
||||||
sun/io/ByteToCharCp949.java \
|
|
||||||
sun/io/ByteToCharCp949C.java \
|
|
||||||
sun/io/ByteToCharCp950.java \
|
|
||||||
sun/io/ByteToCharCp964.java \
|
|
||||||
sun/io/ByteToCharCp970.java \
|
|
||||||
sun/io/ByteToCharJIS0201.java \
|
|
||||||
sun/io/ByteToCharJIS0208.java \
|
|
||||||
sun/io/ByteToCharJIS0208_Solaris.java \
|
|
||||||
sun/io/ByteToCharJIS0212.java \
|
|
||||||
sun/io/ByteToCharJIS0212_Solaris.java \
|
|
||||||
sun/io/ByteToCharEUC_CN.java \
|
|
||||||
sun/io/ByteToCharEUC_JP.java \
|
|
||||||
sun/io/ByteToCharEUC_JP_LINUX.java \
|
|
||||||
sun/io/ByteToCharEUC_JP_Solaris.java \
|
|
||||||
sun/io/ByteToCharEUC_KR.java \
|
|
||||||
sun/io/ByteToCharEUC_TW.java \
|
|
||||||
sun/io/ByteToCharSJIS.java \
|
|
||||||
sun/io/ByteToCharPCK.java \
|
|
||||||
sun/io/ByteToCharGBK.java \
|
|
||||||
sun/io/ByteToCharISCII91.java \
|
|
||||||
sun/io/ByteToCharISO2022.java \
|
|
||||||
sun/io/ByteToCharISO2022CN.java \
|
|
||||||
sun/io/ByteToCharISO2022JP.java \
|
|
||||||
sun/io/ByteToCharISO2022KR.java \
|
|
||||||
sun/io/ByteToCharISO8859_3.java \
|
|
||||||
sun/io/ByteToCharISO8859_6.java \
|
|
||||||
sun/io/ByteToCharISO8859_8.java \
|
|
||||||
sun/io/ByteToCharJISAutoDetect.java \
|
|
||||||
sun/io/ByteToCharJohab.java \
|
|
||||||
sun/io/ByteToCharMS874.java \
|
|
||||||
sun/io/ByteToCharMS932.java \
|
|
||||||
sun/io/ByteToCharMS936.java \
|
|
||||||
sun/io/ByteToCharMS949.java \
|
|
||||||
sun/io/ByteToCharMS950.java \
|
|
||||||
sun/io/ByteToCharMacArabic.java \
|
|
||||||
sun/io/ByteToCharMacCentralEurope.java \
|
|
||||||
sun/io/ByteToCharMacCroatian.java \
|
|
||||||
sun/io/ByteToCharMacCyrillic.java \
|
|
||||||
sun/io/ByteToCharMacDingbat.java \
|
|
||||||
sun/io/ByteToCharMacGreek.java \
|
|
||||||
sun/io/ByteToCharMacHebrew.java \
|
|
||||||
sun/io/ByteToCharMacIceland.java \
|
|
||||||
sun/io/ByteToCharMacRoman.java \
|
|
||||||
sun/io/ByteToCharMacRomania.java \
|
|
||||||
sun/io/ByteToCharMacSymbol.java \
|
|
||||||
sun/io/ByteToCharMacThai.java \
|
|
||||||
sun/io/ByteToCharMacTurkish.java \
|
|
||||||
sun/io/ByteToCharMacUkraine.java \
|
|
||||||
sun/io/ByteToCharTIS620.java \
|
|
||||||
sun/io/CharToByteBig5.java \
|
|
||||||
sun/io/CharToByteBig5_Solaris.java \
|
|
||||||
sun/io/CharToByteBig5_HKSCS.java \
|
|
||||||
sun/io/CharToByteMS950_HKSCS.java \
|
|
||||||
sun/io/CharToByteGB18030.java \
|
|
||||||
sun/io/CharToByteCp037.java \
|
|
||||||
sun/io/CharToByteCp1006.java \
|
|
||||||
sun/io/CharToByteCp1025.java \
|
|
||||||
sun/io/CharToByteCp1026.java \
|
|
||||||
sun/io/CharToByteCp1046.java \
|
|
||||||
sun/io/CharToByteCp1047.java \
|
|
||||||
sun/io/CharToByteCp1097.java \
|
|
||||||
sun/io/CharToByteCp1098.java \
|
|
||||||
sun/io/CharToByteCp1112.java \
|
|
||||||
sun/io/CharToByteCp1122.java \
|
|
||||||
sun/io/CharToByteCp1123.java \
|
|
||||||
sun/io/CharToByteCp1124.java \
|
|
||||||
sun/io/CharToByteCp1140.java \
|
|
||||||
sun/io/CharToByteCp1141.java \
|
|
||||||
sun/io/CharToByteCp1142.java \
|
|
||||||
sun/io/CharToByteCp1143.java \
|
|
||||||
sun/io/CharToByteCp1144.java \
|
|
||||||
sun/io/CharToByteCp1145.java \
|
|
||||||
sun/io/CharToByteCp1146.java \
|
|
||||||
sun/io/CharToByteCp1147.java \
|
|
||||||
sun/io/CharToByteCp1148.java \
|
|
||||||
sun/io/CharToByteCp1149.java \
|
|
||||||
sun/io/CharToByteCp1255.java \
|
|
||||||
sun/io/CharToByteCp1256.java \
|
|
||||||
sun/io/CharToByteCp1258.java \
|
|
||||||
sun/io/CharToByteCp1381.java \
|
|
||||||
sun/io/CharToByteCp1383.java \
|
|
||||||
sun/io/CharToByteCp273.java \
|
|
||||||
sun/io/CharToByteCp277.java \
|
|
||||||
sun/io/CharToByteCp278.java \
|
|
||||||
sun/io/CharToByteCp280.java \
|
|
||||||
sun/io/CharToByteCp284.java \
|
|
||||||
sun/io/CharToByteCp285.java \
|
|
||||||
sun/io/CharToByteCp297.java \
|
|
||||||
sun/io/CharToByteCp33722.java \
|
|
||||||
sun/io/CharToByteCp420.java \
|
|
||||||
sun/io/CharToByteCp424.java \
|
|
||||||
sun/io/CharToByteCp437.java \
|
|
||||||
sun/io/CharToByteCp500.java \
|
|
||||||
sun/io/CharToByteCp737.java \
|
|
||||||
sun/io/CharToByteCp775.java \
|
|
||||||
sun/io/CharToByteCp833.java \
|
|
||||||
sun/io/CharToByteCp834.java \
|
|
||||||
sun/io/CharToByteCp838.java \
|
|
||||||
sun/io/CharToByteCp850.java \
|
|
||||||
sun/io/CharToByteCp852.java \
|
|
||||||
sun/io/CharToByteCp855.java \
|
|
||||||
sun/io/CharToByteCp856.java \
|
|
||||||
sun/io/CharToByteCp857.java \
|
|
||||||
sun/io/CharToByteCp858.java \
|
|
||||||
sun/io/CharToByteCp860.java \
|
|
||||||
sun/io/CharToByteCp861.java \
|
|
||||||
sun/io/CharToByteCp862.java \
|
|
||||||
sun/io/CharToByteCp863.java \
|
|
||||||
sun/io/CharToByteCp864.java \
|
|
||||||
sun/io/CharToByteCp865.java \
|
|
||||||
sun/io/CharToByteCp866.java \
|
|
||||||
sun/io/CharToByteCp868.java \
|
|
||||||
sun/io/CharToByteCp869.java \
|
|
||||||
sun/io/CharToByteCp870.java \
|
|
||||||
sun/io/CharToByteCp871.java \
|
|
||||||
sun/io/CharToByteCp874.java \
|
|
||||||
sun/io/CharToByteCp875.java \
|
|
||||||
sun/io/CharToByteCp918.java \
|
|
||||||
sun/io/CharToByteCp921.java \
|
|
||||||
sun/io/CharToByteCp922.java \
|
|
||||||
sun/io/CharToByteCp930.java \
|
|
||||||
sun/io/CharToByteCp933.java \
|
|
||||||
sun/io/CharToByteCp935.java \
|
|
||||||
sun/io/CharToByteCp937.java \
|
|
||||||
sun/io/CharToByteCp939.java \
|
|
||||||
sun/io/CharToByteCp942.java \
|
|
||||||
sun/io/CharToByteCp942C.java \
|
|
||||||
sun/io/CharToByteCp943.java \
|
|
||||||
sun/io/CharToByteCp943C.java \
|
|
||||||
sun/io/CharToByteCp948.java \
|
|
||||||
sun/io/CharToByteCp949.java \
|
|
||||||
sun/io/CharToByteCp949C.java \
|
|
||||||
sun/io/CharToByteCp950.java \
|
|
||||||
sun/io/CharToByteCp964.java \
|
|
||||||
sun/io/CharToByteCp970.java \
|
|
||||||
sun/io/CharToByteJIS0201.java \
|
|
||||||
sun/io/CharToByteJIS0208.java \
|
|
||||||
sun/io/CharToByteJIS0208_Solaris.java \
|
|
||||||
sun/io/CharToByteJIS0212.java \
|
|
||||||
sun/io/CharToByteJIS0212_Solaris.java \
|
|
||||||
sun/io/CharToByteEUC_CN.java \
|
|
||||||
sun/io/CharToByteEUC_JP.java \
|
|
||||||
sun/io/CharToByteEUC_JP_LINUX.java \
|
|
||||||
sun/io/CharToByteEUC_JP_Solaris.java \
|
|
||||||
sun/io/CharToByteEUC_KR.java \
|
|
||||||
sun/io/CharToByteEUC_TW.java \
|
|
||||||
sun/io/CharToByteSJIS.java \
|
|
||||||
sun/io/CharToBytePCK.java \
|
|
||||||
sun/io/CharToByteGBK.java \
|
|
||||||
sun/io/CharToByteISCII91.java \
|
|
||||||
sun/io/CharToByteISO2022.java \
|
|
||||||
sun/io/CharToByteISO2022CN_CNS.java \
|
|
||||||
sun/io/CharToByteISO2022CN_GB.java \
|
|
||||||
sun/io/CharToByteISO2022JP.java \
|
|
||||||
sun/io/CharToByteISO2022KR.java \
|
|
||||||
sun/io/CharToByteISO8859_3.java \
|
|
||||||
sun/io/CharToByteISO8859_6.java \
|
|
||||||
sun/io/CharToByteISO8859_8.java \
|
|
||||||
sun/io/CharToByteJohab.java \
|
|
||||||
sun/io/CharToByteMS874.java \
|
|
||||||
sun/io/CharToByteMS932.java \
|
|
||||||
sun/io/CharToByteMS936.java \
|
|
||||||
sun/io/CharToByteMS949.java \
|
|
||||||
sun/io/CharToByteMS950.java \
|
|
||||||
sun/io/CharToByteMacArabic.java \
|
|
||||||
sun/io/CharToByteMacCentralEurope.java \
|
|
||||||
sun/io/CharToByteMacCroatian.java \
|
|
||||||
sun/io/CharToByteMacCyrillic.java \
|
|
||||||
sun/io/CharToByteMacDingbat.java \
|
|
||||||
sun/io/CharToByteMacGreek.java \
|
|
||||||
sun/io/CharToByteMacHebrew.java \
|
|
||||||
sun/io/CharToByteMacIceland.java \
|
|
||||||
sun/io/CharToByteMacRoman.java \
|
|
||||||
sun/io/CharToByteMacRomania.java \
|
|
||||||
sun/io/CharToByteMacSymbol.java \
|
|
||||||
sun/io/CharToByteMacThai.java \
|
|
||||||
sun/io/CharToByteMacTurkish.java \
|
|
||||||
sun/io/CharToByteMacUkraine.java \
|
|
||||||
sun/io/CharToByteTIS620.java
|
|
||||||
|
|
||||||
FILES_gen_extcs = \
|
FILES_gen_extcs = \
|
||||||
sun/nio/cs/ext/IBM037.java \
|
sun/nio/cs/ext/IBM037.java \
|
||||||
sun/nio/cs/ext/IBM1006.java \
|
sun/nio/cs/ext/IBM1006.java \
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
BUILDDIR = ../..
|
BUILDDIR = ../..
|
||||||
|
SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
|
||||||
|
SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
# build sun/security/jgss/wrapper on non-windows platform
|
# build sun/security/jgss/wrapper on non-windows platform
|
||||||
|
@ -109,6 +109,9 @@ ifndef OPENJDK
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
JAVAC_MAX_WARNINGS=false
|
||||||
|
JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
|
||||||
|
JAVAC_WARNINGS_FATAL=true
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,6 +26,9 @@
|
|||||||
BUILDDIR = ../../..
|
BUILDDIR = ../../..
|
||||||
PACKAGE = sun.security.other
|
PACKAGE = sun.security.other
|
||||||
PRODUCT = sun
|
PRODUCT = sun
|
||||||
|
JAVAC_MAX_WARNINGS=false
|
||||||
|
JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
|
||||||
|
JAVAC_WARNINGS_FATAL=true
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -110,6 +110,9 @@ ifndef OPENJDK
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
JAVAC_MAX_WARNINGS=false
|
||||||
|
JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
|
||||||
|
JAVAC_WARNINGS_FATAL=true
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -55,18 +55,6 @@ public class $NAME_CLZ$ extends Charset implements HistoricallyNamedCharset
|
|||||||
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
return new SingleByte.Encoder(this, c2b, c2bIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDecoderSingleByteMappings() {
|
|
||||||
return b2cTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public char[] getEncoderIndex2() {
|
|
||||||
return c2b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public char[] getEncoderIndex1() {
|
|
||||||
return c2bIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final static String b2cTable = $B2CTABLE$
|
private final static String b2cTable = $B2CTABLE$
|
||||||
|
|
||||||
private final static char[] b2c = b2cTable.toCharArray();
|
private final static char[] b2c = b2cTable.toCharArray();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -245,7 +245,7 @@ final class AESCrypt extends SymmetricCipher implements AESConstants
|
|||||||
for (j = 0; j < 8; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
tmp = AA[i][j];
|
tmp = AA[i][j];
|
||||||
AA[i][j] = AA[t][j];
|
AA[i][j] = AA[t][j];
|
||||||
AA[t][j] = (byte) tmp;
|
AA[t][j] = tmp;
|
||||||
}
|
}
|
||||||
pivot = AA[i][i];
|
pivot = AA[i][i];
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,13 +25,10 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import sun.security.util.*;
|
|
||||||
import java.security.AlgorithmParametersSpi;
|
import java.security.AlgorithmParametersSpi;
|
||||||
import java.security.spec.AlgorithmParameterSpec;
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
import java.security.spec.InvalidParameterSpecException;
|
import java.security.spec.InvalidParameterSpecException;
|
||||||
import javax.crypto.spec.IvParameterSpec;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements the parameter (IV) used with the AES algorithm
|
* This class implements the parameter (IV) used with the AES algorithm
|
||||||
@ -67,9 +64,15 @@ public final class AESParameters extends AlgorithmParametersSpi {
|
|||||||
core.init(encoded, decodingMethod);
|
core.init(encoded, decodingMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
protected <T extends AlgorithmParameterSpec>
|
||||||
|
T engineGetParameterSpec(Class<T> paramSpec)
|
||||||
throws InvalidParameterSpecException {
|
throws InvalidParameterSpecException {
|
||||||
return core.getParameterSpec(paramSpec);
|
if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||||
|
return core.getParameterSpec(paramSpec);
|
||||||
|
} else {
|
||||||
|
throw new InvalidParameterSpecException
|
||||||
|
("Inappropriate parameter Specification");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected byte[] engineGetEncoded() throws IOException {
|
protected byte[] engineGetEncoded() throws IOException {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import sun.security.util.*;
|
import sun.security.util.*;
|
||||||
import sun.misc.HexDumpEncoder;
|
import sun.misc.HexDumpEncoder;
|
||||||
@ -64,7 +63,7 @@ final class BlockCipherParamsCore {
|
|||||||
throw new InvalidParameterSpecException("IV not " +
|
throw new InvalidParameterSpecException("IV not " +
|
||||||
block_size + " bytes long");
|
block_size + " bytes long");
|
||||||
}
|
}
|
||||||
iv = (byte[]) tmpIv.clone();
|
iv = tmpIv.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(byte[] encoded) throws IOException {
|
void init(byte[] encoded) throws IOException {
|
||||||
@ -90,11 +89,11 @@ final class BlockCipherParamsCore {
|
|||||||
init(encoded);
|
init(encoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
AlgorithmParameterSpec getParameterSpec(Class paramSpec)
|
<T extends AlgorithmParameterSpec> T getParameterSpec(Class<T> paramSpec)
|
||||||
throws InvalidParameterSpecException
|
throws InvalidParameterSpecException
|
||||||
{
|
{
|
||||||
if (IvParameterSpec.class.isAssignableFrom(paramSpec)) {
|
if (IvParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||||
return new IvParameterSpec(this.iv);
|
return paramSpec.cast(new IvParameterSpec(this.iv));
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidParameterSpecException
|
throw new InvalidParameterSpecException
|
||||||
("Inappropriate parameter specification");
|
("Inappropriate parameter specification");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,13 +25,10 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import sun.security.util.*;
|
|
||||||
import java.security.AlgorithmParametersSpi;
|
import java.security.AlgorithmParametersSpi;
|
||||||
import java.security.spec.AlgorithmParameterSpec;
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
import java.security.spec.InvalidParameterSpecException;
|
import java.security.spec.InvalidParameterSpecException;
|
||||||
import javax.crypto.spec.IvParameterSpec;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements the parameter (IV) used with the Blowfish algorithm in
|
* This class implements the parameter (IV) used with the Blowfish algorithm in
|
||||||
@ -68,9 +65,15 @@ public final class BlowfishParameters extends AlgorithmParametersSpi {
|
|||||||
core.init(encoded, decodingMethod);
|
core.init(encoded, decodingMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
protected <T extends AlgorithmParameterSpec>
|
||||||
|
T engineGetParameterSpec(Class<T> paramSpec)
|
||||||
throws InvalidParameterSpecException {
|
throws InvalidParameterSpecException {
|
||||||
return core.getParameterSpec(paramSpec);
|
if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||||
|
return core.getParameterSpec(paramSpec);
|
||||||
|
} else {
|
||||||
|
throw new InvalidParameterSpecException
|
||||||
|
("Inappropriate parameter Specification");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected byte[] engineGetEncoded() throws IOException {
|
protected byte[] engineGetEncoded() throws IOException {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -193,7 +193,7 @@ class CipherBlockChaining extends FeedbackCipher {
|
|||||||
// This is necessary because in this constellation, a
|
// This is necessary because in this constellation, a
|
||||||
// ciphertext block (or parts of it) will be overridden by
|
// ciphertext block (or parts of it) will be overridden by
|
||||||
// the plaintext result.
|
// the plaintext result.
|
||||||
cipherOrig = (byte[])cipher.clone();
|
cipherOrig = cipher.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; cipherOffset < endIndex;
|
for (; cipherOffset < endIndex;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -301,7 +301,7 @@ final class CipherCore {
|
|||||||
*/
|
*/
|
||||||
byte[] getIV() {
|
byte[] getIV() {
|
||||||
byte[] iv = cipher.getIV();
|
byte[] iv = cipher.getIV();
|
||||||
return (iv == null) ? null : (byte[])iv.clone();
|
return (iv == null) ? null : iv.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -475,8 +475,7 @@ final class CipherCore {
|
|||||||
IvParameterSpec ivSpec = null;
|
IvParameterSpec ivSpec = null;
|
||||||
if (params != null) {
|
if (params != null) {
|
||||||
try {
|
try {
|
||||||
ivSpec = (IvParameterSpec)params.getParameterSpec
|
ivSpec = params.getParameterSpec(IvParameterSpec.class);
|
||||||
(IvParameterSpec.class);
|
|
||||||
} catch (InvalidParameterSpecException ipse) {
|
} catch (InvalidParameterSpecException ipse) {
|
||||||
throw new InvalidAlgorithmParameterException("Wrong parameter "
|
throw new InvalidAlgorithmParameterException("Wrong parameter "
|
||||||
+ "type: IV "
|
+ "type: IV "
|
||||||
@ -832,7 +831,7 @@ final class CipherCore {
|
|||||||
buffered = 0;
|
buffered = 0;
|
||||||
diffBlocksize = blockSize;
|
diffBlocksize = blockSize;
|
||||||
if (cipherMode != ECB_MODE) {
|
if (cipherMode != ECB_MODE) {
|
||||||
((FeedbackCipher)cipher).reset();
|
cipher.reset();
|
||||||
}
|
}
|
||||||
return totalLen;
|
return totalLen;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -622,17 +622,17 @@ class DESCrypt extends SymmetricCipher implements DESConstants {
|
|||||||
// mangler function:
|
// mangler function:
|
||||||
// every 6 bit is fed into the sbox, which
|
// every 6 bit is fed into the sbox, which
|
||||||
// produces 4-bit output
|
// produces 4-bit output
|
||||||
left ^= s0p[(int)((temp & 0x3f) ^ key[j+0])]
|
left ^= s0p[(temp & 0x3f) ^ key[j+0]]
|
||||||
^ s1p[(int)(((temp >> 4) & 0x3f) ^ key[j+1])]
|
^ s1p[((temp >> 4) & 0x3f) ^ key[j+1]]
|
||||||
^ s2p[(int)(((temp >> 8) & 0x3f) ^ key[j+2])]
|
^ s2p[((temp >> 8) & 0x3f) ^ key[j+2]]
|
||||||
^ s3p[(int)(((temp >> 12) & 0x3f) ^ key[j+3])]
|
^ s3p[((temp >> 12) & 0x3f) ^ key[j+3]]
|
||||||
^ s4p[(int)(((temp >> 16) & 0x3f) ^ key[j+4])]
|
^ s4p[((temp >> 16) & 0x3f) ^ key[j+4]]
|
||||||
^ s5p[(int)(((temp >> 20) & 0x3f) ^ key[j+5])]
|
^ s5p[((temp >> 20) & 0x3f) ^ key[j+5]]
|
||||||
^ s6p[(int)(((temp >> 24) & 0x3f) ^ key[j+6])];
|
^ s6p[((temp >> 24) & 0x3f) ^ key[j+6]];
|
||||||
|
|
||||||
// make the last sbox input the last bit from right[0]
|
// make the last sbox input the last bit from right[0]
|
||||||
temp = ((right & 1) << 5) | ((right >> 27) & 0x1f);
|
temp = ((right & 1) << 5) | ((right >> 27) & 0x1f);
|
||||||
left ^= s7p[(int)(temp ^ key[j+7])];
|
left ^= s7p[temp ^ key[j+7]];
|
||||||
temp = left;
|
temp = left;
|
||||||
left = right;
|
left = right;
|
||||||
right = temp;
|
right = temp;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -78,7 +78,7 @@ final class DESKey implements SecretKey {
|
|||||||
public byte[] getEncoded() {
|
public byte[] getEncoded() {
|
||||||
// Return a copy of the key, rather than a reference,
|
// Return a copy of the key, rather than a reference,
|
||||||
// so that the key data cannot be modified from outside
|
// so that the key data cannot be modified from outside
|
||||||
return (byte[])this.key.clone();
|
return this.key.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlgorithm() {
|
public String getAlgorithm() {
|
||||||
@ -126,7 +126,7 @@ final class DESKey implements SecretKey {
|
|||||||
throws java.io.IOException, ClassNotFoundException
|
throws java.io.IOException, ClassNotFoundException
|
||||||
{
|
{
|
||||||
s.defaultReadObject();
|
s.defaultReadObject();
|
||||||
key = (byte[])key.clone();
|
key = key.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -92,7 +92,7 @@ public final class DESKeyFactory extends SecretKeyFactorySpi {
|
|||||||
* inappropriate for the given key, or the given key cannot be processed
|
* inappropriate for the given key, or the given key cannot be processed
|
||||||
* (e.g., the given key has an unrecognized algorithm or format).
|
* (e.g., the given key has an unrecognized algorithm or format).
|
||||||
*/
|
*/
|
||||||
protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
|
protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
|
||||||
throws InvalidKeySpecException {
|
throws InvalidKeySpecException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,13 +25,10 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import sun.security.util.*;
|
|
||||||
import java.security.AlgorithmParametersSpi;
|
import java.security.AlgorithmParametersSpi;
|
||||||
import java.security.spec.AlgorithmParameterSpec;
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
import java.security.spec.InvalidParameterSpecException;
|
import java.security.spec.InvalidParameterSpecException;
|
||||||
import javax.crypto.spec.IvParameterSpec;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements the parameter (IV) used with the DES algorithm in
|
* This class implements the parameter (IV) used with the DES algorithm in
|
||||||
@ -68,9 +65,15 @@ public final class DESParameters extends AlgorithmParametersSpi {
|
|||||||
core.init(encoded, decodingMethod);
|
core.init(encoded, decodingMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
protected <T extends AlgorithmParameterSpec>
|
||||||
|
T engineGetParameterSpec(Class<T> paramSpec)
|
||||||
throws InvalidParameterSpecException {
|
throws InvalidParameterSpecException {
|
||||||
return core.getParameterSpec(paramSpec);
|
if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||||
|
return core.getParameterSpec(paramSpec);
|
||||||
|
} else {
|
||||||
|
throw new InvalidParameterSpecException
|
||||||
|
("Inappropriate parameter Specification");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected byte[] engineGetEncoded() throws IOException {
|
protected byte[] engineGetEncoded() throws IOException {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -78,7 +78,7 @@ final class DESedeKey implements SecretKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getEncoded() {
|
public byte[] getEncoded() {
|
||||||
return (byte[])this.key.clone();
|
return this.key.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlgorithm() {
|
public String getAlgorithm() {
|
||||||
@ -127,7 +127,7 @@ final class DESedeKey implements SecretKey {
|
|||||||
throws java.io.IOException, ClassNotFoundException
|
throws java.io.IOException, ClassNotFoundException
|
||||||
{
|
{
|
||||||
s.defaultReadObject();
|
s.defaultReadObject();
|
||||||
key = (byte[])key.clone();
|
key = key.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -92,7 +92,7 @@ public final class DESedeKeyFactory extends SecretKeyFactorySpi {
|
|||||||
* inappropriate for the given key, or the given key cannot be processed
|
* inappropriate for the given key, or the given key cannot be processed
|
||||||
* (e.g., the given key has an unrecognized algorithm or format).
|
* (e.g., the given key has an unrecognized algorithm or format).
|
||||||
*/
|
*/
|
||||||
protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
|
protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
|
||||||
throws InvalidKeySpecException {
|
throws InvalidKeySpecException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,13 +25,10 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import sun.security.util.*;
|
|
||||||
import java.security.AlgorithmParametersSpi;
|
import java.security.AlgorithmParametersSpi;
|
||||||
import java.security.spec.AlgorithmParameterSpec;
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
import java.security.spec.InvalidParameterSpecException;
|
import java.security.spec.InvalidParameterSpecException;
|
||||||
import javax.crypto.spec.IvParameterSpec;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements the parameter (IV) used with the Triple DES algorithm
|
* This class implements the parameter (IV) used with the Triple DES algorithm
|
||||||
@ -67,9 +64,15 @@ public final class DESedeParameters extends AlgorithmParametersSpi {
|
|||||||
core.init(encoded, decodingMethod);
|
core.init(encoded, decodingMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
protected <T extends AlgorithmParameterSpec>
|
||||||
|
T engineGetParameterSpec(Class<T> paramSpec)
|
||||||
throws InvalidParameterSpecException {
|
throws InvalidParameterSpecException {
|
||||||
return core.getParameterSpec(paramSpec);
|
if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||||
|
return core.getParameterSpec(paramSpec);
|
||||||
|
} else {
|
||||||
|
throw new InvalidParameterSpecException
|
||||||
|
("Inappropriate parameter Specification");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected byte[] engineGetEncoded() throws IOException {
|
protected byte[] engineGetEncoded() throws IOException {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
import java.security.spec.*;
|
import java.security.spec.*;
|
||||||
import javax.crypto.*;
|
import javax.crypto.*;
|
||||||
@ -151,7 +150,7 @@ public final class DESedeWrapCipher extends CipherSpi {
|
|||||||
* been set.
|
* been set.
|
||||||
*/
|
*/
|
||||||
protected byte[] engineGetIV() {
|
protected byte[] engineGetIV() {
|
||||||
return (iv == null? null:(byte[]) iv.clone());
|
return (iv == null) ? null : iv.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -277,8 +276,7 @@ public final class DESedeWrapCipher extends CipherSpi {
|
|||||||
try {
|
try {
|
||||||
DESedeParameters paramsEng = new DESedeParameters();
|
DESedeParameters paramsEng = new DESedeParameters();
|
||||||
paramsEng.engineInit(params.getEncoded());
|
paramsEng.engineInit(params.getEncoded());
|
||||||
ivSpec = (IvParameterSpec)
|
ivSpec = paramsEng.engineGetParameterSpec(IvParameterSpec.class);
|
||||||
paramsEng.engineGetParameterSpec(IvParameterSpec.class);
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
InvalidAlgorithmParameterException iape =
|
InvalidAlgorithmParameterException iape =
|
||||||
new InvalidAlgorithmParameterException
|
new InvalidAlgorithmParameterException
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.lang.*;
|
|
||||||
import java.security.Key;
|
import java.security.Key;
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
@ -140,7 +138,8 @@ public final class DHKeyFactory extends KeyFactorySpi {
|
|||||||
* inappropriate for the given key, or the given key cannot be processed
|
* inappropriate for the given key, or the given key cannot be processed
|
||||||
* (e.g., the given key has an unrecognized algorithm or format).
|
* (e.g., the given key has an unrecognized algorithm or format).
|
||||||
*/
|
*/
|
||||||
protected KeySpec engineGetKeySpec(Key key, Class keySpec)
|
protected <T extends KeySpec>
|
||||||
|
T engineGetKeySpec(Key key, Class<T> keySpec)
|
||||||
throws InvalidKeySpecException {
|
throws InvalidKeySpecException {
|
||||||
DHParameterSpec params;
|
DHParameterSpec params;
|
||||||
|
|
||||||
@ -150,12 +149,12 @@ public final class DHKeyFactory extends KeyFactorySpi {
|
|||||||
javax.crypto.interfaces.DHPublicKey dhPubKey
|
javax.crypto.interfaces.DHPublicKey dhPubKey
|
||||||
= (javax.crypto.interfaces.DHPublicKey) key;
|
= (javax.crypto.interfaces.DHPublicKey) key;
|
||||||
params = dhPubKey.getParams();
|
params = dhPubKey.getParams();
|
||||||
return new DHPublicKeySpec(dhPubKey.getY(),
|
return keySpec.cast(new DHPublicKeySpec(dhPubKey.getY(),
|
||||||
params.getP(),
|
params.getP(),
|
||||||
params.getG());
|
params.getG()));
|
||||||
|
|
||||||
} else if (X509EncodedKeySpec.class.isAssignableFrom(keySpec)) {
|
} else if (X509EncodedKeySpec.class.isAssignableFrom(keySpec)) {
|
||||||
return new X509EncodedKeySpec(key.getEncoded());
|
return keySpec.cast(new X509EncodedKeySpec(key.getEncoded()));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidKeySpecException
|
throw new InvalidKeySpecException
|
||||||
@ -168,12 +167,12 @@ public final class DHKeyFactory extends KeyFactorySpi {
|
|||||||
javax.crypto.interfaces.DHPrivateKey dhPrivKey
|
javax.crypto.interfaces.DHPrivateKey dhPrivKey
|
||||||
= (javax.crypto.interfaces.DHPrivateKey)key;
|
= (javax.crypto.interfaces.DHPrivateKey)key;
|
||||||
params = dhPrivKey.getParams();
|
params = dhPrivKey.getParams();
|
||||||
return new DHPrivateKeySpec(dhPrivKey.getX(),
|
return keySpec.cast(new DHPrivateKeySpec(dhPrivKey.getX(),
|
||||||
params.getP(),
|
params.getP(),
|
||||||
params.getG());
|
params.getG()));
|
||||||
|
|
||||||
} else if (PKCS8EncodedKeySpec.class.isAssignableFrom(keySpec)) {
|
} else if (PKCS8EncodedKeySpec.class.isAssignableFrom(keySpec)) {
|
||||||
return new PKCS8EncodedKeySpec(key.getEncoded());
|
return keySpec.cast(new PKCS8EncodedKeySpec(key.getEncoded()));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidKeySpecException
|
throw new InvalidKeySpecException
|
||||||
@ -208,8 +207,7 @@ public final class DHKeyFactory extends KeyFactorySpi {
|
|||||||
}
|
}
|
||||||
// Convert key to spec
|
// Convert key to spec
|
||||||
DHPublicKeySpec dhPubKeySpec
|
DHPublicKeySpec dhPubKeySpec
|
||||||
= (DHPublicKeySpec)engineGetKeySpec
|
= engineGetKeySpec(key, DHPublicKeySpec.class);
|
||||||
(key, DHPublicKeySpec.class);
|
|
||||||
// Create key from spec, and return it
|
// Create key from spec, and return it
|
||||||
return engineGeneratePublic(dhPubKeySpec);
|
return engineGeneratePublic(dhPubKeySpec);
|
||||||
|
|
||||||
@ -220,8 +218,7 @@ public final class DHKeyFactory extends KeyFactorySpi {
|
|||||||
}
|
}
|
||||||
// Convert key to spec
|
// Convert key to spec
|
||||||
DHPrivateKeySpec dhPrivKeySpec
|
DHPrivateKeySpec dhPrivKeySpec
|
||||||
= (DHPrivateKeySpec)engineGetKeySpec
|
= engineGetKeySpec(key, DHPrivateKeySpec.class);
|
||||||
(key, DHPrivateKeySpec.class);
|
|
||||||
// Create key from spec, and return it
|
// Create key from spec, and return it
|
||||||
return engineGeneratePrivate(dhPrivKeySpec);
|
return engineGeneratePrivate(dhPrivKeySpec);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
import java.security.spec.*;
|
import java.security.spec.*;
|
||||||
import javax.crypto.spec.DHParameterSpec;
|
import javax.crypto.spec.DHParameterSpec;
|
||||||
@ -141,8 +140,7 @@ extends AlgorithmParameterGeneratorSpi {
|
|||||||
paramGen = AlgorithmParameterGenerator.getInstance("DSA");
|
paramGen = AlgorithmParameterGenerator.getInstance("DSA");
|
||||||
paramGen.init(this.primeSize, random);
|
paramGen.init(this.primeSize, random);
|
||||||
algParams = paramGen.generateParameters();
|
algParams = paramGen.generateParameters();
|
||||||
dsaParamSpec = (DSAParameterSpec)
|
dsaParamSpec = algParams.getParameterSpec(DSAParameterSpec.class);
|
||||||
algParams.getParameterSpec(DSAParameterSpec.class);
|
|
||||||
|
|
||||||
DHParameterSpec dhParamSpec;
|
DHParameterSpec dhParamSpec;
|
||||||
if (this.exponentSize > 0) {
|
if (this.exponentSize > 0) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import sun.security.util.*;
|
import sun.security.util.*;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
@ -95,11 +94,12 @@ public final class DHParameters extends AlgorithmParametersSpi {
|
|||||||
engineInit(params);
|
engineInit(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
protected <T extends AlgorithmParameterSpec>
|
||||||
|
T engineGetParameterSpec(Class<T> paramSpec)
|
||||||
throws InvalidParameterSpecException {
|
throws InvalidParameterSpecException {
|
||||||
|
|
||||||
if (DHParameterSpec.class.isAssignableFrom(paramSpec)) {
|
if (DHParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||||
return new DHParameterSpec(this.p, this.g, this.l);
|
return paramSpec.cast(new DHParameterSpec(this.p, this.g, this.l));
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidParameterSpecException
|
throw new InvalidParameterSpecException
|
||||||
("Inappropriate parameter Specification");
|
("Inappropriate parameter Specification");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -31,7 +31,6 @@ import java.security.KeyRep;
|
|||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.ProviderException;
|
import java.security.ProviderException;
|
||||||
import javax.crypto.*;
|
|
||||||
import javax.crypto.spec.DHParameterSpec;
|
import javax.crypto.spec.DHParameterSpec;
|
||||||
import sun.security.util.*;
|
import sun.security.util.*;
|
||||||
|
|
||||||
@ -182,7 +181,7 @@ javax.crypto.interfaces.DHPrivateKey, Serializable {
|
|||||||
|
|
||||||
// ignore OPTIONAL attributes
|
// ignore OPTIONAL attributes
|
||||||
|
|
||||||
this.encodedKey = (byte[])encodedKey.clone();
|
this.encodedKey = encodedKey.clone();
|
||||||
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
InvalidKeyException ike = new InvalidKeyException(
|
InvalidKeyException ike = new InvalidKeyException(
|
||||||
@ -256,7 +255,7 @@ javax.crypto.interfaces.DHPrivateKey, Serializable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (byte[])this.encodedKey.clone();
|
return this.encodedKey.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,10 +29,8 @@ import java.io.*;
|
|||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.KeyRep;
|
import java.security.KeyRep;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
|
||||||
import java.security.ProviderException;
|
import java.security.ProviderException;
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import javax.crypto.*;
|
|
||||||
import javax.crypto.spec.DHParameterSpec;
|
import javax.crypto.spec.DHParameterSpec;
|
||||||
import sun.security.util.*;
|
import sun.security.util.*;
|
||||||
|
|
||||||
@ -174,7 +172,7 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
|||||||
throw new InvalidKeyException("Excess key data");
|
throw new InvalidKeyException("Excess key data");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.encodedKey = (byte[])encodedKey.clone();
|
this.encodedKey = encodedKey.clone();
|
||||||
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
throw new InvalidKeyException("Private-value length too big");
|
throw new InvalidKeyException("Private-value length too big");
|
||||||
@ -237,7 +235,7 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (byte[])this.encodedKey.clone();
|
return this.encodedKey.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -77,7 +77,7 @@ final class EncryptedPrivateKeyInfo {
|
|||||||
if (seq[1].data.available() != 0)
|
if (seq[1].data.available() != 0)
|
||||||
throw new IOException("encryptedData field overrun");
|
throw new IOException("encryptedData field overrun");
|
||||||
|
|
||||||
this.encoded = (byte[])encoded.clone();
|
this.encoded = encoded.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,7 +86,7 @@ final class EncryptedPrivateKeyInfo {
|
|||||||
*/
|
*/
|
||||||
EncryptedPrivateKeyInfo(AlgorithmId algid, byte[] encryptedData) {
|
EncryptedPrivateKeyInfo(AlgorithmId algid, byte[] encryptedData) {
|
||||||
this.algid = algid;
|
this.algid = algid;
|
||||||
this.encryptedData = (byte[])encryptedData.clone();
|
this.encryptedData = encryptedData.clone();
|
||||||
this.encoded = null; // lazy generation of encoding
|
this.encoded = null; // lazy generation of encoding
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ final class EncryptedPrivateKeyInfo {
|
|||||||
* Returns the encrypted data.
|
* Returns the encrypted data.
|
||||||
*/
|
*/
|
||||||
byte[] getEncryptedData() {
|
byte[] getEncryptedData() {
|
||||||
return (byte[])this.encryptedData.clone();
|
return this.encryptedData.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,7 +110,7 @@ final class EncryptedPrivateKeyInfo {
|
|||||||
byte[] getEncoded()
|
byte[] getEncoded()
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
if (this.encoded != null) return (byte[])this.encoded.clone();
|
if (this.encoded != null) return this.encoded.clone();
|
||||||
|
|
||||||
DerOutputStream out = new DerOutputStream();
|
DerOutputStream out = new DerOutputStream();
|
||||||
DerOutputStream tmp = new DerOutputStream();
|
DerOutputStream tmp = new DerOutputStream();
|
||||||
@ -125,6 +125,6 @@ final class EncryptedPrivateKeyInfo {
|
|||||||
out.write(DerValue.tag_Sequence, tmp);
|
out.write(DerValue.tag_Sequence, tmp);
|
||||||
this.encoded = out.toByteArray();
|
this.encoded = out.toByteArray();
|
||||||
|
|
||||||
return (byte[])this.encoded.clone();
|
return this.encoded.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -78,8 +78,8 @@ final class HmacCore implements Cloneable {
|
|||||||
private HmacCore(HmacCore other) throws CloneNotSupportedException {
|
private HmacCore(HmacCore other) throws CloneNotSupportedException {
|
||||||
this.md = (MessageDigest)other.md.clone();
|
this.md = (MessageDigest)other.md.clone();
|
||||||
this.blockLen = other.blockLen;
|
this.blockLen = other.blockLen;
|
||||||
this.k_ipad = (byte[])other.k_ipad.clone();
|
this.k_ipad = other.k_ipad.clone();
|
||||||
this.k_opad = (byte[])other.k_opad.clone();
|
this.k_opad = other.k_opad.clone();
|
||||||
this.first = other.first;
|
this.first = other.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -38,9 +38,7 @@ import java.security.KeyStoreException;
|
|||||||
import java.security.UnrecoverableKeyException;
|
import java.security.UnrecoverableKeyException;
|
||||||
import java.security.cert.Certificate;
|
import java.security.cert.Certificate;
|
||||||
import java.security.cert.CertificateFactory;
|
import java.security.cert.CertificateFactory;
|
||||||
import java.security.cert.X509Certificate;
|
|
||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
import java.security.spec.InvalidKeySpecException;
|
|
||||||
import javax.crypto.SealedObject;
|
import javax.crypto.SealedObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,7 +85,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
|||||||
* Private keys and certificates are stored in a hashtable.
|
* Private keys and certificates are stored in a hashtable.
|
||||||
* Hash entries are keyed by alias names.
|
* Hash entries are keyed by alias names.
|
||||||
*/
|
*/
|
||||||
private Hashtable entries = new Hashtable();
|
private Hashtable<String, Object> entries = new Hashtable<String, Object>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the key associated with the given alias, using the given
|
* Returns the key associated with the given alias, using the given
|
||||||
@ -156,7 +154,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
|||||||
|
|
||||||
if ((entry instanceof PrivateKeyEntry)
|
if ((entry instanceof PrivateKeyEntry)
|
||||||
&& (((PrivateKeyEntry)entry).chain != null)) {
|
&& (((PrivateKeyEntry)entry).chain != null)) {
|
||||||
chain = (Certificate[])((PrivateKeyEntry)entry).chain.clone();
|
chain = ((PrivateKeyEntry)entry).chain.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
return chain;
|
return chain;
|
||||||
@ -262,7 +260,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
|||||||
// clone the chain
|
// clone the chain
|
||||||
if ((chain != null) &&
|
if ((chain != null) &&
|
||||||
(chain.length !=0)) {
|
(chain.length !=0)) {
|
||||||
entry.chain = (Certificate[])chain.clone();
|
entry.chain = chain.clone();
|
||||||
} else {
|
} else {
|
||||||
entry.chain = null;
|
entry.chain = null;
|
||||||
}
|
}
|
||||||
@ -316,10 +314,10 @@ public final class JceKeyStore extends KeyStoreSpi {
|
|||||||
PrivateKeyEntry entry = new PrivateKeyEntry();
|
PrivateKeyEntry entry = new PrivateKeyEntry();
|
||||||
entry.date = new Date();
|
entry.date = new Date();
|
||||||
|
|
||||||
entry.protectedKey = (byte[])key.clone();
|
entry.protectedKey = key.clone();
|
||||||
if ((chain != null) &&
|
if ((chain != null) &&
|
||||||
(chain.length != 0)) {
|
(chain.length != 0)) {
|
||||||
entry.chain = (Certificate[])chain.clone();
|
entry.chain = chain.clone();
|
||||||
} else {
|
} else {
|
||||||
entry.chain = null;
|
entry.chain = null;
|
||||||
}
|
}
|
||||||
@ -384,7 +382,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
|||||||
*
|
*
|
||||||
* @return enumeration of the alias names
|
* @return enumeration of the alias names
|
||||||
*/
|
*/
|
||||||
public Enumeration engineAliases() {
|
public Enumeration<String> engineAliases() {
|
||||||
return entries.keys();
|
return entries.keys();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,9 +460,9 @@ public final class JceKeyStore extends KeyStoreSpi {
|
|||||||
public String engineGetCertificateAlias(Certificate cert) {
|
public String engineGetCertificateAlias(Certificate cert) {
|
||||||
Certificate certElem;
|
Certificate certElem;
|
||||||
|
|
||||||
Enumeration e = entries.keys();
|
Enumeration<String> e = entries.keys();
|
||||||
while (e.hasMoreElements()) {
|
while (e.hasMoreElements()) {
|
||||||
String alias = (String)e.nextElement();
|
String alias = e.nextElement();
|
||||||
Object entry = entries.get(alias);
|
Object entry = entries.get(alias);
|
||||||
if (entry instanceof TrustedCertEntry) {
|
if (entry instanceof TrustedCertEntry) {
|
||||||
certElem = ((TrustedCertEntry)entry).cert;
|
certElem = ((TrustedCertEntry)entry).cert;
|
||||||
@ -560,10 +558,10 @@ public final class JceKeyStore extends KeyStoreSpi {
|
|||||||
|
|
||||||
dos.writeInt(entries.size());
|
dos.writeInt(entries.size());
|
||||||
|
|
||||||
Enumeration e = entries.keys();
|
Enumeration<String> e = entries.keys();
|
||||||
while (e.hasMoreElements()) {
|
while (e.hasMoreElements()) {
|
||||||
|
|
||||||
String alias = (String)e.nextElement();
|
String alias = e.nextElement();
|
||||||
Object entry = entries.get(alias);
|
Object entry = entries.get(alias);
|
||||||
|
|
||||||
if (entry instanceof PrivateKeyEntry) {
|
if (entry instanceof PrivateKeyEntry) {
|
||||||
@ -677,7 +675,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
|||||||
DataInputStream dis;
|
DataInputStream dis;
|
||||||
MessageDigest md = null;
|
MessageDigest md = null;
|
||||||
CertificateFactory cf = null;
|
CertificateFactory cf = null;
|
||||||
Hashtable cfs = null;
|
Hashtable<String, CertificateFactory> cfs = null;
|
||||||
ByteArrayInputStream bais = null;
|
ByteArrayInputStream bais = null;
|
||||||
byte[] encoded = null;
|
byte[] encoded = null;
|
||||||
|
|
||||||
@ -713,7 +711,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
|||||||
cf = CertificateFactory.getInstance("X509");
|
cf = CertificateFactory.getInstance("X509");
|
||||||
} else {
|
} else {
|
||||||
// version 2
|
// version 2
|
||||||
cfs = new Hashtable(3);
|
cfs = new Hashtable<String, CertificateFactory>(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.clear();
|
entries.clear();
|
||||||
@ -761,7 +759,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
|||||||
String certType = dis.readUTF();
|
String certType = dis.readUTF();
|
||||||
if (cfs.containsKey(certType)) {
|
if (cfs.containsKey(certType)) {
|
||||||
// reuse certificate factory
|
// reuse certificate factory
|
||||||
cf = (CertificateFactory)cfs.get(certType);
|
cf = cfs.get(certType);
|
||||||
} else {
|
} else {
|
||||||
// create new certificate factory
|
// create new certificate factory
|
||||||
cf = CertificateFactory.getInstance(
|
cf = CertificateFactory.getInstance(
|
||||||
@ -803,7 +801,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
|||||||
String certType = dis.readUTF();
|
String certType = dis.readUTF();
|
||||||
if (cfs.containsKey(certType)) {
|
if (cfs.containsKey(certType)) {
|
||||||
// reuse certificate factory
|
// reuse certificate factory
|
||||||
cf = (CertificateFactory)cfs.get(certType);
|
cf = cfs.get(certType);
|
||||||
} else {
|
} else {
|
||||||
// create new certificate factory
|
// create new certificate factory
|
||||||
cf = CertificateFactory.getInstance(certType);
|
cf = CertificateFactory.getInstance(certType);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,14 +25,8 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.ObjectInputStream;
|
|
||||||
import java.io.ObjectOutputStream;
|
|
||||||
import java.io.ObjectInputStream.GetField;
|
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
import java.security.Key;
|
import java.security.Key;
|
||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
@ -42,22 +36,14 @@ import java.security.MessageDigest;
|
|||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.NoSuchProviderException;
|
import java.security.NoSuchProviderException;
|
||||||
import java.security.SecureRandom;
|
|
||||||
import java.security.UnrecoverableKeyException;
|
import java.security.UnrecoverableKeyException;
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
|
||||||
import java.security.InvalidKeyException;
|
|
||||||
import java.security.AlgorithmParameters;
|
import java.security.AlgorithmParameters;
|
||||||
import java.security.spec.InvalidParameterSpecException;
|
|
||||||
import java.security.spec.InvalidKeySpecException;
|
|
||||||
import java.security.spec.PKCS8EncodedKeySpec;
|
import java.security.spec.PKCS8EncodedKeySpec;
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.crypto.CipherSpi;
|
import javax.crypto.CipherSpi;
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
import javax.crypto.NoSuchPaddingException;
|
|
||||||
import javax.crypto.IllegalBlockSizeException;
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
import javax.crypto.BadPaddingException;
|
|
||||||
import javax.crypto.SealedObject;
|
import javax.crypto.SealedObject;
|
||||||
import javax.crypto.spec.*;
|
import javax.crypto.spec.*;
|
||||||
import sun.security.x509.AlgorithmId;
|
import sun.security.x509.AlgorithmId;
|
||||||
@ -127,7 +113,7 @@ final class KeyProtector {
|
|||||||
PBEWithMD5AndTripleDESCipher cipher;
|
PBEWithMD5AndTripleDESCipher cipher;
|
||||||
cipher = new PBEWithMD5AndTripleDESCipher();
|
cipher = new PBEWithMD5AndTripleDESCipher();
|
||||||
cipher.engineInit(Cipher.ENCRYPT_MODE, sKey, pbeSpec, null);
|
cipher.engineInit(Cipher.ENCRYPT_MODE, sKey, pbeSpec, null);
|
||||||
byte[] plain = (byte[])key.getEncoded();
|
byte[] plain = key.getEncoded();
|
||||||
byte[] encrKey = cipher.engineDoFinal(plain, 0, plain.length);
|
byte[] encrKey = cipher.engineDoFinal(plain, 0, plain.length);
|
||||||
|
|
||||||
// wrap encrypted private key in EncryptedPrivateKeyInfo
|
// wrap encrypted private key in EncryptedPrivateKeyInfo
|
||||||
@ -169,8 +155,8 @@ final class KeyProtector {
|
|||||||
AlgorithmParameters pbeParams =
|
AlgorithmParameters pbeParams =
|
||||||
AlgorithmParameters.getInstance("PBE");
|
AlgorithmParameters.getInstance("PBE");
|
||||||
pbeParams.init(encodedParams);
|
pbeParams.init(encodedParams);
|
||||||
PBEParameterSpec pbeSpec = (PBEParameterSpec)
|
PBEParameterSpec pbeSpec =
|
||||||
pbeParams.getParameterSpec(PBEParameterSpec.class);
|
pbeParams.getParameterSpec(PBEParameterSpec.class);
|
||||||
|
|
||||||
// create PBE key from password
|
// create PBE key from password
|
||||||
PBEKeySpec pbeKeySpec = new PBEKeySpec(this.password);
|
PBEKeySpec pbeKeySpec = new PBEKeySpec(this.password);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,7 +26,6 @@
|
|||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import sun.security.util.*;
|
import sun.security.util.*;
|
||||||
import sun.security.x509.*;
|
import sun.security.x509.*;
|
||||||
@ -180,11 +179,13 @@ public final class OAEPParameters extends AlgorithmParametersSpi {
|
|||||||
engineInit(encoded);
|
engineInit(encoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
protected <T extends AlgorithmParameterSpec>
|
||||||
|
T engineGetParameterSpec(Class<T> paramSpec)
|
||||||
throws InvalidParameterSpecException {
|
throws InvalidParameterSpecException {
|
||||||
if (OAEPParameterSpec.class.isAssignableFrom(paramSpec)) {
|
if (OAEPParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||||
return new OAEPParameterSpec(mdName, "MGF1", mgfSpec,
|
return paramSpec.cast(
|
||||||
new PSource.PSpecified(p));
|
new OAEPParameterSpec(mdName, "MGF1", mgfSpec,
|
||||||
|
new PSource.PSpecified(p)));
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidParameterSpecException
|
throw new InvalidParameterSpecException
|
||||||
("Inappropriate parameter specification");
|
("Inappropriate parameter specification");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
import java.security.spec.*;
|
import java.security.spec.*;
|
||||||
import javax.crypto.*;
|
import javax.crypto.*;
|
||||||
@ -326,8 +325,7 @@ final class PBECipherCore {
|
|||||||
PBEParameterSpec pbeSpec = null;
|
PBEParameterSpec pbeSpec = null;
|
||||||
if (params != null) {
|
if (params != null) {
|
||||||
try {
|
try {
|
||||||
pbeSpec = (PBEParameterSpec) params.getParameterSpec
|
pbeSpec = params.getParameterSpec(PBEParameterSpec.class);
|
||||||
(PBEParameterSpec.class);
|
|
||||||
} catch (InvalidParameterSpecException ipse) {
|
} catch (InvalidParameterSpecException ipse) {
|
||||||
throw new InvalidAlgorithmParameterException("Wrong parameter "
|
throw new InvalidAlgorithmParameterException("Wrong parameter "
|
||||||
+ "type: PBE "
|
+ "type: PBE "
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.security.KeyRep;
|
import java.security.KeyRep;
|
||||||
import java.security.spec.InvalidKeySpecException;
|
import java.security.spec.InvalidKeySpecException;
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
@ -69,7 +68,7 @@ final class PBEKey implements SecretKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getEncoded() {
|
public byte[] getEncoded() {
|
||||||
return (byte[])this.key.clone();
|
return this.key.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlgorithm() {
|
public String getAlgorithm() {
|
||||||
@ -118,7 +117,7 @@ final class PBEKey implements SecretKey {
|
|||||||
throws java.io.IOException, ClassNotFoundException
|
throws java.io.IOException, ClassNotFoundException
|
||||||
{
|
{
|
||||||
s.defaultReadObject();
|
s.defaultReadObject();
|
||||||
key = (byte[])key.clone();
|
key = key.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.spec.KeySpec;
|
import java.security.spec.KeySpec;
|
||||||
import java.security.spec.InvalidKeySpecException;
|
import java.security.spec.InvalidKeySpecException;
|
||||||
@ -132,7 +131,7 @@ abstract class PBEKeyFactory extends SecretKeyFactorySpi {
|
|||||||
* inappropriate for the given key, or the given key cannot be processed
|
* inappropriate for the given key, or the given key cannot be processed
|
||||||
* (e.g., the given key has an unrecognized algorithm or format).
|
* (e.g., the given key has an unrecognized algorithm or format).
|
||||||
*/
|
*/
|
||||||
protected KeySpec engineGetKeySpec(SecretKey key, Class keySpecCl)
|
protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpecCl)
|
||||||
throws InvalidKeySpecException {
|
throws InvalidKeySpecException {
|
||||||
if ((key instanceof SecretKey)
|
if ((key instanceof SecretKey)
|
||||||
&& (validTypes.contains(key.getAlgorithm().toUpperCase()))
|
&& (validTypes.contains(key.getAlgorithm().toUpperCase()))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.AlgorithmParametersSpi;
|
import java.security.AlgorithmParametersSpi;
|
||||||
@ -65,7 +64,7 @@ public final class PBEParameters extends AlgorithmParametersSpi {
|
|||||||
throw new InvalidParameterSpecException
|
throw new InvalidParameterSpecException
|
||||||
("Inappropriate parameter specification");
|
("Inappropriate parameter specification");
|
||||||
}
|
}
|
||||||
this.salt = (byte[])((PBEParameterSpec)paramSpec).getSalt().clone();
|
this.salt = ((PBEParameterSpec)paramSpec).getSalt().clone();
|
||||||
this.iCount = ((PBEParameterSpec)paramSpec).getIterationCount();
|
this.iCount = ((PBEParameterSpec)paramSpec).getIterationCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,11 +97,12 @@ public final class PBEParameters extends AlgorithmParametersSpi {
|
|||||||
engineInit(encoded);
|
engineInit(encoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
protected <T extends AlgorithmParameterSpec>
|
||||||
|
T engineGetParameterSpec(Class<T> paramSpec)
|
||||||
throws InvalidParameterSpecException
|
throws InvalidParameterSpecException
|
||||||
{
|
{
|
||||||
if (PBEParameterSpec.class.isAssignableFrom(paramSpec)) {
|
if (PBEParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||||
return new PBEParameterSpec(this.salt, this.iCount);
|
return paramSpec.cast(new PBEParameterSpec(this.salt, this.iCount));
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidParameterSpecException
|
throw new InvalidParameterSpecException
|
||||||
("Inappropriate parameter specification");
|
("Inappropriate parameter specification");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,14 +25,12 @@
|
|||||||
|
|
||||||
package com.sun.crypto.provider;
|
package com.sun.crypto.provider;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.spec.KeySpec;
|
import java.security.spec.KeySpec;
|
||||||
import java.security.spec.InvalidKeySpecException;
|
import java.security.spec.InvalidKeySpecException;
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
import javax.crypto.SecretKeyFactorySpi;
|
import javax.crypto.SecretKeyFactorySpi;
|
||||||
import javax.crypto.spec.PBEKeySpec;
|
import javax.crypto.spec.PBEKeySpec;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements a key factory for PBE keys derived using
|
* This class implements a key factory for PBE keys derived using
|
||||||
@ -88,7 +86,7 @@ public final class PBKDF2HmacSHA1Factory extends SecretKeyFactorySpi {
|
|||||||
* given key cannot be processed (e.g., the given key has an
|
* given key cannot be processed (e.g., the given key has an
|
||||||
* unrecognized algorithm or format).
|
* unrecognized algorithm or format).
|
||||||
*/
|
*/
|
||||||
protected KeySpec engineGetKeySpec(SecretKey key, Class keySpecCl)
|
protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpecCl)
|
||||||
throws InvalidKeySpecException {
|
throws InvalidKeySpecException {
|
||||||
if (key instanceof javax.crypto.interfaces.PBEKey) {
|
if (key instanceof javax.crypto.interfaces.PBEKey) {
|
||||||
// Check if requested key spec is amongst the valid ones
|
// Check if requested key spec is amongst the valid ones
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -133,6 +133,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
|||||||
byte[] ti = new byte[hlen];
|
byte[] ti = new byte[hlen];
|
||||||
// SecretKeySpec cannot be used, since password can be empty here.
|
// SecretKeySpec cannot be used, since password can be empty here.
|
||||||
SecretKey macKey = new SecretKey() {
|
SecretKey macKey = new SecretKey() {
|
||||||
|
private static final long serialVersionUID = 7874493593505141603L;
|
||||||
@Override
|
@Override
|
||||||
public String getAlgorithm() {
|
public String getAlgorithm() {
|
||||||
return prf.getAlgorithm();
|
return prf.getAlgorithm();
|
||||||
@ -194,7 +195,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getEncoded() {
|
public byte[] getEncoded() {
|
||||||
return (byte[]) key.clone();
|
return key.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlgorithm() {
|
public String getAlgorithm() {
|
||||||
@ -206,7 +207,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public char[] getPassword() {
|
public char[] getPassword() {
|
||||||
return (char[]) passwd.clone();
|
return passwd.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getSalt() {
|
public byte[] getSalt() {
|
||||||
@ -268,7 +269,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
|||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
try {
|
try {
|
||||||
if (this.passwd != null) {
|
if (this.passwd != null) {
|
||||||
java.util.Arrays.fill(this.passwd, (char) '0');
|
java.util.Arrays.fill(this.passwd, '0');
|
||||||
this.passwd = null;
|
this.passwd = null;
|
||||||
}
|
}
|
||||||
if (this.key != null) {
|
if (this.key != null) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -145,7 +145,7 @@ final class PCBC extends FeedbackCipher {
|
|||||||
for (; plainOffset < endIndex;
|
for (; plainOffset < endIndex;
|
||||||
plainOffset += blockSize, cipherOffset += blockSize) {
|
plainOffset += blockSize, cipherOffset += blockSize) {
|
||||||
for (i=0; i<blockSize; i++) {
|
for (i=0; i<blockSize; i++) {
|
||||||
k[i] ^= (byte)(plain[i+plainOffset]);
|
k[i] ^= plain[i+plainOffset];
|
||||||
}
|
}
|
||||||
embeddedCipher.encryptBlock(k, 0, cipher, cipherOffset);
|
embeddedCipher.encryptBlock(k, 0, cipher, cipherOffset);
|
||||||
for (i = 0; i < blockSize; i++) {
|
for (i = 0; i < blockSize; i++) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -98,8 +98,8 @@ public final class RC2Cipher extends CipherSpi {
|
|||||||
throws InvalidKeyException, InvalidAlgorithmParameterException {
|
throws InvalidKeyException, InvalidAlgorithmParameterException {
|
||||||
if (params != null && params.getAlgorithm().equals("RC2")) {
|
if (params != null && params.getAlgorithm().equals("RC2")) {
|
||||||
try {
|
try {
|
||||||
RC2ParameterSpec rc2Params = (RC2ParameterSpec)
|
RC2ParameterSpec rc2Params =
|
||||||
params.getParameterSpec(RC2ParameterSpec.class);
|
params.getParameterSpec(RC2ParameterSpec.class);
|
||||||
engineInit(opmode, key, rc2Params, random);
|
engineInit(opmode, key, rc2Params, random);
|
||||||
} catch (InvalidParameterSpecException ipse) {
|
} catch (InvalidParameterSpecException ipse) {
|
||||||
throw new InvalidAlgorithmParameterException
|
throw new InvalidAlgorithmParameterException
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -55,7 +55,6 @@ import sun.security.util.*;
|
|||||||
* @author Sean Mullan
|
* @author Sean Mullan
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class RC2Parameters extends AlgorithmParametersSpi {
|
public final class RC2Parameters extends AlgorithmParametersSpi {
|
||||||
|
|
||||||
// TABLE[EKB] from section 6 of RFC 2268, used to convert effective key
|
// TABLE[EKB] from section 6 of RFC 2268, used to convert effective key
|
||||||
@ -177,13 +176,14 @@ public final class RC2Parameters extends AlgorithmParametersSpi {
|
|||||||
engineInit(encoded);
|
engineInit(encoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
protected <T extends AlgorithmParameterSpec>
|
||||||
|
T engineGetParameterSpec(Class<T> paramSpec)
|
||||||
throws InvalidParameterSpecException {
|
throws InvalidParameterSpecException {
|
||||||
|
|
||||||
if (RC2ParameterSpec.class.isAssignableFrom(paramSpec)) {
|
if (RC2ParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||||
return (iv == null ?
|
return paramSpec.cast((iv == null ?
|
||||||
new RC2ParameterSpec(effectiveKeySize) :
|
new RC2ParameterSpec(effectiveKeySize) :
|
||||||
new RC2ParameterSpec(effectiveKeySize, iv));
|
new RC2ParameterSpec(effectiveKeySize, iv)));
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidParameterSpecException
|
throw new InvalidParameterSpecException
|
||||||
("Inappropriate parameter specification");
|
("Inappropriate parameter specification");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -227,8 +227,8 @@ public final class RSACipher extends CipherSpi {
|
|||||||
init(opmode, key, random, null);
|
init(opmode, key, random, null);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
OAEPParameterSpec spec = (OAEPParameterSpec)
|
OAEPParameterSpec spec =
|
||||||
params.getParameterSpec(OAEPParameterSpec.class);
|
params.getParameterSpec(OAEPParameterSpec.class);
|
||||||
init(opmode, key, random, spec);
|
init(opmode, key, random, spec);
|
||||||
} catch (InvalidParameterSpecException ipse) {
|
} catch (InvalidParameterSpecException ipse) {
|
||||||
InvalidAlgorithmParameterException iape =
|
InvalidAlgorithmParameterException iape =
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,11 +27,6 @@ package com.sun.crypto.provider;
|
|||||||
|
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.security.Provider;
|
import java.security.Provider;
|
||||||
import java.security.PrivilegedAction;
|
|
||||||
import java.security.cert.*;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.security.CodeSource;
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
|
|
||||||
@ -105,352 +100,353 @@ public final class SunJCE extends Provider {
|
|||||||
"|OFB72|OFB80|OFB88|OFB96|OFB104|OFB112|OFB120|OFB128";
|
"|OFB72|OFB80|OFB88|OFB96|OFB104|OFB112|OFB120|OFB128";
|
||||||
final String BLOCK_PADS = "NOPADDING|PKCS5PADDING|ISO10126PADDING";
|
final String BLOCK_PADS = "NOPADDING|PKCS5PADDING|ISO10126PADDING";
|
||||||
|
|
||||||
AccessController.doPrivileged(new java.security.PrivilegedAction() {
|
AccessController.doPrivileged(
|
||||||
|
new java.security.PrivilegedAction<Object>() {
|
||||||
public Object run() {
|
public Object run() {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cipher engines
|
* Cipher engines
|
||||||
*/
|
*/
|
||||||
put("Cipher.RSA", "com.sun.crypto.provider.RSACipher");
|
put("Cipher.RSA", "com.sun.crypto.provider.RSACipher");
|
||||||
put("Cipher.RSA SupportedModes", "ECB");
|
put("Cipher.RSA SupportedModes", "ECB");
|
||||||
put("Cipher.RSA SupportedPaddings",
|
put("Cipher.RSA SupportedPaddings",
|
||||||
"NOPADDING|PKCS1PADDING|OAEPWITHMD5ANDMGF1PADDING"
|
"NOPADDING|PKCS1PADDING|OAEPWITHMD5ANDMGF1PADDING"
|
||||||
+ "|OAEPWITHSHA1ANDMGF1PADDING"
|
+ "|OAEPWITHSHA1ANDMGF1PADDING"
|
||||||
+ "|OAEPWITHSHA-1ANDMGF1PADDING"
|
+ "|OAEPWITHSHA-1ANDMGF1PADDING"
|
||||||
+ "|OAEPWITHSHA-256ANDMGF1PADDING"
|
+ "|OAEPWITHSHA-256ANDMGF1PADDING"
|
||||||
+ "|OAEPWITHSHA-384ANDMGF1PADDING"
|
+ "|OAEPWITHSHA-384ANDMGF1PADDING"
|
||||||
+ "|OAEPWITHSHA-512ANDMGF1PADDING");
|
+ "|OAEPWITHSHA-512ANDMGF1PADDING");
|
||||||
put("Cipher.RSA SupportedKeyClasses",
|
put("Cipher.RSA SupportedKeyClasses",
|
||||||
"java.security.interfaces.RSAPublicKey" +
|
"java.security.interfaces.RSAPublicKey" +
|
||||||
"|java.security.interfaces.RSAPrivateKey");
|
"|java.security.interfaces.RSAPrivateKey");
|
||||||
|
|
||||||
put("Cipher.DES", "com.sun.crypto.provider.DESCipher");
|
put("Cipher.DES", "com.sun.crypto.provider.DESCipher");
|
||||||
put("Cipher.DES SupportedModes", BLOCK_MODES);
|
put("Cipher.DES SupportedModes", BLOCK_MODES);
|
||||||
put("Cipher.DES SupportedPaddings", BLOCK_PADS);
|
put("Cipher.DES SupportedPaddings", BLOCK_PADS);
|
||||||
put("Cipher.DES SupportedKeyFormats", "RAW");
|
put("Cipher.DES SupportedKeyFormats", "RAW");
|
||||||
|
|
||||||
put("Cipher.DESede", "com.sun.crypto.provider.DESedeCipher");
|
put("Cipher.DESede", "com.sun.crypto.provider.DESedeCipher");
|
||||||
put("Alg.Alias.Cipher.TripleDES", "DESede");
|
put("Alg.Alias.Cipher.TripleDES", "DESede");
|
||||||
put("Cipher.DESede SupportedModes", BLOCK_MODES);
|
put("Cipher.DESede SupportedModes", BLOCK_MODES);
|
||||||
put("Cipher.DESede SupportedPaddings", BLOCK_PADS);
|
put("Cipher.DESede SupportedPaddings", BLOCK_PADS);
|
||||||
put("Cipher.DESede SupportedKeyFormats", "RAW");
|
put("Cipher.DESede SupportedKeyFormats", "RAW");
|
||||||
|
|
||||||
put("Cipher.DESedeWrap",
|
put("Cipher.DESedeWrap",
|
||||||
"com.sun.crypto.provider.DESedeWrapCipher");
|
"com.sun.crypto.provider.DESedeWrapCipher");
|
||||||
put("Cipher.DESedeWrap SupportedModes", "CBC");
|
put("Cipher.DESedeWrap SupportedModes", "CBC");
|
||||||
put("Cipher.DESedeWrap SupportedPaddings", "NOPADDING");
|
put("Cipher.DESedeWrap SupportedPaddings", "NOPADDING");
|
||||||
put("Cipher.DESedeWrap SupportedKeyFormats", "RAW");
|
put("Cipher.DESedeWrap SupportedKeyFormats", "RAW");
|
||||||
|
|
||||||
put("Cipher.PBEWithMD5AndDES",
|
put("Cipher.PBEWithMD5AndDES",
|
||||||
"com.sun.crypto.provider.PBEWithMD5AndDESCipher");
|
"com.sun.crypto.provider.PBEWithMD5AndDESCipher");
|
||||||
put("Alg.Alias.Cipher.OID."+OID_PKCS5_MD5_DES,
|
put("Alg.Alias.Cipher.OID."+OID_PKCS5_MD5_DES,
|
||||||
"PBEWithMD5AndDES");
|
"PBEWithMD5AndDES");
|
||||||
put("Alg.Alias.Cipher."+OID_PKCS5_MD5_DES,
|
put("Alg.Alias.Cipher."+OID_PKCS5_MD5_DES,
|
||||||
"PBEWithMD5AndDES");
|
"PBEWithMD5AndDES");
|
||||||
put("Cipher.PBEWithMD5AndTripleDES",
|
put("Cipher.PBEWithMD5AndTripleDES",
|
||||||
"com.sun.crypto.provider.PBEWithMD5AndTripleDESCipher");
|
"com.sun.crypto.provider.PBEWithMD5AndTripleDESCipher");
|
||||||
put("Cipher.PBEWithSHA1AndRC2_40",
|
put("Cipher.PBEWithSHA1AndRC2_40",
|
||||||
"com.sun.crypto.provider.PKCS12PBECipherCore$" +
|
"com.sun.crypto.provider.PKCS12PBECipherCore$" +
|
||||||
"PBEWithSHA1AndRC2_40");
|
"PBEWithSHA1AndRC2_40");
|
||||||
put("Alg.Alias.Cipher.OID." + OID_PKCS12_RC2_40,
|
put("Alg.Alias.Cipher.OID." + OID_PKCS12_RC2_40,
|
||||||
"PBEWithSHA1AndRC2_40");
|
"PBEWithSHA1AndRC2_40");
|
||||||
put("Alg.Alias.Cipher." + OID_PKCS12_RC2_40,
|
put("Alg.Alias.Cipher." + OID_PKCS12_RC2_40,
|
||||||
"PBEWithSHA1AndRC2_40");
|
"PBEWithSHA1AndRC2_40");
|
||||||
put("Cipher.PBEWithSHA1AndDESede",
|
put("Cipher.PBEWithSHA1AndDESede",
|
||||||
"com.sun.crypto.provider.PKCS12PBECipherCore$" +
|
"com.sun.crypto.provider.PKCS12PBECipherCore$" +
|
||||||
"PBEWithSHA1AndDESede");
|
"PBEWithSHA1AndDESede");
|
||||||
put("Alg.Alias.Cipher.OID." + OID_PKCS12_DESede,
|
put("Alg.Alias.Cipher.OID." + OID_PKCS12_DESede,
|
||||||
"PBEWithSHA1AndDESede");
|
"PBEWithSHA1AndDESede");
|
||||||
put("Alg.Alias.Cipher." + OID_PKCS12_DESede,
|
put("Alg.Alias.Cipher." + OID_PKCS12_DESede,
|
||||||
"PBEWithSHA1AndDESede");
|
"PBEWithSHA1AndDESede");
|
||||||
|
|
||||||
put("Cipher.Blowfish",
|
put("Cipher.Blowfish",
|
||||||
"com.sun.crypto.provider.BlowfishCipher");
|
"com.sun.crypto.provider.BlowfishCipher");
|
||||||
put("Cipher.Blowfish SupportedModes", BLOCK_MODES);
|
put("Cipher.Blowfish SupportedModes", BLOCK_MODES);
|
||||||
put("Cipher.Blowfish SupportedPaddings", BLOCK_PADS);
|
put("Cipher.Blowfish SupportedPaddings", BLOCK_PADS);
|
||||||
put("Cipher.Blowfish SupportedKeyFormats", "RAW");
|
put("Cipher.Blowfish SupportedKeyFormats", "RAW");
|
||||||
|
|
||||||
put("Cipher.AES", "com.sun.crypto.provider.AESCipher");
|
put("Cipher.AES", "com.sun.crypto.provider.AESCipher");
|
||||||
put("Alg.Alias.Cipher.Rijndael", "AES");
|
put("Alg.Alias.Cipher.Rijndael", "AES");
|
||||||
put("Cipher.AES SupportedModes", BLOCK_MODES128);
|
put("Cipher.AES SupportedModes", BLOCK_MODES128);
|
||||||
put("Cipher.AES SupportedPaddings", BLOCK_PADS);
|
put("Cipher.AES SupportedPaddings", BLOCK_PADS);
|
||||||
put("Cipher.AES SupportedKeyFormats", "RAW");
|
put("Cipher.AES SupportedKeyFormats", "RAW");
|
||||||
|
|
||||||
put("Cipher.AESWrap", "com.sun.crypto.provider.AESWrapCipher");
|
put("Cipher.AESWrap", "com.sun.crypto.provider.AESWrapCipher");
|
||||||
put("Cipher.AESWrap SupportedModes", "ECB");
|
put("Cipher.AESWrap SupportedModes", "ECB");
|
||||||
put("Cipher.AESWrap SupportedPaddings", "NOPADDING");
|
put("Cipher.AESWrap SupportedPaddings", "NOPADDING");
|
||||||
put("Cipher.AESWrap SupportedKeyFormats", "RAW");
|
put("Cipher.AESWrap SupportedKeyFormats", "RAW");
|
||||||
|
|
||||||
put("Cipher.RC2",
|
put("Cipher.RC2",
|
||||||
"com.sun.crypto.provider.RC2Cipher");
|
"com.sun.crypto.provider.RC2Cipher");
|
||||||
put("Cipher.RC2 SupportedModes", BLOCK_MODES);
|
put("Cipher.RC2 SupportedModes", BLOCK_MODES);
|
||||||
put("Cipher.RC2 SupportedPaddings", BLOCK_PADS);
|
put("Cipher.RC2 SupportedPaddings", BLOCK_PADS);
|
||||||
put("Cipher.RC2 SupportedKeyFormats", "RAW");
|
put("Cipher.RC2 SupportedKeyFormats", "RAW");
|
||||||
|
|
||||||
put("Cipher.ARCFOUR",
|
put("Cipher.ARCFOUR",
|
||||||
"com.sun.crypto.provider.ARCFOURCipher");
|
"com.sun.crypto.provider.ARCFOURCipher");
|
||||||
put("Alg.Alias.Cipher.RC4", "ARCFOUR");
|
put("Alg.Alias.Cipher.RC4", "ARCFOUR");
|
||||||
put("Cipher.ARCFOUR SupportedModes", "ECB");
|
put("Cipher.ARCFOUR SupportedModes", "ECB");
|
||||||
put("Cipher.ARCFOUR SupportedPaddings", "NOPADDING");
|
put("Cipher.ARCFOUR SupportedPaddings", "NOPADDING");
|
||||||
put("Cipher.ARCFOUR SupportedKeyFormats", "RAW");
|
put("Cipher.ARCFOUR SupportedKeyFormats", "RAW");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Key(pair) Generator engines
|
* Key(pair) Generator engines
|
||||||
*/
|
*/
|
||||||
put("KeyGenerator.DES",
|
put("KeyGenerator.DES",
|
||||||
"com.sun.crypto.provider.DESKeyGenerator");
|
"com.sun.crypto.provider.DESKeyGenerator");
|
||||||
|
|
||||||
put("KeyGenerator.DESede",
|
put("KeyGenerator.DESede",
|
||||||
"com.sun.crypto.provider.DESedeKeyGenerator");
|
"com.sun.crypto.provider.DESedeKeyGenerator");
|
||||||
put("Alg.Alias.KeyGenerator.TripleDES", "DESede");
|
put("Alg.Alias.KeyGenerator.TripleDES", "DESede");
|
||||||
|
|
||||||
put("KeyGenerator.Blowfish",
|
put("KeyGenerator.Blowfish",
|
||||||
"com.sun.crypto.provider.BlowfishKeyGenerator");
|
"com.sun.crypto.provider.BlowfishKeyGenerator");
|
||||||
|
|
||||||
put("KeyGenerator.AES",
|
put("KeyGenerator.AES",
|
||||||
"com.sun.crypto.provider.AESKeyGenerator");
|
"com.sun.crypto.provider.AESKeyGenerator");
|
||||||
put("Alg.Alias.KeyGenerator.Rijndael", "AES");
|
put("Alg.Alias.KeyGenerator.Rijndael", "AES");
|
||||||
|
|
||||||
put("KeyGenerator.RC2",
|
put("KeyGenerator.RC2",
|
||||||
"com.sun.crypto.provider.KeyGeneratorCore$" +
|
"com.sun.crypto.provider.KeyGeneratorCore$" +
|
||||||
"RC2KeyGenerator");
|
"RC2KeyGenerator");
|
||||||
put("KeyGenerator.ARCFOUR",
|
put("KeyGenerator.ARCFOUR",
|
||||||
"com.sun.crypto.provider.KeyGeneratorCore$" +
|
"com.sun.crypto.provider.KeyGeneratorCore$" +
|
||||||
"ARCFOURKeyGenerator");
|
"ARCFOURKeyGenerator");
|
||||||
put("Alg.Alias.KeyGenerator.RC4", "ARCFOUR");
|
put("Alg.Alias.KeyGenerator.RC4", "ARCFOUR");
|
||||||
|
|
||||||
put("KeyGenerator.HmacMD5",
|
put("KeyGenerator.HmacMD5",
|
||||||
"com.sun.crypto.provider.HmacMD5KeyGenerator");
|
"com.sun.crypto.provider.HmacMD5KeyGenerator");
|
||||||
|
|
||||||
put("KeyGenerator.HmacSHA1",
|
put("KeyGenerator.HmacSHA1",
|
||||||
"com.sun.crypto.provider.HmacSHA1KeyGenerator");
|
"com.sun.crypto.provider.HmacSHA1KeyGenerator");
|
||||||
|
|
||||||
put("KeyGenerator.HmacSHA256",
|
put("KeyGenerator.HmacSHA256",
|
||||||
"com.sun.crypto.provider.KeyGeneratorCore$HmacSHA256KG");
|
"com.sun.crypto.provider.KeyGeneratorCore$HmacSHA256KG");
|
||||||
put("KeyGenerator.HmacSHA384",
|
put("KeyGenerator.HmacSHA384",
|
||||||
"com.sun.crypto.provider.KeyGeneratorCore$HmacSHA384KG");
|
"com.sun.crypto.provider.KeyGeneratorCore$HmacSHA384KG");
|
||||||
put("KeyGenerator.HmacSHA512",
|
put("KeyGenerator.HmacSHA512",
|
||||||
"com.sun.crypto.provider.KeyGeneratorCore$HmacSHA512KG");
|
"com.sun.crypto.provider.KeyGeneratorCore$HmacSHA512KG");
|
||||||
|
|
||||||
put("KeyPairGenerator.DiffieHellman",
|
put("KeyPairGenerator.DiffieHellman",
|
||||||
"com.sun.crypto.provider.DHKeyPairGenerator");
|
"com.sun.crypto.provider.DHKeyPairGenerator");
|
||||||
put("Alg.Alias.KeyPairGenerator.DH", "DiffieHellman");
|
put("Alg.Alias.KeyPairGenerator.DH", "DiffieHellman");
|
||||||
put("Alg.Alias.KeyPairGenerator.OID."+OID_PKCS3,
|
put("Alg.Alias.KeyPairGenerator.OID."+OID_PKCS3,
|
||||||
"DiffieHellman");
|
"DiffieHellman");
|
||||||
put("Alg.Alias.KeyPairGenerator."+OID_PKCS3,
|
put("Alg.Alias.KeyPairGenerator."+OID_PKCS3,
|
||||||
"DiffieHellman");
|
"DiffieHellman");
|
||||||
/*
|
/*
|
||||||
* Algorithm parameter generation engines
|
* Algorithm parameter generation engines
|
||||||
*/
|
*/
|
||||||
put("AlgorithmParameterGenerator.DiffieHellman",
|
put("AlgorithmParameterGenerator.DiffieHellman",
|
||||||
"com.sun.crypto.provider.DHParameterGenerator");
|
"com.sun.crypto.provider.DHParameterGenerator");
|
||||||
put("Alg.Alias.AlgorithmParameterGenerator.DH",
|
put("Alg.Alias.AlgorithmParameterGenerator.DH",
|
||||||
"DiffieHellman");
|
"DiffieHellman");
|
||||||
put("Alg.Alias.AlgorithmParameterGenerator.OID."+OID_PKCS3,
|
put("Alg.Alias.AlgorithmParameterGenerator.OID."+OID_PKCS3,
|
||||||
"DiffieHellman");
|
"DiffieHellman");
|
||||||
put("Alg.Alias.AlgorithmParameterGenerator."+OID_PKCS3,
|
put("Alg.Alias.AlgorithmParameterGenerator."+OID_PKCS3,
|
||||||
"DiffieHellman");
|
"DiffieHellman");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Key Agreement engines
|
* Key Agreement engines
|
||||||
*/
|
*/
|
||||||
put("KeyAgreement.DiffieHellman",
|
put("KeyAgreement.DiffieHellman",
|
||||||
"com.sun.crypto.provider.DHKeyAgreement");
|
"com.sun.crypto.provider.DHKeyAgreement");
|
||||||
put("Alg.Alias.KeyAgreement.DH", "DiffieHellman");
|
put("Alg.Alias.KeyAgreement.DH", "DiffieHellman");
|
||||||
put("Alg.Alias.KeyAgreement.OID."+OID_PKCS3, "DiffieHellman");
|
put("Alg.Alias.KeyAgreement.OID."+OID_PKCS3, "DiffieHellman");
|
||||||
put("Alg.Alias.KeyAgreement."+OID_PKCS3, "DiffieHellman");
|
put("Alg.Alias.KeyAgreement."+OID_PKCS3, "DiffieHellman");
|
||||||
|
|
||||||
put("KeyAgreement.DiffieHellman SupportedKeyClasses",
|
put("KeyAgreement.DiffieHellman SupportedKeyClasses",
|
||||||
"javax.crypto.interfaces.DHPublicKey" +
|
"javax.crypto.interfaces.DHPublicKey" +
|
||||||
"|javax.crypto.interfaces.DHPrivateKey");
|
"|javax.crypto.interfaces.DHPrivateKey");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Algorithm Parameter engines
|
* Algorithm Parameter engines
|
||||||
*/
|
*/
|
||||||
put("AlgorithmParameters.DiffieHellman",
|
put("AlgorithmParameters.DiffieHellman",
|
||||||
"com.sun.crypto.provider.DHParameters");
|
"com.sun.crypto.provider.DHParameters");
|
||||||
put("Alg.Alias.AlgorithmParameters.DH", "DiffieHellman");
|
put("Alg.Alias.AlgorithmParameters.DH", "DiffieHellman");
|
||||||
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS3,
|
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS3,
|
||||||
"DiffieHellman");
|
"DiffieHellman");
|
||||||
put("Alg.Alias.AlgorithmParameters."+OID_PKCS3,
|
put("Alg.Alias.AlgorithmParameters."+OID_PKCS3,
|
||||||
"DiffieHellman");
|
"DiffieHellman");
|
||||||
|
|
||||||
put("AlgorithmParameters.DES",
|
put("AlgorithmParameters.DES",
|
||||||
"com.sun.crypto.provider.DESParameters");
|
"com.sun.crypto.provider.DESParameters");
|
||||||
|
|
||||||
put("AlgorithmParameters.DESede",
|
put("AlgorithmParameters.DESede",
|
||||||
"com.sun.crypto.provider.DESedeParameters");
|
"com.sun.crypto.provider.DESedeParameters");
|
||||||
put("Alg.Alias.AlgorithmParameters.TripleDES", "DESede");
|
put("Alg.Alias.AlgorithmParameters.TripleDES", "DESede");
|
||||||
|
|
||||||
put("AlgorithmParameters.PBE",
|
put("AlgorithmParameters.PBE",
|
||||||
"com.sun.crypto.provider.PBEParameters");
|
"com.sun.crypto.provider.PBEParameters");
|
||||||
|
|
||||||
put("AlgorithmParameters.PBEWithMD5AndDES",
|
put("AlgorithmParameters.PBEWithMD5AndDES",
|
||||||
"com.sun.crypto.provider.PBEParameters");
|
"com.sun.crypto.provider.PBEParameters");
|
||||||
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS5_MD5_DES,
|
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS5_MD5_DES,
|
||||||
"PBEWithMD5AndDES");
|
"PBEWithMD5AndDES");
|
||||||
put("Alg.Alias.AlgorithmParameters."+OID_PKCS5_MD5_DES,
|
put("Alg.Alias.AlgorithmParameters."+OID_PKCS5_MD5_DES,
|
||||||
"PBEWithMD5AndDES");
|
"PBEWithMD5AndDES");
|
||||||
|
|
||||||
put("AlgorithmParameters.PBEWithMD5AndTripleDES",
|
put("AlgorithmParameters.PBEWithMD5AndTripleDES",
|
||||||
"com.sun.crypto.provider.PBEParameters");
|
"com.sun.crypto.provider.PBEParameters");
|
||||||
|
|
||||||
put("AlgorithmParameters.PBEWithSHA1AndDESede",
|
put("AlgorithmParameters.PBEWithSHA1AndDESede",
|
||||||
"com.sun.crypto.provider.PBEParameters");
|
"com.sun.crypto.provider.PBEParameters");
|
||||||
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_DESede,
|
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_DESede,
|
||||||
"PBEWithSHA1AndDESede");
|
"PBEWithSHA1AndDESede");
|
||||||
put("Alg.Alias.AlgorithmParameters."+OID_PKCS12_DESede,
|
put("Alg.Alias.AlgorithmParameters."+OID_PKCS12_DESede,
|
||||||
"PBEWithSHA1AndDESede");
|
"PBEWithSHA1AndDESede");
|
||||||
|
|
||||||
put("AlgorithmParameters.PBEWithSHA1AndRC2_40",
|
put("AlgorithmParameters.PBEWithSHA1AndRC2_40",
|
||||||
"com.sun.crypto.provider.PBEParameters");
|
"com.sun.crypto.provider.PBEParameters");
|
||||||
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_RC2_40,
|
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_RC2_40,
|
||||||
"PBEWithSHA1AndRC2_40");
|
"PBEWithSHA1AndRC2_40");
|
||||||
put("Alg.Alias.AlgorithmParameters." + OID_PKCS12_RC2_40,
|
put("Alg.Alias.AlgorithmParameters." + OID_PKCS12_RC2_40,
|
||||||
"PBEWithSHA1AndRC2_40");
|
"PBEWithSHA1AndRC2_40");
|
||||||
|
|
||||||
put("AlgorithmParameters.Blowfish",
|
put("AlgorithmParameters.Blowfish",
|
||||||
"com.sun.crypto.provider.BlowfishParameters");
|
"com.sun.crypto.provider.BlowfishParameters");
|
||||||
|
|
||||||
put("AlgorithmParameters.AES",
|
put("AlgorithmParameters.AES",
|
||||||
"com.sun.crypto.provider.AESParameters");
|
"com.sun.crypto.provider.AESParameters");
|
||||||
put("Alg.Alias.AlgorithmParameters.Rijndael", "AES");
|
put("Alg.Alias.AlgorithmParameters.Rijndael", "AES");
|
||||||
|
|
||||||
|
|
||||||
put("AlgorithmParameters.RC2",
|
put("AlgorithmParameters.RC2",
|
||||||
"com.sun.crypto.provider.RC2Parameters");
|
"com.sun.crypto.provider.RC2Parameters");
|
||||||
|
|
||||||
put("AlgorithmParameters.OAEP",
|
put("AlgorithmParameters.OAEP",
|
||||||
"com.sun.crypto.provider.OAEPParameters");
|
"com.sun.crypto.provider.OAEPParameters");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Key factories
|
* Key factories
|
||||||
*/
|
*/
|
||||||
put("KeyFactory.DiffieHellman",
|
put("KeyFactory.DiffieHellman",
|
||||||
"com.sun.crypto.provider.DHKeyFactory");
|
"com.sun.crypto.provider.DHKeyFactory");
|
||||||
put("Alg.Alias.KeyFactory.DH", "DiffieHellman");
|
put("Alg.Alias.KeyFactory.DH", "DiffieHellman");
|
||||||
put("Alg.Alias.KeyFactory.OID."+OID_PKCS3,
|
put("Alg.Alias.KeyFactory.OID."+OID_PKCS3,
|
||||||
"DiffieHellman");
|
"DiffieHellman");
|
||||||
put("Alg.Alias.KeyFactory."+OID_PKCS3, "DiffieHellman");
|
put("Alg.Alias.KeyFactory."+OID_PKCS3, "DiffieHellman");
|
||||||
/*
|
/*
|
||||||
* Secret-key factories
|
* Secret-key factories
|
||||||
*/
|
*/
|
||||||
put("SecretKeyFactory.DES",
|
put("SecretKeyFactory.DES",
|
||||||
"com.sun.crypto.provider.DESKeyFactory");
|
"com.sun.crypto.provider.DESKeyFactory");
|
||||||
|
|
||||||
put("SecretKeyFactory.DESede",
|
put("SecretKeyFactory.DESede",
|
||||||
"com.sun.crypto.provider.DESedeKeyFactory");
|
"com.sun.crypto.provider.DESedeKeyFactory");
|
||||||
put("Alg.Alias.SecretKeyFactory.TripleDES", "DESede");
|
put("Alg.Alias.SecretKeyFactory.TripleDES", "DESede");
|
||||||
|
|
||||||
put("SecretKeyFactory.PBEWithMD5AndDES",
|
put("SecretKeyFactory.PBEWithMD5AndDES",
|
||||||
"com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndDES"
|
"com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndDES"
|
||||||
);
|
);
|
||||||
put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS5_MD5_DES,
|
put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS5_MD5_DES,
|
||||||
"PBEWithMD5AndDES");
|
"PBEWithMD5AndDES");
|
||||||
put("Alg.Alias.SecretKeyFactory."+OID_PKCS5_MD5_DES,
|
put("Alg.Alias.SecretKeyFactory."+OID_PKCS5_MD5_DES,
|
||||||
"PBEWithMD5AndDES");
|
"PBEWithMD5AndDES");
|
||||||
|
|
||||||
put("Alg.Alias.SecretKeyFactory.PBE",
|
put("Alg.Alias.SecretKeyFactory.PBE",
|
||||||
"PBEWithMD5AndDES");
|
"PBEWithMD5AndDES");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Internal in-house crypto algorithm used for
|
* Internal in-house crypto algorithm used for
|
||||||
* the JCEKS keystore type. Since this was developed
|
* the JCEKS keystore type. Since this was developed
|
||||||
* internally, there isn't an OID corresponding to this
|
* internally, there isn't an OID corresponding to this
|
||||||
* algorithm.
|
* algorithm.
|
||||||
*/
|
*/
|
||||||
put("SecretKeyFactory.PBEWithMD5AndTripleDES",
|
put("SecretKeyFactory.PBEWithMD5AndTripleDES",
|
||||||
"com.sun.crypto.provider.PBEKeyFactory$" +
|
"com.sun.crypto.provider.PBEKeyFactory$" +
|
||||||
"PBEWithMD5AndTripleDES"
|
"PBEWithMD5AndTripleDES"
|
||||||
);
|
);
|
||||||
|
|
||||||
put("SecretKeyFactory.PBEWithSHA1AndDESede",
|
put("SecretKeyFactory.PBEWithSHA1AndDESede",
|
||||||
"com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndDESede"
|
"com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndDESede"
|
||||||
);
|
);
|
||||||
put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS12_DESede,
|
put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS12_DESede,
|
||||||
"PBEWithSHA1AndDESede");
|
"PBEWithSHA1AndDESede");
|
||||||
put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_DESede,
|
put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_DESede,
|
||||||
"PBEWithSHA1AndDESede");
|
"PBEWithSHA1AndDESede");
|
||||||
|
|
||||||
put("SecretKeyFactory.PBEWithSHA1AndRC2_40",
|
put("SecretKeyFactory.PBEWithSHA1AndRC2_40",
|
||||||
"com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC2_40"
|
"com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC2_40"
|
||||||
);
|
);
|
||||||
put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS12_RC2_40,
|
put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS12_RC2_40,
|
||||||
"PBEWithSHA1AndRC2_40");
|
"PBEWithSHA1AndRC2_40");
|
||||||
put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_RC2_40,
|
put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_RC2_40,
|
||||||
"PBEWithSHA1AndRC2_40");
|
"PBEWithSHA1AndRC2_40");
|
||||||
|
|
||||||
put("SecretKeyFactory.PBKDF2WithHmacSHA1",
|
put("SecretKeyFactory.PBKDF2WithHmacSHA1",
|
||||||
"com.sun.crypto.provider.PBKDF2HmacSHA1Factory");
|
"com.sun.crypto.provider.PBKDF2HmacSHA1Factory");
|
||||||
put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS5_PBKDF2,
|
put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS5_PBKDF2,
|
||||||
"PBKDF2WithHmacSHA1");
|
"PBKDF2WithHmacSHA1");
|
||||||
put("Alg.Alias.SecretKeyFactory." + OID_PKCS5_PBKDF2,
|
put("Alg.Alias.SecretKeyFactory." + OID_PKCS5_PBKDF2,
|
||||||
"PBKDF2WithHmacSHA1");
|
"PBKDF2WithHmacSHA1");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MAC
|
* MAC
|
||||||
*/
|
*/
|
||||||
put("Mac.HmacMD5", "com.sun.crypto.provider.HmacMD5");
|
put("Mac.HmacMD5", "com.sun.crypto.provider.HmacMD5");
|
||||||
put("Mac.HmacSHA1", "com.sun.crypto.provider.HmacSHA1");
|
put("Mac.HmacSHA1", "com.sun.crypto.provider.HmacSHA1");
|
||||||
put("Mac.HmacSHA256",
|
put("Mac.HmacSHA256",
|
||||||
"com.sun.crypto.provider.HmacCore$HmacSHA256");
|
"com.sun.crypto.provider.HmacCore$HmacSHA256");
|
||||||
put("Mac.HmacSHA384",
|
put("Mac.HmacSHA384",
|
||||||
"com.sun.crypto.provider.HmacCore$HmacSHA384");
|
"com.sun.crypto.provider.HmacCore$HmacSHA384");
|
||||||
put("Mac.HmacSHA512",
|
put("Mac.HmacSHA512",
|
||||||
"com.sun.crypto.provider.HmacCore$HmacSHA512");
|
"com.sun.crypto.provider.HmacCore$HmacSHA512");
|
||||||
put("Mac.HmacPBESHA1",
|
put("Mac.HmacPBESHA1",
|
||||||
"com.sun.crypto.provider.HmacPKCS12PBESHA1");
|
"com.sun.crypto.provider.HmacPKCS12PBESHA1");
|
||||||
|
|
||||||
put("Mac.SslMacMD5",
|
put("Mac.SslMacMD5",
|
||||||
"com.sun.crypto.provider.SslMacCore$SslMacMD5");
|
"com.sun.crypto.provider.SslMacCore$SslMacMD5");
|
||||||
put("Mac.SslMacSHA1",
|
put("Mac.SslMacSHA1",
|
||||||
"com.sun.crypto.provider.SslMacCore$SslMacSHA1");
|
"com.sun.crypto.provider.SslMacCore$SslMacSHA1");
|
||||||
|
|
||||||
put("Mac.HmacMD5 SupportedKeyFormats", "RAW");
|
put("Mac.HmacMD5 SupportedKeyFormats", "RAW");
|
||||||
put("Mac.HmacSHA1 SupportedKeyFormats", "RAW");
|
put("Mac.HmacSHA1 SupportedKeyFormats", "RAW");
|
||||||
put("Mac.HmacSHA256 SupportedKeyFormats", "RAW");
|
put("Mac.HmacSHA256 SupportedKeyFormats", "RAW");
|
||||||
put("Mac.HmacSHA384 SupportedKeyFormats", "RAW");
|
put("Mac.HmacSHA384 SupportedKeyFormats", "RAW");
|
||||||
put("Mac.HmacSHA512 SupportedKeyFormats", "RAW");
|
put("Mac.HmacSHA512 SupportedKeyFormats", "RAW");
|
||||||
put("Mac.HmacPBESHA1 SupportedKeyFormats", "RAW");
|
put("Mac.HmacPBESHA1 SupportedKeyFormats", "RAW");
|
||||||
put("Mac.SslMacMD5 SupportedKeyFormats", "RAW");
|
put("Mac.SslMacMD5 SupportedKeyFormats", "RAW");
|
||||||
put("Mac.SslMacSHA1 SupportedKeyFormats", "RAW");
|
put("Mac.SslMacSHA1 SupportedKeyFormats", "RAW");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* KeyStore
|
* KeyStore
|
||||||
*/
|
*/
|
||||||
put("KeyStore.JCEKS", "com.sun.crypto.provider.JceKeyStore");
|
put("KeyStore.JCEKS", "com.sun.crypto.provider.JceKeyStore");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SSL/TLS mechanisms
|
* SSL/TLS mechanisms
|
||||||
*
|
*
|
||||||
* These are strictly internal implementations and may
|
* These are strictly internal implementations and may
|
||||||
* be changed at any time. These names were chosen
|
* be changed at any time. These names were chosen
|
||||||
* because PKCS11/SunPKCS11 does not yet have TLS1.2
|
* because PKCS11/SunPKCS11 does not yet have TLS1.2
|
||||||
* mechanisms, and it will cause calls to come here.
|
* mechanisms, and it will cause calls to come here.
|
||||||
*/
|
*/
|
||||||
put("KeyGenerator.SunTlsPrf",
|
put("KeyGenerator.SunTlsPrf",
|
||||||
"com.sun.crypto.provider.TlsPrfGenerator$V10");
|
"com.sun.crypto.provider.TlsPrfGenerator$V10");
|
||||||
put("KeyGenerator.SunTls12Prf",
|
put("KeyGenerator.SunTls12Prf",
|
||||||
"com.sun.crypto.provider.TlsPrfGenerator$V12");
|
"com.sun.crypto.provider.TlsPrfGenerator$V12");
|
||||||
|
|
||||||
put("KeyGenerator.SunTlsMasterSecret",
|
put("KeyGenerator.SunTlsMasterSecret",
|
||||||
"com.sun.crypto.provider.TlsMasterSecretGenerator");
|
"com.sun.crypto.provider.TlsMasterSecretGenerator");
|
||||||
put("Alg.Alias.KeyGenerator.SunTls12MasterSecret",
|
put("Alg.Alias.KeyGenerator.SunTls12MasterSecret",
|
||||||
"SunTlsMasterSecret");
|
"SunTlsMasterSecret");
|
||||||
|
|
||||||
put("KeyGenerator.SunTlsKeyMaterial",
|
put("KeyGenerator.SunTlsKeyMaterial",
|
||||||
"com.sun.crypto.provider.TlsKeyMaterialGenerator");
|
"com.sun.crypto.provider.TlsKeyMaterialGenerator");
|
||||||
put("Alg.Alias.KeyGenerator.SunTls12KeyMaterial",
|
put("Alg.Alias.KeyGenerator.SunTls12KeyMaterial",
|
||||||
"SunTlsKeyMaterial");
|
"SunTlsKeyMaterial");
|
||||||
|
|
||||||
put("KeyGenerator.SunTlsRsaPremasterSecret",
|
put("KeyGenerator.SunTlsRsaPremasterSecret",
|
||||||
"com.sun.crypto.provider.TlsRsaPremasterSecretGenerator");
|
"com.sun.crypto.provider.TlsRsaPremasterSecretGenerator");
|
||||||
put("Alg.Alias.KeyGenerator.SunTls12RsaPremasterSecret",
|
put("Alg.Alias.KeyGenerator.SunTls12RsaPremasterSecret",
|
||||||
"SunTlsRsaPremasterSecret");
|
"SunTlsRsaPremasterSecret");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -31,7 +31,6 @@ import java.security.spec.AlgorithmParameterSpec;
|
|||||||
import javax.crypto.*;
|
import javax.crypto.*;
|
||||||
import javax.crypto.spec.*;
|
import javax.crypto.spec.*;
|
||||||
|
|
||||||
import sun.security.internal.interfaces.TlsMasterSecret;
|
|
||||||
import sun.security.internal.spec.*;
|
import sun.security.internal.spec.*;
|
||||||
|
|
||||||
import static com.sun.crypto.provider.TlsPrfGenerator.*;
|
import static com.sun.crypto.provider.TlsPrfGenerator.*;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -140,6 +140,7 @@ public final class TlsMasterSecretGenerator extends KeyGeneratorSpi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final class TlsMasterSecretKey implements TlsMasterSecret {
|
private static final class TlsMasterSecretKey implements TlsMasterSecret {
|
||||||
|
private static final long serialVersionUID = 1019571680375368880L;
|
||||||
|
|
||||||
private byte[] key;
|
private byte[] key;
|
||||||
private final int majorVersion, minorVersion;
|
private final int majorVersion, minorVersion;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -32,8 +32,6 @@ import java.util.NoSuchElementException;
|
|||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
import org.omg.CosNaming.*;
|
import org.omg.CosNaming.*;
|
||||||
import org.omg.CosNaming.NamingContextPackage.*;
|
|
||||||
import org.omg.CORBA.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the JNDI NamingEnumeration interface for COS
|
* Implements the JNDI NamingEnumeration interface for COS
|
||||||
@ -44,7 +42,8 @@ import org.omg.CORBA.*;
|
|||||||
* @author Rosanna Lee
|
* @author Rosanna Lee
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final class CNBindingEnumeration implements NamingEnumeration {
|
final class CNBindingEnumeration
|
||||||
|
implements NamingEnumeration<javax.naming.Binding> {
|
||||||
|
|
||||||
private static final int DEFAULT_BATCHSIZE = 100;
|
private static final int DEFAULT_BATCHSIZE = 100;
|
||||||
private BindingListHolder _bindingList; // list of bindings
|
private BindingListHolder _bindingList; // list of bindings
|
||||||
@ -52,105 +51,105 @@ final class CNBindingEnumeration implements NamingEnumeration {
|
|||||||
private int counter; // pointer in _bindingList
|
private int counter; // pointer in _bindingList
|
||||||
private int batchsize = DEFAULT_BATCHSIZE; // how many to ask for each time
|
private int batchsize = DEFAULT_BATCHSIZE; // how many to ask for each time
|
||||||
private CNCtx _ctx; // ctx to list
|
private CNCtx _ctx; // ctx to list
|
||||||
private Hashtable _env; // environment for getObjectInstance
|
private Hashtable<?,?> _env; // environment for getObjectInstance
|
||||||
private boolean more = false; // iterator done?
|
private boolean more = false; // iterator done?
|
||||||
private boolean isLookedUpCtx = false; // iterating on a context beneath this context ?
|
private boolean isLookedUpCtx = false; // iterating on a context beneath this context ?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a CNBindingEnumeration object.
|
* Creates a CNBindingEnumeration object.
|
||||||
* @param ctx Context to enumerate
|
* @param ctx Context to enumerate
|
||||||
*/
|
*/
|
||||||
CNBindingEnumeration(CNCtx ctx, boolean isLookedUpCtx, Hashtable env) {
|
CNBindingEnumeration(CNCtx ctx, boolean isLookedUpCtx, Hashtable<?,?> env) {
|
||||||
// Get batch size to use
|
// Get batch size to use
|
||||||
String batch = (env != null ?
|
String batch = (env != null ?
|
||||||
(String)env.get(javax.naming.Context.BATCHSIZE) : null);
|
(String)env.get(javax.naming.Context.BATCHSIZE) : null);
|
||||||
if (batch != null) {
|
if (batch != null) {
|
||||||
try {
|
try {
|
||||||
batchsize = Integer.parseInt(batch);
|
batchsize = Integer.parseInt(batch);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
throw new IllegalArgumentException("Batch size not numeric: " + batch);
|
throw new IllegalArgumentException("Batch size not numeric: " + batch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ctx = ctx;
|
||||||
|
_ctx.incEnumCount();
|
||||||
|
this.isLookedUpCtx = isLookedUpCtx;
|
||||||
|
_env = env;
|
||||||
|
_bindingList = new BindingListHolder();
|
||||||
|
BindingIteratorHolder _bindingIterH = new BindingIteratorHolder();
|
||||||
|
|
||||||
|
// Perform listing and request that bindings be returned in _bindingIter
|
||||||
|
// Upon return,_bindingList returns a zero length list
|
||||||
|
_ctx._nc.list(0, _bindingList, _bindingIterH);
|
||||||
|
|
||||||
|
_bindingIter = _bindingIterH.value;
|
||||||
|
|
||||||
|
// Get first batch using _bindingIter
|
||||||
|
if (_bindingIter != null) {
|
||||||
|
more = _bindingIter.next_n(batchsize, _bindingList);
|
||||||
|
} else {
|
||||||
|
more = false;
|
||||||
|
}
|
||||||
|
counter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the next binding in the list.
|
||||||
|
* @exception NamingException any naming exception.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public javax.naming.Binding next() throws NamingException {
|
||||||
|
if (more && counter >= _bindingList.value.length) {
|
||||||
|
getMore();
|
||||||
|
}
|
||||||
|
if (more && counter < _bindingList.value.length) {
|
||||||
|
org.omg.CosNaming.Binding bndg = _bindingList.value[counter];
|
||||||
|
counter++;
|
||||||
|
return mapBinding(bndg);
|
||||||
|
} else {
|
||||||
|
throw new NoSuchElementException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ctx = ctx;
|
|
||||||
_ctx.incEnumCount();
|
|
||||||
this.isLookedUpCtx = isLookedUpCtx;
|
|
||||||
_env = env;
|
|
||||||
_bindingList = new BindingListHolder();
|
|
||||||
BindingIteratorHolder _bindingIterH = new BindingIteratorHolder();
|
|
||||||
|
|
||||||
// Perform listing and request that bindings be returned in _bindingIter
|
|
||||||
// Upon return,_bindingList returns a zero length list
|
|
||||||
_ctx._nc.list(0, _bindingList, _bindingIterH);
|
|
||||||
|
|
||||||
_bindingIter = _bindingIterH.value;
|
/**
|
||||||
|
* Returns true or false depending on whether there are more bindings.
|
||||||
|
* @return boolean value
|
||||||
|
*/
|
||||||
|
|
||||||
// Get first batch using _bindingIter
|
public boolean hasMore() throws NamingException {
|
||||||
if (_bindingIter != null) {
|
// If there's more, check whether current bindingList has been exhausted,
|
||||||
more = _bindingIter.next_n(batchsize, _bindingList);
|
// and if so, try to get more.
|
||||||
} else {
|
// If no more, just say so.
|
||||||
more = false;
|
return more ? (counter < _bindingList.value.length || getMore()) : false;
|
||||||
}
|
}
|
||||||
counter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the next binding in the list.
|
* Returns true or false depending on whether there are more bindings.
|
||||||
* @exception NamingException any naming exception.
|
* Need to define this to satisfy the Enumeration api requirement.
|
||||||
*/
|
* @return boolean value
|
||||||
|
*/
|
||||||
|
|
||||||
public java.lang.Object next() throws NamingException {
|
public boolean hasMoreElements() {
|
||||||
if (more && counter >= _bindingList.value.length) {
|
try {
|
||||||
getMore();
|
return hasMore();
|
||||||
}
|
} catch (NamingException e) {
|
||||||
if (more && counter < _bindingList.value.length) {
|
return false;
|
||||||
org.omg.CosNaming.Binding bndg = _bindingList.value[counter];
|
}
|
||||||
counter++;
|
}
|
||||||
return mapBinding(bndg);
|
|
||||||
} else {
|
|
||||||
throw new NoSuchElementException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
|
||||||
* Returns true or false depending on whether there are more bindings.
|
|
||||||
* @return boolean value
|
|
||||||
*/
|
|
||||||
|
|
||||||
public boolean hasMore() throws NamingException {
|
|
||||||
// If there's more, check whether current bindingList has been exhausted,
|
|
||||||
// and if so, try to get more.
|
|
||||||
// If no more, just say so.
|
|
||||||
return more ? (counter < _bindingList.value.length || getMore()) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true or false depending on whether there are more bindings.
|
|
||||||
* Need to define this to satisfy the Enumeration api requirement.
|
|
||||||
* @return boolean value
|
|
||||||
*/
|
|
||||||
|
|
||||||
public boolean hasMoreElements() {
|
|
||||||
try {
|
|
||||||
return hasMore();
|
|
||||||
} catch (NamingException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the next binding in the list.
|
* Returns the next binding in the list.
|
||||||
* @exception NoSuchElementException Thrown when the end of the
|
* @exception NoSuchElementException Thrown when the end of the
|
||||||
* list is reached.
|
* list is reached.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public java.lang.Object nextElement() {
|
public javax.naming.Binding nextElement() {
|
||||||
try {
|
try {
|
||||||
return next();
|
return next();
|
||||||
} catch (NamingException ne) {
|
} catch (NamingException ne) {
|
||||||
throw new NoSuchElementException();
|
throw new NoSuchElementException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws NamingException {
|
public void close() throws NamingException {
|
||||||
more = false;
|
more = false;
|
||||||
@ -197,7 +196,7 @@ final class CNBindingEnumeration implements NamingEnumeration {
|
|||||||
return more;
|
return more;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a JNDI Binding object from the COS Naming binding
|
* Constructs a JNDI Binding object from the COS Naming binding
|
||||||
* object.
|
* object.
|
||||||
* @exception NameNotFound No objects under the name.
|
* @exception NameNotFound No objects under the name.
|
||||||
@ -232,5 +231,5 @@ final class CNBindingEnumeration implements NamingEnumeration {
|
|||||||
String fullName = CNNameParser.cosNameToInsString(comps);
|
String fullName = CNNameParser.cosNameToInsString(comps);
|
||||||
jbndg.setNameInNamespace(fullName);
|
jbndg.setNameInNamespace(fullName);
|
||||||
return jbndg;
|
return jbndg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -30,7 +30,6 @@ import javax.naming.spi.NamingManager;
|
|||||||
import javax.naming.spi.ResolveResult;
|
import javax.naming.spi.ResolveResult;
|
||||||
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Vector;
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -63,7 +62,7 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
public NamingContext _nc; // public for accessing underlying NamingContext
|
public NamingContext _nc; // public for accessing underlying NamingContext
|
||||||
private NameComponent[] _name = null;
|
private NameComponent[] _name = null;
|
||||||
|
|
||||||
Hashtable _env; // used by ExceptionMapper
|
Hashtable<String, java.lang.Object> _env; // used by ExceptionMapper
|
||||||
static final CNNameParser parser = new CNNameParser();
|
static final CNNameParser parser = new CNNameParser();
|
||||||
|
|
||||||
private static final String FED_PROP = "com.sun.jndi.cosnaming.federation";
|
private static final String FED_PROP = "com.sun.jndi.cosnaming.federation";
|
||||||
@ -82,11 +81,12 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
* @param env Environment properties for initializing name service.
|
* @param env Environment properties for initializing name service.
|
||||||
* @exception NamingException Cannot initialize ORB or naming context.
|
* @exception NamingException Cannot initialize ORB or naming context.
|
||||||
*/
|
*/
|
||||||
CNCtx(Hashtable env) throws NamingException {
|
@SuppressWarnings("unchecked")
|
||||||
|
CNCtx(Hashtable<?,?> env) throws NamingException {
|
||||||
if (env != null) {
|
if (env != null) {
|
||||||
env = (Hashtable) env.clone();
|
env = (Hashtable<?,?>)env.clone();
|
||||||
}
|
}
|
||||||
_env = env;
|
_env = (Hashtable<String, java.lang.Object>)env;
|
||||||
federation = "true".equals(env != null ? env.get(FED_PROP) : null);
|
federation = "true".equals(env != null ? env.get(FED_PROP) : null);
|
||||||
initOrbAndRootContext(env);
|
initOrbAndRootContext(env);
|
||||||
}
|
}
|
||||||
@ -97,13 +97,14 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
/**
|
/**
|
||||||
* This method is used by the iiop and iiopname URL Context factories.
|
* This method is used by the iiop and iiopname URL Context factories.
|
||||||
*/
|
*/
|
||||||
public static ResolveResult createUsingURL(String url, Hashtable env)
|
@SuppressWarnings("unchecked")
|
||||||
|
public static ResolveResult createUsingURL(String url, Hashtable<?,?> env)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
CNCtx ctx = new CNCtx();
|
CNCtx ctx = new CNCtx();
|
||||||
if (env != null) {
|
if (env != null) {
|
||||||
env = (Hashtable) env.clone();
|
env = (Hashtable<?,?>) env.clone();
|
||||||
}
|
}
|
||||||
ctx._env = env;
|
ctx._env = (Hashtable<String, java.lang.Object>)env;
|
||||||
String rest = ctx.initUsingUrl(
|
String rest = ctx.initUsingUrl(
|
||||||
env != null ?
|
env != null ?
|
||||||
(org.omg.CORBA.ORB) env.get("java.naming.corba.orb")
|
(org.omg.CORBA.ORB) env.get("java.naming.corba.orb")
|
||||||
@ -128,8 +129,8 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
* @param name The name of this context relative to the root
|
* @param name The name of this context relative to the root
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CNCtx(ORB orb, OrbReuseTracker tracker, NamingContext nctx, Hashtable env,
|
CNCtx(ORB orb, OrbReuseTracker tracker, NamingContext nctx,
|
||||||
NameComponent[]name)
|
Hashtable<String, java.lang.Object> env, NameComponent[]name)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
if (orb == null || nctx == null)
|
if (orb == null || nctx == null)
|
||||||
throw new ConfigurationException(
|
throw new ConfigurationException(
|
||||||
@ -207,7 +208,7 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
* @exception NamingException When an error occurs while initializing the
|
* @exception NamingException When an error occurs while initializing the
|
||||||
* ORB or the naming context.
|
* ORB or the naming context.
|
||||||
*/
|
*/
|
||||||
private void initOrbAndRootContext(Hashtable env) throws NamingException {
|
private void initOrbAndRootContext(Hashtable<?,?> env) throws NamingException {
|
||||||
org.omg.CORBA.ORB inOrb = null;
|
org.omg.CORBA.ORB inOrb = null;
|
||||||
String ncIor = null;
|
String ncIor = null;
|
||||||
|
|
||||||
@ -240,7 +241,7 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
|
|
||||||
// If name supplied in URL, resolve it to a NamingContext
|
// If name supplied in URL, resolve it to a NamingContext
|
||||||
if (insName.length() > 0) {
|
if (insName.length() > 0) {
|
||||||
_name = parser.nameToCosName(parser.parse(insName));
|
_name = CNNameParser.nameToCosName(parser.parse(insName));
|
||||||
try {
|
try {
|
||||||
org.omg.CORBA.Object obj = _nc.resolve(_name);
|
org.omg.CORBA.Object obj = _nc.resolve(_name);
|
||||||
_nc = NamingContextHelper.narrow(obj);
|
_nc = NamingContextHelper.narrow(obj);
|
||||||
@ -271,7 +272,7 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String initUsingUrl(ORB orb, String url, Hashtable env)
|
private String initUsingUrl(ORB orb, String url, Hashtable<?,?> env)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
if (url.startsWith("iiop://") || url.startsWith("iiopname://")) {
|
if (url.startsWith("iiop://") || url.startsWith("iiopname://")) {
|
||||||
return initUsingIiopUrl(orb, url, env);
|
return initUsingIiopUrl(orb, url, env);
|
||||||
@ -283,17 +284,14 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
/**
|
/**
|
||||||
* Handles "iiop" and "iiopname" URLs (INS 98-10-11)
|
* Handles "iiop" and "iiopname" URLs (INS 98-10-11)
|
||||||
*/
|
*/
|
||||||
private String initUsingIiopUrl(ORB defOrb, String url, Hashtable env)
|
private String initUsingIiopUrl(ORB defOrb, String url, Hashtable<?,?> env)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
try {
|
try {
|
||||||
IiopUrl parsedUrl = new IiopUrl(url);
|
IiopUrl parsedUrl = new IiopUrl(url);
|
||||||
|
|
||||||
Vector addrs = parsedUrl.getAddresses();
|
|
||||||
IiopUrl.Address addr;
|
|
||||||
NamingException savedException = null;
|
NamingException savedException = null;
|
||||||
|
|
||||||
for (int i = 0; i < addrs.size(); i++) {
|
for (IiopUrl.Address addr : parsedUrl.getAddresses()) {
|
||||||
addr = (IiopUrl.Address)addrs.elementAt(i);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (defOrb != null) {
|
if (defOrb != null) {
|
||||||
@ -341,7 +339,7 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
/**
|
/**
|
||||||
* Initializes using "corbaname" URL (INS 99-12-03)
|
* Initializes using "corbaname" URL (INS 99-12-03)
|
||||||
*/
|
*/
|
||||||
private String initUsingCorbanameUrl(ORB orb, String url, Hashtable env)
|
private String initUsingCorbanameUrl(ORB orb, String url, Hashtable<?,?> env)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
try {
|
try {
|
||||||
CorbanameUrl parsedUrl = new CorbanameUrl(url);
|
CorbanameUrl parsedUrl = new CorbanameUrl(url);
|
||||||
@ -731,7 +729,7 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
// as per JNDI spec
|
// as per JNDI spec
|
||||||
|
|
||||||
if (leafNotFound(e, path[path.length-1])) {
|
if (leafNotFound(e, path[path.length-1])) {
|
||||||
; // do nothing
|
// do nothing
|
||||||
} else {
|
} else {
|
||||||
throw ExceptionMapper.mapException(e, this, path);
|
throw ExceptionMapper.mapException(e, this, path);
|
||||||
}
|
}
|
||||||
@ -829,7 +827,7 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
* with a non-null argument
|
* with a non-null argument
|
||||||
* @return a list of name-class objects as a NameClassEnumeration.
|
* @return a list of name-class objects as a NameClassEnumeration.
|
||||||
*/
|
*/
|
||||||
public NamingEnumeration list(String name) throws NamingException {
|
public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
|
||||||
return list(new CompositeName(name));
|
return list(new CompositeName(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -840,9 +838,10 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
* @exception NamingException All exceptions thrown by lookup
|
* @exception NamingException All exceptions thrown by lookup
|
||||||
* @return a list of name-class objects as a NameClassEnumeration.
|
* @return a list of name-class objects as a NameClassEnumeration.
|
||||||
*/
|
*/
|
||||||
public NamingEnumeration list(Name name)
|
@SuppressWarnings("unchecked")
|
||||||
|
public NamingEnumeration<NameClassPair> list(Name name)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
return listBindings(name);
|
return (NamingEnumeration)listBindings(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -852,7 +851,7 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
* @exception NamingException all exceptions returned by lookup
|
* @exception NamingException all exceptions returned by lookup
|
||||||
* @return a list of bindings as a BindingEnumeration.
|
* @return a list of bindings as a BindingEnumeration.
|
||||||
*/
|
*/
|
||||||
public NamingEnumeration listBindings(String name)
|
public NamingEnumeration<javax.naming.Binding> listBindings(String name)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
return listBindings(new CompositeName(name));
|
return listBindings(new CompositeName(name));
|
||||||
}
|
}
|
||||||
@ -864,7 +863,7 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
* @exception NamingException all exceptions returned by lookup.
|
* @exception NamingException all exceptions returned by lookup.
|
||||||
* @return a list of bindings as a BindingEnumeration.
|
* @return a list of bindings as a BindingEnumeration.
|
||||||
*/
|
*/
|
||||||
public NamingEnumeration listBindings(Name name)
|
public NamingEnumeration<javax.naming.Binding> listBindings(Name name)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
if (_nc == null)
|
if (_nc == null)
|
||||||
throw new ConfigurationException(
|
throw new ConfigurationException(
|
||||||
@ -1064,11 +1063,12 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
* Returns the current environment.
|
* Returns the current environment.
|
||||||
* @return Environment.
|
* @return Environment.
|
||||||
*/
|
*/
|
||||||
public Hashtable getEnvironment() throws NamingException {
|
@SuppressWarnings("unchecked")
|
||||||
|
public Hashtable<String, java.lang.Object> getEnvironment() throws NamingException {
|
||||||
if (_env == null) {
|
if (_env == null) {
|
||||||
return new Hashtable(5, 0.75f);
|
return new Hashtable<>(5, 0.75f);
|
||||||
} else {
|
} else {
|
||||||
return (Hashtable)_env.clone();
|
return (Hashtable<String, java.lang.Object>)_env.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1090,25 +1090,27 @@ public class CNCtx implements javax.naming.Context {
|
|||||||
* @param propVal The ORB.
|
* @param propVal The ORB.
|
||||||
* @return the previous value of this property if any.
|
* @return the previous value of this property if any.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public java.lang.Object addToEnvironment(String propName,
|
public java.lang.Object addToEnvironment(String propName,
|
||||||
java.lang.Object propValue)
|
java.lang.Object propValue)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
if (_env == null) {
|
if (_env == null) {
|
||||||
_env = new Hashtable(7, 0.75f);
|
_env = new Hashtable<>(7, 0.75f);
|
||||||
} else {
|
} else {
|
||||||
// copy-on-write
|
// copy-on-write
|
||||||
_env = (Hashtable)_env.clone();
|
_env = (Hashtable<String, java.lang.Object>)_env.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
return _env.put(propName, propValue);
|
return _env.put(propName, propValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record change but do not reinitialize ORB
|
// Record change but do not reinitialize ORB
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public java.lang.Object removeFromEnvironment(String propName)
|
public java.lang.Object removeFromEnvironment(String propName)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
if (_env != null && _env.get(propName) != null) {
|
if (_env != null && _env.get(propName) != null) {
|
||||||
// copy-on-write
|
// copy-on-write
|
||||||
_env = (Hashtable)_env.clone();
|
_env = (Hashtable<String, java.lang.Object>)_env.clone();
|
||||||
return _env.remove(propName);
|
return _env.remove(propName);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -67,7 +67,7 @@ final public class CNNameParser implements NameParser {
|
|||||||
* @return a non-null CompoundName
|
* @return a non-null CompoundName
|
||||||
*/
|
*/
|
||||||
public Name parse(String name) throws NamingException {
|
public Name parse(String name) throws NamingException {
|
||||||
Vector comps = insStringToStringifiedComps(name);
|
Vector<String> comps = insStringToStringifiedComps(name);
|
||||||
return new CNCompoundName(comps.elements());
|
return new CNCompoundName(comps.elements());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,11 +128,11 @@ final public class CNNameParser implements NameParser {
|
|||||||
* each element of the vector contains a stringified form of
|
* each element of the vector contains a stringified form of
|
||||||
* a NameComponent.
|
* a NameComponent.
|
||||||
*/
|
*/
|
||||||
private static Vector insStringToStringifiedComps(String str)
|
private static Vector<String> insStringToStringifiedComps(String str)
|
||||||
throws InvalidNameException {
|
throws InvalidNameException {
|
||||||
|
|
||||||
int len = str.length();
|
int len = str.length();
|
||||||
Vector components = new Vector(10);
|
Vector<String> components = new Vector<>(10);
|
||||||
char[] id = new char[len];
|
char[] id = new char[len];
|
||||||
char[] kind = new char[len];
|
char[] kind = new char[len];
|
||||||
int idCount, kindCount;
|
int idCount, kindCount;
|
||||||
@ -306,7 +306,7 @@ final public class CNNameParser implements NameParser {
|
|||||||
* and stringifying code of the default CompoundName.
|
* and stringifying code of the default CompoundName.
|
||||||
*/
|
*/
|
||||||
static final class CNCompoundName extends CompoundName {
|
static final class CNCompoundName extends CompoundName {
|
||||||
CNCompoundName(Enumeration enum_) {
|
CNCompoundName(Enumeration<String> enum_) {
|
||||||
super(enum_, CNNameParser.mySyntax);
|
super(enum_, CNNameParser.mySyntax);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,12 +315,12 @@ final public class CNNameParser implements NameParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Name getPrefix(int posn) {
|
public Name getPrefix(int posn) {
|
||||||
Enumeration comps = super.getPrefix(posn).getAll();
|
Enumeration<String> comps = super.getPrefix(posn).getAll();
|
||||||
return new CNCompoundName(comps);
|
return new CNCompoundName(comps);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Name getSuffix(int posn) {
|
public Name getSuffix(int posn) {
|
||||||
Enumeration comps = super.getSuffix(posn).getAll();
|
Enumeration<String> comps = super.getSuffix(posn).getAll();
|
||||||
return new CNCompoundName(comps);
|
return new CNCompoundName(comps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -102,10 +102,10 @@ public final class ExceptionMapper {
|
|||||||
|
|
||||||
private static final NamingException tryFed(NotFound e, CNCtx ctx,
|
private static final NamingException tryFed(NotFound e, CNCtx ctx,
|
||||||
NameComponent[] inputName) throws NamingException {
|
NameComponent[] inputName) throws NamingException {
|
||||||
NameComponent[] rest = ((NotFound) e).rest_of_name;
|
NameComponent[] rest = e.rest_of_name;
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
System.out.println(((NotFound)e).why.value());
|
System.out.println(e.why.value());
|
||||||
System.out.println(rest.length);
|
System.out.println(rest.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -68,7 +68,7 @@ public final class IiopUrl {
|
|||||||
static final private int DEFAULT_IIOPNAME_PORT = 9999;
|
static final private int DEFAULT_IIOPNAME_PORT = 9999;
|
||||||
static final private int DEFAULT_IIOP_PORT = 900;
|
static final private int DEFAULT_IIOP_PORT = 900;
|
||||||
static final private String DEFAULT_HOST = "localhost";
|
static final private String DEFAULT_HOST = "localhost";
|
||||||
private Vector addresses;
|
private Vector<Address> addresses;
|
||||||
private String stringName;
|
private String stringName;
|
||||||
|
|
||||||
public static class Address {
|
public static class Address {
|
||||||
@ -149,7 +149,7 @@ public final class IiopUrl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector getAddresses() {
|
public Vector<Address> getAddresses() {
|
||||||
return addresses;
|
return addresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ public final class IiopUrl {
|
|||||||
} else {
|
} else {
|
||||||
stringName = UrlUtil.decode(url.substring(addrEnd+1));
|
stringName = UrlUtil.decode(url.substring(addrEnd+1));
|
||||||
}
|
}
|
||||||
addresses = new Vector(3);
|
addresses = new Vector<>(3);
|
||||||
if (oldFormat) {
|
if (oldFormat) {
|
||||||
// Only one host:port part, not multiple
|
// Only one host:port part, not multiple
|
||||||
addresses.addElement(
|
addresses.addElement(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -524,7 +524,7 @@ public class DnsClient {
|
|||||||
"\tResponse Q:" + resps);
|
"\tResponse Q:" + resps);
|
||||||
}
|
}
|
||||||
byte[] pkt;
|
byte[] pkt;
|
||||||
if ((pkt = (byte[]) resps.get(xid)) != null) {
|
if ((pkt = resps.get(xid)) != null) {
|
||||||
checkResponseCode(new Header(pkt, pkt.length));
|
checkResponseCode(new Header(pkt, pkt.length));
|
||||||
synchronized (queuesLock) {
|
synchronized (queuesLock) {
|
||||||
resps.remove(xid);
|
resps.remove(xid);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -47,7 +47,7 @@ public class DnsContext extends ComponentDirContext {
|
|||||||
|
|
||||||
DnsName domain; // fully-qualified domain name of this context,
|
DnsName domain; // fully-qualified domain name of this context,
|
||||||
// with a root (empty) label at position 0
|
// with a root (empty) label at position 0
|
||||||
Hashtable environment;
|
Hashtable<Object,Object> environment;
|
||||||
private boolean envShared; // true if environment is possibly shared
|
private boolean envShared; // true if environment is possibly shared
|
||||||
// and so must be copied on write
|
// and so must be copied on write
|
||||||
private boolean parentIsDns; // was this DnsContext created by
|
private boolean parentIsDns; // was this DnsContext created by
|
||||||
@ -95,14 +95,15 @@ public class DnsContext extends ComponentDirContext {
|
|||||||
* There must be at least one server.
|
* There must be at least one server.
|
||||||
* The environment must not be null; it is cloned before being stored.
|
* The environment must not be null; it is cloned before being stored.
|
||||||
*/
|
*/
|
||||||
public DnsContext(String domain, String[] servers, Hashtable environment)
|
@SuppressWarnings("unchecked")
|
||||||
|
public DnsContext(String domain, String[] servers, Hashtable<?,?> environment)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
this.domain = new DnsName(domain.endsWith(".")
|
this.domain = new DnsName(domain.endsWith(".")
|
||||||
? domain
|
? domain
|
||||||
: domain + ".");
|
: domain + ".");
|
||||||
this.servers = servers;
|
this.servers = servers;
|
||||||
this.environment = (Hashtable) environment.clone();
|
this.environment = (Hashtable<Object,Object>) environment.clone();
|
||||||
envShared = false;
|
envShared = false;
|
||||||
parentIsDns = false;
|
parentIsDns = false;
|
||||||
resolver = null;
|
resolver = null;
|
||||||
@ -154,14 +155,15 @@ public class DnsContext extends ComponentDirContext {
|
|||||||
/*
|
/*
|
||||||
* Override default with a noncloning version.
|
* Override default with a noncloning version.
|
||||||
*/
|
*/
|
||||||
protected Hashtable p_getEnvironment() {
|
protected Hashtable<?,?> p_getEnvironment() {
|
||||||
return environment;
|
return environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hashtable getEnvironment() throws NamingException {
|
public Hashtable<?,?> getEnvironment() throws NamingException {
|
||||||
return (Hashtable) environment.clone();
|
return (Hashtable<?,?>) environment.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public Object addToEnvironment(String propName, Object propVal)
|
public Object addToEnvironment(String propName, Object propVal)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
@ -189,7 +191,7 @@ public class DnsContext extends ComponentDirContext {
|
|||||||
return environment.put(propName, propVal);
|
return environment.put(propName, propVal);
|
||||||
} else if (environment.get(propName) != propVal) {
|
} else if (environment.get(propName) != propVal) {
|
||||||
// copy on write
|
// copy on write
|
||||||
environment = (Hashtable) environment.clone();
|
environment = (Hashtable<Object,Object>) environment.clone();
|
||||||
envShared = false;
|
envShared = false;
|
||||||
return environment.put(propName, propVal);
|
return environment.put(propName, propVal);
|
||||||
} else {
|
} else {
|
||||||
@ -197,6 +199,7 @@ public class DnsContext extends ComponentDirContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public Object removeFromEnvironment(String propName)
|
public Object removeFromEnvironment(String propName)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
@ -222,7 +225,7 @@ public class DnsContext extends ComponentDirContext {
|
|||||||
return environment.remove(propName);
|
return environment.remove(propName);
|
||||||
} else if (environment.get(propName) != null) {
|
} else if (environment.get(propName) != null) {
|
||||||
// copy-on-write
|
// copy-on-write
|
||||||
environment = (Hashtable) environment.clone();
|
environment = (Hashtable<Object,Object>) environment.clone();
|
||||||
envShared = false;
|
envShared = false;
|
||||||
return environment.remove(propName);
|
return environment.remove(propName);
|
||||||
} else {
|
} else {
|
||||||
@ -307,7 +310,7 @@ public class DnsContext extends ComponentDirContext {
|
|||||||
return c_lookup(name, cont);
|
return c_lookup(name, cont);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration c_list(Name name, Continuation cont)
|
public NamingEnumeration<NameClassPair> c_list(Name name, Continuation cont)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
cont.setSuccess();
|
cont.setSuccess();
|
||||||
try {
|
try {
|
||||||
@ -322,7 +325,7 @@ public class DnsContext extends ComponentDirContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration c_listBindings(Name name, Continuation cont)
|
public NamingEnumeration<Binding> c_listBindings(Name name, Continuation cont)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
cont.setSuccess();
|
cont.setSuccess();
|
||||||
try {
|
try {
|
||||||
@ -457,7 +460,7 @@ public class DnsContext extends ComponentDirContext {
|
|||||||
new OperationNotSupportedException());
|
new OperationNotSupportedException());
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration c_search(Name name,
|
public NamingEnumeration<SearchResult> c_search(Name name,
|
||||||
Attributes matchingAttributes,
|
Attributes matchingAttributes,
|
||||||
String[] attributesToReturn,
|
String[] attributesToReturn,
|
||||||
Continuation cont)
|
Continuation cont)
|
||||||
@ -465,7 +468,7 @@ public class DnsContext extends ComponentDirContext {
|
|||||||
throw new OperationNotSupportedException();
|
throw new OperationNotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration c_search(Name name,
|
public NamingEnumeration<SearchResult> c_search(Name name,
|
||||||
String filter,
|
String filter,
|
||||||
SearchControls cons,
|
SearchControls cons,
|
||||||
Continuation cont)
|
Continuation cont)
|
||||||
@ -473,7 +476,7 @@ public class DnsContext extends ComponentDirContext {
|
|||||||
throw new OperationNotSupportedException();
|
throw new OperationNotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration c_search(Name name,
|
public NamingEnumeration<SearchResult> c_search(Name name,
|
||||||
String filterExpr,
|
String filterExpr,
|
||||||
Object[] filterArgs,
|
Object[] filterArgs,
|
||||||
SearchControls cons,
|
SearchControls cons,
|
||||||
@ -608,7 +611,7 @@ public class DnsContext extends ComponentDirContext {
|
|||||||
BasicAttributes attrs = new BasicAttributes(true);
|
BasicAttributes attrs = new BasicAttributes(true);
|
||||||
|
|
||||||
for (int i = 0; i < rrs.answer.size(); i++) {
|
for (int i = 0; i < rrs.answer.size(); i++) {
|
||||||
ResourceRecord rr = (ResourceRecord) rrs.answer.elementAt(i);
|
ResourceRecord rr = rrs.answer.elementAt(i);
|
||||||
int rrtype = rr.getType();
|
int rrtype = rr.getType();
|
||||||
int rrclass = rr.getRrclass();
|
int rrclass = rr.getRrclass();
|
||||||
|
|
||||||
@ -952,19 +955,14 @@ class CT {
|
|||||||
//----------
|
//----------
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An enumeration of name/classname pairs.
|
* Common base class for NameClassPairEnumeration and BindingEnumeration.
|
||||||
*
|
|
||||||
* Nodes that have children or that are zone cuts are returned with
|
|
||||||
* classname DirContext. Other nodes are returned with classname
|
|
||||||
* Object even though they are DirContexts as well, since this might
|
|
||||||
* make the namespace easier to browse.
|
|
||||||
*/
|
*/
|
||||||
class NameClassPairEnumeration implements NamingEnumeration {
|
abstract class BaseNameClassPairEnumeration<T> implements NamingEnumeration<T> {
|
||||||
|
|
||||||
protected Enumeration nodes; // nodes to be enumerated, or null if none
|
protected Enumeration<NameNode> nodes; // nodes to be enumerated, or null if none
|
||||||
protected DnsContext ctx; // context being enumerated
|
protected DnsContext ctx; // context being enumerated
|
||||||
|
|
||||||
NameClassPairEnumeration(DnsContext ctx, Hashtable nodes) {
|
BaseNameClassPairEnumeration(DnsContext ctx, Hashtable<String,NameNode> nodes) {
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
this.nodes = (nodes != null)
|
this.nodes = (nodes != null)
|
||||||
? nodes.elements()
|
? nodes.elements()
|
||||||
@ -974,12 +972,12 @@ class NameClassPairEnumeration implements NamingEnumeration {
|
|||||||
/*
|
/*
|
||||||
* ctx will be set to null when no longer needed by the enumeration.
|
* ctx will be set to null when no longer needed by the enumeration.
|
||||||
*/
|
*/
|
||||||
public void close() {
|
public final void close() {
|
||||||
nodes = null;
|
nodes = null;
|
||||||
ctx = null;
|
ctx = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMore() {
|
public final boolean hasMore() {
|
||||||
boolean more = ((nodes != null) && nodes.hasMoreElements());
|
boolean more = ((nodes != null) && nodes.hasMoreElements());
|
||||||
if (!more) {
|
if (!more) {
|
||||||
close();
|
close();
|
||||||
@ -987,11 +985,46 @@ class NameClassPairEnumeration implements NamingEnumeration {
|
|||||||
return more;
|
return more;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object next() throws NamingException {
|
public final boolean hasMoreElements() {
|
||||||
|
return hasMore();
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract public T next() throws NamingException;
|
||||||
|
|
||||||
|
public final T nextElement() {
|
||||||
|
try {
|
||||||
|
return next();
|
||||||
|
} catch (NamingException e) {
|
||||||
|
java.util.NoSuchElementException nsee =
|
||||||
|
new java.util.NoSuchElementException();
|
||||||
|
nsee.initCause(e);
|
||||||
|
throw nsee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* An enumeration of name/classname pairs.
|
||||||
|
*
|
||||||
|
* Nodes that have children or that are zone cuts are returned with
|
||||||
|
* classname DirContext. Other nodes are returned with classname
|
||||||
|
* Object even though they are DirContexts as well, since this might
|
||||||
|
* make the namespace easier to browse.
|
||||||
|
*/
|
||||||
|
final class NameClassPairEnumeration
|
||||||
|
extends BaseNameClassPairEnumeration<NameClassPair>
|
||||||
|
implements NamingEnumeration<NameClassPair> {
|
||||||
|
|
||||||
|
NameClassPairEnumeration(DnsContext ctx, Hashtable<String,NameNode> nodes) {
|
||||||
|
super(ctx, nodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NameClassPair next() throws NamingException {
|
||||||
if (!hasMore()) {
|
if (!hasMore()) {
|
||||||
throw new java.util.NoSuchElementException();
|
throw new java.util.NoSuchElementException();
|
||||||
}
|
}
|
||||||
NameNode nnode = (NameNode) nodes.nextElement();
|
NameNode nnode = nodes.nextElement();
|
||||||
String className = (nnode.isZoneCut() ||
|
String className = (nnode.isZoneCut() ||
|
||||||
(nnode.getChildren() != null))
|
(nnode.getChildren() != null))
|
||||||
? "javax.naming.directory.DirContext"
|
? "javax.naming.directory.DirContext"
|
||||||
@ -1005,28 +1038,15 @@ class NameClassPairEnumeration implements NamingEnumeration {
|
|||||||
ncp.setNameInNamespace(ctx.fullyQualify(cname).toString());
|
ncp.setNameInNamespace(ctx.fullyQualify(cname).toString());
|
||||||
return ncp;
|
return ncp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMoreElements() {
|
|
||||||
return hasMore();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object nextElement() {
|
|
||||||
try {
|
|
||||||
return next();
|
|
||||||
} catch (NamingException e) {
|
|
||||||
throw (new java.util.NoSuchElementException(
|
|
||||||
"javax.naming.NamingException was thrown: " +
|
|
||||||
e.getMessage()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An enumeration of Bindings.
|
* An enumeration of Bindings.
|
||||||
*/
|
*/
|
||||||
class BindingEnumeration extends NameClassPairEnumeration {
|
final class BindingEnumeration extends BaseNameClassPairEnumeration<Binding>
|
||||||
|
implements NamingEnumeration<Binding> {
|
||||||
|
|
||||||
BindingEnumeration(DnsContext ctx, Hashtable nodes) {
|
BindingEnumeration(DnsContext ctx, Hashtable<String,NameNode> nodes) {
|
||||||
super(ctx, nodes);
|
super(ctx, nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1035,11 +1055,12 @@ class BindingEnumeration extends NameClassPairEnumeration {
|
|||||||
// close();
|
// close();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public Object next() throws NamingException {
|
@Override
|
||||||
|
public Binding next() throws NamingException {
|
||||||
if (!hasMore()) {
|
if (!hasMore()) {
|
||||||
throw (new java.util.NoSuchElementException());
|
throw (new java.util.NoSuchElementException());
|
||||||
}
|
}
|
||||||
NameNode nnode = (NameNode) nodes.nextElement();
|
NameNode nnode = nodes.nextElement();
|
||||||
|
|
||||||
String label = nnode.getLabel();
|
String label = nnode.getLabel();
|
||||||
Name compName = (new DnsName()).add(label);
|
Name compName = (new DnsName()).add(label);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -59,7 +59,7 @@ public class DnsContextFactory implements InitialContextFactory {
|
|||||||
|
|
||||||
public Context getInitialContext(Hashtable<?,?> env) throws NamingException {
|
public Context getInitialContext(Hashtable<?,?> env) throws NamingException {
|
||||||
if (env == null) {
|
if (env == null) {
|
||||||
env = new Hashtable(5);
|
env = new Hashtable<>(5);
|
||||||
}
|
}
|
||||||
return urlToContext(getInitCtxUrl(env), env);
|
return urlToContext(getInitCtxUrl(env), env);
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ public class DnsContextFactory implements InitialContextFactory {
|
|||||||
* components are overridden by "domain".
|
* components are overridden by "domain".
|
||||||
*/
|
*/
|
||||||
public static DnsContext getContext(String domain,
|
public static DnsContext getContext(String domain,
|
||||||
DnsUrl[] urls, Hashtable env)
|
DnsUrl[] urls, Hashtable<?,?> env)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
String[] servers = serversForUrls(urls);
|
String[] servers = serversForUrls(urls);
|
||||||
@ -95,7 +95,7 @@ public class DnsContextFactory implements InitialContextFactory {
|
|||||||
).isEmpty();
|
).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Context urlToContext(String url, Hashtable env)
|
private static Context urlToContext(String url, Hashtable<?,?> env)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
DnsUrl[] urls;
|
DnsUrl[] urls;
|
||||||
@ -212,7 +212,7 @@ public class DnsContextFactory implements InitialContextFactory {
|
|||||||
* Reads environment to find URL(s) of initial context.
|
* Reads environment to find URL(s) of initial context.
|
||||||
* Default URL is "dns:".
|
* Default URL is "dns:".
|
||||||
*/
|
*/
|
||||||
private static String getInitCtxUrl(Hashtable env) {
|
private static String getInitCtxUrl(Hashtable<?,?> env) {
|
||||||
String url = (String) env.get(Context.PROVIDER_URL);
|
String url = (String) env.get(Context.PROVIDER_URL);
|
||||||
return ((url != null) ? url : DEFAULT_URL);
|
return ((url != null) ? url : DEFAULT_URL);
|
||||||
}
|
}
|
||||||
@ -223,34 +223,31 @@ public class DnsContextFactory implements InitialContextFactory {
|
|||||||
* @param oneIsEnough return output once there exists one ok
|
* @param oneIsEnough return output once there exists one ok
|
||||||
* @return the filtered list, all non-permitted input removed
|
* @return the filtered list, all non-permitted input removed
|
||||||
*/
|
*/
|
||||||
private static List filterNameServers(List input, boolean oneIsEnough) {
|
private static List<String> filterNameServers(List<String> input, boolean oneIsEnough) {
|
||||||
SecurityManager security = System.getSecurityManager();
|
SecurityManager security = System.getSecurityManager();
|
||||||
if (security == null || input == null || input.isEmpty()) {
|
if (security == null || input == null || input.isEmpty()) {
|
||||||
return input;
|
return input;
|
||||||
} else {
|
} else {
|
||||||
List output = new ArrayList();
|
List<String> output = new ArrayList<>();
|
||||||
for (Object o: input) {
|
for (String platformServer: input) {
|
||||||
if (o instanceof String) {
|
int colon = platformServer.indexOf(':',
|
||||||
String platformServer = (String)o;
|
platformServer.indexOf(']') + 1);
|
||||||
int colon = platformServer.indexOf(':',
|
|
||||||
platformServer.indexOf(']') + 1);
|
|
||||||
|
|
||||||
int p = (colon < 0)
|
int p = (colon < 0)
|
||||||
? DEFAULT_PORT
|
? DEFAULT_PORT
|
||||||
: Integer.parseInt(
|
: Integer.parseInt(
|
||||||
platformServer.substring(colon + 1));
|
platformServer.substring(colon + 1));
|
||||||
String s = (colon < 0)
|
String s = (colon < 0)
|
||||||
? platformServer
|
? platformServer
|
||||||
: platformServer.substring(0, colon);
|
: platformServer.substring(0, colon);
|
||||||
try {
|
try {
|
||||||
security.checkConnect(s, p);
|
security.checkConnect(s, p);
|
||||||
output.add(platformServer);
|
output.add(platformServer);
|
||||||
if (oneIsEnough) {
|
if (oneIsEnough) {
|
||||||
return output;
|
return output;
|
||||||
}
|
|
||||||
} catch (SecurityException se) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
} catch (SecurityException se) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,7 +29,6 @@ package com.sun.jndi.dns;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import javax.naming.*;
|
import javax.naming.*;
|
||||||
|
|
||||||
@ -111,7 +110,7 @@ public final class DnsName implements Name {
|
|||||||
// The labels of this domain name, as a list of strings. Index 0
|
// The labels of this domain name, as a list of strings. Index 0
|
||||||
// corresponds to the leftmost (least significant) label: note that
|
// corresponds to the leftmost (least significant) label: note that
|
||||||
// this is the reverse of the ordering used by the Name interface.
|
// this is the reverse of the ordering used by the Name interface.
|
||||||
private ArrayList labels = new ArrayList();
|
private ArrayList<String> labels = new ArrayList<>();
|
||||||
|
|
||||||
// The number of octets needed to carry this domain name in a DNS
|
// The number of octets needed to carry this domain name in a DNS
|
||||||
// packet. Equal to the sum of the lengths of each label, plus the
|
// packet. Equal to the sum of the lengths of each label, plus the
|
||||||
@ -152,9 +151,7 @@ public final class DnsName implements Name {
|
|||||||
domain = n.domain;
|
domain = n.domain;
|
||||||
octets = n.octets;
|
octets = n.octets;
|
||||||
} else {
|
} else {
|
||||||
Iterator iter = labels.iterator();
|
for (String label: labels) {
|
||||||
while (iter.hasNext()) {
|
|
||||||
String label = (String) iter.next();
|
|
||||||
if (label.length() > 0) {
|
if (label.length() > 0) {
|
||||||
octets += (short) (label.length() + 1);
|
octets += (short) (label.length() + 1);
|
||||||
}
|
}
|
||||||
@ -165,10 +162,8 @@ public final class DnsName implements Name {
|
|||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (domain == null) {
|
if (domain == null) {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
Iterator iter = labels.iterator();
|
for (String label: labels) {
|
||||||
while (iter.hasNext()) {
|
|
||||||
String label = (String) iter.next();
|
|
||||||
if (buf.length() > 0 || label.length() == 0) {
|
if (buf.length() > 0 || label.length() == 0) {
|
||||||
buf.append('.');
|
buf.append('.');
|
||||||
}
|
}
|
||||||
@ -183,9 +178,8 @@ public final class DnsName implements Name {
|
|||||||
* Does this domain name follow <em>host name</em> syntax?
|
* Does this domain name follow <em>host name</em> syntax?
|
||||||
*/
|
*/
|
||||||
public boolean isHostName() {
|
public boolean isHostName() {
|
||||||
Iterator iter = labels.iterator();
|
for (String label: labels) {
|
||||||
while (iter.hasNext()) {
|
if (!isHostNameLabel(label)) {
|
||||||
if (!isHostNameLabel((String) iter.next())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,16 +235,16 @@ public final class DnsName implements Name {
|
|||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
}
|
}
|
||||||
int i = size() - pos - 1; // index of "pos" component in "labels"
|
int i = size() - pos - 1; // index of "pos" component in "labels"
|
||||||
return (String) labels.get(i);
|
return labels.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Enumeration getAll() {
|
public Enumeration<String> getAll() {
|
||||||
return new Enumeration() {
|
return new Enumeration<String>() {
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
public boolean hasMoreElements() {
|
public boolean hasMoreElements() {
|
||||||
return (pos < size());
|
return (pos < size());
|
||||||
}
|
}
|
||||||
public Object nextElement() {
|
public String nextElement() {
|
||||||
if (pos < size()) {
|
if (pos < size()) {
|
||||||
return get(pos++);
|
return get(pos++);
|
||||||
}
|
}
|
||||||
@ -276,7 +270,7 @@ public final class DnsName implements Name {
|
|||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
}
|
}
|
||||||
int i = size() - pos - 1; // index of element to remove in "labels"
|
int i = size() - pos - 1; // index of element to remove in "labels"
|
||||||
String label = (String) labels.remove(i);
|
String label = labels.remove(i);
|
||||||
int len = label.length();
|
int len = label.length();
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
octets -= (short) (len + 1);
|
octets -= (short) (len + 1);
|
||||||
@ -530,7 +524,7 @@ public final class DnsName implements Name {
|
|||||||
/*
|
/*
|
||||||
* Append a label to buf, escaping as needed.
|
* Append a label to buf, escaping as needed.
|
||||||
*/
|
*/
|
||||||
private static void escape(StringBuffer buf, String label) {
|
private static void escape(StringBuilder buf, String label) {
|
||||||
for (int i = 0; i < label.length(); i++) {
|
for (int i = 0; i < label.length(); i++) {
|
||||||
char c = label.charAt(i);
|
char c = label.charAt(i);
|
||||||
if (c == '.' || c == '\\') {
|
if (c == '.' || c == '\\') {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -52,7 +52,7 @@ class NameNode {
|
|||||||
|
|
||||||
private String label; // name of this node relative to its
|
private String label; // name of this node relative to its
|
||||||
// parent, or null for root of a tree
|
// parent, or null for root of a tree
|
||||||
private Hashtable children = null; // child nodes
|
private Hashtable<String,NameNode> children = null; // child nodes
|
||||||
private boolean isZoneCut = false; // true if this node is a zone cut
|
private boolean isZoneCut = false; // true if this node is a zone cut
|
||||||
private int depth = 0; // depth in tree (0 for root)
|
private int depth = 0; // depth in tree (0 for root)
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ class NameNode {
|
|||||||
* Returns the children of this node, or null if there are none.
|
* Returns the children of this node, or null if there are none.
|
||||||
* The caller must not modify the Hashtable returned.
|
* The caller must not modify the Hashtable returned.
|
||||||
*/
|
*/
|
||||||
Hashtable getChildren() {
|
Hashtable<String,NameNode> getChildren() {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ class NameNode {
|
|||||||
*/
|
*/
|
||||||
NameNode get(String key) {
|
NameNode get(String key) {
|
||||||
return (children != null)
|
return (children != null)
|
||||||
? (NameNode) children.get(key)
|
? children.get(key)
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,9 +140,9 @@ class NameNode {
|
|||||||
|
|
||||||
NameNode child = null;
|
NameNode child = null;
|
||||||
if (node.children == null) {
|
if (node.children == null) {
|
||||||
node.children = new Hashtable();
|
node.children = new Hashtable<>();
|
||||||
} else {
|
} else {
|
||||||
child = (NameNode) node.children.get(key);
|
child = node.children.get(key);
|
||||||
}
|
}
|
||||||
if (child == null) {
|
if (child == null) {
|
||||||
child = newNameNode(label);
|
child = newNameNode(label);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -125,8 +125,7 @@ class Resolver {
|
|||||||
}
|
}
|
||||||
// Look for an SOA record giving the zone's top node.
|
// Look for an SOA record giving the zone's top node.
|
||||||
for (int i = 0; i < rrs.authority.size(); i++) {
|
for (int i = 0; i < rrs.authority.size(); i++) {
|
||||||
ResourceRecord rr = (ResourceRecord)
|
ResourceRecord rr = rrs.authority.elementAt(i);
|
||||||
rrs.authority.elementAt(i);
|
|
||||||
if (rr.getType() == ResourceRecord.TYPE_SOA) {
|
if (rr.getType() == ResourceRecord.TYPE_SOA) {
|
||||||
DnsName zone = rr.getName();
|
DnsName zone = rr.getName();
|
||||||
if (fqdn.endsWith(zone)) {
|
if (fqdn.endsWith(zone)) {
|
||||||
@ -152,7 +151,7 @@ class Resolver {
|
|||||||
ResourceRecords rrs = query(zone, rrclass, ResourceRecord.TYPE_SOA,
|
ResourceRecords rrs = query(zone, rrclass, ResourceRecord.TYPE_SOA,
|
||||||
recursion, false);
|
recursion, false);
|
||||||
for (int i = 0; i < rrs.answer.size(); i++) {
|
for (int i = 0; i < rrs.answer.size(); i++) {
|
||||||
ResourceRecord rr = (ResourceRecord) rrs.answer.elementAt(i);
|
ResourceRecord rr = rrs.answer.elementAt(i);
|
||||||
if (rr.getType() == ResourceRecord.TYPE_SOA) {
|
if (rr.getType() == ResourceRecord.TYPE_SOA) {
|
||||||
return rr;
|
return rr;
|
||||||
}
|
}
|
||||||
@ -175,8 +174,7 @@ class Resolver {
|
|||||||
recursion, false);
|
recursion, false);
|
||||||
String[] ns = new String[rrs.answer.size()];
|
String[] ns = new String[rrs.answer.size()];
|
||||||
for (int i = 0; i < ns.length; i++) {
|
for (int i = 0; i < ns.length; i++) {
|
||||||
ResourceRecord rr = (ResourceRecord)
|
ResourceRecord rr = rrs.answer.elementAt(i);
|
||||||
rrs.answer.elementAt(i);
|
|
||||||
if (rr.getType() != ResourceRecord.TYPE_NS) {
|
if (rr.getType() != ResourceRecord.TYPE_NS) {
|
||||||
throw new CommunicationException("Corrupted DNS message");
|
throw new CommunicationException("Corrupted DNS message");
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -45,10 +45,10 @@ class ResourceRecords {
|
|||||||
// Four sections: question, answer, authority, additional.
|
// Four sections: question, answer, authority, additional.
|
||||||
// The question section is treated as being made up of (shortened)
|
// The question section is treated as being made up of (shortened)
|
||||||
// resource records, although this isn't technically how it's defined.
|
// resource records, although this isn't technically how it's defined.
|
||||||
Vector question = new Vector();
|
Vector<ResourceRecord> question = new Vector<>();
|
||||||
Vector answer = new Vector();
|
Vector<ResourceRecord> answer = new Vector<>();
|
||||||
Vector authority = new Vector();
|
Vector<ResourceRecord> authority = new Vector<>();
|
||||||
Vector additional = new Vector();
|
Vector<ResourceRecord> additional = new Vector<>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* True if these resource records are from a zone transfer. In
|
* True if these resource records are from a zone transfer. In
|
||||||
@ -80,7 +80,7 @@ class ResourceRecords {
|
|||||||
if (answer.size() == 0) {
|
if (answer.size() == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return ((ResourceRecord) answer.firstElement()).getType();
|
return answer.firstElement().getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -91,7 +91,7 @@ class ResourceRecords {
|
|||||||
if (answer.size() == 0) {
|
if (answer.size() == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return ((ResourceRecord) answer.lastElement()).getType();
|
return answer.lastElement().getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -55,7 +55,7 @@ import java.util.Vector;
|
|||||||
|
|
||||||
class ZoneNode extends NameNode {
|
class ZoneNode extends NameNode {
|
||||||
|
|
||||||
private SoftReference contentsRef = null; // the zone's namespace
|
private SoftReference<NameNode> contentsRef = null; // the zone's namespace
|
||||||
private long serialNumber = -1; // the zone data's serial number
|
private long serialNumber = -1; // the zone data's serial number
|
||||||
private Date expiration = null; // time when the zone's data expires
|
private Date expiration = null; // time when the zone's data expires
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ class ZoneNode extends NameNode {
|
|||||||
*/
|
*/
|
||||||
synchronized NameNode getContents() {
|
synchronized NameNode getContents() {
|
||||||
return (contentsRef != null)
|
return (contentsRef != null)
|
||||||
? (NameNode) contentsRef.get()
|
? contentsRef.get()
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ class ZoneNode extends NameNode {
|
|||||||
NameNode newContents = new NameNode(null);
|
NameNode newContents = new NameNode(null);
|
||||||
|
|
||||||
for (int i = 0; i < rrs.answer.size(); i++) {
|
for (int i = 0; i < rrs.answer.size(); i++) {
|
||||||
ResourceRecord rr = (ResourceRecord) rrs.answer.elementAt(i);
|
ResourceRecord rr = rrs.answer.elementAt(i);
|
||||||
DnsName n = rr.getName();
|
DnsName n = rr.getName();
|
||||||
|
|
||||||
// Ignore resource records whose names aren't within the zone's
|
// Ignore resource records whose names aren't within the zone's
|
||||||
@ -144,9 +144,9 @@ class ZoneNode extends NameNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The zone's SOA record is the first record in the answer section.
|
// The zone's SOA record is the first record in the answer section.
|
||||||
ResourceRecord soa = (ResourceRecord) rrs.answer.firstElement();
|
ResourceRecord soa = rrs.answer.firstElement();
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
contentsRef = new SoftReference(newContents);
|
contentsRef = new SoftReference<NameNode>(newContents);
|
||||||
serialNumber = getSerialNumber(soa);
|
serialNumber = getSerialNumber(soa);
|
||||||
setExpiration(getMinimumTtl(soa));
|
setExpiration(getMinimumTtl(soa));
|
||||||
return newContents;
|
return newContents;
|
||||||
|
@ -0,0 +1,408 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation. Oracle designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Oracle in the LICENSE file that accompanied this code.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sun.jndi.ldap;
|
||||||
|
|
||||||
|
import com.sun.jndi.toolkit.ctx.Continuation;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import javax.naming.*;
|
||||||
|
import javax.naming.directory.Attributes;
|
||||||
|
import javax.naming.ldap.Control;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic enumeration for NameClassPair, Binding, and SearchResults.
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract class AbstractLdapNamingEnumeration<T extends NameClassPair>
|
||||||
|
implements NamingEnumeration<T>, ReferralEnumeration<T> {
|
||||||
|
|
||||||
|
protected Name listArg;
|
||||||
|
|
||||||
|
private boolean cleaned = false;
|
||||||
|
private LdapResult res;
|
||||||
|
private LdapClient enumClnt;
|
||||||
|
private Continuation cont; // used to fill in exceptions
|
||||||
|
private Vector<LdapEntry> entries = null;
|
||||||
|
private int limit = 0;
|
||||||
|
private int posn = 0;
|
||||||
|
protected LdapCtx homeCtx;
|
||||||
|
private LdapReferralException refEx = null;
|
||||||
|
private NamingException errEx = null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Record the next set of entries and/or referrals.
|
||||||
|
*/
|
||||||
|
AbstractLdapNamingEnumeration(LdapCtx homeCtx, LdapResult answer, Name listArg,
|
||||||
|
Continuation cont) throws NamingException {
|
||||||
|
|
||||||
|
// These checks are to accommodate referrals and limit exceptions
|
||||||
|
// which will generate an enumeration and defer the exception
|
||||||
|
// to be thrown at the end of the enumeration.
|
||||||
|
// All other exceptions are thrown immediately.
|
||||||
|
// Exceptions shouldn't be thrown here anyhow because
|
||||||
|
// process_return_code() is called before the constructor
|
||||||
|
// is called, so these are just safety checks.
|
||||||
|
|
||||||
|
if ((answer.status != LdapClient.LDAP_SUCCESS) &&
|
||||||
|
(answer.status != LdapClient.LDAP_SIZE_LIMIT_EXCEEDED) &&
|
||||||
|
(answer.status != LdapClient.LDAP_TIME_LIMIT_EXCEEDED) &&
|
||||||
|
(answer.status != LdapClient.LDAP_ADMIN_LIMIT_EXCEEDED) &&
|
||||||
|
(answer.status != LdapClient.LDAP_REFERRAL) &&
|
||||||
|
(answer.status != LdapClient.LDAP_PARTIAL_RESULTS)) {
|
||||||
|
|
||||||
|
// %%% need to deal with referral
|
||||||
|
NamingException e = new NamingException(
|
||||||
|
LdapClient.getErrorMessage(
|
||||||
|
answer.status, answer.errorMessage));
|
||||||
|
|
||||||
|
throw cont.fillInException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise continue
|
||||||
|
|
||||||
|
res = answer;
|
||||||
|
entries = answer.entries;
|
||||||
|
limit = (entries == null) ? 0 : entries.size(); // handle empty set
|
||||||
|
this.listArg = listArg;
|
||||||
|
this.cont = cont;
|
||||||
|
|
||||||
|
if (answer.refEx != null) {
|
||||||
|
refEx = answer.refEx;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensures that context won't get closed from underneath us
|
||||||
|
this.homeCtx = homeCtx;
|
||||||
|
homeCtx.incEnumCount();
|
||||||
|
enumClnt = homeCtx.clnt; // remember
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final T nextElement() {
|
||||||
|
try {
|
||||||
|
return next();
|
||||||
|
} catch (NamingException e) {
|
||||||
|
// can't throw exception
|
||||||
|
cleanup();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final boolean hasMoreElements() {
|
||||||
|
try {
|
||||||
|
return hasMore();
|
||||||
|
} catch (NamingException e) {
|
||||||
|
// can't throw exception
|
||||||
|
cleanup();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Retrieve the next set of entries and/or referrals.
|
||||||
|
*/
|
||||||
|
private void getNextBatch() throws NamingException {
|
||||||
|
|
||||||
|
res = homeCtx.getSearchReply(enumClnt, res);
|
||||||
|
if (res == null) {
|
||||||
|
limit = posn = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
entries = res.entries;
|
||||||
|
limit = (entries == null) ? 0 : entries.size(); // handle empty set
|
||||||
|
posn = 0; // reset
|
||||||
|
|
||||||
|
// mimimize the number of calls to processReturnCode()
|
||||||
|
// (expensive when batchSize is small and there are many results)
|
||||||
|
if ((res.status != LdapClient.LDAP_SUCCESS) ||
|
||||||
|
((res.status == LdapClient.LDAP_SUCCESS) &&
|
||||||
|
(res.referrals != null))) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// convert referrals into a chain of LdapReferralException
|
||||||
|
homeCtx.processReturnCode(res, listArg);
|
||||||
|
|
||||||
|
} catch (LimitExceededException | PartialResultException e) {
|
||||||
|
setNamingException(e);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// merge any newly received referrals with any current referrals
|
||||||
|
if (res.refEx != null) {
|
||||||
|
if (refEx == null) {
|
||||||
|
refEx = res.refEx;
|
||||||
|
} else {
|
||||||
|
refEx = refEx.appendUnprocessedReferrals(res.refEx);
|
||||||
|
}
|
||||||
|
res.refEx = null; // reset
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.resControls != null) {
|
||||||
|
homeCtx.respCtls = res.resControls;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean more = true; // assume we have something to start with
|
||||||
|
private boolean hasMoreCalled = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test if unprocessed entries or referrals exist.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public final boolean hasMore() throws NamingException {
|
||||||
|
|
||||||
|
if (hasMoreCalled) {
|
||||||
|
return more;
|
||||||
|
}
|
||||||
|
|
||||||
|
hasMoreCalled = true;
|
||||||
|
|
||||||
|
if (!more) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return (more = hasMoreImpl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Retrieve the next entry.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public final T next() throws NamingException {
|
||||||
|
|
||||||
|
if (!hasMoreCalled) {
|
||||||
|
hasMore();
|
||||||
|
}
|
||||||
|
hasMoreCalled = false;
|
||||||
|
return nextImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test if unprocessed entries or referrals exist.
|
||||||
|
*/
|
||||||
|
private boolean hasMoreImpl() throws NamingException {
|
||||||
|
// when page size is supported, this
|
||||||
|
// might generate an exception while attempting
|
||||||
|
// to fetch the next batch to determine
|
||||||
|
// whether there are any more elements
|
||||||
|
|
||||||
|
// test if the current set of entries has been processed
|
||||||
|
if (posn == limit) {
|
||||||
|
getNextBatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
// test if any unprocessed entries exist
|
||||||
|
if (posn < limit) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// try to process another referral
|
||||||
|
return hasMoreReferrals();
|
||||||
|
|
||||||
|
} catch (LdapReferralException |
|
||||||
|
LimitExceededException |
|
||||||
|
PartialResultException e) {
|
||||||
|
cleanup();
|
||||||
|
throw e;
|
||||||
|
|
||||||
|
} catch (NamingException e) {
|
||||||
|
cleanup();
|
||||||
|
PartialResultException pre = new PartialResultException();
|
||||||
|
pre.setRootCause(e);
|
||||||
|
throw pre;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Retrieve the next entry.
|
||||||
|
*/
|
||||||
|
private T nextImpl() throws NamingException {
|
||||||
|
try {
|
||||||
|
return nextAux();
|
||||||
|
} catch (NamingException e) {
|
||||||
|
cleanup();
|
||||||
|
throw cont.fillInException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private T nextAux() throws NamingException {
|
||||||
|
if (posn == limit) {
|
||||||
|
getNextBatch(); // updates posn and limit
|
||||||
|
}
|
||||||
|
|
||||||
|
if (posn >= limit) {
|
||||||
|
cleanup();
|
||||||
|
throw new NoSuchElementException("invalid enumeration handle");
|
||||||
|
}
|
||||||
|
|
||||||
|
LdapEntry result = entries.elementAt(posn++);
|
||||||
|
|
||||||
|
// gets and outputs DN from the entry
|
||||||
|
return createItem(result.DN, result.attributes, result.respCtls);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final String getAtom(String dn) {
|
||||||
|
// need to strip off all but lowest component of dn
|
||||||
|
// so that is relative to current context (currentDN)
|
||||||
|
try {
|
||||||
|
Name parsed = new LdapName(dn);
|
||||||
|
return parsed.get(parsed.size() - 1);
|
||||||
|
} catch (NamingException e) {
|
||||||
|
return dn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract T createItem(String dn, Attributes attrs,
|
||||||
|
Vector<Control> respCtls) throws NamingException;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Append the supplied (chain of) referrals onto the
|
||||||
|
* end of the current (chain of) referrals.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void appendUnprocessedReferrals(LdapReferralException ex) {
|
||||||
|
if (refEx != null) {
|
||||||
|
refEx = refEx.appendUnprocessedReferrals(ex);
|
||||||
|
} else {
|
||||||
|
refEx = ex.appendUnprocessedReferrals(refEx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final void setNamingException(NamingException e) {
|
||||||
|
errEx = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract AbstractLdapNamingEnumeration<T> getReferredResults(
|
||||||
|
LdapReferralContext refCtx) throws NamingException;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Iterate through the URLs of a referral. If successful then perform
|
||||||
|
* a search operation and merge the received results with the current
|
||||||
|
* results.
|
||||||
|
*/
|
||||||
|
protected final boolean hasMoreReferrals() throws NamingException {
|
||||||
|
|
||||||
|
if ((refEx != null) &&
|
||||||
|
(refEx.hasMoreReferrals() ||
|
||||||
|
refEx.hasMoreReferralExceptions())) {
|
||||||
|
|
||||||
|
if (homeCtx.handleReferrals == LdapClient.LDAP_REF_THROW) {
|
||||||
|
throw (NamingException)(refEx.fillInStackTrace());
|
||||||
|
}
|
||||||
|
|
||||||
|
// process the referrals sequentially
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
LdapReferralContext refCtx =
|
||||||
|
(LdapReferralContext)refEx.getReferralContext(
|
||||||
|
homeCtx.envprops, homeCtx.reqCtls);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
update(getReferredResults(refCtx));
|
||||||
|
break;
|
||||||
|
|
||||||
|
} catch (LdapReferralException re) {
|
||||||
|
|
||||||
|
// record a previous exception
|
||||||
|
if (errEx == null) {
|
||||||
|
errEx = re.getNamingException();
|
||||||
|
}
|
||||||
|
refEx = re;
|
||||||
|
continue;
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
// Make sure we close referral context
|
||||||
|
refCtx.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasMoreImpl();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
cleanup();
|
||||||
|
|
||||||
|
if (errEx != null) {
|
||||||
|
throw errEx;
|
||||||
|
}
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Merge the entries and/or referrals from the supplied enumeration
|
||||||
|
* with those of the current enumeration.
|
||||||
|
*/
|
||||||
|
protected void update(AbstractLdapNamingEnumeration<T> ne) {
|
||||||
|
// Cleanup previous context first
|
||||||
|
homeCtx.decEnumCount();
|
||||||
|
|
||||||
|
// New enum will have already incremented enum count and recorded clnt
|
||||||
|
homeCtx = ne.homeCtx;
|
||||||
|
enumClnt = ne.enumClnt;
|
||||||
|
|
||||||
|
// Do this to prevent referral enumeration (ne) from decrementing
|
||||||
|
// enum count because we'll be doing that here from this
|
||||||
|
// enumeration.
|
||||||
|
ne.homeCtx = null;
|
||||||
|
|
||||||
|
// Record rest of information from new enum
|
||||||
|
posn = ne.posn;
|
||||||
|
limit = ne.limit;
|
||||||
|
res = ne.res;
|
||||||
|
entries = ne.entries;
|
||||||
|
refEx = ne.refEx;
|
||||||
|
listArg = ne.listArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final void finalize() {
|
||||||
|
cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final void cleanup() {
|
||||||
|
if (cleaned) return; // been there; done that
|
||||||
|
|
||||||
|
if(enumClnt != null) {
|
||||||
|
enumClnt.clearSearchReply(res, homeCtx.reqCtls);
|
||||||
|
}
|
||||||
|
|
||||||
|
enumClnt = null;
|
||||||
|
cleaned = true;
|
||||||
|
if (homeCtx != null) {
|
||||||
|
homeCtx.decEnumCount();
|
||||||
|
homeCtx = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void close() {
|
||||||
|
cleanup();
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -94,12 +94,14 @@ public abstract class Ber {
|
|||||||
public static final int ASN_ENUMERATED = 0x0a;
|
public static final int ASN_ENUMERATED = 0x0a;
|
||||||
|
|
||||||
final static class EncodeException extends IOException {
|
final static class EncodeException extends IOException {
|
||||||
|
private static final long serialVersionUID = -5247359637775781768L;
|
||||||
EncodeException(String msg) {
|
EncodeException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final static class DecodeException extends IOException {
|
final static class DecodeException extends IOException {
|
||||||
|
private static final long serialVersionUID = 8735036969244425583L;
|
||||||
DecodeException(String msg) {
|
DecodeException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
package com.sun.jndi.ldap;
|
package com.sun.jndi.ldap;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Arrays; // JDK 1.2
|
import java.util.Arrays; // JDK 1.2
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import javax.naming.ldap.Control;
|
import javax.naming.ldap.Control;
|
||||||
@ -71,10 +72,10 @@ class ClientId {
|
|||||||
ClientId(int version, String hostname, int port, String protocol,
|
ClientId(int version, String hostname, int port, String protocol,
|
||||||
Control[] bindCtls, OutputStream trace, String socketFactory) {
|
Control[] bindCtls, OutputStream trace, String socketFactory) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.hostname = hostname.toLowerCase(); // ignore case
|
this.hostname = hostname.toLowerCase(Locale.ENGLISH); // ignore case
|
||||||
this.port = port;
|
this.port = port;
|
||||||
this.protocol = protocol;
|
this.protocol = protocol;
|
||||||
this.bindCtls = (bindCtls != null ? (Control[]) bindCtls.clone() : null);
|
this.bindCtls = (bindCtls != null ? bindCtls.clone() : null);
|
||||||
this.trace = trace;
|
this.trace = trace;
|
||||||
//
|
//
|
||||||
// Needed for custom socket factory pooling
|
// Needed for custom socket factory pooling
|
||||||
@ -83,13 +84,15 @@ class ClientId {
|
|||||||
if ((socketFactory != null) &&
|
if ((socketFactory != null) &&
|
||||||
!socketFactory.equals(LdapCtx.DEFAULT_SSL_FACTORY)) {
|
!socketFactory.equals(LdapCtx.DEFAULT_SSL_FACTORY)) {
|
||||||
try {
|
try {
|
||||||
Class socketFactoryClass = Obj.helper.loadClass(socketFactory);
|
Class<?> socketFactoryClass =
|
||||||
Class objClass = Class.forName("java.lang.Object");
|
Obj.helper.loadClass(socketFactory);
|
||||||
|
Class<?> objClass = Class.forName("java.lang.Object");
|
||||||
this.sockComparator = socketFactoryClass.getMethod(
|
this.sockComparator = socketFactoryClass.getMethod(
|
||||||
"compare", new Class[]{objClass, objClass});
|
"compare", new Class<?>[]{objClass, objClass});
|
||||||
Method getDefault =
|
Method getDefault = socketFactoryClass.getMethod(
|
||||||
socketFactoryClass.getMethod("getDefault", new Class[]{});
|
"getDefault", new Class<?>[]{});
|
||||||
this.factory = (SocketFactory) getDefault.invoke(null, new Object[]{});
|
this.factory =
|
||||||
|
(SocketFactory)getDefault.invoke(null, new Object[]{});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore it here, the same exceptions are/will be handled by
|
// Ignore it here, the same exceptions are/will be handled by
|
||||||
// LdapPoolManager and Connection classes.
|
// LdapPoolManager and Connection classes.
|
||||||
|
@ -238,27 +238,22 @@ public final class Connection implements Runnable {
|
|||||||
throws NoSuchMethodException {
|
throws NoSuchMethodException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class inetSocketAddressClass =
|
Class<?> inetSocketAddressClass =
|
||||||
Class.forName("java.net.InetSocketAddress");
|
Class.forName("java.net.InetSocketAddress");
|
||||||
|
|
||||||
Constructor inetSocketAddressCons =
|
Constructor<?> inetSocketAddressCons =
|
||||||
inetSocketAddressClass.getConstructor(new Class[]{
|
inetSocketAddressClass.getConstructor(new Class<?>[]{
|
||||||
String.class, int.class});
|
String.class, int.class});
|
||||||
|
|
||||||
return inetSocketAddressCons.newInstance(new Object[]{
|
return inetSocketAddressCons.newInstance(new Object[]{
|
||||||
host, new Integer(port)});
|
host, new Integer(port)});
|
||||||
|
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException |
|
||||||
|
InstantiationException |
|
||||||
|
InvocationTargetException |
|
||||||
|
IllegalAccessException e) {
|
||||||
throw new NoSuchMethodException();
|
throw new NoSuchMethodException();
|
||||||
|
|
||||||
} catch (InstantiationException e) {
|
|
||||||
throw new NoSuchMethodException();
|
|
||||||
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
throw new NoSuchMethodException();
|
|
||||||
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
throw new NoSuchMethodException();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,9 +275,9 @@ public final class Connection implements Runnable {
|
|||||||
|
|
||||||
// create the factory
|
// create the factory
|
||||||
|
|
||||||
Class socketFactoryClass = Obj.helper.loadClass(socketFactory);
|
Class<?> socketFactoryClass = Obj.helper.loadClass(socketFactory);
|
||||||
Method getDefault =
|
Method getDefault =
|
||||||
socketFactoryClass.getMethod("getDefault", new Class[]{});
|
socketFactoryClass.getMethod("getDefault", new Class<?>[]{});
|
||||||
Object factory = getDefault.invoke(null, new Object[]{});
|
Object factory = getDefault.invoke(null, new Object[]{});
|
||||||
|
|
||||||
// create the socket
|
// create the socket
|
||||||
@ -293,10 +288,10 @@ public final class Connection implements Runnable {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
createSocket = socketFactoryClass.getMethod("createSocket",
|
createSocket = socketFactoryClass.getMethod("createSocket",
|
||||||
new Class[]{});
|
new Class<?>[]{});
|
||||||
|
|
||||||
Method connect = Socket.class.getMethod("connect",
|
Method connect = Socket.class.getMethod("connect",
|
||||||
new Class[]{Class.forName("java.net.SocketAddress"),
|
new Class<?>[]{Class.forName("java.net.SocketAddress"),
|
||||||
int.class});
|
int.class});
|
||||||
Object endpoint = createInetSocketAddress(host, port);
|
Object endpoint = createInetSocketAddress(host, port);
|
||||||
|
|
||||||
@ -320,7 +315,7 @@ public final class Connection implements Runnable {
|
|||||||
|
|
||||||
if (socket == null) {
|
if (socket == null) {
|
||||||
createSocket = socketFactoryClass.getMethod("createSocket",
|
createSocket = socketFactoryClass.getMethod("createSocket",
|
||||||
new Class[]{String.class, int.class});
|
new Class<?>[]{String.class, int.class});
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
System.err.println("Connection: creating socket using " +
|
System.err.println("Connection: creating socket using " +
|
||||||
@ -335,15 +330,15 @@ public final class Connection implements Runnable {
|
|||||||
if (connectTimeout > 0) {
|
if (connectTimeout > 0) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Constructor socketCons =
|
Constructor<Socket> socketCons =
|
||||||
Socket.class.getConstructor(new Class[]{});
|
Socket.class.getConstructor(new Class<?>[]{});
|
||||||
|
|
||||||
Method connect = Socket.class.getMethod("connect",
|
Method connect = Socket.class.getMethod("connect",
|
||||||
new Class[]{Class.forName("java.net.SocketAddress"),
|
new Class<?>[]{Class.forName("java.net.SocketAddress"),
|
||||||
int.class});
|
int.class});
|
||||||
Object endpoint = createInetSocketAddress(host, port);
|
Object endpoint = createInetSocketAddress(host, port);
|
||||||
|
|
||||||
socket = (Socket) socketCons.newInstance(new Object[]{});
|
socket = socketCons.newInstance(new Object[]{});
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
System.err.println("Connection: creating socket with " +
|
System.err.println("Connection: creating socket with " +
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -65,7 +65,7 @@ class DigestClientId extends SimpleClientId {
|
|||||||
DigestClientId(int version, String hostname, int port,
|
DigestClientId(int version, String hostname, int port,
|
||||||
String protocol, Control[] bindCtls, OutputStream trace,
|
String protocol, Control[] bindCtls, OutputStream trace,
|
||||||
String socketFactory, String username,
|
String socketFactory, String username,
|
||||||
Object passwd, Hashtable env) {
|
Object passwd, Hashtable<?,?> env) {
|
||||||
|
|
||||||
super(version, hostname, port, protocol, bindCtls, trace,
|
super(version, hostname, port, protocol, bindCtls, trace,
|
||||||
socketFactory, username, passwd);
|
socketFactory, username, passwd);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package com.sun.jndi.ldap;
|
package com.sun.jndi.ldap;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
|
|
||||||
@ -52,9 +51,9 @@ final class EventQueue implements Runnable {
|
|||||||
QueueElement next = null;
|
QueueElement next = null;
|
||||||
QueueElement prev = null;
|
QueueElement prev = null;
|
||||||
EventObject event = null;
|
EventObject event = null;
|
||||||
Vector vector = null;
|
Vector<NamingListener> vector = null;
|
||||||
|
|
||||||
QueueElement(EventObject event, Vector vector) {
|
QueueElement(EventObject event, Vector<NamingListener> vector) {
|
||||||
this.event = event;
|
this.event = event;
|
||||||
this.vector = vector;
|
this.vector = vector;
|
||||||
}
|
}
|
||||||
@ -87,7 +86,7 @@ final class EventQueue implements Runnable {
|
|||||||
* are notified.
|
* are notified.
|
||||||
* @param vector List of NamingListeners that will be notified of event.
|
* @param vector List of NamingListeners that will be notified of event.
|
||||||
*/
|
*/
|
||||||
synchronized void enqueue(EventObject event, Vector vector) {
|
synchronized void enqueue(EventObject event, Vector<NamingListener> vector) {
|
||||||
QueueElement newElt = new QueueElement(event, vector);
|
QueueElement newElt = new QueueElement(event, vector);
|
||||||
|
|
||||||
if (head == null) {
|
if (head == null) {
|
||||||
@ -133,7 +132,7 @@ final class EventQueue implements Runnable {
|
|||||||
try {
|
try {
|
||||||
while ((qe = dequeue()) != null) {
|
while ((qe = dequeue()) != null) {
|
||||||
EventObject e = qe.event;
|
EventObject e = qe.event;
|
||||||
Vector v = qe.vector;
|
Vector<NamingListener> v = qe.vector;
|
||||||
|
|
||||||
for (int i = 0; i < v.size(); i++) {
|
for (int i = 0; i < v.size(); i++) {
|
||||||
|
|
||||||
@ -145,12 +144,11 @@ final class EventQueue implements Runnable {
|
|||||||
// only enqueue events with listseners of the correct type.
|
// only enqueue events with listseners of the correct type.
|
||||||
|
|
||||||
if (e instanceof NamingEvent) {
|
if (e instanceof NamingEvent) {
|
||||||
((NamingEvent)e).dispatch((NamingListener)v.elementAt(i));
|
((NamingEvent)e).dispatch(v.elementAt(i));
|
||||||
|
|
||||||
// An exception occurred: if notify all naming listeners
|
// An exception occurred: if notify all naming listeners
|
||||||
} else if (e instanceof NamingExceptionEvent) {
|
} else if (e instanceof NamingExceptionEvent) {
|
||||||
((NamingExceptionEvent)e).dispatch(
|
((NamingExceptionEvent)e).dispatch(v.elementAt(i));
|
||||||
(NamingListener)v.elementAt(i));
|
|
||||||
} else if (e instanceof UnsolicitedNotificationEvent) {
|
} else if (e instanceof UnsolicitedNotificationEvent) {
|
||||||
((UnsolicitedNotificationEvent)e).dispatch(
|
((UnsolicitedNotificationEvent)e).dispatch(
|
||||||
(UnsolicitedNotificationListener)v.elementAt(i));
|
(UnsolicitedNotificationListener)v.elementAt(i));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,11 +27,9 @@ package com.sun.jndi.ldap;
|
|||||||
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
|
|
||||||
import javax.naming.*;
|
import javax.naming.*;
|
||||||
import javax.naming.directory.*;
|
|
||||||
import javax.naming.event.*;
|
import javax.naming.event.*;
|
||||||
import javax.naming.directory.SearchControls;
|
import javax.naming.directory.SearchControls;
|
||||||
import javax.naming.ldap.UnsolicitedNotificationListener;
|
import javax.naming.ldap.UnsolicitedNotificationListener;
|
||||||
@ -120,12 +118,13 @@ final class EventSupport {
|
|||||||
/**
|
/**
|
||||||
* NamingEventNotifiers; hashed by search arguments;
|
* NamingEventNotifiers; hashed by search arguments;
|
||||||
*/
|
*/
|
||||||
private Hashtable notifiers = new Hashtable(11);
|
private Hashtable<NotifierArgs, NamingEventNotifier> notifiers =
|
||||||
|
new Hashtable<>(11);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of unsolicited notification listeners.
|
* List of unsolicited notification listeners.
|
||||||
*/
|
*/
|
||||||
private Vector unsolicited = null;
|
private Vector<UnsolicitedNotificationListener> unsolicited = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs EventSupport for ctx.
|
* Constructs EventSupport for ctx.
|
||||||
@ -155,8 +154,7 @@ final class EventSupport {
|
|||||||
l instanceof NamespaceChangeListener) {
|
l instanceof NamespaceChangeListener) {
|
||||||
NotifierArgs args = new NotifierArgs(nm, scope, l);
|
NotifierArgs args = new NotifierArgs(nm, scope, l);
|
||||||
|
|
||||||
NamingEventNotifier notifier =
|
NamingEventNotifier notifier = notifiers.get(args);
|
||||||
(NamingEventNotifier) notifiers.get(args);
|
|
||||||
if (notifier == null) {
|
if (notifier == null) {
|
||||||
notifier = new NamingEventNotifier(this, ctx, args, l);
|
notifier = new NamingEventNotifier(this, ctx, args, l);
|
||||||
notifiers.put(args, notifier);
|
notifiers.put(args, notifier);
|
||||||
@ -167,10 +165,10 @@ final class EventSupport {
|
|||||||
if (l instanceof UnsolicitedNotificationListener) {
|
if (l instanceof UnsolicitedNotificationListener) {
|
||||||
// Add listener to this's list of unsolicited notifiers
|
// Add listener to this's list of unsolicited notifiers
|
||||||
if (unsolicited == null) {
|
if (unsolicited == null) {
|
||||||
unsolicited = new Vector(3);
|
unsolicited = new Vector<>(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsolicited.addElement(l);
|
unsolicited.addElement((UnsolicitedNotificationListener)l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,8 +183,7 @@ final class EventSupport {
|
|||||||
l instanceof NamespaceChangeListener) {
|
l instanceof NamespaceChangeListener) {
|
||||||
NotifierArgs args = new NotifierArgs(nm, filter, ctls, l);
|
NotifierArgs args = new NotifierArgs(nm, filter, ctls, l);
|
||||||
|
|
||||||
NamingEventNotifier notifier =
|
NamingEventNotifier notifier = notifiers.get(args);
|
||||||
(NamingEventNotifier) notifiers.get(args);
|
|
||||||
if (notifier == null) {
|
if (notifier == null) {
|
||||||
notifier = new NamingEventNotifier(this, ctx, args, l);
|
notifier = new NamingEventNotifier(this, ctx, args, l);
|
||||||
notifiers.put(args, notifier);
|
notifiers.put(args, notifier);
|
||||||
@ -197,9 +194,9 @@ final class EventSupport {
|
|||||||
if (l instanceof UnsolicitedNotificationListener) {
|
if (l instanceof UnsolicitedNotificationListener) {
|
||||||
// Add listener to this's list of unsolicited notifiers
|
// Add listener to this's list of unsolicited notifiers
|
||||||
if (unsolicited == null) {
|
if (unsolicited == null) {
|
||||||
unsolicited = new Vector(3);
|
unsolicited = new Vector<>(3);
|
||||||
}
|
}
|
||||||
unsolicited.addElement(l);
|
unsolicited.addElement((UnsolicitedNotificationListener)l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,15 +204,11 @@ final class EventSupport {
|
|||||||
* Removes <tt>l</tt> from all notifiers in this context.
|
* Removes <tt>l</tt> from all notifiers in this context.
|
||||||
*/
|
*/
|
||||||
synchronized void removeNamingListener(NamingListener l) {
|
synchronized void removeNamingListener(NamingListener l) {
|
||||||
Enumeration allnotifiers = notifiers.elements();
|
|
||||||
NamingEventNotifier notifier;
|
|
||||||
|
|
||||||
if (debug) System.err.println("EventSupport removing listener");
|
if (debug) System.err.println("EventSupport removing listener");
|
||||||
|
|
||||||
// Go through list of notifiers, remove 'l' from each.
|
// Go through list of notifiers, remove 'l' from each.
|
||||||
// If 'l' is notifier's only listener, remove notifier too.
|
// If 'l' is notifier's only listener, remove notifier too.
|
||||||
while (allnotifiers.hasMoreElements()) {
|
for (NamingEventNotifier notifier : notifiers.values()) {
|
||||||
notifier = (NamingEventNotifier)allnotifiers.nextElement();
|
|
||||||
if (notifier != null) {
|
if (notifier != null) {
|
||||||
if (debug)
|
if (debug)
|
||||||
System.err.println("EventSupport removing listener from notifier");
|
System.err.println("EventSupport removing listener from notifier");
|
||||||
@ -305,8 +298,8 @@ final class EventSupport {
|
|||||||
synchronized void cleanup() {
|
synchronized void cleanup() {
|
||||||
if (debug) System.err.println("EventSupport clean up");
|
if (debug) System.err.println("EventSupport clean up");
|
||||||
if (notifiers != null) {
|
if (notifiers != null) {
|
||||||
for (Enumeration ns = notifiers.elements(); ns.hasMoreElements(); ) {
|
for (NamingEventNotifier notifier : notifiers.values()) {
|
||||||
((NamingEventNotifier) ns.nextElement()).stop();
|
notifier.stop();
|
||||||
}
|
}
|
||||||
notifiers = null;
|
notifiers = null;
|
||||||
}
|
}
|
||||||
@ -328,7 +321,8 @@ final class EventSupport {
|
|||||||
* them to the registered listeners.
|
* them to the registered listeners.
|
||||||
* Package private; used by NamingEventNotifier to fire events
|
* Package private; used by NamingEventNotifier to fire events
|
||||||
*/
|
*/
|
||||||
synchronized void queueEvent(EventObject event, Vector vector) {
|
synchronized void queueEvent(EventObject event,
|
||||||
|
Vector<? extends NamingListener> vector) {
|
||||||
if (eventQueue == null)
|
if (eventQueue == null)
|
||||||
eventQueue = new EventQueue();
|
eventQueue = new EventQueue();
|
||||||
|
|
||||||
@ -340,7 +334,9 @@ final class EventSupport {
|
|||||||
* of this event will not take effect until after the event is
|
* of this event will not take effect until after the event is
|
||||||
* delivered.
|
* delivered.
|
||||||
*/
|
*/
|
||||||
Vector v = (Vector)vector.clone();
|
@SuppressWarnings("unchecked") // clone()
|
||||||
|
Vector<NamingListener> v =
|
||||||
|
(Vector<NamingListener>)vector.clone();
|
||||||
eventQueue.enqueue(event, v);
|
eventQueue.enqueue(event, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,8 +26,6 @@
|
|||||||
package com.sun.jndi.ldap;
|
package com.sun.jndi.ldap;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import javax.naming.*;
|
import javax.naming.*;
|
||||||
@ -50,11 +48,12 @@ final class LdapAttribute extends BasicAttribute {
|
|||||||
// these two are used to reconstruct the baseCtx if this attribute has
|
// these two are used to reconstruct the baseCtx if this attribute has
|
||||||
// been serialized (
|
// been serialized (
|
||||||
private String baseCtxURL;
|
private String baseCtxURL;
|
||||||
private Hashtable baseCtxEnv;
|
private Hashtable<String, ? super String> baseCtxEnv;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked") // clone()
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
LdapAttribute attr = new LdapAttribute(this.attrID, baseCtx, rdn);
|
LdapAttribute attr = new LdapAttribute(this.attrID, baseCtx, rdn);
|
||||||
attr.values = (Vector)values.clone();
|
attr.values = (Vector<Object>)values.clone();
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +111,7 @@ final class LdapAttribute extends BasicAttribute {
|
|||||||
private DirContext getBaseCtx() throws NamingException {
|
private DirContext getBaseCtx() throws NamingException {
|
||||||
if(baseCtx == null) {
|
if(baseCtx == null) {
|
||||||
if (baseCtxEnv == null) {
|
if (baseCtxEnv == null) {
|
||||||
baseCtxEnv = new Hashtable(3);
|
baseCtxEnv = new Hashtable<String, String>(3);
|
||||||
}
|
}
|
||||||
baseCtxEnv.put(Context.INITIAL_CONTEXT_FACTORY,
|
baseCtxEnv.put(Context.INITIAL_CONTEXT_FACTORY,
|
||||||
"com.sun.jndi.ldap.LdapCtxFactory");
|
"com.sun.jndi.ldap.LdapCtxFactory");
|
||||||
@ -144,9 +143,10 @@ final class LdapAttribute extends BasicAttribute {
|
|||||||
* we are serialized. This must be called _before_ the object is
|
* we are serialized. This must be called _before_ the object is
|
||||||
* serialized!!!
|
* serialized!!!
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked") // clone()
|
||||||
private void setBaseCtxInfo() {
|
private void setBaseCtxInfo() {
|
||||||
Hashtable realEnv = null;
|
Hashtable<String, Object> realEnv = null;
|
||||||
Hashtable secureEnv = null;
|
Hashtable<String, Object> secureEnv = null;
|
||||||
|
|
||||||
if (baseCtx != null) {
|
if (baseCtx != null) {
|
||||||
realEnv = ((LdapCtx)baseCtx).envprops;
|
realEnv = ((LdapCtx)baseCtx).envprops;
|
||||||
@ -156,16 +156,14 @@ final class LdapAttribute extends BasicAttribute {
|
|||||||
if(realEnv != null && realEnv.size() > 0 ) {
|
if(realEnv != null && realEnv.size() > 0 ) {
|
||||||
// remove any security credentials - otherwise the serialized form
|
// remove any security credentials - otherwise the serialized form
|
||||||
// would store them in the clear
|
// would store them in the clear
|
||||||
Enumeration keys = realEnv.keys();
|
for (String key : realEnv.keySet()){
|
||||||
while(keys.hasMoreElements()) {
|
|
||||||
String key = (String)keys.nextElement();
|
|
||||||
if (key.indexOf("security") != -1 ) {
|
if (key.indexOf("security") != -1 ) {
|
||||||
|
|
||||||
//if we need to remove props, we must do it to a clone
|
//if we need to remove props, we must do it to a clone
|
||||||
//of the environment. cloning is expensive, so we only do
|
//of the environment. cloning is expensive, so we only do
|
||||||
//it if we have to.
|
//it if we have to.
|
||||||
if(secureEnv == null) {
|
if(secureEnv == null) {
|
||||||
secureEnv = (Hashtable)realEnv.clone();
|
secureEnv = (Hashtable<String, Object>)realEnv.clone();
|
||||||
}
|
}
|
||||||
secureEnv.remove(key);
|
secureEnv.remove(key);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,11 +28,13 @@ package com.sun.jndi.ldap;
|
|||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import javax.naming.*;
|
import javax.naming.*;
|
||||||
import javax.naming.directory.*;
|
import javax.naming.directory.*;
|
||||||
|
import javax.naming.ldap.Control;
|
||||||
import javax.naming.spi.*;
|
import javax.naming.spi.*;
|
||||||
|
|
||||||
import com.sun.jndi.toolkit.ctx.Continuation;
|
import com.sun.jndi.toolkit.ctx.Continuation;
|
||||||
|
|
||||||
final class LdapBindingEnumeration extends LdapNamingEnumeration {
|
final class LdapBindingEnumeration
|
||||||
|
extends AbstractLdapNamingEnumeration<Binding> {
|
||||||
|
|
||||||
LdapBindingEnumeration(LdapCtx homeCtx, LdapResult answer, Name remain,
|
LdapBindingEnumeration(LdapCtx homeCtx, LdapResult answer, Name remain,
|
||||||
Continuation cont) throws NamingException
|
Continuation cont) throws NamingException
|
||||||
@ -40,8 +42,9 @@ final class LdapBindingEnumeration extends LdapNamingEnumeration {
|
|||||||
super(homeCtx, answer, remain, cont);
|
super(homeCtx, answer, remain, cont);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected NameClassPair
|
@Override
|
||||||
createItem(String dn, Attributes attrs, Vector respCtls)
|
protected Binding
|
||||||
|
createItem(String dn, Attributes attrs, Vector<Control> respCtls)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
Object obj = null;
|
Object obj = null;
|
||||||
@ -85,9 +88,10 @@ final class LdapBindingEnumeration extends LdapNamingEnumeration {
|
|||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LdapNamingEnumeration
|
@Override
|
||||||
getReferredResults(LdapReferralContext refCtx) throws NamingException{
|
protected LdapBindingEnumeration getReferredResults(
|
||||||
|
LdapReferralContext refCtx) throws NamingException{
|
||||||
// repeat the original operation at the new context
|
// repeat the original operation at the new context
|
||||||
return (LdapNamingEnumeration) refCtx.listBindings(listArg);
|
return (LdapBindingEnumeration)refCtx.listBindings(listArg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
package com.sun.jndi.ldap;
|
package com.sun.jndi.ldap;
|
||||||
|
|
||||||
import java.net.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
@ -81,7 +81,8 @@ public final class LdapClient implements PooledConnection {
|
|||||||
static final boolean caseIgnore = true;
|
static final boolean caseIgnore = true;
|
||||||
|
|
||||||
// Default list of binary attributes
|
// Default list of binary attributes
|
||||||
private static final Hashtable defaultBinaryAttrs = new Hashtable(23,0.75f);
|
private static final Hashtable<String, Boolean> defaultBinaryAttrs =
|
||||||
|
new Hashtable<>(23,0.75f);
|
||||||
static {
|
static {
|
||||||
defaultBinaryAttrs.put("userpassword", Boolean.TRUE); //2.5.4.35
|
defaultBinaryAttrs.put("userpassword", Boolean.TRUE); //2.5.4.35
|
||||||
defaultBinaryAttrs.put("javaserializeddata", Boolean.TRUE);
|
defaultBinaryAttrs.put("javaserializeddata", Boolean.TRUE);
|
||||||
@ -146,7 +147,7 @@ public final class LdapClient implements PooledConnection {
|
|||||||
|
|
||||||
synchronized LdapResult
|
synchronized LdapResult
|
||||||
authenticate(boolean initial, String name, Object pw, int version,
|
authenticate(boolean initial, String name, Object pw, int version,
|
||||||
String authMechanism, Control[] ctls, Hashtable env)
|
String authMechanism, Control[] ctls, Hashtable<?,?> env)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
authenticateCalled = true;
|
authenticateCalled = true;
|
||||||
@ -516,8 +517,8 @@ public final class LdapClient implements PooledConnection {
|
|||||||
LdapResult search(String dn, int scope, int deref, int sizeLimit,
|
LdapResult search(String dn, int scope, int deref, int sizeLimit,
|
||||||
int timeLimit, boolean attrsOnly, String attrs[],
|
int timeLimit, boolean attrsOnly, String attrs[],
|
||||||
String filter, int batchSize, Control[] reqCtls,
|
String filter, int batchSize, Control[] reqCtls,
|
||||||
Hashtable binaryAttrs, boolean waitFirstReply,
|
Hashtable<String, Boolean> binaryAttrs,
|
||||||
int replyQueueCapacity)
|
boolean waitFirstReply, int replyQueueCapacity)
|
||||||
throws IOException, NamingException {
|
throws IOException, NamingException {
|
||||||
|
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
@ -586,7 +587,7 @@ public final class LdapClient implements PooledConnection {
|
|||||||
* Retrieve the next batch of entries and/or referrals.
|
* Retrieve the next batch of entries and/or referrals.
|
||||||
*/
|
*/
|
||||||
LdapResult getSearchReply(int batchSize, LdapResult res,
|
LdapResult getSearchReply(int batchSize, LdapResult res,
|
||||||
Hashtable binaryAttrs) throws IOException, NamingException {
|
Hashtable<String, Boolean> binaryAttrs) throws IOException, NamingException {
|
||||||
|
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
|
|
||||||
@ -600,7 +601,7 @@ public final class LdapClient implements PooledConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private LdapResult getSearchReply(LdapRequest req,
|
private LdapResult getSearchReply(LdapRequest req,
|
||||||
int batchSize, LdapResult res, Hashtable binaryAttrs)
|
int batchSize, LdapResult res, Hashtable<String, Boolean> binaryAttrs)
|
||||||
throws IOException, NamingException {
|
throws IOException, NamingException {
|
||||||
|
|
||||||
if (batchSize == 0)
|
if (batchSize == 0)
|
||||||
@ -610,7 +611,7 @@ public final class LdapClient implements PooledConnection {
|
|||||||
res.entries.setSize(0); // clear the (previous) set of entries
|
res.entries.setSize(0); // clear the (previous) set of entries
|
||||||
} else {
|
} else {
|
||||||
res.entries =
|
res.entries =
|
||||||
new Vector(batchSize == Integer.MAX_VALUE ? 32 : batchSize);
|
new Vector<>(batchSize == Integer.MAX_VALUE ? 32 : batchSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.referrals != null) {
|
if (res.referrals != null) {
|
||||||
@ -660,7 +661,7 @@ public final class LdapClient implements PooledConnection {
|
|||||||
} else if ((seq == LDAP_REP_SEARCH_REF) && isLdapv3) {
|
} else if ((seq == LDAP_REP_SEARCH_REF) && isLdapv3) {
|
||||||
|
|
||||||
// handle LDAPv3 search reference
|
// handle LDAPv3 search reference
|
||||||
Vector URLs = new Vector(4);
|
Vector<String> URLs = new Vector<>(4);
|
||||||
|
|
||||||
// %%% Although not strictly correct, some LDAP servers
|
// %%% Although not strictly correct, some LDAP servers
|
||||||
// encode the SEQUENCE OF tag in the SearchResultRef
|
// encode the SEQUENCE OF tag in the SearchResultRef
|
||||||
@ -676,7 +677,7 @@ public final class LdapClient implements PooledConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (res.referrals == null) {
|
if (res.referrals == null) {
|
||||||
res.referrals = new Vector(4);
|
res.referrals = new Vector<>(4);
|
||||||
}
|
}
|
||||||
res.referrals.addElement(URLs);
|
res.referrals.addElement(URLs);
|
||||||
res.resControls = isLdapv3 ? parseControls(replyBer) : null;
|
res.resControls = isLdapv3 ? parseControls(replyBer) : null;
|
||||||
@ -700,7 +701,8 @@ public final class LdapClient implements PooledConnection {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Attribute parseAttribute(BerDecoder ber, Hashtable binaryAttrs)
|
private Attribute parseAttribute(BerDecoder ber,
|
||||||
|
Hashtable<String, Boolean> binaryAttrs)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
int len[] = new int[1];
|
int len[] = new int[1];
|
||||||
@ -737,13 +739,15 @@ public final class LdapClient implements PooledConnection {
|
|||||||
if (hasBinaryValues) {
|
if (hasBinaryValues) {
|
||||||
la.add(ber.parseOctetString(ber.peekByte(), len));
|
la.add(ber.parseOctetString(ber.peekByte(), len));
|
||||||
} else {
|
} else {
|
||||||
la.add(ber.parseStringWithTag(Ber.ASN_SIMPLE_STRING, isLdapv3, len));
|
la.add(ber.parseStringWithTag(
|
||||||
|
Ber.ASN_SIMPLE_STRING, isLdapv3, len));
|
||||||
}
|
}
|
||||||
return len[0];
|
return len[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBinaryValued(String attrid, Hashtable binaryAttrs) {
|
private boolean isBinaryValued(String attrid,
|
||||||
String id = attrid.toLowerCase();
|
Hashtable<String, Boolean> binaryAttrs) {
|
||||||
|
String id = attrid.toLowerCase(Locale.ENGLISH);
|
||||||
|
|
||||||
return ((id.indexOf(";binary") != -1) ||
|
return ((id.indexOf(";binary") != -1) ||
|
||||||
defaultBinaryAttrs.containsKey(id) ||
|
defaultBinaryAttrs.containsKey(id) ||
|
||||||
@ -751,8 +755,8 @@ public final class LdapClient implements PooledConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// package entry point; used by Connection
|
// package entry point; used by Connection
|
||||||
static void parseResult(BerDecoder replyBer, LdapResult res, boolean isLdapv3)
|
static void parseResult(BerDecoder replyBer, LdapResult res,
|
||||||
throws IOException {
|
boolean isLdapv3) throws IOException {
|
||||||
|
|
||||||
res.status = replyBer.parseEnumeration();
|
res.status = replyBer.parseEnumeration();
|
||||||
res.matchedDN = replyBer.parseString(isLdapv3);
|
res.matchedDN = replyBer.parseString(isLdapv3);
|
||||||
@ -763,7 +767,7 @@ public final class LdapClient implements PooledConnection {
|
|||||||
(replyBer.bytesLeft() > 0) &&
|
(replyBer.bytesLeft() > 0) &&
|
||||||
(replyBer.peekByte() == LDAP_REP_REFERRAL)) {
|
(replyBer.peekByte() == LDAP_REP_REFERRAL)) {
|
||||||
|
|
||||||
Vector URLs = new Vector(4);
|
Vector<String> URLs = new Vector<>(4);
|
||||||
int[] seqlen = new int[1];
|
int[] seqlen = new int[1];
|
||||||
|
|
||||||
replyBer.parseSeq(seqlen);
|
replyBer.parseSeq(seqlen);
|
||||||
@ -775,18 +779,18 @@ public final class LdapClient implements PooledConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (res.referrals == null) {
|
if (res.referrals == null) {
|
||||||
res.referrals = new Vector(4);
|
res.referrals = new Vector<>(4);
|
||||||
}
|
}
|
||||||
res.referrals.addElement(URLs);
|
res.referrals.addElement(URLs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// package entry point; used by Connection
|
// package entry point; used by Connection
|
||||||
static Vector parseControls(BerDecoder replyBer) throws IOException {
|
static Vector<Control> parseControls(BerDecoder replyBer) throws IOException {
|
||||||
|
|
||||||
// handle LDAPv3 controls (if present)
|
// handle LDAPv3 controls (if present)
|
||||||
if ((replyBer.bytesLeft() > 0) && (replyBer.peekByte() == LDAP_CONTROLS)) {
|
if ((replyBer.bytesLeft() > 0) && (replyBer.peekByte() == LDAP_CONTROLS)) {
|
||||||
Vector ctls = new Vector(4);
|
Vector<Control> ctls = new Vector<>(4);
|
||||||
String controlOID;
|
String controlOID;
|
||||||
boolean criticality = false; // default
|
boolean criticality = false; // default
|
||||||
byte[] controlValue = null; // optional
|
byte[] controlValue = null; // optional
|
||||||
@ -957,7 +961,7 @@ public final class LdapClient implements PooledConnection {
|
|||||||
ber.beginSeq(Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR);
|
ber.beginSeq(Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR);
|
||||||
ber.encodeString(attr.getID(), isLdapv3);
|
ber.encodeString(attr.getID(), isLdapv3);
|
||||||
ber.beginSeq(Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR | 1);
|
ber.beginSeq(Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR | 1);
|
||||||
NamingEnumeration enum_ = attr.getAll();
|
NamingEnumeration<?> enum_ = attr.getAll();
|
||||||
Object val;
|
Object val;
|
||||||
while (enum_.hasMore()) {
|
while (enum_.hasMore()) {
|
||||||
val = enum_.next();
|
val = enum_.next();
|
||||||
@ -1007,9 +1011,10 @@ public final class LdapClient implements PooledConnection {
|
|||||||
ber.beginSeq(LDAP_REQ_ADD);
|
ber.beginSeq(LDAP_REQ_ADD);
|
||||||
ber.encodeString(entry.DN, isLdapv3);
|
ber.encodeString(entry.DN, isLdapv3);
|
||||||
ber.beginSeq(Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR);
|
ber.beginSeq(Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR);
|
||||||
NamingEnumeration enum_ = entry.attributes.getAll();
|
NamingEnumeration<? extends Attribute> enum_ =
|
||||||
|
entry.attributes.getAll();
|
||||||
while (enum_.hasMore()) {
|
while (enum_.hasMore()) {
|
||||||
attr = (Attribute)enum_.next();
|
attr = enum_.next();
|
||||||
|
|
||||||
// zero values is not permitted
|
// zero values is not permitted
|
||||||
if (hasNoValue(attr)) {
|
if (hasNoValue(attr)) {
|
||||||
@ -1474,7 +1479,7 @@ public final class LdapClient implements PooledConnection {
|
|||||||
// removeUnsolicited() is invoked to remove an LdapCtx from this client.
|
// removeUnsolicited() is invoked to remove an LdapCtx from this client.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
private Vector unsolicited = new Vector(3);
|
private Vector<LdapCtx> unsolicited = new Vector<>(3);
|
||||||
void addUnsolicited(LdapCtx ctx) {
|
void addUnsolicited(LdapCtx ctx) {
|
||||||
if (debug > 0) {
|
if (debug > 0) {
|
||||||
System.err.println("LdapClient.addUnsolicited" + ctx);
|
System.err.println("LdapClient.addUnsolicited" + ctx);
|
||||||
@ -1500,70 +1505,70 @@ public final class LdapClient implements PooledConnection {
|
|||||||
if (debug > 0) {
|
if (debug > 0) {
|
||||||
System.err.println("LdapClient.processUnsolicited");
|
System.err.println("LdapClient.processUnsolicited");
|
||||||
}
|
}
|
||||||
synchronized (unsolicited) {
|
synchronized (unsolicited) {
|
||||||
try {
|
try {
|
||||||
// Parse the response
|
// Parse the response
|
||||||
LdapResult res = new LdapResult();
|
LdapResult res = new LdapResult();
|
||||||
|
|
||||||
ber.parseSeq(null); // init seq
|
ber.parseSeq(null); // init seq
|
||||||
ber.parseInt(); // msg id; should be 0; ignored
|
ber.parseInt(); // msg id; should be 0; ignored
|
||||||
if (ber.parseByte() != LDAP_REP_EXTENSION) {
|
if (ber.parseByte() != LDAP_REP_EXTENSION) {
|
||||||
throw new IOException(
|
throw new IOException(
|
||||||
"Unsolicited Notification must be an Extended Response");
|
"Unsolicited Notification must be an Extended Response");
|
||||||
}
|
|
||||||
ber.parseLength();
|
|
||||||
parseExtResponse(ber, res);
|
|
||||||
|
|
||||||
if (DISCONNECT_OID.equals(res.extensionId)) {
|
|
||||||
// force closing of connection
|
|
||||||
forceClose(pooled);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unsolicited.size() > 0) {
|
|
||||||
// Create an UnsolicitedNotification using the parsed data
|
|
||||||
// Need a 'ctx' object because we want to use the context's
|
|
||||||
// list of provider control factories.
|
|
||||||
UnsolicitedNotification notice = new UnsolicitedResponseImpl(
|
|
||||||
res.extensionId,
|
|
||||||
res.extensionValue,
|
|
||||||
res.referrals,
|
|
||||||
res.status,
|
|
||||||
res.errorMessage,
|
|
||||||
res.matchedDN,
|
|
||||||
(res.resControls != null) ?
|
|
||||||
((LdapCtx)unsolicited.elementAt(0)).convertControls(res.resControls) :
|
|
||||||
null);
|
|
||||||
|
|
||||||
// Fire UnsolicitedNotification events to listeners
|
|
||||||
notifyUnsolicited(notice);
|
|
||||||
|
|
||||||
// If "disconnect" notification,
|
|
||||||
// notify unsolicited listeners via NamingException
|
|
||||||
if (DISCONNECT_OID.equals(res.extensionId)) {
|
|
||||||
notifyUnsolicited(
|
|
||||||
new CommunicationException("Connection closed"));
|
|
||||||
}
|
}
|
||||||
|
ber.parseLength();
|
||||||
|
parseExtResponse(ber, res);
|
||||||
|
|
||||||
|
if (DISCONNECT_OID.equals(res.extensionId)) {
|
||||||
|
// force closing of connection
|
||||||
|
forceClose(pooled);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unsolicited.size() > 0) {
|
||||||
|
// Create an UnsolicitedNotification using the parsed data
|
||||||
|
// Need a 'ctx' object because we want to use the context's
|
||||||
|
// list of provider control factories.
|
||||||
|
UnsolicitedNotification notice = new UnsolicitedResponseImpl(
|
||||||
|
res.extensionId,
|
||||||
|
res.extensionValue,
|
||||||
|
res.referrals,
|
||||||
|
res.status,
|
||||||
|
res.errorMessage,
|
||||||
|
res.matchedDN,
|
||||||
|
(res.resControls != null) ?
|
||||||
|
unsolicited.elementAt(0).convertControls(res.resControls) :
|
||||||
|
null);
|
||||||
|
|
||||||
|
// Fire UnsolicitedNotification events to listeners
|
||||||
|
notifyUnsolicited(notice);
|
||||||
|
|
||||||
|
// If "disconnect" notification,
|
||||||
|
// notify unsolicited listeners via NamingException
|
||||||
|
if (DISCONNECT_OID.equals(res.extensionId)) {
|
||||||
|
notifyUnsolicited(
|
||||||
|
new CommunicationException("Connection closed"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
if (unsolicited.size() == 0)
|
||||||
|
return; // no one registered; ignore
|
||||||
|
|
||||||
|
NamingException ne = new CommunicationException(
|
||||||
|
"Problem parsing unsolicited notification");
|
||||||
|
ne.setRootCause(e);
|
||||||
|
|
||||||
|
notifyUnsolicited(ne);
|
||||||
|
|
||||||
|
} catch (NamingException e) {
|
||||||
|
notifyUnsolicited(e);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
|
||||||
if (unsolicited.size() == 0)
|
|
||||||
return; // no one registered; ignore
|
|
||||||
|
|
||||||
NamingException ne = new CommunicationException(
|
|
||||||
"Problem parsing unsolicited notification");
|
|
||||||
ne.setRootCause(e);
|
|
||||||
|
|
||||||
notifyUnsolicited(ne);
|
|
||||||
|
|
||||||
} catch (NamingException e) {
|
|
||||||
notifyUnsolicited(e);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void notifyUnsolicited(Object e) {
|
private void notifyUnsolicited(Object e) {
|
||||||
for (int i = 0; i < unsolicited.size(); i++) {
|
for (int i = 0; i < unsolicited.size(); i++) {
|
||||||
((LdapCtx)unsolicited.elementAt(i)).fireUnsolicited(e);
|
unsolicited.elementAt(i).fireUnsolicited(e);
|
||||||
}
|
}
|
||||||
if (e instanceof NamingException) {
|
if (e instanceof NamingException) {
|
||||||
unsolicited.setSize(0); // no more listeners after exception
|
unsolicited.setSize(0); // no more listeners after exception
|
||||||
@ -1584,7 +1589,7 @@ public final class LdapClient implements PooledConnection {
|
|||||||
static LdapClient getInstance(boolean usePool, String hostname, int port,
|
static LdapClient getInstance(boolean usePool, String hostname, int port,
|
||||||
String factory, int connectTimeout, int readTimeout, OutputStream trace,
|
String factory, int connectTimeout, int readTimeout, OutputStream trace,
|
||||||
int version, String authMechanism, Control[] ctls, String protocol,
|
int version, String authMechanism, Control[] ctls, String protocol,
|
||||||
String user, Object passwd, Hashtable env) throws NamingException {
|
String user, Object passwd, Hashtable<?,?> env) throws NamingException {
|
||||||
|
|
||||||
if (usePool) {
|
if (usePool) {
|
||||||
if (LdapPoolManager.isPoolingAllowed(factory, trace,
|
if (LdapPoolManager.isPoolingAllowed(factory, trace,
|
||||||
|
@ -33,6 +33,7 @@ import javax.naming.ldap.*;
|
|||||||
import javax.naming.ldap.LdapName;
|
import javax.naming.ldap.LdapName;
|
||||||
import javax.naming.ldap.Rdn;
|
import javax.naming.ldap.Rdn;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -223,7 +224,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
String hostname = null; // host name of server (no brackets
|
String hostname = null; // host name of server (no brackets
|
||||||
// for IPv6 literals)
|
// for IPv6 literals)
|
||||||
LdapClient clnt = null; // connection handle
|
LdapClient clnt = null; // connection handle
|
||||||
Hashtable envprops = null; // environment properties of context
|
Hashtable<String, java.lang.Object> envprops = null; // environment properties of context
|
||||||
int handleReferrals = DEFAULT_REFERRAL_MODE; // how referral is handled
|
int handleReferrals = DEFAULT_REFERRAL_MODE; // how referral is handled
|
||||||
boolean hasLdapsScheme = false; // true if the context was created
|
boolean hasLdapsScheme = false; // true if the context was created
|
||||||
// using an LDAPS URL.
|
// using an LDAPS URL.
|
||||||
@ -232,7 +233,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
|
|
||||||
String currentDN; // DN of this context
|
String currentDN; // DN of this context
|
||||||
Name currentParsedDN; // DN of this context
|
Name currentParsedDN; // DN of this context
|
||||||
Vector respCtls = null; // Response controls read
|
Vector<Control> respCtls = null; // Response controls read
|
||||||
Control[] reqCtls = null; // Controls to be sent with each request
|
Control[] reqCtls = null; // Controls to be sent with each request
|
||||||
|
|
||||||
|
|
||||||
@ -244,14 +245,14 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
private boolean netscapeSchemaBug = false; // workaround
|
private boolean netscapeSchemaBug = false; // workaround
|
||||||
private Control[] bindCtls = null; // Controls to be sent with LDAP "bind"
|
private Control[] bindCtls = null; // Controls to be sent with LDAP "bind"
|
||||||
private int referralHopLimit = DEFAULT_REFERRAL_LIMIT; // max referral
|
private int referralHopLimit = DEFAULT_REFERRAL_LIMIT; // max referral
|
||||||
private Hashtable schemaTrees = null; // schema root of this context
|
private Hashtable<String, DirContext> schemaTrees = null; // schema root of this context
|
||||||
private int batchSize = DEFAULT_BATCH_SIZE; // batch size for search results
|
private int batchSize = DEFAULT_BATCH_SIZE; // batch size for search results
|
||||||
private boolean deleteRDN = DEFAULT_DELETE_RDN; // delete the old RDN when modifying DN
|
private boolean deleteRDN = DEFAULT_DELETE_RDN; // delete the old RDN when modifying DN
|
||||||
private boolean typesOnly = DEFAULT_TYPES_ONLY; // return attribute types (no values)
|
private boolean typesOnly = DEFAULT_TYPES_ONLY; // return attribute types (no values)
|
||||||
private int derefAliases = DEFAULT_DEREF_ALIASES;// de-reference alias entries during searching
|
private int derefAliases = DEFAULT_DEREF_ALIASES;// de-reference alias entries during searching
|
||||||
private char addrEncodingSeparator = DEFAULT_REF_SEPARATOR; // encoding RefAddr
|
private char addrEncodingSeparator = DEFAULT_REF_SEPARATOR; // encoding RefAddr
|
||||||
|
|
||||||
private Hashtable binaryAttrs = null; // attr values returned as byte[]
|
private Hashtable<String, Boolean> binaryAttrs = null; // attr values returned as byte[]
|
||||||
private int connectTimeout = -1; // no timeout value
|
private int connectTimeout = -1; // no timeout value
|
||||||
private int readTimeout = -1; // no timeout value
|
private int readTimeout = -1; // no timeout value
|
||||||
private boolean waitForReply = true; // wait for search response
|
private boolean waitForReply = true; // wait for search response
|
||||||
@ -272,13 +273,15 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
|
|
||||||
// -------------- Constructors -----------------------------------
|
// -------------- Constructors -----------------------------------
|
||||||
|
|
||||||
public LdapCtx(String dn, String host, int port_number, Hashtable props,
|
@SuppressWarnings("unchecked")
|
||||||
|
public LdapCtx(String dn, String host, int port_number,
|
||||||
|
Hashtable<?,?> props,
|
||||||
boolean useSsl) throws NamingException {
|
boolean useSsl) throws NamingException {
|
||||||
|
|
||||||
this.useSsl = this.hasLdapsScheme = useSsl;
|
this.useSsl = this.hasLdapsScheme = useSsl;
|
||||||
|
|
||||||
if (props != null) {
|
if (props != null) {
|
||||||
envprops = (Hashtable) props.clone();
|
envprops = (Hashtable<String, java.lang.Object>) props.clone();
|
||||||
|
|
||||||
// SSL env prop overrides the useSsl argument
|
// SSL env prop overrides the useSsl argument
|
||||||
if ("ssl".equals(envprops.get(Context.SECURITY_PROTOCOL))) {
|
if ("ssl".equals(envprops.get(Context.SECURITY_PROTOCOL))) {
|
||||||
@ -310,7 +313,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
this.useDefaultPortNumber = true;
|
this.useDefaultPortNumber = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
schemaTrees = new Hashtable(11, 0.75f);
|
schemaTrees = new Hashtable<>(11, 0.75f);
|
||||||
initEnv();
|
initEnv();
|
||||||
try {
|
try {
|
||||||
connect(false);
|
connect(false);
|
||||||
@ -557,9 +560,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
if (answer.resControls != null) {
|
if (answer.resControls != null) {
|
||||||
respCtls = appendVector(respCtls, answer.resControls);
|
respCtls = appendVector(respCtls, answer.resControls);
|
||||||
}
|
}
|
||||||
} catch (NamingException ae) {
|
} catch (NamingException | IOException ae) {
|
||||||
addEx = ae;
|
|
||||||
} catch (IOException ae) {
|
|
||||||
addEx = ae;
|
addEx = ae;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -918,19 +919,17 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse string name into list of RDNs
|
// Parse string name into list of RDNs
|
||||||
//List<Rdn> rdnList = (new LdapName(dn)).rdns();
|
List<Rdn> rdnList = (new LdapName(dn)).getRdns();
|
||||||
List rdnList = (new LdapName(dn)).getRdns();
|
|
||||||
|
|
||||||
// Get leaf RDN
|
// Get leaf RDN
|
||||||
//Rdn rdn = rdnList.get(rdnList.size() - 1);
|
Rdn rdn = rdnList.get(rdnList.size() - 1);
|
||||||
Rdn rdn = (Rdn) rdnList.get(rdnList.size() - 1);
|
|
||||||
Attributes nameAttrs = rdn.toAttributes();
|
Attributes nameAttrs = rdn.toAttributes();
|
||||||
|
|
||||||
// Add attributes of RDN to attrs if not already there
|
// Add attributes of RDN to attrs if not already there
|
||||||
NamingEnumeration enum_ = nameAttrs.getAll();
|
NamingEnumeration<? extends Attribute> enum_ = nameAttrs.getAll();
|
||||||
Attribute nameAttr;
|
Attribute nameAttr;
|
||||||
while (enum_.hasMore()) {
|
while (enum_.hasMore()) {
|
||||||
nameAttr = (Attribute) enum_.next();
|
nameAttr = enum_.next();
|
||||||
|
|
||||||
// If attrs already has the attribute, don't change or add to it
|
// If attrs already has the attribute, don't change or add to it
|
||||||
if (attrs.get(nameAttr.getID()) == null) {
|
if (attrs.get(nameAttr.getID()) == null) {
|
||||||
@ -961,12 +960,12 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static boolean containsIgnoreCase(NamingEnumeration enumStr,
|
private static boolean containsIgnoreCase(NamingEnumeration<String> enumStr,
|
||||||
String str) throws NamingException {
|
String str) throws NamingException {
|
||||||
String strEntry;
|
String strEntry;
|
||||||
|
|
||||||
while (enumStr.hasMore()) {
|
while (enumStr.hasMore()) {
|
||||||
strEntry = (String) enumStr.next();
|
strEntry = enumStr.next();
|
||||||
if (strEntry.equalsIgnoreCase(str)) {
|
if (strEntry.equalsIgnoreCase(str)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -993,7 +992,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
* Append the the second Vector onto the first Vector
|
* Append the the second Vector onto the first Vector
|
||||||
* (v2 must be non-null)
|
* (v2 must be non-null)
|
||||||
*/
|
*/
|
||||||
private static Vector appendVector(Vector v1, Vector v2) {
|
private static <T> Vector<T> appendVector(Vector<T> v1, Vector<T> v2) {
|
||||||
if (v1 == null) {
|
if (v1 == null) {
|
||||||
v1 = v2;
|
v1 = v2;
|
||||||
} else {
|
} else {
|
||||||
@ -1038,10 +1037,10 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
// found it but got no attributes
|
// found it but got no attributes
|
||||||
attrs = new BasicAttributes(LdapClient.caseIgnore);
|
attrs = new BasicAttributes(LdapClient.caseIgnore);
|
||||||
} else {
|
} else {
|
||||||
LdapEntry entry = (LdapEntry)answer.entries.elementAt(0);
|
LdapEntry entry = answer.entries.elementAt(0);
|
||||||
attrs = entry.attributes;
|
attrs = entry.attributes;
|
||||||
|
|
||||||
Vector entryCtls = entry.respCtls; // retrieve entry controls
|
Vector<Control> entryCtls = entry.respCtls; // retrieve entry controls
|
||||||
if (entryCtls != null) {
|
if (entryCtls != null) {
|
||||||
appendVector(respCtls, entryCtls); // concatenate controls
|
appendVector(respCtls, entryCtls); // concatenate controls
|
||||||
}
|
}
|
||||||
@ -1097,7 +1096,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected NamingEnumeration c_list(Name name, Continuation cont)
|
protected NamingEnumeration<NameClassPair> c_list(Name name, Continuation cont)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
SearchControls cons = new SearchControls();
|
SearchControls cons = new SearchControls();
|
||||||
String[] classAttrs = new String[2];
|
String[] classAttrs = new String[2];
|
||||||
@ -1170,7 +1169,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected NamingEnumeration c_listBindings(Name name, Continuation cont)
|
protected NamingEnumeration<Binding> c_listBindings(Name name, Continuation cont)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
SearchControls cons = new SearchControls();
|
SearchControls cons = new SearchControls();
|
||||||
@ -1198,7 +1197,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
|
|
||||||
// process the referrals sequentially
|
// process the referrals sequentially
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
LdapReferralContext refCtx =
|
LdapReferralContext refCtx =
|
||||||
(LdapReferralContext)e.getReferralContext(envprops, bindCtls);
|
(LdapReferralContext)e.getReferralContext(envprops, bindCtls);
|
||||||
|
|
||||||
@ -1220,16 +1219,14 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
LdapBindingEnumeration res =
|
LdapBindingEnumeration res =
|
||||||
new LdapBindingEnumeration(this, answer, name, cont);
|
new LdapBindingEnumeration(this, answer, name, cont);
|
||||||
|
|
||||||
res.setNamingException(
|
res.setNamingException(cont.fillInException(e));
|
||||||
(LimitExceededException)cont.fillInException(e));
|
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
} catch (PartialResultException e) {
|
} catch (PartialResultException e) {
|
||||||
LdapBindingEnumeration res =
|
LdapBindingEnumeration res =
|
||||||
new LdapBindingEnumeration(this, answer, name, cont);
|
new LdapBindingEnumeration(this, answer, name, cont);
|
||||||
|
|
||||||
res.setNamingException(
|
res.setNamingException(cont.fillInException(e));
|
||||||
(PartialResultException)cont.fillInException(e));
|
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
} catch (NamingException e) {
|
} catch (NamingException e) {
|
||||||
@ -1337,9 +1334,9 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get attributes from result
|
// get attributes from result
|
||||||
LdapEntry entry = (LdapEntry) answer.entries.elementAt(0);
|
LdapEntry entry = answer.entries.elementAt(0);
|
||||||
|
|
||||||
Vector entryCtls = entry.respCtls; // retrieve entry controls
|
Vector<Control> entryCtls = entry.respCtls; // retrieve entry controls
|
||||||
if (entryCtls != null) {
|
if (entryCtls != null) {
|
||||||
appendVector(respCtls, entryCtls); // concatenate controls
|
appendVector(respCtls, entryCtls); // concatenate controls
|
||||||
}
|
}
|
||||||
@ -1398,10 +1395,10 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
int[] jmods = new int[attrs.size()];
|
int[] jmods = new int[attrs.size()];
|
||||||
Attribute[] jattrs = new Attribute[attrs.size()];
|
Attribute[] jattrs = new Attribute[attrs.size()];
|
||||||
|
|
||||||
NamingEnumeration ae = attrs.getAll();
|
NamingEnumeration<? extends Attribute> ae = attrs.getAll();
|
||||||
for(int i = 0; i < jmods.length && ae.hasMore(); i++) {
|
for(int i = 0; i < jmods.length && ae.hasMore(); i++) {
|
||||||
jmods[i] = jmod_op;
|
jmods[i] = jmod_op;
|
||||||
jattrs[i] = (Attribute)ae.next();
|
jattrs[i] = ae.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
LdapResult answer = clnt.modify(newDN, jmods, jattrs, reqCtls);
|
LdapResult answer = clnt.modify(newDN, jmods, jattrs, reqCtls);
|
||||||
@ -1565,7 +1562,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
HierMemDirCtx objectClassCtx = new HierMemDirCtx();
|
HierMemDirCtx objectClassCtx = new HierMemDirCtx();
|
||||||
DirContext objectClassDef;
|
DirContext objectClassDef;
|
||||||
String objectClassName;
|
String objectClassName;
|
||||||
for (Enumeration objectClasses = objectClassAttr.getAll();
|
for (Enumeration<?> objectClasses = objectClassAttr.getAll();
|
||||||
objectClasses.hasMoreElements(); ) {
|
objectClasses.hasMoreElements(); ) {
|
||||||
objectClassName = (String)objectClasses.nextElement();
|
objectClassName = (String)objectClasses.nextElement();
|
||||||
// %%% Should we fail if not found, or just continue?
|
// %%% Should we fail if not found, or just continue?
|
||||||
@ -1591,7 +1588,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
private DirContext getSchemaTree(Name name) throws NamingException {
|
private DirContext getSchemaTree(Name name) throws NamingException {
|
||||||
String subschemasubentry = getSchemaEntry(name, true);
|
String subschemasubentry = getSchemaEntry(name, true);
|
||||||
|
|
||||||
DirContext schemaTree = (DirContext)schemaTrees.get(subschemasubentry);
|
DirContext schemaTree = schemaTrees.get(subschemasubentry);
|
||||||
|
|
||||||
if(schemaTree==null) {
|
if(schemaTree==null) {
|
||||||
if(debug){System.err.println("LdapCtx: building new schema tree " + this);}
|
if(debug){System.err.println("LdapCtx: building new schema tree " + this);}
|
||||||
@ -1621,7 +1618,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
false /*deref link */ );
|
false /*deref link */ );
|
||||||
|
|
||||||
Name sse = (new CompositeName()).add(subschemasubentry);
|
Name sse = (new CompositeName()).add(subschemasubentry);
|
||||||
NamingEnumeration results =
|
NamingEnumeration<SearchResult> results =
|
||||||
searchAux(sse, "(objectClass=subschema)", constraints,
|
searchAux(sse, "(objectClass=subschema)", constraints,
|
||||||
false, true, new Continuation());
|
false, true, new Continuation());
|
||||||
|
|
||||||
@ -1629,7 +1626,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
throw new OperationNotSupportedException(
|
throw new OperationNotSupportedException(
|
||||||
"Cannot get read subschemasubentry: " + subschemasubentry);
|
"Cannot get read subschemasubentry: " + subschemasubentry);
|
||||||
}
|
}
|
||||||
SearchResult result = (SearchResult)results.next();
|
SearchResult result = results.next();
|
||||||
results.close();
|
results.close();
|
||||||
|
|
||||||
Object obj = result.getObject();
|
Object obj = result.getObject();
|
||||||
@ -1674,7 +1671,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
false /* returning obj */,
|
false /* returning obj */,
|
||||||
false /* deref link */);
|
false /* deref link */);
|
||||||
|
|
||||||
NamingEnumeration results;
|
NamingEnumeration<SearchResult> results;
|
||||||
try {
|
try {
|
||||||
results = searchAux(name, "objectclass=*", constraints, relative,
|
results = searchAux(name, "objectclass=*", constraints, relative,
|
||||||
true, new Continuation());
|
true, new Continuation());
|
||||||
@ -1695,7 +1692,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
"Requesting schema of nonexistent entry: " + name);
|
"Requesting schema of nonexistent entry: " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchResult result = (SearchResult) results.next();
|
SearchResult result = results.next();
|
||||||
results.close();
|
results.close();
|
||||||
|
|
||||||
Attribute schemaEntryAttr =
|
Attribute schemaEntryAttr =
|
||||||
@ -1720,7 +1717,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
// Set attributes to point to this context in case some one
|
// Set attributes to point to this context in case some one
|
||||||
// asked for their schema
|
// asked for their schema
|
||||||
void setParents(Attributes attrs, Name name) throws NamingException {
|
void setParents(Attributes attrs, Name name) throws NamingException {
|
||||||
NamingEnumeration ae = attrs.getAll();
|
NamingEnumeration<? extends Attribute> ae = attrs.getAll();
|
||||||
while(ae.hasMore()) {
|
while(ae.hasMore()) {
|
||||||
((LdapAttribute) ae.next()).setParent(this, name);
|
((LdapAttribute) ae.next()).setParent(this, name);
|
||||||
}
|
}
|
||||||
@ -1740,14 +1737,14 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --------------------- Searches -----------------------------
|
// --------------------- Searches -----------------------------
|
||||||
protected NamingEnumeration c_search(Name name,
|
protected NamingEnumeration<SearchResult> c_search(Name name,
|
||||||
Attributes matchingAttributes,
|
Attributes matchingAttributes,
|
||||||
Continuation cont)
|
Continuation cont)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
return c_search(name, matchingAttributes, null, cont);
|
return c_search(name, matchingAttributes, null, cont);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected NamingEnumeration c_search(Name name,
|
protected NamingEnumeration<SearchResult> c_search(Name name,
|
||||||
Attributes matchingAttributes,
|
Attributes matchingAttributes,
|
||||||
String[] attributesToReturn,
|
String[] attributesToReturn,
|
||||||
Continuation cont)
|
Continuation cont)
|
||||||
@ -1764,7 +1761,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
return c_search(name, filter, cons, cont);
|
return c_search(name, filter, cons, cont);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected NamingEnumeration c_search(Name name,
|
protected NamingEnumeration<SearchResult> c_search(Name name,
|
||||||
String filter,
|
String filter,
|
||||||
SearchControls cons,
|
SearchControls cons,
|
||||||
Continuation cont)
|
Continuation cont)
|
||||||
@ -1773,7 +1770,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
waitForReply, cont);
|
waitForReply, cont);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected NamingEnumeration c_search(Name name,
|
protected NamingEnumeration<SearchResult> c_search(Name name,
|
||||||
String filterExpr,
|
String filterExpr,
|
||||||
Object[] filterArgs,
|
Object[] filterArgs,
|
||||||
SearchControls cons,
|
SearchControls cons,
|
||||||
@ -1790,7 +1787,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Used by NamingNotifier
|
// Used by NamingNotifier
|
||||||
NamingEnumeration searchAux(Name name,
|
NamingEnumeration<SearchResult> searchAux(Name name,
|
||||||
String filter,
|
String filter,
|
||||||
SearchControls cons,
|
SearchControls cons,
|
||||||
boolean relative,
|
boolean relative,
|
||||||
@ -1849,7 +1846,8 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
processReturnCode(answer, name);
|
processReturnCode(answer, name);
|
||||||
}
|
}
|
||||||
return new LdapSearchEnumeration(this, answer,
|
return new LdapSearchEnumeration(this, answer,
|
||||||
fullyQualifiedName(name), args, cont);
|
fullyQualifiedName(name),
|
||||||
|
args, cont);
|
||||||
|
|
||||||
} catch (LdapReferralException e) {
|
} catch (LdapReferralException e) {
|
||||||
if (handleReferrals == LdapClient.LDAP_REF_THROW)
|
if (handleReferrals == LdapClient.LDAP_REF_THROW)
|
||||||
@ -1858,8 +1856,9 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
// process the referrals sequentially
|
// process the referrals sequentially
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
LdapReferralContext refCtx =
|
@SuppressWarnings("unchecked")
|
||||||
(LdapReferralContext)e.getReferralContext(envprops, bindCtls);
|
LdapReferralContext refCtx = (LdapReferralContext)
|
||||||
|
e.getReferralContext(envprops, bindCtls);
|
||||||
|
|
||||||
// repeat the original operation at the new context
|
// repeat the original operation at the new context
|
||||||
try {
|
try {
|
||||||
@ -2143,16 +2142,18 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
/**
|
/**
|
||||||
* Override with noncloning version.
|
* Override with noncloning version.
|
||||||
*/
|
*/
|
||||||
protected Hashtable p_getEnvironment() {
|
protected Hashtable<String, Object> p_getEnvironment() {
|
||||||
return envprops;
|
return envprops;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hashtable getEnvironment() throws NamingException {
|
@SuppressWarnings("unchecked") // clone()
|
||||||
|
public Hashtable<String, Object> getEnvironment() throws NamingException {
|
||||||
return (envprops == null
|
return (envprops == null
|
||||||
? new Hashtable(5, 0.75f)
|
? new Hashtable<String, Object>(5, 0.75f)
|
||||||
: (Hashtable)envprops.clone());
|
: (Hashtable<String, Object>)envprops.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked") // clone()
|
||||||
public Object removeFromEnvironment(String propName)
|
public Object removeFromEnvironment(String propName)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
@ -2160,58 +2161,74 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
if (envprops == null || envprops.get(propName) == null) {
|
if (envprops == null || envprops.get(propName) == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
switch (propName) {
|
||||||
|
case REF_SEPARATOR:
|
||||||
|
addrEncodingSeparator = DEFAULT_REF_SEPARATOR;
|
||||||
|
break;
|
||||||
|
case TYPES_ONLY:
|
||||||
|
typesOnly = DEFAULT_TYPES_ONLY;
|
||||||
|
break;
|
||||||
|
case DELETE_RDN:
|
||||||
|
deleteRDN = DEFAULT_DELETE_RDN;
|
||||||
|
break;
|
||||||
|
case DEREF_ALIASES:
|
||||||
|
derefAliases = DEFAULT_DEREF_ALIASES;
|
||||||
|
break;
|
||||||
|
case Context.BATCHSIZE:
|
||||||
|
batchSize = DEFAULT_BATCH_SIZE;
|
||||||
|
break;
|
||||||
|
case REFERRAL_LIMIT:
|
||||||
|
referralHopLimit = DEFAULT_REFERRAL_LIMIT;
|
||||||
|
break;
|
||||||
|
case Context.REFERRAL:
|
||||||
|
setReferralMode(null, true);
|
||||||
|
break;
|
||||||
|
case BINARY_ATTRIBUTES:
|
||||||
|
setBinaryAttributes(null);
|
||||||
|
break;
|
||||||
|
case CONNECT_TIMEOUT:
|
||||||
|
connectTimeout = -1;
|
||||||
|
break;
|
||||||
|
case READ_TIMEOUT:
|
||||||
|
readTimeout = -1;
|
||||||
|
break;
|
||||||
|
case WAIT_FOR_REPLY:
|
||||||
|
waitForReply = true;
|
||||||
|
break;
|
||||||
|
case REPLY_QUEUE_SIZE:
|
||||||
|
replyQueueSize = -1;
|
||||||
|
break;
|
||||||
|
|
||||||
if (propName.equals(REF_SEPARATOR)) {
|
// The following properties affect the connection
|
||||||
addrEncodingSeparator = DEFAULT_REF_SEPARATOR;
|
|
||||||
} else if (propName.equals(TYPES_ONLY)) {
|
|
||||||
typesOnly = DEFAULT_TYPES_ONLY;
|
|
||||||
} else if (propName.equals(DELETE_RDN)) {
|
|
||||||
deleteRDN = DEFAULT_DELETE_RDN;
|
|
||||||
} else if (propName.equals(DEREF_ALIASES)) {
|
|
||||||
derefAliases = DEFAULT_DEREF_ALIASES;
|
|
||||||
} else if (propName.equals(Context.BATCHSIZE)) {
|
|
||||||
batchSize = DEFAULT_BATCH_SIZE;
|
|
||||||
} else if (propName.equals(REFERRAL_LIMIT)) {
|
|
||||||
referralHopLimit = DEFAULT_REFERRAL_LIMIT;
|
|
||||||
} else if (propName.equals(Context.REFERRAL)) {
|
|
||||||
setReferralMode(null, true);
|
|
||||||
} else if (propName.equals(BINARY_ATTRIBUTES)) {
|
|
||||||
setBinaryAttributes(null);
|
|
||||||
} else if (propName.equals(CONNECT_TIMEOUT)) {
|
|
||||||
connectTimeout = -1;
|
|
||||||
} else if (propName.equals(READ_TIMEOUT)) {
|
|
||||||
readTimeout = -1;
|
|
||||||
} else if (propName.equals(WAIT_FOR_REPLY)) {
|
|
||||||
waitForReply = true;
|
|
||||||
} else if (propName.equals(REPLY_QUEUE_SIZE)) {
|
|
||||||
replyQueueSize = -1;
|
|
||||||
|
|
||||||
// The following properties affect the connection
|
case Context.SECURITY_PROTOCOL:
|
||||||
|
closeConnection(SOFT_CLOSE);
|
||||||
} else if (propName.equals(Context.SECURITY_PROTOCOL)) {
|
// De-activate SSL and reset the context's url and port number
|
||||||
closeConnection(SOFT_CLOSE);
|
if (useSsl && !hasLdapsScheme) {
|
||||||
// De-activate SSL and reset the context's url and port number
|
useSsl = false;
|
||||||
if (useSsl && !hasLdapsScheme) {
|
url = null;
|
||||||
useSsl = false;
|
if (useDefaultPortNumber) {
|
||||||
url = null;
|
port_number = DEFAULT_PORT;
|
||||||
if (useDefaultPortNumber) {
|
}
|
||||||
port_number = DEFAULT_PORT;
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
} else if (propName.equals(VERSION) ||
|
case VERSION:
|
||||||
propName.equals(SOCKET_FACTORY)) {
|
case SOCKET_FACTORY:
|
||||||
closeConnection(SOFT_CLOSE);
|
closeConnection(SOFT_CLOSE);
|
||||||
} else if(propName.equals(Context.SECURITY_AUTHENTICATION) ||
|
break;
|
||||||
propName.equals(Context.SECURITY_PRINCIPAL) ||
|
case Context.SECURITY_AUTHENTICATION:
|
||||||
propName.equals(Context.SECURITY_CREDENTIALS)) {
|
case Context.SECURITY_PRINCIPAL:
|
||||||
sharable = false;
|
case Context.SECURITY_CREDENTIALS:
|
||||||
|
sharable = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update environment; reconnection will use new props
|
// Update environment; reconnection will use new props
|
||||||
envprops = (Hashtable)envprops.clone();
|
envprops = (Hashtable<String, Object>)envprops.clone();
|
||||||
return envprops.remove(propName);
|
return envprops.remove(propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked") // clone()
|
||||||
public Object addToEnvironment(String propName, Object propVal)
|
public Object addToEnvironment(String propName, Object propVal)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
@ -2219,57 +2236,72 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
if (propVal == null) {
|
if (propVal == null) {
|
||||||
return removeFromEnvironment(propName);
|
return removeFromEnvironment(propName);
|
||||||
}
|
}
|
||||||
|
switch (propName) {
|
||||||
|
case REF_SEPARATOR:
|
||||||
|
setRefSeparator((String)propVal);
|
||||||
|
break;
|
||||||
|
case TYPES_ONLY:
|
||||||
|
setTypesOnly((String)propVal);
|
||||||
|
break;
|
||||||
|
case DELETE_RDN:
|
||||||
|
setDeleteRDN((String)propVal);
|
||||||
|
break;
|
||||||
|
case DEREF_ALIASES:
|
||||||
|
setDerefAliases((String)propVal);
|
||||||
|
break;
|
||||||
|
case Context.BATCHSIZE:
|
||||||
|
setBatchSize((String)propVal);
|
||||||
|
break;
|
||||||
|
case REFERRAL_LIMIT:
|
||||||
|
setReferralLimit((String)propVal);
|
||||||
|
break;
|
||||||
|
case Context.REFERRAL:
|
||||||
|
setReferralMode((String)propVal, true);
|
||||||
|
break;
|
||||||
|
case BINARY_ATTRIBUTES:
|
||||||
|
setBinaryAttributes((String)propVal);
|
||||||
|
break;
|
||||||
|
case CONNECT_TIMEOUT:
|
||||||
|
setConnectTimeout((String)propVal);
|
||||||
|
break;
|
||||||
|
case READ_TIMEOUT:
|
||||||
|
setReadTimeout((String)propVal);
|
||||||
|
break;
|
||||||
|
case WAIT_FOR_REPLY:
|
||||||
|
setWaitForReply((String)propVal);
|
||||||
|
break;
|
||||||
|
case REPLY_QUEUE_SIZE:
|
||||||
|
setReplyQueueSize((String)propVal);
|
||||||
|
break;
|
||||||
|
|
||||||
if (propName.equals(REF_SEPARATOR)) {
|
// The following properties affect the connection
|
||||||
setRefSeparator((String)propVal);
|
|
||||||
} else if (propName.equals(TYPES_ONLY)) {
|
|
||||||
setTypesOnly((String)propVal);
|
|
||||||
} else if (propName.equals(DELETE_RDN)) {
|
|
||||||
setDeleteRDN((String)propVal);
|
|
||||||
} else if (propName.equals(DEREF_ALIASES)) {
|
|
||||||
setDerefAliases((String)propVal);
|
|
||||||
} else if (propName.equals(Context.BATCHSIZE)) {
|
|
||||||
setBatchSize((String)propVal);
|
|
||||||
} else if (propName.equals(REFERRAL_LIMIT)) {
|
|
||||||
setReferralLimit((String)propVal);
|
|
||||||
} else if (propName.equals(Context.REFERRAL)) {
|
|
||||||
setReferralMode((String)propVal, true);
|
|
||||||
} else if (propName.equals(BINARY_ATTRIBUTES)) {
|
|
||||||
setBinaryAttributes((String)propVal);
|
|
||||||
} else if (propName.equals(CONNECT_TIMEOUT)) {
|
|
||||||
setConnectTimeout((String)propVal);
|
|
||||||
} else if (propName.equals(READ_TIMEOUT)) {
|
|
||||||
setReadTimeout((String)propVal);
|
|
||||||
} else if (propName.equals(WAIT_FOR_REPLY)) {
|
|
||||||
setWaitForReply((String)propVal);
|
|
||||||
} else if (propName.equals(REPLY_QUEUE_SIZE)) {
|
|
||||||
setReplyQueueSize((String)propVal);
|
|
||||||
|
|
||||||
// The following properties affect the connection
|
case Context.SECURITY_PROTOCOL:
|
||||||
|
closeConnection(SOFT_CLOSE);
|
||||||
} else if (propName.equals(Context.SECURITY_PROTOCOL)) {
|
// Activate SSL and reset the context's url and port number
|
||||||
closeConnection(SOFT_CLOSE);
|
if ("ssl".equals(propVal)) {
|
||||||
// Activate SSL and reset the context's url and port number
|
useSsl = true;
|
||||||
if ("ssl".equals(propVal)) {
|
url = null;
|
||||||
useSsl = true;
|
if (useDefaultPortNumber) {
|
||||||
url = null;
|
port_number = DEFAULT_SSL_PORT;
|
||||||
if (useDefaultPortNumber) {
|
}
|
||||||
port_number = DEFAULT_SSL_PORT;
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
} else if (propName.equals(VERSION) ||
|
case VERSION:
|
||||||
propName.equals(SOCKET_FACTORY)) {
|
case SOCKET_FACTORY:
|
||||||
closeConnection(SOFT_CLOSE);
|
closeConnection(SOFT_CLOSE);
|
||||||
} else if (propName.equals(Context.SECURITY_AUTHENTICATION) ||
|
break;
|
||||||
propName.equals(Context.SECURITY_PRINCIPAL) ||
|
case Context.SECURITY_AUTHENTICATION:
|
||||||
propName.equals(Context.SECURITY_CREDENTIALS)) {
|
case Context.SECURITY_PRINCIPAL:
|
||||||
sharable = false;
|
case Context.SECURITY_CREDENTIALS:
|
||||||
|
sharable = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update environment; reconnection will use new props
|
// Update environment; reconnection will use new props
|
||||||
envprops = (envprops == null
|
envprops = (envprops == null
|
||||||
? new Hashtable(5, 0.75f)
|
? new Hashtable<String, Object>(5, 0.75f)
|
||||||
: (Hashtable)envprops.clone());
|
: (Hashtable<String, Object>)envprops.clone());
|
||||||
return envprops.put(propName, propVal);
|
return envprops.put(propName, propVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2380,15 +2412,19 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
private void setReferralMode(String ref, boolean update) {
|
private void setReferralMode(String ref, boolean update) {
|
||||||
// First determine the referral mode
|
// First determine the referral mode
|
||||||
if (ref != null) {
|
if (ref != null) {
|
||||||
if (ref.equals("follow")) {
|
switch (ref) {
|
||||||
handleReferrals = LdapClient.LDAP_REF_FOLLOW;
|
case "follow":
|
||||||
} else if (ref.equals("throw")) {
|
handleReferrals = LdapClient.LDAP_REF_FOLLOW;
|
||||||
handleReferrals = LdapClient.LDAP_REF_THROW;
|
break;
|
||||||
} else if (ref.equals("ignore")) {
|
case "throw":
|
||||||
handleReferrals = LdapClient.LDAP_REF_IGNORE;
|
handleReferrals = LdapClient.LDAP_REF_THROW;
|
||||||
} else {
|
break;
|
||||||
throw new IllegalArgumentException(
|
case "ignore":
|
||||||
"Illegal value for " + Context.REFERRAL + " property.");
|
handleReferrals = LdapClient.LDAP_REF_IGNORE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Illegal value for " + Context.REFERRAL + " property.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
handleReferrals = DEFAULT_REFERRAL_MODE;
|
handleReferrals = DEFAULT_REFERRAL_MODE;
|
||||||
@ -2411,17 +2447,22 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
*/
|
*/
|
||||||
private void setDerefAliases(String deref) {
|
private void setDerefAliases(String deref) {
|
||||||
if (deref != null) {
|
if (deref != null) {
|
||||||
if (deref.equals("never")) {
|
switch (deref) {
|
||||||
derefAliases = 0; // never de-reference aliases
|
case "never":
|
||||||
} else if (deref.equals("searching")) {
|
derefAliases = 0; // never de-reference aliases
|
||||||
derefAliases = 1; // de-reference aliases during searching
|
break;
|
||||||
} else if (deref.equals("finding")) {
|
case "searching":
|
||||||
derefAliases = 2; // de-reference during name resolution
|
derefAliases = 1; // de-reference aliases during searching
|
||||||
} else if (deref.equals("always")) {
|
break;
|
||||||
derefAliases = 3; // always de-reference aliases
|
case "finding":
|
||||||
} else {
|
derefAliases = 2; // de-reference during name resolution
|
||||||
throw new IllegalArgumentException("Illegal value for " +
|
break;
|
||||||
DEREF_ALIASES + " property.");
|
case "always":
|
||||||
|
derefAliases = 3; // always de-reference aliases
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Illegal value for " +
|
||||||
|
DEREF_ALIASES + " property.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
derefAliases = DEFAULT_DEREF_ALIASES;
|
derefAliases = DEFAULT_DEREF_ALIASES;
|
||||||
@ -2514,8 +2555,10 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
* <ldapurls> ::= <separator> <ldapurl> | <ldapurls>
|
* <ldapurls> ::= <separator> <ldapurl> | <ldapurls>
|
||||||
* <separator> ::= ASCII linefeed character (0x0a)
|
* <separator> ::= ASCII linefeed character (0x0a)
|
||||||
* <ldapurl> ::= LDAP URL format (RFC 1959)
|
* <ldapurl> ::= LDAP URL format (RFC 1959)
|
||||||
|
*
|
||||||
|
* Returns a Vector of single-String Vectors.
|
||||||
*/
|
*/
|
||||||
private static Vector extractURLs(String refString) {
|
private static Vector<Vector<String>> extractURLs(String refString) {
|
||||||
|
|
||||||
int separator = 0;
|
int separator = 0;
|
||||||
int urlCount = 0;
|
int urlCount = 0;
|
||||||
@ -2526,17 +2569,21 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
urlCount++;
|
urlCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector referrals = new Vector(urlCount);
|
Vector<Vector<String>> referrals = new Vector<>(urlCount);
|
||||||
int iURL;
|
int iURL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
separator = refString.indexOf('\n');
|
separator = refString.indexOf('\n');
|
||||||
iURL = separator + 1;
|
iURL = separator + 1;
|
||||||
while ((separator = refString.indexOf('\n', iURL)) >= 0) {
|
while ((separator = refString.indexOf('\n', iURL)) >= 0) {
|
||||||
referrals.addElement(refString.substring(iURL, separator));
|
Vector<String> referral = new Vector<>(1);
|
||||||
|
referral.addElement(refString.substring(iURL, separator));
|
||||||
|
referrals.addElement(referral);
|
||||||
iURL = separator + 1;
|
iURL = separator + 1;
|
||||||
}
|
}
|
||||||
referrals.addElement(refString.substring(iURL));
|
Vector<String> referral = new Vector<>(1);
|
||||||
|
referral.addElement(refString.substring(iURL));
|
||||||
|
referrals.addElement(referral);
|
||||||
|
|
||||||
return referrals;
|
return referrals;
|
||||||
}
|
}
|
||||||
@ -2549,9 +2596,9 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
if (attrIds == null) {
|
if (attrIds == null) {
|
||||||
binaryAttrs = null;
|
binaryAttrs = null;
|
||||||
} else {
|
} else {
|
||||||
binaryAttrs = new Hashtable(11, 0.75f);
|
binaryAttrs = new Hashtable<>(11, 0.75f);
|
||||||
StringTokenizer tokens =
|
StringTokenizer tokens =
|
||||||
new StringTokenizer(attrIds.toLowerCase(), " ");
|
new StringTokenizer(attrIds.toLowerCase(Locale.ENGLISH), " ");
|
||||||
|
|
||||||
while (tokens.hasMoreTokens()) {
|
while (tokens.hasMoreTokens()) {
|
||||||
binaryAttrs.put(tokens.nextToken(), Boolean.TRUE);
|
binaryAttrs.put(tokens.nextToken(), Boolean.TRUE);
|
||||||
@ -2601,11 +2648,12 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked") // clone()
|
||||||
public void reconnect(Control[] connCtls) throws NamingException {
|
public void reconnect(Control[] connCtls) throws NamingException {
|
||||||
// Update environment
|
// Update environment
|
||||||
envprops = (envprops == null
|
envprops = (envprops == null
|
||||||
? new Hashtable(5, 0.75f)
|
? new Hashtable<String, Object>(5, 0.75f)
|
||||||
: (Hashtable)envprops.clone());
|
: (Hashtable<String, Object>)envprops.clone());
|
||||||
|
|
||||||
if (connCtls == null) {
|
if (connCtls == null) {
|
||||||
envprops.remove(BIND_CONTROLS);
|
envprops.remove(BIND_CONTROLS);
|
||||||
@ -2631,7 +2679,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reset the cache before a new connection is established
|
// reset the cache before a new connection is established
|
||||||
schemaTrees = new Hashtable(11, 0.75f);
|
schemaTrees = new Hashtable<>(11, 0.75f);
|
||||||
connect(startTLS);
|
connect(startTLS);
|
||||||
|
|
||||||
} else if (!sharable || startTLS) {
|
} else if (!sharable || startTLS) {
|
||||||
@ -2644,7 +2692,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// reset the cache before a new connection is established
|
// reset the cache before a new connection is established
|
||||||
schemaTrees = new Hashtable(11, 0.75f);
|
schemaTrees = new Hashtable<>(11, 0.75f);
|
||||||
connect(startTLS);
|
connect(startTLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2846,7 +2894,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void processReturnCode(LdapResult res, Name resolvedName,
|
protected void processReturnCode(LdapResult res, Name resolvedName,
|
||||||
Object resolvedObj, Name remainName, Hashtable envprops, String fullDN)
|
Object resolvedObj, Name remainName, Hashtable<?,?> envprops, String fullDN)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
String msg = LdapClient.getErrorMessage(res.status, res.errorMessage);
|
String msg = LdapClient.getErrorMessage(res.status, res.errorMessage);
|
||||||
@ -2880,7 +2928,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
r = new LdapReferralException(resolvedName, resolvedObj,
|
r = new LdapReferralException(resolvedName, resolvedObj,
|
||||||
remainName, msg, envprops, fullDN, handleReferrals,
|
remainName, msg, envprops, fullDN, handleReferrals,
|
||||||
reqCtls);
|
reqCtls);
|
||||||
r.setReferralInfo((Vector)res.referrals.elementAt(i), true);
|
r.setReferralInfo(res.referrals.elementAt(i), true);
|
||||||
|
|
||||||
if (hopCount > 1) {
|
if (hopCount > 1) {
|
||||||
r.setHopCount(hopCount);
|
r.setHopCount(hopCount);
|
||||||
@ -2927,7 +2975,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
r = new LdapReferralException(resolvedName, resolvedObj, remainName,
|
r = new LdapReferralException(resolvedName, resolvedObj, remainName,
|
||||||
msg, envprops, fullDN, handleReferrals, reqCtls);
|
msg, envprops, fullDN, handleReferrals, reqCtls);
|
||||||
// only one set of URLs is present
|
// only one set of URLs is present
|
||||||
r.setReferralInfo((Vector)res.referrals.elementAt(0), false);
|
r.setReferralInfo(res.referrals.elementAt(0), false);
|
||||||
|
|
||||||
if (hopCount > 1) {
|
if (hopCount > 1) {
|
||||||
r.setHopCount(hopCount);
|
r.setHopCount(hopCount);
|
||||||
@ -2995,10 +3043,10 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
* If 1 referral and 0 entries is received then
|
* If 1 referral and 0 entries is received then
|
||||||
* assume name resolution has not yet completed.
|
* assume name resolution has not yet completed.
|
||||||
*/
|
*/
|
||||||
if (((res.entries == null) || (res.entries.size() == 0)) &&
|
if (((res.entries == null) || (res.entries.isEmpty())) &&
|
||||||
(res.referrals.size() == 1)) {
|
(res.referrals.size() == 1)) {
|
||||||
|
|
||||||
r.setReferralInfo((Vector)res.referrals, false);
|
r.setReferralInfo(res.referrals, false);
|
||||||
|
|
||||||
// check the hop limit
|
// check the hop limit
|
||||||
if (hopCount > referralHopLimit) {
|
if (hopCount > referralHopLimit) {
|
||||||
@ -3284,9 +3332,9 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Narrow controls using own default factory and ControlFactory.
|
* Narrow controls using own default factory and ControlFactory.
|
||||||
* @param ctls A non-null Vector
|
* @param ctls A non-null Vector<Control>
|
||||||
*/
|
*/
|
||||||
Control[] convertControls(Vector ctls) throws NamingException {
|
Control[] convertControls(Vector<Control> ctls) throws NamingException {
|
||||||
int count = ctls.size();
|
int count = ctls.size();
|
||||||
|
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
@ -3298,12 +3346,12 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
// Try own factory first
|
// Try own factory first
|
||||||
controls[i] = myResponseControlFactory.getControlInstance(
|
controls[i] = myResponseControlFactory.getControlInstance(
|
||||||
(Control)ctls.elementAt(i));
|
ctls.elementAt(i));
|
||||||
|
|
||||||
// Try assigned factories if own produced null
|
// Try assigned factories if own produced null
|
||||||
if (controls[i] == null) {
|
if (controls[i] == null) {
|
||||||
controls[i] = ControlFactory.getControlInstance(
|
controls[i] = ControlFactory.getControlInstance(
|
||||||
(Control)ctls.elementAt(i), this, envprops);
|
ctls.elementAt(i), this, envprops);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return controls;
|
return controls;
|
||||||
@ -3448,7 +3496,7 @@ final public class LdapCtx extends ComponentDirContext
|
|||||||
if (nm.size() > 1) {
|
if (nm.size() > 1) {
|
||||||
throw new InvalidNameException(
|
throw new InvalidNameException(
|
||||||
"Target cannot span multiple namespaces: " + nm);
|
"Target cannot span multiple namespaces: " + nm);
|
||||||
} else if (nm.size() == 0) {
|
} else if (nm.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
return nm.get(0);
|
return nm.get(0);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,7 +28,6 @@ package com.sun.jndi.ldap;
|
|||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.net.MalformedURLException;
|
|
||||||
|
|
||||||
import javax.naming.*;
|
import javax.naming.*;
|
||||||
import javax.naming.directory.*;
|
import javax.naming.directory.*;
|
||||||
@ -119,9 +118,9 @@ final public class LdapCtxFactory implements ObjectFactory, InitialContextFactor
|
|||||||
int size = 0; // number of URLs
|
int size = 0; // number of URLs
|
||||||
String[] urls = new String[ref.size()];
|
String[] urls = new String[ref.size()];
|
||||||
|
|
||||||
Enumeration addrs = ref.getAll();
|
Enumeration<RefAddr> addrs = ref.getAll();
|
||||||
while (addrs.hasMoreElements()) {
|
while (addrs.hasMoreElements()) {
|
||||||
RefAddr addr = (RefAddr)addrs.nextElement();
|
RefAddr addr = addrs.nextElement();
|
||||||
|
|
||||||
if ((addr instanceof StringRefAddr) &&
|
if ((addr instanceof StringRefAddr) &&
|
||||||
addr.getType().equals(ADDRESS_TYPE)) {
|
addr.getType().equals(ADDRESS_TYPE)) {
|
||||||
@ -145,7 +144,7 @@ final public class LdapCtxFactory implements ObjectFactory, InitialContextFactor
|
|||||||
|
|
||||||
// ------------ Utilities used by other classes ----------------
|
// ------------ Utilities used by other classes ----------------
|
||||||
|
|
||||||
public static DirContext getLdapCtxInstance(Object urlInfo, Hashtable env)
|
public static DirContext getLdapCtxInstance(Object urlInfo, Hashtable<?,?> env)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
if (urlInfo instanceof String) {
|
if (urlInfo instanceof String) {
|
||||||
@ -158,7 +157,7 @@ final public class LdapCtxFactory implements ObjectFactory, InitialContextFactor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DirContext getUsingURL(String url, Hashtable env)
|
private static DirContext getUsingURL(String url, Hashtable<?,?> env)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
DirContext ctx = null;
|
DirContext ctx = null;
|
||||||
LdapURL ldapUrl = new LdapURL(url);
|
LdapURL ldapUrl = new LdapURL(url);
|
||||||
@ -202,7 +201,7 @@ final public class LdapCtxFactory implements ObjectFactory, InitialContextFactor
|
|||||||
* If all URLs fail, throw one of the exceptions arbitrarily.
|
* If all URLs fail, throw one of the exceptions arbitrarily.
|
||||||
* Not pretty, but potentially more informative than returning null.
|
* Not pretty, but potentially more informative than returning null.
|
||||||
*/
|
*/
|
||||||
private static DirContext getUsingURLs(String[] urls, Hashtable env)
|
private static DirContext getUsingURLs(String[] urls, Hashtable<?,?> env)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
NamingException ne = null;
|
NamingException ne = null;
|
||||||
DirContext ctx = null;
|
DirContext ctx = null;
|
||||||
@ -221,8 +220,8 @@ final public class LdapCtxFactory implements ObjectFactory, InitialContextFactor
|
|||||||
/**
|
/**
|
||||||
* Used by Obj and obj/RemoteToAttrs too so must be public
|
* Used by Obj and obj/RemoteToAttrs too so must be public
|
||||||
*/
|
*/
|
||||||
public static Attribute createTypeNameAttr(Class cl) {
|
public static Attribute createTypeNameAttr(Class<?> cl) {
|
||||||
Vector v = new Vector(10);
|
Vector<String> v = new Vector<>(10);
|
||||||
String[] types = getTypeNames(cl, v);
|
String[] types = getTypeNames(cl, v);
|
||||||
if (types.length > 0) {
|
if (types.length > 0) {
|
||||||
BasicAttribute tAttr =
|
BasicAttribute tAttr =
|
||||||
@ -235,7 +234,7 @@ final public class LdapCtxFactory implements ObjectFactory, InitialContextFactor
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] getTypeNames(Class currentClass, Vector v) {
|
private static String[] getTypeNames(Class<?> currentClass, Vector<String> v) {
|
||||||
|
|
||||||
getClassesAux(currentClass, v);
|
getClassesAux(currentClass, v);
|
||||||
Class[] members = currentClass.getInterfaces();
|
Class[] members = currentClass.getInterfaces();
|
||||||
@ -244,13 +243,14 @@ final public class LdapCtxFactory implements ObjectFactory, InitialContextFactor
|
|||||||
}
|
}
|
||||||
String[] ret = new String[v.size()];
|
String[] ret = new String[v.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (java.util.Enumeration e = v.elements(); e.hasMoreElements();) {
|
|
||||||
ret[i++] = (String)e.nextElement();
|
for (String name : v) {
|
||||||
|
ret[i++] = name;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void getClassesAux(Class currentClass, Vector v) {
|
private static void getClassesAux(Class<?> currentClass, Vector<String> v) {
|
||||||
if (!v.contains(currentClass.getName())) {
|
if (!v.contains(currentClass.getName())) {
|
||||||
v.addElement(currentClass.getName());
|
v.addElement(currentClass.getName());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,7 +27,7 @@ package com.sun.jndi.ldap;
|
|||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import javax.naming.directory.Attributes;
|
import javax.naming.directory.Attributes;
|
||||||
import javax.naming.directory.Attribute;
|
import javax.naming.ldap.Control;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A holder for an LDAP entry read from an LDAP server.
|
* A holder for an LDAP entry read from an LDAP server.
|
||||||
@ -38,14 +38,14 @@ import javax.naming.directory.Attribute;
|
|||||||
final class LdapEntry {
|
final class LdapEntry {
|
||||||
String DN;
|
String DN;
|
||||||
Attributes attributes;
|
Attributes attributes;
|
||||||
Vector respCtls = null;
|
Vector<Control> respCtls = null;
|
||||||
|
|
||||||
LdapEntry(String DN, Attributes attrs) {
|
LdapEntry(String DN, Attributes attrs) {
|
||||||
this.DN = DN;
|
this.DN = DN;
|
||||||
this.attributes = attrs;
|
this.attributes = attrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
LdapEntry(String DN, Attributes attrs, Vector respCtls) {
|
LdapEntry(String DN, Attributes attrs, Vector<Control> respCtls) {
|
||||||
this.DN = DN;
|
this.DN = DN;
|
||||||
this.attributes = attrs;
|
this.attributes = attrs;
|
||||||
this.respCtls = respCtls;
|
this.respCtls = respCtls;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,6 +28,7 @@ package com.sun.jndi.ldap;
|
|||||||
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.naming.*;
|
import javax.naming.*;
|
||||||
import javax.naming.directory.Attributes;
|
import javax.naming.directory.Attributes;
|
||||||
@ -78,7 +79,7 @@ import javax.naming.directory.BasicAttributes;
|
|||||||
public final class LdapName implements Name {
|
public final class LdapName implements Name {
|
||||||
|
|
||||||
private transient String unparsed; // if non-null, the DN in unparsed form
|
private transient String unparsed; // if non-null, the DN in unparsed form
|
||||||
private transient Vector rdns; // parsed name components
|
private transient Vector<Rdn> rdns; // parsed name components
|
||||||
private transient boolean valuesCaseSensitive = false;
|
private transient boolean valuesCaseSensitive = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,9 +98,10 @@ public final class LdapName implements Name {
|
|||||||
* Constructs an LDAP name given its parsed components and, optionally
|
* Constructs an LDAP name given its parsed components and, optionally
|
||||||
* (if "name" is not null), the unparsed DN.
|
* (if "name" is not null), the unparsed DN.
|
||||||
*/
|
*/
|
||||||
private LdapName(String name, Vector rdns) {
|
@SuppressWarnings("unchecked") // clone()
|
||||||
|
private LdapName(String name, Vector<Rdn> rdns) {
|
||||||
unparsed = name;
|
unparsed = name;
|
||||||
this.rdns = (Vector)rdns.clone();
|
this.rdns = (Vector<Rdn>)rdns.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -107,9 +109,9 @@ public final class LdapName implements Name {
|
|||||||
* of "rdns" in the range [beg,end)) and, optionally
|
* of "rdns" in the range [beg,end)) and, optionally
|
||||||
* (if "name" is not null), the unparsed DN.
|
* (if "name" is not null), the unparsed DN.
|
||||||
*/
|
*/
|
||||||
private LdapName(String name, Vector rdns, int beg, int end) {
|
private LdapName(String name, Vector<Rdn> rdns, int beg, int end) {
|
||||||
unparsed = name;
|
unparsed = name;
|
||||||
this.rdns = new Vector();
|
this.rdns = new Vector<>();
|
||||||
for (int i = beg; i < end; i++) {
|
for (int i = beg; i < end; i++) {
|
||||||
this.rdns.addElement(rdns.elementAt(i));
|
this.rdns.addElement(rdns.elementAt(i));
|
||||||
}
|
}
|
||||||
@ -130,7 +132,7 @@ public final class LdapName implements Name {
|
|||||||
if (i < rdns.size() - 1) {
|
if (i < rdns.size() - 1) {
|
||||||
buf.append(',');
|
buf.append(',');
|
||||||
}
|
}
|
||||||
Rdn rdn = (Rdn)rdns.elementAt(i);
|
Rdn rdn = rdns.elementAt(i);
|
||||||
buf.append(rdn);
|
buf.append(rdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,8 +157,8 @@ public final class LdapName implements Name {
|
|||||||
int minSize = Math.min(rdns.size(), that.rdns.size());
|
int minSize = Math.min(rdns.size(), that.rdns.size());
|
||||||
for (int i = 0 ; i < minSize; i++) {
|
for (int i = 0 ; i < minSize; i++) {
|
||||||
// Compare a single pair of RDNs.
|
// Compare a single pair of RDNs.
|
||||||
Rdn rdn1 = (Rdn)rdns.elementAt(i);
|
Rdn rdn1 = rdns.elementAt(i);
|
||||||
Rdn rdn2 = (Rdn)that.rdns.elementAt(i);
|
Rdn rdn2 = that.rdns.elementAt(i);
|
||||||
|
|
||||||
int diff = rdn1.compareTo(rdn2);
|
int diff = rdn1.compareTo(rdn2);
|
||||||
if (diff != 0) {
|
if (diff != 0) {
|
||||||
@ -172,7 +174,7 @@ public final class LdapName implements Name {
|
|||||||
|
|
||||||
// For each RDN...
|
// For each RDN...
|
||||||
for (int i = 0; i < rdns.size(); i++) {
|
for (int i = 0; i < rdns.size(); i++) {
|
||||||
Rdn rdn = (Rdn)rdns.elementAt(i);
|
Rdn rdn = rdns.elementAt(i);
|
||||||
hash += rdn.hashCode();
|
hash += rdn.hashCode();
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
@ -186,14 +188,14 @@ public final class LdapName implements Name {
|
|||||||
return rdns.isEmpty();
|
return rdns.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Enumeration getAll() {
|
public Enumeration<String> getAll() {
|
||||||
final Enumeration enum_ = rdns.elements();
|
final Enumeration<Rdn> enum_ = rdns.elements();
|
||||||
|
|
||||||
return new Enumeration () {
|
return new Enumeration<String>() {
|
||||||
public boolean hasMoreElements() {
|
public boolean hasMoreElements() {
|
||||||
return enum_.hasMoreElements();
|
return enum_.hasMoreElements();
|
||||||
}
|
}
|
||||||
public Object nextElement() {
|
public String nextElement() {
|
||||||
return enum_.nextElement().toString();
|
return enum_.nextElement().toString();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -254,7 +256,7 @@ public final class LdapName implements Name {
|
|||||||
Rdn rdn;
|
Rdn rdn;
|
||||||
if (n instanceof LdapName) {
|
if (n instanceof LdapName) {
|
||||||
LdapName ln = (LdapName)n;
|
LdapName ln = (LdapName)n;
|
||||||
rdn = (Rdn)ln.rdns.elementAt(i - beg);
|
rdn = ln.rdns.elementAt(i - beg);
|
||||||
} else {
|
} else {
|
||||||
String rdnString = n.get(i - beg);
|
String rdnString = n.get(i - beg);
|
||||||
try {
|
try {
|
||||||
@ -286,9 +288,9 @@ public final class LdapName implements Name {
|
|||||||
rdns.insertElementAt(s.rdns.elementAt(i), pos++);
|
rdns.insertElementAt(s.rdns.elementAt(i), pos++);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Enumeration comps = suffix.getAll();
|
Enumeration<String> comps = suffix.getAll();
|
||||||
while (comps.hasMoreElements()) {
|
while (comps.hasMoreElements()) {
|
||||||
DnParser p = new DnParser((String)comps.nextElement(),
|
DnParser p = new DnParser(comps.nextElement(),
|
||||||
valuesCaseSensitive);
|
valuesCaseSensitive);
|
||||||
rdns.insertElementAt(p.getRdn(), pos++);
|
rdns.insertElementAt(p.getRdn(), pos++);
|
||||||
}
|
}
|
||||||
@ -406,9 +408,9 @@ public final class LdapName implements Name {
|
|||||||
/*
|
/*
|
||||||
* Parses the DN, returning a Vector of its RDNs.
|
* Parses the DN, returning a Vector of its RDNs.
|
||||||
*/
|
*/
|
||||||
Vector getDn() throws InvalidNameException {
|
Vector<Rdn> getDn() throws InvalidNameException {
|
||||||
cur = 0;
|
cur = 0;
|
||||||
Vector rdns = new Vector(len / 3 + 10); // leave room for growth
|
Vector<Rdn> rdns = new Vector<>(len / 3 + 10); // leave room for growth
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return rdns;
|
return rdns;
|
||||||
@ -595,7 +597,7 @@ public final class LdapName implements Name {
|
|||||||
* A vector of the TypeAndValue elements of this Rdn.
|
* A vector of the TypeAndValue elements of this Rdn.
|
||||||
* It is sorted to facilitate set operations.
|
* It is sorted to facilitate set operations.
|
||||||
*/
|
*/
|
||||||
private final Vector tvs = new Vector();
|
private final Vector<TypeAndValue> tvs = new Vector<>();
|
||||||
|
|
||||||
void add(TypeAndValue tv) {
|
void add(TypeAndValue tv) {
|
||||||
|
|
||||||
@ -636,7 +638,7 @@ public final class LdapName implements Name {
|
|||||||
int minSize = Math.min(tvs.size(), that.tvs.size());
|
int minSize = Math.min(tvs.size(), that.tvs.size());
|
||||||
for (int i = 0; i < minSize; i++) {
|
for (int i = 0; i < minSize; i++) {
|
||||||
// Compare a single pair of type/value pairs.
|
// Compare a single pair of type/value pairs.
|
||||||
TypeAndValue tv = (TypeAndValue)tvs.elementAt(i);
|
TypeAndValue tv = tvs.elementAt(i);
|
||||||
int diff = tv.compareTo(that.tvs.elementAt(i));
|
int diff = tv.compareTo(that.tvs.elementAt(i));
|
||||||
if (diff != 0) {
|
if (diff != 0) {
|
||||||
return diff;
|
return diff;
|
||||||
@ -662,7 +664,7 @@ public final class LdapName implements Name {
|
|||||||
Attribute attr;
|
Attribute attr;
|
||||||
|
|
||||||
for (int i = 0; i < tvs.size(); i++) {
|
for (int i = 0; i < tvs.size(); i++) {
|
||||||
tv = (TypeAndValue) tvs.elementAt(i);
|
tv = tvs.elementAt(i);
|
||||||
if ((attr = attrs.get(tv.getType())) == null) {
|
if ((attr = attrs.get(tv.getType())) == null) {
|
||||||
attrs.put(tv.getType(), tv.getUnescapedValue());
|
attrs.put(tv.getType(), tv.getUnescapedValue());
|
||||||
} else {
|
} else {
|
||||||
@ -706,7 +708,7 @@ public final class LdapName implements Name {
|
|||||||
|
|
||||||
TypeAndValue that = (TypeAndValue)obj;
|
TypeAndValue that = (TypeAndValue)obj;
|
||||||
|
|
||||||
int diff = type.toUpperCase().compareTo(that.type.toUpperCase());
|
int diff = type.compareToIgnoreCase(that.type);
|
||||||
if (diff != 0) {
|
if (diff != 0) {
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
@ -729,7 +731,7 @@ public final class LdapName implements Name {
|
|||||||
|
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
// If two objects are equal, their hash codes must match.
|
// If two objects are equal, their hash codes must match.
|
||||||
return (type.toUpperCase().hashCode() +
|
return (type.toUpperCase(Locale.ENGLISH).hashCode() +
|
||||||
getValueComparable().hashCode());
|
getValueComparable().hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -763,11 +765,12 @@ public final class LdapName implements Name {
|
|||||||
|
|
||||||
// cache result
|
// cache result
|
||||||
if (binary) {
|
if (binary) {
|
||||||
comparable = value.toUpperCase();
|
comparable = value.toUpperCase(Locale.ENGLISH);
|
||||||
} else {
|
} else {
|
||||||
comparable = (String)unescapeValue(value);
|
comparable = (String)unescapeValue(value);
|
||||||
if (!valueCaseSensitive) {
|
if (!valueCaseSensitive) {
|
||||||
comparable = comparable.toUpperCase(); // ignore case
|
// ignore case
|
||||||
|
comparable = comparable.toUpperCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return comparable;
|
return comparable;
|
||||||
@ -835,7 +838,7 @@ public final class LdapName implements Name {
|
|||||||
buf.append(Character.forDigit(0xF & b, 16));
|
buf.append(Character.forDigit(0xF & b, 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (new String(buf)).toUpperCase();
|
return (new String(buf)).toUpperCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,267 +27,25 @@ package com.sun.jndi.ldap;
|
|||||||
|
|
||||||
import javax.naming.*;
|
import javax.naming.*;
|
||||||
import javax.naming.directory.*;
|
import javax.naming.directory.*;
|
||||||
import javax.naming.spi.*;
|
|
||||||
|
|
||||||
import com.sun.jndi.toolkit.ctx.Continuation;
|
import com.sun.jndi.toolkit.ctx.Continuation;
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import javax.naming.ldap.LdapName;
|
import javax.naming.ldap.Control;
|
||||||
|
|
||||||
/**
|
|
||||||
* Basic enumeration for NameClassPair, Binding, and SearchResults.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class LdapNamingEnumeration implements NamingEnumeration, ReferralEnumeration {
|
final class LdapNamingEnumeration
|
||||||
protected Name listArg;
|
extends AbstractLdapNamingEnumeration<NameClassPair> {
|
||||||
|
|
||||||
private boolean cleaned = false;
|
|
||||||
private LdapResult res;
|
|
||||||
private LdapClient enumClnt;
|
|
||||||
private Continuation cont; // used to fill in exceptions
|
|
||||||
private Vector entries = null;
|
|
||||||
private int limit = 0;
|
|
||||||
private int posn = 0;
|
|
||||||
protected LdapCtx homeCtx;
|
|
||||||
private LdapReferralException refEx = null;
|
|
||||||
private NamingException errEx = null;
|
|
||||||
|
|
||||||
private static final String defaultClassName = DirContext.class.getName();
|
private static final String defaultClassName = DirContext.class.getName();
|
||||||
|
|
||||||
/*
|
|
||||||
* Record the next set of entries and/or referrals.
|
|
||||||
*/
|
|
||||||
LdapNamingEnumeration(LdapCtx homeCtx, LdapResult answer, Name listArg,
|
LdapNamingEnumeration(LdapCtx homeCtx, LdapResult answer, Name listArg,
|
||||||
Continuation cont) throws NamingException {
|
Continuation cont) throws NamingException {
|
||||||
|
super(homeCtx, answer, listArg, cont);
|
||||||
// These checks are to accommodate referrals and limit exceptions
|
|
||||||
// which will generate an enumeration and defer the exception
|
|
||||||
// to be thrown at the end of the enumeration.
|
|
||||||
// All other exceptions are thrown immediately.
|
|
||||||
// Exceptions shouldn't be thrown here anyhow because
|
|
||||||
// process_return_code() is called before the constructor
|
|
||||||
// is called, so these are just safety checks.
|
|
||||||
|
|
||||||
if ((answer.status != LdapClient.LDAP_SUCCESS) &&
|
|
||||||
(answer.status != LdapClient.LDAP_SIZE_LIMIT_EXCEEDED) &&
|
|
||||||
(answer.status != LdapClient.LDAP_TIME_LIMIT_EXCEEDED) &&
|
|
||||||
(answer.status != LdapClient.LDAP_ADMIN_LIMIT_EXCEEDED) &&
|
|
||||||
(answer.status != LdapClient.LDAP_REFERRAL) &&
|
|
||||||
(answer.status != LdapClient.LDAP_PARTIAL_RESULTS)) {
|
|
||||||
|
|
||||||
// %%% need to deal with referral
|
|
||||||
NamingException e = new NamingException(
|
|
||||||
LdapClient.getErrorMessage(
|
|
||||||
answer.status, answer.errorMessage));
|
|
||||||
|
|
||||||
throw cont.fillInException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise continue
|
|
||||||
|
|
||||||
res = answer;
|
|
||||||
entries = answer.entries;
|
|
||||||
limit = (entries == null) ? 0 : entries.size(); // handle empty set
|
|
||||||
this.listArg = listArg;
|
|
||||||
this.cont = cont;
|
|
||||||
|
|
||||||
if (answer.refEx != null) {
|
|
||||||
refEx = answer.refEx;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensures that context won't get closed from underneath us
|
|
||||||
this.homeCtx = homeCtx;
|
|
||||||
homeCtx.incEnumCount();
|
|
||||||
enumClnt = homeCtx.clnt; // remember
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object nextElement() {
|
|
||||||
try {
|
|
||||||
return next();
|
|
||||||
} catch (NamingException e) {
|
|
||||||
// can't throw exception
|
|
||||||
cleanup();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasMoreElements() {
|
|
||||||
try {
|
|
||||||
return hasMore();
|
|
||||||
} catch (NamingException e) {
|
|
||||||
// can't throw exception
|
|
||||||
cleanup();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Retrieve the next set of entries and/or referrals.
|
|
||||||
*/
|
|
||||||
private void getNextBatch() throws NamingException {
|
|
||||||
|
|
||||||
res = homeCtx.getSearchReply(enumClnt, res);
|
|
||||||
if (res == null) {
|
|
||||||
limit = posn = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
entries = res.entries;
|
|
||||||
limit = (entries == null) ? 0 : entries.size(); // handle empty set
|
|
||||||
posn = 0; // reset
|
|
||||||
|
|
||||||
// mimimize the number of calls to processReturnCode()
|
|
||||||
// (expensive when batchSize is small and there are many results)
|
|
||||||
if ((res.status != LdapClient.LDAP_SUCCESS) ||
|
|
||||||
((res.status == LdapClient.LDAP_SUCCESS) &&
|
|
||||||
(res.referrals != null))) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
// convert referrals into a chain of LdapReferralException
|
|
||||||
homeCtx.processReturnCode(res, listArg);
|
|
||||||
|
|
||||||
} catch (LimitExceededException e) {
|
|
||||||
setNamingException(e);
|
|
||||||
|
|
||||||
} catch (PartialResultException e) {
|
|
||||||
setNamingException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// merge any newly received referrals with any current referrals
|
|
||||||
if (res.refEx != null) {
|
|
||||||
if (refEx == null) {
|
|
||||||
refEx = res.refEx;
|
|
||||||
} else {
|
|
||||||
refEx = refEx.appendUnprocessedReferrals(res.refEx);
|
|
||||||
}
|
|
||||||
res.refEx = null; // reset
|
|
||||||
}
|
|
||||||
|
|
||||||
if (res.resControls != null) {
|
|
||||||
homeCtx.respCtls = res.resControls;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean more = true; // assume we have something to start with
|
|
||||||
private boolean hasMoreCalled = false;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Test if unprocessed entries or referrals exist.
|
|
||||||
*/
|
|
||||||
public boolean hasMore() throws NamingException {
|
|
||||||
|
|
||||||
if (hasMoreCalled) {
|
|
||||||
return more;
|
|
||||||
}
|
|
||||||
|
|
||||||
hasMoreCalled = true;
|
|
||||||
|
|
||||||
if (!more) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return (more = hasMoreImpl());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Retrieve the next entry.
|
|
||||||
*/
|
|
||||||
public Object next() throws NamingException {
|
|
||||||
|
|
||||||
if (!hasMoreCalled) {
|
|
||||||
hasMore();
|
|
||||||
}
|
|
||||||
hasMoreCalled = false;
|
|
||||||
return nextImpl();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Test if unprocessed entries or referrals exist.
|
|
||||||
*/
|
|
||||||
private boolean hasMoreImpl() throws NamingException {
|
|
||||||
// when page size is supported, this
|
|
||||||
// might generate an exception while attempting
|
|
||||||
// to fetch the next batch to determine
|
|
||||||
// whether there are any more elements
|
|
||||||
|
|
||||||
// test if the current set of entries has been processed
|
|
||||||
if (posn == limit) {
|
|
||||||
getNextBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// test if any unprocessed entries exist
|
|
||||||
if (posn < limit) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
try {
|
|
||||||
// try to process another referral
|
|
||||||
return hasMoreReferrals();
|
|
||||||
|
|
||||||
} catch (LdapReferralException e) {
|
|
||||||
cleanup();
|
|
||||||
throw e;
|
|
||||||
|
|
||||||
} catch (LimitExceededException e) {
|
|
||||||
cleanup();
|
|
||||||
throw e;
|
|
||||||
|
|
||||||
} catch (PartialResultException e) {
|
|
||||||
cleanup();
|
|
||||||
throw e;
|
|
||||||
|
|
||||||
} catch (NamingException e) {
|
|
||||||
cleanup();
|
|
||||||
PartialResultException pre = new PartialResultException();
|
|
||||||
pre.setRootCause(e);
|
|
||||||
throw pre;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Retrieve the next entry.
|
|
||||||
*/
|
|
||||||
private Object nextImpl() throws NamingException {
|
|
||||||
try {
|
|
||||||
return nextAux();
|
|
||||||
} catch (NamingException e) {
|
|
||||||
cleanup();
|
|
||||||
throw cont.fillInException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object nextAux() throws NamingException {
|
|
||||||
if (posn == limit) {
|
|
||||||
getNextBatch(); // updates posn and limit
|
|
||||||
}
|
|
||||||
|
|
||||||
if (posn >= limit) {
|
|
||||||
cleanup();
|
|
||||||
throw new NoSuchElementException("invalid enumeration handle");
|
|
||||||
}
|
|
||||||
|
|
||||||
LdapEntry result = (LdapEntry)entries.elementAt(posn++);
|
|
||||||
|
|
||||||
// gets and outputs DN from the entry
|
|
||||||
return createItem(result.DN, result.attributes, result.respCtls);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getAtom(String dn) {
|
|
||||||
String atom;
|
|
||||||
// need to strip off all but lowest component of dn
|
|
||||||
// so that is relative to current context (currentDN)
|
|
||||||
try {
|
|
||||||
Name parsed = new LdapName(dn);
|
|
||||||
return parsed.get(parsed.size() - 1);
|
|
||||||
} catch (NamingException e) {
|
|
||||||
return dn;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected NameClassPair createItem(String dn, Attributes attrs,
|
protected NameClassPair createItem(String dn, Attributes attrs,
|
||||||
Vector respCtls) throws NamingException {
|
Vector<Control> respCtls) throws NamingException {
|
||||||
|
|
||||||
Attribute attr;
|
Attribute attr;
|
||||||
String className = null;
|
String className = null;
|
||||||
@ -313,128 +71,10 @@ class LdapNamingEnumeration implements NamingEnumeration, ReferralEnumeration {
|
|||||||
return ncp;
|
return ncp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* Append the supplied (chain of) referrals onto the
|
protected LdapNamingEnumeration getReferredResults(
|
||||||
* end of the current (chain of) referrals.
|
LdapReferralContext refCtx) throws NamingException {
|
||||||
*/
|
|
||||||
public void appendUnprocessedReferrals(LdapReferralException ex) {
|
|
||||||
|
|
||||||
if (refEx != null) {
|
|
||||||
refEx = refEx.appendUnprocessedReferrals(ex);
|
|
||||||
} else {
|
|
||||||
refEx = ex.appendUnprocessedReferrals(refEx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setNamingException(NamingException e) {
|
|
||||||
errEx = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected LdapNamingEnumeration
|
|
||||||
getReferredResults(LdapReferralContext refCtx) throws NamingException {
|
|
||||||
// repeat the original operation at the new context
|
// repeat the original operation at the new context
|
||||||
return (LdapNamingEnumeration)refCtx.list(listArg);
|
return (LdapNamingEnumeration)refCtx.list(listArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Iterate through the URLs of a referral. If successful then perform
|
|
||||||
* a search operation and merge the received results with the current
|
|
||||||
* results.
|
|
||||||
*/
|
|
||||||
protected boolean hasMoreReferrals() throws NamingException {
|
|
||||||
|
|
||||||
if ((refEx != null) &&
|
|
||||||
(refEx.hasMoreReferrals() ||
|
|
||||||
refEx.hasMoreReferralExceptions())) {
|
|
||||||
|
|
||||||
if (homeCtx.handleReferrals == LdapClient.LDAP_REF_THROW) {
|
|
||||||
throw (NamingException)(refEx.fillInStackTrace());
|
|
||||||
}
|
|
||||||
|
|
||||||
// process the referrals sequentially
|
|
||||||
while (true) {
|
|
||||||
|
|
||||||
LdapReferralContext refCtx =
|
|
||||||
(LdapReferralContext)refEx.getReferralContext(
|
|
||||||
homeCtx.envprops, homeCtx.reqCtls);
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
update(getReferredResults(refCtx));
|
|
||||||
break;
|
|
||||||
|
|
||||||
} catch (LdapReferralException re) {
|
|
||||||
|
|
||||||
// record a previous exception
|
|
||||||
if (errEx == null) {
|
|
||||||
errEx = re.getNamingException();
|
|
||||||
}
|
|
||||||
refEx = re;
|
|
||||||
continue;
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
// Make sure we close referral context
|
|
||||||
refCtx.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hasMoreImpl();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
cleanup();
|
|
||||||
|
|
||||||
if (errEx != null) {
|
|
||||||
throw errEx;
|
|
||||||
}
|
|
||||||
return (false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Merge the entries and/or referrals from the supplied enumeration
|
|
||||||
* with those of the current enumeration.
|
|
||||||
*/
|
|
||||||
protected void update(LdapNamingEnumeration ne) {
|
|
||||||
// Cleanup previous context first
|
|
||||||
homeCtx.decEnumCount();
|
|
||||||
|
|
||||||
// New enum will have already incremented enum count and recorded clnt
|
|
||||||
homeCtx = ne.homeCtx;
|
|
||||||
enumClnt = ne.enumClnt;
|
|
||||||
|
|
||||||
// Do this to prevent referral enumeration (ne) from decrementing
|
|
||||||
// enum count because we'll be doing that here from this
|
|
||||||
// enumeration.
|
|
||||||
ne.homeCtx = null;
|
|
||||||
|
|
||||||
// Record rest of information from new enum
|
|
||||||
posn = ne.posn;
|
|
||||||
limit = ne.limit;
|
|
||||||
res = ne.res;
|
|
||||||
entries = ne.entries;
|
|
||||||
refEx = ne.refEx;
|
|
||||||
listArg = ne.listArg;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void finalize() {
|
|
||||||
cleanup();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void cleanup() {
|
|
||||||
if (cleaned) return; // been there; done that
|
|
||||||
|
|
||||||
if(enumClnt != null) {
|
|
||||||
enumClnt.clearSearchReply(res, homeCtx.reqCtls);
|
|
||||||
}
|
|
||||||
|
|
||||||
enumClnt = null;
|
|
||||||
cleaned = true;
|
|
||||||
if (homeCtx != null) {
|
|
||||||
homeCtx.decEnumCount();
|
|
||||||
homeCtx = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void close() {
|
|
||||||
cleanup();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,6 +28,7 @@ package com.sun.jndi.ldap;
|
|||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import javax.naming.ldap.Control;
|
import javax.naming.ldap.Control;
|
||||||
@ -133,7 +134,7 @@ public final class LdapPoolManager {
|
|||||||
String mech;
|
String mech;
|
||||||
int p;
|
int p;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
mech = parser.nextToken().toLowerCase();
|
mech = parser.nextToken().toLowerCase(Locale.ENGLISH);
|
||||||
if (mech.equals("anonymous")) {
|
if (mech.equals("anonymous")) {
|
||||||
mech = "none";
|
mech = "none";
|
||||||
}
|
}
|
||||||
@ -214,7 +215,7 @@ public final class LdapPoolManager {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static boolean isPoolingAllowed(String socketFactory, OutputStream trace,
|
static boolean isPoolingAllowed(String socketFactory, OutputStream trace,
|
||||||
String authMech, String protocol, Hashtable env)
|
String authMech, String protocol, Hashtable<?,?> env)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
if (trace != null && !debug
|
if (trace != null && !debug
|
||||||
@ -235,7 +236,7 @@ public final class LdapPoolManager {
|
|||||||
if ((socketFactory != null) &&
|
if ((socketFactory != null) &&
|
||||||
!socketFactory.equals(LdapCtx.DEFAULT_SSL_FACTORY)) {
|
!socketFactory.equals(LdapCtx.DEFAULT_SSL_FACTORY)) {
|
||||||
try {
|
try {
|
||||||
Class socketFactoryClass = Obj.helper.loadClass(socketFactory);
|
Class<?> socketFactoryClass = Obj.helper.loadClass(socketFactory);
|
||||||
Class[] interfaces = socketFactoryClass.getInterfaces();
|
Class[] interfaces = socketFactoryClass.getInterfaces();
|
||||||
for (int i = 0; i < interfaces.length; i++) {
|
for (int i = 0; i < interfaces.length; i++) {
|
||||||
if (interfaces[i].getCanonicalName().equals(COMPARATOR)) {
|
if (interfaces[i].getCanonicalName().equals(COMPARATOR)) {
|
||||||
@ -294,7 +295,7 @@ public final class LdapPoolManager {
|
|||||||
static LdapClient getLdapClient(String host, int port, String socketFactory,
|
static LdapClient getLdapClient(String host, int port, String socketFactory,
|
||||||
int connTimeout, int readTimeout, OutputStream trace, int version,
|
int connTimeout, int readTimeout, OutputStream trace, int version,
|
||||||
String authMech, Control[] ctls, String protocol, String user,
|
String authMech, Control[] ctls, String protocol, String user,
|
||||||
Object passwd, Hashtable env) throws NamingException {
|
Object passwd, Hashtable<?,?> env) throws NamingException {
|
||||||
|
|
||||||
// Create base identity for LdapClient
|
// Create base identity for LdapClient
|
||||||
ClientId id = null;
|
ClientId id = null;
|
||||||
@ -385,9 +386,9 @@ public final class LdapPoolManager {
|
|||||||
|
|
||||||
private static final String getProperty(final String propName,
|
private static final String getProperty(final String propName,
|
||||||
final String defVal) {
|
final String defVal) {
|
||||||
return (String) AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedAction() {
|
new PrivilegedAction<String>() {
|
||||||
public Object run() {
|
public String run() {
|
||||||
try {
|
try {
|
||||||
return System.getProperty(propName, defVal);
|
return System.getProperty(propName, defVal);
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
@ -399,9 +400,9 @@ public final class LdapPoolManager {
|
|||||||
|
|
||||||
private static final int getInteger(final String propName,
|
private static final int getInteger(final String propName,
|
||||||
final int defVal) {
|
final int defVal) {
|
||||||
Integer val = (Integer) AccessController.doPrivileged(
|
Integer val = AccessController.doPrivileged(
|
||||||
new PrivilegedAction() {
|
new PrivilegedAction<Integer>() {
|
||||||
public Object run() {
|
public Integer run() {
|
||||||
try {
|
try {
|
||||||
return Integer.getInteger(propName, defVal);
|
return Integer.getInteger(propName, defVal);
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
@ -414,9 +415,9 @@ public final class LdapPoolManager {
|
|||||||
|
|
||||||
private static final long getLong(final String propName,
|
private static final long getLong(final String propName,
|
||||||
final long defVal) {
|
final long defVal) {
|
||||||
Long val = (Long) AccessController.doPrivileged(
|
Long val = AccessController.doPrivileged(
|
||||||
new PrivilegedAction() {
|
new PrivilegedAction<Long>() {
|
||||||
public Object run() {
|
public Long run() {
|
||||||
try {
|
try {
|
||||||
return Long.getLong(propName, defVal);
|
return Long.getLong(propName, defVal);
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -52,7 +52,9 @@ final class LdapReferralContext implements DirContext, LdapContext {
|
|||||||
private int hopCount = 1;
|
private int hopCount = 1;
|
||||||
private NamingException previousEx = null;
|
private NamingException previousEx = null;
|
||||||
|
|
||||||
LdapReferralContext(LdapReferralException ex, Hashtable env,
|
@SuppressWarnings("unchecked") // clone()
|
||||||
|
LdapReferralContext(LdapReferralException ex,
|
||||||
|
Hashtable<?,?> env,
|
||||||
Control[] connCtls,
|
Control[] connCtls,
|
||||||
Control[] reqCtls,
|
Control[] reqCtls,
|
||||||
String nextName,
|
String nextName,
|
||||||
@ -69,20 +71,21 @@ final class LdapReferralContext implements DirContext, LdapContext {
|
|||||||
|
|
||||||
// Make copies of environment and connect controls for our own use.
|
// Make copies of environment and connect controls for our own use.
|
||||||
if (env != null) {
|
if (env != null) {
|
||||||
env = (Hashtable) env.clone();
|
env = (Hashtable<?,?>) env.clone();
|
||||||
// Remove old connect controls from environment, unless we have new
|
// Remove old connect controls from environment, unless we have new
|
||||||
// ones that will override them anyway.
|
// ones that will override them anyway.
|
||||||
if (connCtls == null) {
|
if (connCtls == null) {
|
||||||
env.remove(LdapCtx.BIND_CONTROLS);
|
env.remove(LdapCtx.BIND_CONTROLS);
|
||||||
}
|
}
|
||||||
} else if (connCtls != null) {
|
} else if (connCtls != null) {
|
||||||
env = new Hashtable(5);
|
env = new Hashtable<String, Control[]>(5);
|
||||||
}
|
}
|
||||||
if (connCtls != null) {
|
if (connCtls != null) {
|
||||||
Control[] copiedCtls = new Control[connCtls.length];
|
Control[] copiedCtls = new Control[connCtls.length];
|
||||||
System.arraycopy(connCtls, 0, copiedCtls, 0, connCtls.length);
|
System.arraycopy(connCtls, 0, copiedCtls, 0, connCtls.length);
|
||||||
// Add copied controls to environment, replacing any old ones.
|
// Add copied controls to environment, replacing any old ones.
|
||||||
env.put(LdapCtx.BIND_CONTROLS, copiedCtls);
|
((Hashtable<? super String, ? super Control[]>)env)
|
||||||
|
.put(LdapCtx.BIND_CONTROLS, copiedCtls);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -260,24 +263,26 @@ final class LdapReferralContext implements DirContext, LdapContext {
|
|||||||
refCtx.rename(overrideName(oldName), toName(refEx.getNewRdn()));
|
refCtx.rename(overrideName(oldName), toName(refEx.getNewRdn()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration list(String name) throws NamingException {
|
public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
|
||||||
return list(toName(name));
|
return list(toName(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration list(Name name) throws NamingException {
|
@SuppressWarnings("unchecked")
|
||||||
|
public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
|
||||||
if (skipThisReferral) {
|
if (skipThisReferral) {
|
||||||
throw (NamingException)
|
throw (NamingException)
|
||||||
((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
|
((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
NamingEnumeration ne = null;
|
NamingEnumeration<NameClassPair> ne = null;
|
||||||
|
|
||||||
if (urlScope != null && urlScope.equals("base")) {
|
if (urlScope != null && urlScope.equals("base")) {
|
||||||
SearchControls cons = new SearchControls();
|
SearchControls cons = new SearchControls();
|
||||||
cons.setReturningObjFlag(true);
|
cons.setReturningObjFlag(true);
|
||||||
cons.setSearchScope(SearchControls.OBJECT_SCOPE);
|
cons.setSearchScope(SearchControls.OBJECT_SCOPE);
|
||||||
|
|
||||||
ne = refCtx.search(overrideName(name), "(objectclass=*)", cons);
|
ne = (NamingEnumeration)
|
||||||
|
refCtx.search(overrideName(name), "(objectclass=*)", cons);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ne = refCtx.list(overrideName(name));
|
ne = refCtx.list(overrideName(name));
|
||||||
@ -318,25 +323,29 @@ final class LdapReferralContext implements DirContext, LdapContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration listBindings(String name) throws NamingException {
|
public NamingEnumeration<Binding> listBindings(String name) throws
|
||||||
|
NamingException {
|
||||||
return listBindings(toName(name));
|
return listBindings(toName(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration listBindings(Name name) throws NamingException {
|
@SuppressWarnings("unchecked")
|
||||||
|
public NamingEnumeration<Binding> listBindings(Name name) throws
|
||||||
|
NamingException {
|
||||||
if (skipThisReferral) {
|
if (skipThisReferral) {
|
||||||
throw (NamingException)
|
throw (NamingException)
|
||||||
((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
|
((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
NamingEnumeration be = null;
|
NamingEnumeration<Binding> be = null;
|
||||||
|
|
||||||
if (urlScope != null && urlScope.equals("base")) {
|
if (urlScope != null && urlScope.equals("base")) {
|
||||||
SearchControls cons = new SearchControls();
|
SearchControls cons = new SearchControls();
|
||||||
cons.setReturningObjFlag(true);
|
cons.setReturningObjFlag(true);
|
||||||
cons.setSearchScope(SearchControls.OBJECT_SCOPE);
|
cons.setSearchScope(SearchControls.OBJECT_SCOPE);
|
||||||
|
|
||||||
be = refCtx.search(overrideName(name), "(objectclass=*)", cons);
|
be = (NamingEnumeration)refCtx.search(overrideName(name),
|
||||||
|
"(objectclass=*)", cons);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
be = refCtx.listBindings(overrideName(name));
|
be = refCtx.listBindings(overrideName(name));
|
||||||
@ -347,7 +356,7 @@ final class LdapReferralContext implements DirContext, LdapContext {
|
|||||||
// append (referrals from) the exception that generated this
|
// append (referrals from) the exception that generated this
|
||||||
// context to the new search results, so that referral processing
|
// context to the new search results, so that referral processing
|
||||||
// can continue
|
// can continue
|
||||||
((ReferralEnumeration)be).appendUnprocessedReferrals(refEx);
|
((ReferralEnumeration<Binding>)be).appendUnprocessedReferrals(refEx);
|
||||||
|
|
||||||
return (be);
|
return (be);
|
||||||
|
|
||||||
@ -462,7 +471,7 @@ final class LdapReferralContext implements DirContext, LdapContext {
|
|||||||
return refCtx.removeFromEnvironment(propName);
|
return refCtx.removeFromEnvironment(propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hashtable getEnvironment() throws NamingException {
|
public Hashtable<?,?> getEnvironment() throws NamingException {
|
||||||
if (skipThisReferral) {
|
if (skipThisReferral) {
|
||||||
throw (NamingException)
|
throw (NamingException)
|
||||||
((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
|
((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
|
||||||
@ -602,23 +611,23 @@ final class LdapReferralContext implements DirContext, LdapContext {
|
|||||||
return refCtx.getSchemaClassDefinition(overrideName(name));
|
return refCtx.getSchemaClassDefinition(overrideName(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration search(String name,
|
public NamingEnumeration<SearchResult> search(String name,
|
||||||
Attributes matchingAttributes)
|
Attributes matchingAttributes)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
return search(toName(name), SearchFilter.format(matchingAttributes),
|
return search(toName(name), SearchFilter.format(matchingAttributes),
|
||||||
new SearchControls());
|
new SearchControls());
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration search(Name name,
|
public NamingEnumeration<SearchResult> search(Name name,
|
||||||
Attributes matchingAttributes)
|
Attributes matchingAttributes)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
return search(name, SearchFilter.format(matchingAttributes),
|
return search(name, SearchFilter.format(matchingAttributes),
|
||||||
new SearchControls());
|
new SearchControls());
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration search(String name,
|
public NamingEnumeration<SearchResult> search(String name,
|
||||||
Attributes matchingAttributes,
|
Attributes matchingAttributes,
|
||||||
String[] attributesToReturn)
|
String[] attributesToReturn)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
SearchControls cons = new SearchControls();
|
SearchControls cons = new SearchControls();
|
||||||
cons.setReturningAttributes(attributesToReturn);
|
cons.setReturningAttributes(attributesToReturn);
|
||||||
@ -627,9 +636,9 @@ final class LdapReferralContext implements DirContext, LdapContext {
|
|||||||
cons);
|
cons);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration search(Name name,
|
public NamingEnumeration<SearchResult> search(Name name,
|
||||||
Attributes matchingAttributes,
|
Attributes matchingAttributes,
|
||||||
String[] attributesToReturn)
|
String[] attributesToReturn)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
SearchControls cons = new SearchControls();
|
SearchControls cons = new SearchControls();
|
||||||
cons.setReturningAttributes(attributesToReturn);
|
cons.setReturningAttributes(attributesToReturn);
|
||||||
@ -637,15 +646,15 @@ final class LdapReferralContext implements DirContext, LdapContext {
|
|||||||
return search(name, SearchFilter.format(matchingAttributes), cons);
|
return search(name, SearchFilter.format(matchingAttributes), cons);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration search(String name,
|
public NamingEnumeration<SearchResult> search(String name,
|
||||||
String filter,
|
String filter,
|
||||||
SearchControls cons)
|
SearchControls cons)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
return search(toName(name), filter, cons);
|
return search(toName(name), filter, cons);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration search(Name name,
|
public NamingEnumeration<SearchResult> search(Name name,
|
||||||
String filter,
|
String filter,
|
||||||
SearchControls cons) throws NamingException {
|
SearchControls cons) throws NamingException {
|
||||||
|
|
||||||
if (skipThisReferral) {
|
if (skipThisReferral) {
|
||||||
@ -654,8 +663,10 @@ final class LdapReferralContext implements DirContext, LdapContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
NamingEnumeration se = refCtx.search(overrideName(name),
|
NamingEnumeration<SearchResult> se =
|
||||||
overrideFilter(filter), overrideAttributesAndScope(cons));
|
refCtx.search(overrideName(name),
|
||||||
|
overrideFilter(filter),
|
||||||
|
overrideAttributesAndScope(cons));
|
||||||
|
|
||||||
refEx.setNameResolved(true);
|
refEx.setNameResolved(true);
|
||||||
|
|
||||||
@ -694,15 +705,15 @@ final class LdapReferralContext implements DirContext, LdapContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration search(String name,
|
public NamingEnumeration<SearchResult> search(String name,
|
||||||
String filterExpr,
|
String filterExpr,
|
||||||
Object[] filterArgs,
|
Object[] filterArgs,
|
||||||
SearchControls cons)
|
SearchControls cons)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
return search(toName(name), filterExpr, filterArgs, cons);
|
return search(toName(name), filterExpr, filterArgs, cons);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamingEnumeration search(Name name,
|
public NamingEnumeration<SearchResult> search(Name name,
|
||||||
String filterExpr,
|
String filterExpr,
|
||||||
Object[] filterArgs,
|
Object[] filterArgs,
|
||||||
SearchControls cons) throws NamingException {
|
SearchControls cons) throws NamingException {
|
||||||
@ -713,7 +724,7 @@ final class LdapReferralContext implements DirContext, LdapContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
NamingEnumeration se;
|
NamingEnumeration<SearchResult> se;
|
||||||
|
|
||||||
if (urlFilter != null) {
|
if (urlFilter != null) {
|
||||||
se = refCtx.search(overrideName(name), urlFilter,
|
se = refCtx.search(overrideName(name), urlFilter,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,7 +26,6 @@
|
|||||||
package com.sun.jndi.ldap;
|
package com.sun.jndi.ldap;
|
||||||
|
|
||||||
import javax.naming.*;
|
import javax.naming.*;
|
||||||
import javax.naming.spi.*;
|
|
||||||
import javax.naming.ldap.Control;
|
import javax.naming.ldap.Control;
|
||||||
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
@ -67,15 +66,16 @@ import java.util.Vector;
|
|||||||
*/
|
*/
|
||||||
final public class LdapReferralException extends
|
final public class LdapReferralException extends
|
||||||
javax.naming.ldap.LdapReferralException {
|
javax.naming.ldap.LdapReferralException {
|
||||||
|
private static final long serialVersionUID = 627059076356906399L;
|
||||||
|
|
||||||
// ----------- fields initialized in constructor ---------------
|
// ----------- fields initialized in constructor ---------------
|
||||||
private int handleReferrals;
|
private int handleReferrals;
|
||||||
private Hashtable envprops;
|
private Hashtable<?,?> envprops;
|
||||||
private String nextName;
|
private String nextName;
|
||||||
private Control[] reqCtls;
|
private Control[] reqCtls;
|
||||||
|
|
||||||
// ----------- fields that have defaults -----------------------
|
// ----------- fields that have defaults -----------------------
|
||||||
private Vector referrals = null; // alternatives,set by setReferralInfo()
|
private Vector<?> referrals = null; // alternatives,set by setReferralInfo()
|
||||||
private int referralIndex = 0; // index into referrals
|
private int referralIndex = 0; // index into referrals
|
||||||
private int referralCount = 0; // count of referrals
|
private int referralCount = 0; // count of referrals
|
||||||
private boolean foundEntry = false; // will stop when entry is found
|
private boolean foundEntry = false; // will stop when entry is found
|
||||||
@ -98,7 +98,7 @@ final public class LdapReferralException extends
|
|||||||
Object resolvedObj,
|
Object resolvedObj,
|
||||||
Name remainingName,
|
Name remainingName,
|
||||||
String explanation,
|
String explanation,
|
||||||
Hashtable envprops,
|
Hashtable<?,?> envprops,
|
||||||
String nextName,
|
String nextName,
|
||||||
int handleReferrals,
|
int handleReferrals,
|
||||||
Control[] reqCtls) {
|
Control[] reqCtls) {
|
||||||
@ -210,7 +210,7 @@ final public class LdapReferralException extends
|
|||||||
/**
|
/**
|
||||||
* Sets referral information.
|
* Sets referral information.
|
||||||
*/
|
*/
|
||||||
void setReferralInfo(Vector referrals, boolean continuationRef) {
|
void setReferralInfo(Vector<?> referrals, boolean continuationRef) {
|
||||||
// %%% continuationRef is currently ignored
|
// %%% continuationRef is currently ignored
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,6 +28,7 @@ package com.sun.jndi.ldap;
|
|||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import javax.naming.directory.Attributes;
|
import javax.naming.directory.Attributes;
|
||||||
import javax.naming.directory.BasicAttributes;
|
import javax.naming.directory.BasicAttributes;
|
||||||
|
import javax.naming.ldap.Control;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* %%% public for use by LdapSasl %%%
|
* %%% public for use by LdapSasl %%%
|
||||||
@ -37,10 +38,11 @@ public final class LdapResult {
|
|||||||
public int status; // %%% public for use by LdapSasl
|
public int status; // %%% public for use by LdapSasl
|
||||||
String matchedDN;
|
String matchedDN;
|
||||||
String errorMessage;
|
String errorMessage;
|
||||||
Vector referrals = null;
|
// Vector<String | Vector<String>>
|
||||||
|
Vector<Vector<String>> referrals = null;
|
||||||
LdapReferralException refEx = null;
|
LdapReferralException refEx = null;
|
||||||
Vector entries = null;
|
Vector<LdapEntry> entries = null;
|
||||||
Vector resControls = null;
|
Vector<Control> resControls = null;
|
||||||
public byte[] serverCreds = null; // %%% public for use by LdapSasl
|
public byte[] serverCreds = null; // %%% public for use by LdapSasl
|
||||||
String extensionId = null; // string OID
|
String extensionId = null; // string OID
|
||||||
byte[] extensionValue = null; // BER OCTET STRING
|
byte[] extensionValue = null; // BER OCTET STRING
|
||||||
@ -57,7 +59,7 @@ public final class LdapResult {
|
|||||||
switch (status) {
|
switch (status) {
|
||||||
case LdapClient.LDAP_COMPARE_TRUE:
|
case LdapClient.LDAP_COMPARE_TRUE:
|
||||||
status = LdapClient.LDAP_SUCCESS;
|
status = LdapClient.LDAP_SUCCESS;
|
||||||
entries = new Vector(1,1);
|
entries = new Vector<>(1,1);
|
||||||
Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
|
Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
|
||||||
LdapEntry entry = new LdapEntry( name, attrs );
|
LdapEntry entry = new LdapEntry( name, attrs );
|
||||||
entries.addElement(entry);
|
entries.addElement(entry);
|
||||||
@ -66,7 +68,7 @@ public final class LdapResult {
|
|||||||
|
|
||||||
case LdapClient.LDAP_COMPARE_FALSE:
|
case LdapClient.LDAP_COMPARE_FALSE:
|
||||||
status = LdapClient.LDAP_SUCCESS;
|
status = LdapClient.LDAP_SUCCESS;
|
||||||
entries = new Vector(0);
|
entries = new Vector<>(0);
|
||||||
successful = true;
|
successful = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -61,8 +61,9 @@ final class LdapSchemaCtx extends HierMemDirCtx {
|
|||||||
|
|
||||||
private int objectType;
|
private int objectType;
|
||||||
|
|
||||||
static DirContext createSchemaTree(Hashtable env, String subschemasubentry,
|
static DirContext createSchemaTree(Hashtable<String,Object> env,
|
||||||
LdapCtx schemaEntry, Attributes schemaAttrs, boolean netscapeBug)
|
String subschemasubentry, LdapCtx schemaEntry,
|
||||||
|
Attributes schemaAttrs, boolean netscapeBug)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
try {
|
try {
|
||||||
LdapSchemaParser parser = new LdapSchemaParser(netscapeBug);
|
LdapSchemaParser parser = new LdapSchemaParser(netscapeBug);
|
||||||
@ -71,7 +72,7 @@ final class LdapSchemaCtx extends HierMemDirCtx {
|
|||||||
schemaEntry, parser);
|
schemaEntry, parser);
|
||||||
|
|
||||||
LdapSchemaCtx root = new LdapSchemaCtx(SCHEMA_ROOT, env, allinfo);
|
LdapSchemaCtx root = new LdapSchemaCtx(SCHEMA_ROOT, env, allinfo);
|
||||||
parser.LDAP2JNDISchema(schemaAttrs, root);
|
LdapSchemaParser.LDAP2JNDISchema(schemaAttrs, root);
|
||||||
return root;
|
return root;
|
||||||
} catch (NamingException e) {
|
} catch (NamingException e) {
|
||||||
schemaEntry.close(); // cleanup
|
schemaEntry.close(); // cleanup
|
||||||
@ -80,7 +81,8 @@ final class LdapSchemaCtx extends HierMemDirCtx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Called by createNewCtx
|
// Called by createNewCtx
|
||||||
private LdapSchemaCtx(int objectType, Hashtable environment, SchemaInfo info) {
|
private LdapSchemaCtx(int objectType, Hashtable<String,Object> environment,
|
||||||
|
SchemaInfo info) {
|
||||||
super(environment, LdapClient.caseIgnore);
|
super(environment, LdapClient.caseIgnore);
|
||||||
|
|
||||||
this.objectType = objectType;
|
this.objectType = objectType;
|
||||||
@ -223,9 +225,9 @@ final class LdapSchemaCtx extends HierMemDirCtx {
|
|||||||
final private static Attributes deepClone(Attributes orig)
|
final private static Attributes deepClone(Attributes orig)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
BasicAttributes copy = new BasicAttributes(true);
|
BasicAttributes copy = new BasicAttributes(true);
|
||||||
NamingEnumeration attrs = orig.getAll();
|
NamingEnumeration<? extends Attribute> attrs = orig.getAll();
|
||||||
while (attrs.hasMore()) {
|
while (attrs.hasMore()) {
|
||||||
copy.put((Attribute)((Attribute)attrs.next()).clone());
|
copy.put((Attribute)attrs.next().clone());
|
||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
@ -409,13 +411,14 @@ final class LdapSchemaCtx extends HierMemDirCtx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private LdapCtx reopenEntry(Hashtable env) throws NamingException {
|
private LdapCtx reopenEntry(Hashtable<?,?> env) throws NamingException {
|
||||||
// Use subschemasubentry name as DN
|
// Use subschemasubentry name as DN
|
||||||
return new LdapCtx(schemaEntryName, host, port,
|
return new LdapCtx(schemaEntryName, host, port,
|
||||||
env, hasLdapsScheme);
|
env, hasLdapsScheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized void modifyAttributes(Hashtable env, ModificationItem[] mods)
|
synchronized void modifyAttributes(Hashtable<?,?> env,
|
||||||
|
ModificationItem[] mods)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
if (schemaEntry == null) {
|
if (schemaEntry == null) {
|
||||||
schemaEntry = reopenEntry(env);
|
schemaEntry = reopenEntry(env);
|
||||||
@ -423,7 +426,7 @@ final class LdapSchemaCtx extends HierMemDirCtx {
|
|||||||
schemaEntry.modifyAttributes("", mods);
|
schemaEntry.modifyAttributes("", mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized void modifyAttributes(Hashtable env, int mod,
|
synchronized void modifyAttributes(Hashtable<?,?> env, int mod,
|
||||||
Attributes attrs) throws NamingException {
|
Attributes attrs) throws NamingException {
|
||||||
if (schemaEntry == null) {
|
if (schemaEntry == null) {
|
||||||
schemaEntry = reopenEntry(env);
|
schemaEntry = reopenEntry(env);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,7 +27,6 @@ package com.sun.jndi.ldap;
|
|||||||
|
|
||||||
import javax.naming.*;
|
import javax.naming.*;
|
||||||
import javax.naming.directory.*;
|
import javax.naming.directory.*;
|
||||||
import java.util.Hashtable;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,9 +140,9 @@ final class LdapSchemaParser {
|
|||||||
LdapSchemaCtx schemaRoot)
|
LdapSchemaCtx schemaRoot)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
NamingEnumeration objDescs;
|
NamingEnumeration<?> objDescs;
|
||||||
Attributes objDef;
|
Attributes objDef;
|
||||||
LdapSchemaCtx classDefTree;
|
LdapSchemaCtx classDefTree;
|
||||||
|
|
||||||
// create the class def subtree
|
// create the class def subtree
|
||||||
Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
|
Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
|
||||||
@ -173,9 +172,9 @@ final class LdapSchemaParser {
|
|||||||
LdapSchemaCtx schemaRoot)
|
LdapSchemaCtx schemaRoot)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
NamingEnumeration attrDescs;
|
NamingEnumeration<?> attrDescs;
|
||||||
Attributes attrDef;
|
Attributes attrDef;
|
||||||
LdapSchemaCtx attrDefTree;
|
LdapSchemaCtx attrDefTree;
|
||||||
|
|
||||||
// create the AttributeDef subtree
|
// create the AttributeDef subtree
|
||||||
Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
|
Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
|
||||||
@ -206,9 +205,9 @@ final class LdapSchemaParser {
|
|||||||
LdapSchemaCtx schemaRoot)
|
LdapSchemaCtx schemaRoot)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
NamingEnumeration syntaxDescs;
|
NamingEnumeration<?> syntaxDescs;
|
||||||
Attributes syntaxDef;
|
Attributes syntaxDef;
|
||||||
LdapSchemaCtx syntaxDefTree;
|
LdapSchemaCtx syntaxDefTree;
|
||||||
|
|
||||||
// create the SyntaxDef subtree
|
// create the SyntaxDef subtree
|
||||||
Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
|
Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
|
||||||
@ -239,9 +238,9 @@ final class LdapSchemaParser {
|
|||||||
LdapSchemaCtx schemaRoot)
|
LdapSchemaCtx schemaRoot)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
NamingEnumeration matchRuleDescs;
|
NamingEnumeration<?> matchRuleDescs;
|
||||||
Attributes matchRuleDef;
|
Attributes matchRuleDef;
|
||||||
LdapSchemaCtx matchRuleDefTree;
|
LdapSchemaCtx matchRuleDefTree;
|
||||||
|
|
||||||
// create the MatchRuleDef subtree
|
// create the MatchRuleDef subtree
|
||||||
Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
|
Attributes attrs = new BasicAttributes(LdapClient.caseIgnore);
|
||||||
@ -519,8 +518,8 @@ final class LdapSchemaParser {
|
|||||||
final private static String[] readQDescrList(String string, int[] pos)
|
final private static String[] readQDescrList(String string, int[] pos)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
int begin, end;
|
int begin, end;
|
||||||
Vector values = new Vector(5);
|
Vector<String> values = new Vector<>(5);
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
System.err.println("ReadQDescrList: pos="+pos[0]);
|
System.err.println("ReadQDescrList: pos="+pos[0]);
|
||||||
@ -553,7 +552,7 @@ final class LdapSchemaParser {
|
|||||||
|
|
||||||
String[] answer = new String[values.size()];
|
String[] answer = new String[values.size()];
|
||||||
for (int i = 0; i < answer.length; i++) {
|
for (int i = 0; i < answer.length; i++) {
|
||||||
answer[i] = (String)values.elementAt(i);
|
answer[i] = values.elementAt(i);
|
||||||
}
|
}
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
@ -614,7 +613,7 @@ final class LdapSchemaParser {
|
|||||||
|
|
||||||
int begin, cur, end;
|
int begin, cur, end;
|
||||||
String oidName = null;
|
String oidName = null;
|
||||||
Vector values = new Vector(5);
|
Vector<String> values = new Vector<>(5);
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
System.err.println("ReadOIDList: pos="+pos[0]);
|
System.err.println("ReadOIDList: pos="+pos[0]);
|
||||||
@ -663,7 +662,7 @@ final class LdapSchemaParser {
|
|||||||
|
|
||||||
String[] answer = new String[values.size()];
|
String[] answer = new String[values.size()];
|
||||||
for (int i = 0; i < answer.length; i++) {
|
for (int i = 0; i < answer.length; i++) {
|
||||||
answer[i] = (String)values.elementAt(i);
|
answer[i] = values.elementAt(i);
|
||||||
}
|
}
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
@ -843,10 +842,10 @@ final class LdapSchemaParser {
|
|||||||
String attrId = null;
|
String attrId = null;
|
||||||
|
|
||||||
// use enumeration because attribute ID is not known
|
// use enumeration because attribute ID is not known
|
||||||
for (NamingEnumeration ae = attrs.getAll();
|
for (NamingEnumeration<? extends Attribute> ae = attrs.getAll();
|
||||||
ae.hasMoreElements(); ) {
|
ae.hasMoreElements(); ) {
|
||||||
|
|
||||||
attr = (Attribute)ae.next();
|
attr = ae.next();
|
||||||
attrId = attr.getID();
|
attrId = attr.getID();
|
||||||
|
|
||||||
// skip those already processed
|
// skip those already processed
|
||||||
@ -973,10 +972,10 @@ final class LdapSchemaParser {
|
|||||||
String attrId = null;
|
String attrId = null;
|
||||||
|
|
||||||
// use enumeration because attribute ID is not known
|
// use enumeration because attribute ID is not known
|
||||||
for (NamingEnumeration ae = attrs.getAll();
|
for (NamingEnumeration<? extends Attribute> ae = attrs.getAll();
|
||||||
ae.hasMoreElements(); ) {
|
ae.hasMoreElements(); ) {
|
||||||
|
|
||||||
attr = (Attribute)ae.next();
|
attr = ae.next();
|
||||||
attrId = attr.getID();
|
attrId = attr.getID();
|
||||||
|
|
||||||
// skip those already processed
|
// skip those already processed
|
||||||
@ -1040,10 +1039,10 @@ final class LdapSchemaParser {
|
|||||||
String attrId = null;
|
String attrId = null;
|
||||||
|
|
||||||
// use enumeration because attribute ID is not known
|
// use enumeration because attribute ID is not known
|
||||||
for (NamingEnumeration ae = attrs.getAll();
|
for (NamingEnumeration<? extends Attribute> ae = attrs.getAll();
|
||||||
ae.hasMoreElements(); ) {
|
ae.hasMoreElements(); ) {
|
||||||
|
|
||||||
attr = (Attribute)ae.next();
|
attr = ae.next();
|
||||||
attrId = attr.getID();
|
attrId = attr.getID();
|
||||||
|
|
||||||
// skip those already processed
|
// skip those already processed
|
||||||
@ -1117,10 +1116,10 @@ final class LdapSchemaParser {
|
|||||||
String attrId = null;
|
String attrId = null;
|
||||||
|
|
||||||
// use enumeration because attribute ID is not known
|
// use enumeration because attribute ID is not known
|
||||||
for (NamingEnumeration ae = attrs.getAll();
|
for (NamingEnumeration<? extends Attribute> ae = attrs.getAll();
|
||||||
ae.hasMoreElements(); ) {
|
ae.hasMoreElements(); ) {
|
||||||
|
|
||||||
attr = (Attribute)ae.next();
|
attr = ae.next();
|
||||||
attrId = attr.getID();
|
attrId = attr.getID();
|
||||||
|
|
||||||
// skip those already processed
|
// skip those already processed
|
||||||
@ -1201,7 +1200,7 @@ final class LdapSchemaParser {
|
|||||||
qdList.append(WHSP);
|
qdList.append(WHSP);
|
||||||
qdList.append(OID_LIST_BEGIN);
|
qdList.append(OID_LIST_BEGIN);
|
||||||
|
|
||||||
NamingEnumeration values = attr.getAll();
|
NamingEnumeration<?> values = attr.getAll();
|
||||||
|
|
||||||
while(values.hasMore()) {
|
while(values.hasMore()) {
|
||||||
qdList.append(WHSP);
|
qdList.append(WHSP);
|
||||||
@ -1238,7 +1237,7 @@ final class LdapSchemaParser {
|
|||||||
oidList.append(WHSP);
|
oidList.append(WHSP);
|
||||||
oidList.append(OID_LIST_BEGIN);
|
oidList.append(OID_LIST_BEGIN);
|
||||||
|
|
||||||
NamingEnumeration values = oidsAttr.getAll();
|
NamingEnumeration<?> values = oidsAttr.getAll();
|
||||||
oidList.append(WHSP);
|
oidList.append(WHSP);
|
||||||
oidList.append(values.next());
|
oidList.append(values.next());
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -34,7 +34,8 @@ import javax.naming.ldap.LdapName;
|
|||||||
|
|
||||||
import com.sun.jndi.toolkit.ctx.Continuation;
|
import com.sun.jndi.toolkit.ctx.Continuation;
|
||||||
|
|
||||||
final class LdapSearchEnumeration extends LdapNamingEnumeration {
|
final class LdapSearchEnumeration
|
||||||
|
extends AbstractLdapNamingEnumeration<SearchResult> {
|
||||||
|
|
||||||
private Name startName; // prefix of names of search results
|
private Name startName; // prefix of names of search results
|
||||||
private LdapCtx.SearchArgs searchArgs = null;
|
private LdapCtx.SearchArgs searchArgs = null;
|
||||||
@ -52,9 +53,10 @@ final class LdapSearchEnumeration extends LdapNamingEnumeration {
|
|||||||
searchArgs = args;
|
searchArgs = args;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected NameClassPair
|
@Override
|
||||||
createItem(String dn, Attributes attrs, Vector respCtls)
|
protected SearchResult createItem(String dn, Attributes attrs,
|
||||||
throws NamingException {
|
Vector<Control> respCtls)
|
||||||
|
throws NamingException {
|
||||||
|
|
||||||
Object obj = null;
|
Object obj = null;
|
||||||
|
|
||||||
@ -174,6 +176,7 @@ final class LdapSearchEnumeration extends LdapNamingEnumeration {
|
|||||||
return sr;
|
return sr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void appendUnprocessedReferrals(LdapReferralException ex) {
|
public void appendUnprocessedReferrals(LdapReferralException ex) {
|
||||||
|
|
||||||
// a referral has been followed so do not create relative names
|
// a referral has been followed so do not create relative names
|
||||||
@ -181,14 +184,16 @@ final class LdapSearchEnumeration extends LdapNamingEnumeration {
|
|||||||
super.appendUnprocessedReferrals(ex);
|
super.appendUnprocessedReferrals(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LdapNamingEnumeration
|
@Override
|
||||||
getReferredResults(LdapReferralContext refCtx) throws NamingException {
|
protected LdapSearchEnumeration getReferredResults(
|
||||||
|
LdapReferralContext refCtx) throws NamingException {
|
||||||
// repeat the original operation at the new context
|
// repeat the original operation at the new context
|
||||||
return (LdapSearchEnumeration)
|
return (LdapSearchEnumeration)refCtx.search(
|
||||||
refCtx.search(searchArgs.name, searchArgs.filter, searchArgs.cons);
|
searchArgs.name, searchArgs.filter, searchArgs.cons);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void update(LdapNamingEnumeration ne) {
|
@Override
|
||||||
|
protected void update(AbstractLdapNamingEnumeration<SearchResult> ne) {
|
||||||
super.update(ne);
|
super.update(ne);
|
||||||
|
|
||||||
// Update search-specific variables
|
// Update search-specific variables
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -50,12 +50,12 @@ import com.sun.jndi.toolkit.ctx.Continuation;
|
|||||||
final class NamingEventNotifier implements Runnable {
|
final class NamingEventNotifier implements Runnable {
|
||||||
private final static boolean debug = false;
|
private final static boolean debug = false;
|
||||||
|
|
||||||
private Vector namingListeners;
|
private Vector<NamingListener> namingListeners;
|
||||||
private Thread worker;
|
private Thread worker;
|
||||||
private LdapCtx context;
|
private LdapCtx context;
|
||||||
private EventContext eventSrc;
|
private EventContext eventSrc;
|
||||||
private EventSupport support;
|
private EventSupport support;
|
||||||
private NamingEnumeration results;
|
private NamingEnumeration<SearchResult> results;
|
||||||
|
|
||||||
// package private; used by EventSupport to remove it
|
// package private; used by EventSupport to remove it
|
||||||
NotifierArgs info;
|
NotifierArgs info;
|
||||||
@ -83,7 +83,7 @@ final class NamingEventNotifier implements Runnable {
|
|||||||
context = (LdapCtx)ctx.newInstance(new Control[]{psearch});
|
context = (LdapCtx)ctx.newInstance(new Control[]{psearch});
|
||||||
eventSrc = ctx;
|
eventSrc = ctx;
|
||||||
|
|
||||||
namingListeners = new Vector();
|
namingListeners = new Vector<>();
|
||||||
namingListeners.addElement(firstListener);
|
namingListeners.addElement(firstListener);
|
||||||
|
|
||||||
worker = Obj.helper.createThread(this);
|
worker = Obj.helper.createThread(this);
|
||||||
@ -124,7 +124,8 @@ final class NamingEventNotifier implements Runnable {
|
|||||||
// Change root of search results so that it will generate
|
// Change root of search results so that it will generate
|
||||||
// names relative to the event context instead of that
|
// names relative to the event context instead of that
|
||||||
// named by nm
|
// named by nm
|
||||||
((LdapSearchEnumeration)results).setStartName(context.currentParsedDN);
|
((LdapSearchEnumeration)(NamingEnumeration)results)
|
||||||
|
.setStartName(context.currentParsedDN);
|
||||||
|
|
||||||
SearchResult si;
|
SearchResult si;
|
||||||
Control[] respctls;
|
Control[] respctls;
|
||||||
@ -132,7 +133,7 @@ final class NamingEventNotifier implements Runnable {
|
|||||||
long changeNum;
|
long changeNum;
|
||||||
|
|
||||||
while (results.hasMore()) {
|
while (results.hasMore()) {
|
||||||
si = (SearchResult)results.next();
|
si = results.next();
|
||||||
respctls = (si instanceof HasControls) ?
|
respctls = (si instanceof HasControls) ?
|
||||||
((HasControls) si).getControls() : null;
|
((HasControls) si).getControls() : null;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -133,7 +133,7 @@ final class NotifierArgs {
|
|||||||
private int controlsCode() {
|
private int controlsCode() {
|
||||||
if (controls == null) return 0;
|
if (controls == null) return 0;
|
||||||
|
|
||||||
int total = (int)controls.getTimeLimit() + (int)controls.getCountLimit() +
|
int total = controls.getTimeLimit() + (int)controls.getCountLimit() +
|
||||||
(controls.getDerefLinkFlag() ? 1 : 0) +
|
(controls.getDerefLinkFlag() ? 1 : 0) +
|
||||||
(controls.getReturningObjFlag() ? 1 : 0);
|
(controls.getReturningObjFlag() ? 1 : 0);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -84,6 +84,7 @@ final class Obj {
|
|||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
private static final int REMOTE_LOC = 7;
|
private static final int REMOTE_LOC = 7;
|
||||||
|
|
||||||
// LDAP object classes to support Java objects
|
// LDAP object classes to support Java objects
|
||||||
@ -206,13 +207,13 @@ final class Obj {
|
|||||||
} else {
|
} else {
|
||||||
StringTokenizer parser =
|
StringTokenizer parser =
|
||||||
new StringTokenizer((String)codebaseAttr.get());
|
new StringTokenizer((String)codebaseAttr.get());
|
||||||
Vector vec = new Vector(10);
|
Vector<String> vec = new Vector<>(10);
|
||||||
while (parser.hasMoreTokens()) {
|
while (parser.hasMoreTokens()) {
|
||||||
vec.addElement(parser.nextToken());
|
vec.addElement(parser.nextToken());
|
||||||
}
|
}
|
||||||
String[] answer = new String[vec.size()];
|
String[] answer = new String[vec.size()];
|
||||||
for (int i = 0; i < answer.length; i++) {
|
for (int i = 0; i < answer.length; i++) {
|
||||||
answer[i] = (String)vec.elementAt(i);
|
answer[i] = vec.elementAt(i);
|
||||||
}
|
}
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
@ -410,10 +411,10 @@ final class Obj {
|
|||||||
* Temporary Vector for decoded RefAddr addresses - used to ensure
|
* Temporary Vector for decoded RefAddr addresses - used to ensure
|
||||||
* unordered addresses are correctly re-ordered.
|
* unordered addresses are correctly re-ordered.
|
||||||
*/
|
*/
|
||||||
Vector refAddrList = new Vector();
|
Vector<RefAddr> refAddrList = new Vector<>();
|
||||||
refAddrList.setSize(attr.size());
|
refAddrList.setSize(attr.size());
|
||||||
|
|
||||||
for (NamingEnumeration vals = attr.getAll(); vals.hasMore(); ) {
|
for (NamingEnumeration<?> vals = attr.getAll(); vals.hasMore(); ) {
|
||||||
|
|
||||||
val = (String)vals.next();
|
val = (String)vals.next();
|
||||||
|
|
||||||
@ -488,7 +489,7 @@ final class Obj {
|
|||||||
|
|
||||||
// Copy to real reference
|
// Copy to real reference
|
||||||
for (int i = 0; i < refAddrList.size(); i++) {
|
for (int i = 0; i < refAddrList.size(); i++) {
|
||||||
ref.add((RefAddr)refAddrList.elementAt(i));
|
ref.add(refAddrList.elementAt(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,9 +503,9 @@ final class Obj {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||||
ObjectOutputStream serial = new ObjectOutputStream(bytes);
|
try (ObjectOutputStream serial = new ObjectOutputStream(bytes)) {
|
||||||
serial.writeObject(obj);
|
serial.writeObject(obj);
|
||||||
serial.close();
|
}
|
||||||
|
|
||||||
return (bytes.toByteArray());
|
return (bytes.toByteArray());
|
||||||
|
|
||||||
@ -524,18 +525,14 @@ final class Obj {
|
|||||||
try {
|
try {
|
||||||
// Create ObjectInputStream for deserialization
|
// Create ObjectInputStream for deserialization
|
||||||
ByteArrayInputStream bytes = new ByteArrayInputStream(obj);
|
ByteArrayInputStream bytes = new ByteArrayInputStream(obj);
|
||||||
ObjectInputStream deserial = (cl == null ?
|
try (ObjectInputStream deserial = cl == null ?
|
||||||
new ObjectInputStream(bytes) :
|
new ObjectInputStream(bytes) :
|
||||||
new LoaderInputStream(bytes, cl));
|
new LoaderInputStream(bytes, cl)) {
|
||||||
|
|
||||||
try {
|
|
||||||
return deserial.readObject();
|
return deserial.readObject();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
NamingException ne = new NamingException();
|
NamingException ne = new NamingException();
|
||||||
ne.setRootCause(e);
|
ne.setRootCause(e);
|
||||||
throw ne;
|
throw ne;
|
||||||
} finally {
|
|
||||||
deserial.close();
|
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
NamingException ne = new NamingException();
|
NamingException ne = new NamingException();
|
||||||
@ -549,7 +546,7 @@ final class Obj {
|
|||||||
*/
|
*/
|
||||||
static Attributes determineBindAttrs(
|
static Attributes determineBindAttrs(
|
||||||
char separator, Object obj, Attributes attrs, boolean cloned,
|
char separator, Object obj, Attributes attrs, boolean cloned,
|
||||||
Name name, Context ctx, Hashtable env)
|
Name name, Context ctx, Hashtable<?,?> env)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
|
|
||||||
// Call state factories to convert object and attrs
|
// Call state factories to convert object and attrs
|
||||||
@ -582,10 +579,10 @@ final class Obj {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Get existing objectclass attribute
|
// Get existing objectclass attribute
|
||||||
objectClass = (Attribute)attrs.get("objectClass");
|
objectClass = attrs.get("objectClass");
|
||||||
if (objectClass == null && !attrs.isCaseIgnored()) {
|
if (objectClass == null && !attrs.isCaseIgnored()) {
|
||||||
// %%% workaround
|
// %%% workaround
|
||||||
objectClass = (Attribute)attrs.get("objectclass");
|
objectClass = attrs.get("objectclass");
|
||||||
}
|
}
|
||||||
|
|
||||||
// No objectclasses supplied, use "top" to start
|
// No objectclasses supplied, use "top" to start
|
||||||
@ -614,8 +611,8 @@ final class Obj {
|
|||||||
classLoader = cl;
|
classLoader = cl;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Class resolveClass(ObjectStreamClass desc) throws IOException,
|
protected Class<?> resolveClass(ObjectStreamClass desc) throws
|
||||||
ClassNotFoundException {
|
IOException, ClassNotFoundException {
|
||||||
try {
|
try {
|
||||||
// %%% Should use Class.forName(desc.getName(), false, classLoader);
|
// %%% Should use Class.forName(desc.getName(), false, classLoader);
|
||||||
// except we can't because that is only available on JDK1.2
|
// except we can't because that is only available on JDK1.2
|
||||||
@ -625,15 +622,15 @@ final class Obj {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Class resolveProxyClass(String[] interfaces) throws
|
protected Class<?> resolveProxyClass(String[] interfaces) throws
|
||||||
IOException, ClassNotFoundException {
|
IOException, ClassNotFoundException {
|
||||||
ClassLoader nonPublicLoader = null;
|
ClassLoader nonPublicLoader = null;
|
||||||
boolean hasNonPublicInterface = false;
|
boolean hasNonPublicInterface = false;
|
||||||
|
|
||||||
// define proxy in class loader of non-public interface(s), if any
|
// define proxy in class loader of non-public interface(s), if any
|
||||||
Class[] classObjs = new Class[interfaces.length];
|
Class<?>[] classObjs = new Class<?>[interfaces.length];
|
||||||
for (int i = 0; i < interfaces.length; i++) {
|
for (int i = 0; i < interfaces.length; i++) {
|
||||||
Class cl = Class.forName(interfaces[i], false, classLoader);
|
Class<?> cl = Class.forName(interfaces[i], false, classLoader);
|
||||||
if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
|
if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
|
||||||
if (hasNonPublicInterface) {
|
if (hasNonPublicInterface) {
|
||||||
if (nonPublicLoader != cl.getClassLoader()) {
|
if (nonPublicLoader != cl.getClassLoader()) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,6 +27,6 @@ package com.sun.jndi.ldap;
|
|||||||
|
|
||||||
import javax.naming.NamingEnumeration;
|
import javax.naming.NamingEnumeration;
|
||||||
|
|
||||||
interface ReferralEnumeration extends NamingEnumeration {
|
interface ReferralEnumeration<T> extends NamingEnumeration<T> {
|
||||||
void appendUnprocessedReferrals(LdapReferralException ex);
|
void appendUnprocessedReferrals(LdapReferralException ex);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,9 +26,7 @@
|
|||||||
package com.sun.jndi.ldap;
|
package com.sun.jndi.ldap;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -39,8 +37,6 @@ import javax.naming.spi.NamingManager;
|
|||||||
import javax.naming.ldap.LdapName;
|
import javax.naming.ldap.LdapName;
|
||||||
import javax.naming.ldap.Rdn;
|
import javax.naming.ldap.Rdn;
|
||||||
|
|
||||||
import com.sun.jndi.ldap.LdapURL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class discovers the location of LDAP services by querying DNS.
|
* This class discovers the location of LDAP services by querying DNS.
|
||||||
* See http://www.ietf.org/internet-drafts/draft-ietf-ldapext-locate-07.txt
|
* See http://www.ietf.org/internet-drafts/draft-ietf-ldapext-locate-07.txt
|
||||||
@ -78,10 +74,10 @@ class ServiceLocator {
|
|||||||
// process RDNs left-to-right
|
// process RDNs left-to-right
|
||||||
//List<Rdn> rdnList = ldapName.getRdns();
|
//List<Rdn> rdnList = ldapName.getRdns();
|
||||||
|
|
||||||
List rdnList = ldapName.getRdns();
|
List<Rdn> rdnList = ldapName.getRdns();
|
||||||
for (int i = rdnList.size() - 1; i >= 0; i--) {
|
for (int i = rdnList.size() - 1; i >= 0; i--) {
|
||||||
//Rdn rdn = rdnList.get(i);
|
//Rdn rdn = rdnList.get(i);
|
||||||
Rdn rdn = (Rdn) rdnList.get(i);
|
Rdn rdn = rdnList.get(i);
|
||||||
|
|
||||||
// single-valued RDN with a DC attribute
|
// single-valued RDN with a DC attribute
|
||||||
if ((rdn.size() == 1) &&
|
if ((rdn.size() == 1) &&
|
||||||
@ -117,7 +113,7 @@ class ServiceLocator {
|
|||||||
* @return An ordered list of hostports for the LDAP service or null if
|
* @return An ordered list of hostports for the LDAP service or null if
|
||||||
* the service has not been located.
|
* the service has not been located.
|
||||||
*/
|
*/
|
||||||
static String[] getLdapService(String domainName, Hashtable environment) {
|
static String[] getLdapService(String domainName, Hashtable<?,?> environment) {
|
||||||
|
|
||||||
if (domainName == null || domainName.length() == 0) {
|
if (domainName == null || domainName.length() == 0) {
|
||||||
return null;
|
return null;
|
||||||
@ -252,7 +248,7 @@ class ServiceLocator {
|
|||||||
* See http://www.ietf.org/rfc/rfc2782.txt
|
* See http://www.ietf.org/rfc/rfc2782.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static class SrvRecord implements Comparable {
|
static class SrvRecord implements Comparable<SrvRecord> {
|
||||||
|
|
||||||
int priority;
|
int priority;
|
||||||
int weight;
|
int weight;
|
||||||
@ -284,8 +280,7 @@ static class SrvRecord implements Comparable {
|
|||||||
* Sort records in ascending order of priority value. For records with
|
* Sort records in ascending order of priority value. For records with
|
||||||
* equal priority move those with weight 0 to the top of the list.
|
* equal priority move those with weight 0 to the top of the list.
|
||||||
*/
|
*/
|
||||||
public int compareTo(Object o) {
|
public int compareTo(SrvRecord that) {
|
||||||
SrvRecord that = (SrvRecord) o;
|
|
||||||
if (priority > that.priority) {
|
if (priority > that.priority) {
|
||||||
return 1; // this > that
|
return 1; // this > that
|
||||||
} else if (priority < that.priority) {
|
} else if (priority < that.priority) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -54,9 +54,9 @@ class SimpleClientId extends ClientId {
|
|||||||
} else if (passwd instanceof String) {
|
} else if (passwd instanceof String) {
|
||||||
this.passwd = passwd;
|
this.passwd = passwd;
|
||||||
} else if (passwd instanceof byte[]) {
|
} else if (passwd instanceof byte[]) {
|
||||||
this.passwd = (byte[]) ((byte[])passwd).clone();
|
this.passwd = ((byte[])passwd).clone();
|
||||||
} else if (passwd instanceof char[]) {
|
} else if (passwd instanceof char[]) {
|
||||||
this.passwd = (char[]) ((char[])passwd).clone();
|
this.passwd = ((char[])passwd).clone();
|
||||||
} else {
|
} else {
|
||||||
this.passwd = passwd;
|
this.passwd = passwd;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -41,7 +41,7 @@ final class UnsolicitedResponseImpl implements UnsolicitedNotification {
|
|||||||
private NamingException exception;
|
private NamingException exception;
|
||||||
private Control[] controls;
|
private Control[] controls;
|
||||||
|
|
||||||
UnsolicitedResponseImpl(String oid, byte[] berVal, Vector ref,
|
UnsolicitedResponseImpl(String oid, byte[] berVal, Vector<Vector<String>> ref,
|
||||||
int status, String msg, String matchedDN, Control[] controls) {
|
int status, String msg, String matchedDN, Control[] controls) {
|
||||||
this.oid = oid;
|
this.oid = oid;
|
||||||
this.extensionValue = berVal;
|
this.extensionValue = berVal;
|
||||||
@ -50,7 +50,8 @@ final class UnsolicitedResponseImpl implements UnsolicitedNotification {
|
|||||||
int len = ref.size();
|
int len = ref.size();
|
||||||
referrals = new String[len];
|
referrals = new String[len];
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
referrals[i] = (String)ref.elementAt(i);
|
// ref is a list of single-String Vectors
|
||||||
|
referrals[i] = ref.elementAt(i).elementAt(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exception = LdapCtx.mapErrorCode(status, msg);
|
exception = LdapCtx.mapErrorCode(status, msg);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user