Merge
This commit is contained in:
commit
90bc153da6
@ -169,3 +169,4 @@ e4f81a817447c3a4f6868f083c81c2fb1b15d44c jdk8-b44
|
||||
633f2378c904c92bb922a6e19e9f62fe8eac14af jdk8-b45
|
||||
27fa766a2298ba8347dc198f0cf85ba6618e17db jdk8-b46
|
||||
1dcb4b7b9373e64e135c12fe1f8699f1f80e51e8 jdk8-b47
|
||||
3f6c72d1c2a6e5c9e7d81c3dc984886678a128ad jdk8-b48
|
||||
|
@ -3383,3 +3383,397 @@ included with JRE 7, JDK 7, and OpenJDK 7, except where noted:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
%% This notice is provided with respect to Mozilla Network Security
|
||||
Services (NSS), which is supplied with the JDK test suite in the OpenJDK
|
||||
source code repository. It is licensed under Mozilla Public License (MPL),
|
||||
version 2.0.
|
||||
|
||||
The NSS libraries are supplied in executable form, built from unmodified
|
||||
NSS source code labeled with the "NSS_3.13.1_RTM" release tag.
|
||||
|
||||
The NSS source code is available in the OpenJDK source code repository at:
|
||||
jdk/test/sun/security/pkcs11/nss/src
|
||||
|
||||
The NSS libraries are available in the OpenJDK source code repository at:
|
||||
jdk/test/sun/security/pkcs11/nss/lib
|
||||
|
||||
--- begin of LICENSE ---
|
||||
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
|
||||
--- end of LICENSE ---
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
@ -169,3 +169,4 @@ cd879aff5d3cc1f58829aab3116880aa19525b78 jdk8-b43
|
||||
747dad9e9d37d244a5c765a1afe9194f7ddae118 jdk8-b45
|
||||
30141e598d72a6146126cb86b034ed6d0bd191b3 jdk8-b46
|
||||
21e46ea21c6a26246fb7a1926ac7fe8d580d0518 jdk8-b47
|
||||
7e2b179a5b4dbd3f097e28daa00abfcc72ba3e0b jdk8-b48
|
||||
|
@ -261,3 +261,4 @@ e77b8e0ed1f84e3e268239e276c7ab64fa573baa jdk8-b43
|
||||
cf37a594c38db2ea926954154636f9f81da2e032 jdk8-b46
|
||||
0c7bb1f4f9c8062b5c5bfa56b3bdca44839b4109 jdk8-b47
|
||||
66b0450071c1534e014b131892cc86b63f1d009c hs24-b16
|
||||
1e26f61bbb521642639f56fae11326f1932f5a7d jdk8-b48
|
||||
|
@ -169,3 +169,4 @@ eff4ece9c8bc43b3ce2b3758574c4c20147f0689 jdk8-b43
|
||||
57476f66e13c55eea2f2fe2b858369a4c64b9936 jdk8-b45
|
||||
300f45e990643af230d6cca39477ff62c44a9a54 jdk8-b46
|
||||
404521944ac9383afda7d55d60713b212c730646 jdk8-b47
|
||||
1c88da9a1365797e49be77ae42c34bbc0a3c3f0c jdk8-b48
|
||||
|
@ -602,7 +602,7 @@ protected static final String PARSER_SETTINGS =
|
||||
if (reader == null) {
|
||||
stream = xmlInputSource.getByteStream();
|
||||
if (stream == null) {
|
||||
URL location = new URL(escapeNonUSAscii(expandedSystemId));
|
||||
URL location = new URL(expandedSystemId);
|
||||
URLConnection connect = location.openConnection();
|
||||
if (!(connect instanceof HttpURLConnection)) {
|
||||
stream = connect.getInputStream();
|
||||
@ -2586,76 +2586,6 @@ protected static final String PARSER_SETTINGS =
|
||||
|
||||
} // fixURI(String):String
|
||||
|
||||
/**
|
||||
* Escape invalid URI characters.
|
||||
*
|
||||
* Passed a URI that contains invalid characters (like spaces, non-ASCII Unicode characters, and the like),
|
||||
* this function percent encodes the invalid characters per the URI specification (i.e., as a sequence of
|
||||
* %-encoded UTF-8 octets).
|
||||
*
|
||||
* N.B. There are two problems. If the URI contains a '%' character, that might be an indication that
|
||||
* the URI has already been escaped by the author, or it might be an invalid '%'. In the former case,
|
||||
* it's important not to escape it, or we'll wind up with invalid, doubly-escaped '%'s. In the latter,
|
||||
* the URI is broken if we don't encode it. Similarly, a '#' character might be the start of a fragment
|
||||
* identifier or it might be an invalid '#'.
|
||||
*
|
||||
* Given that the former is vastly more likely than the latter in each case (most users are familiar with
|
||||
* the magic status of '%' and '#' and they occur relatively infrequently in filenames, and if the user parses
|
||||
* a proper Java File, we will already have %-escaped the URI), we simply assume that %'s and #'s are legit.
|
||||
*
|
||||
* Very rarely, we may be wrong. If so, tell the user to fix the clearly broken URI.
|
||||
*/
|
||||
protected static String escapeNonUSAscii(String str) {
|
||||
if (str == null) {
|
||||
return str;
|
||||
}
|
||||
int len = str.length(), i=0, ch;
|
||||
for (; i < len; i++) {
|
||||
ch = str.charAt(i);
|
||||
// if it's not an ASCII 7 character, break here, and use UTF-8 encoding
|
||||
if (ch >= 128)
|
||||
break;
|
||||
}
|
||||
|
||||
// we saw no non-ascii-7 character
|
||||
if (i == len) {
|
||||
return str;
|
||||
}
|
||||
|
||||
// get UTF-8 bytes for the string
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
byte[] bytes = null;
|
||||
byte b;
|
||||
try {
|
||||
bytes = str.getBytes("UTF-8");
|
||||
} catch (java.io.UnsupportedEncodingException e) {
|
||||
// should never happen
|
||||
return str;
|
||||
}
|
||||
|
||||
len = bytes.length;
|
||||
|
||||
// for each byte
|
||||
for (i = 0; i < len; i++) {
|
||||
b = bytes[i];
|
||||
// for non-ascii character: make it positive, then escape
|
||||
if (b < 0) {
|
||||
ch = b + 256;
|
||||
buffer.append('%');
|
||||
buffer.append(gHexChs[ch >> 4]);
|
||||
buffer.append(gHexChs[ch & 0xf]);
|
||||
}
|
||||
else if (b != '%' && b != '#' && gNeedEscaping[b]) {
|
||||
buffer.append('%');
|
||||
buffer.append(gAfterEscaping1[b]);
|
||||
buffer.append(gAfterEscaping2[b]);
|
||||
}
|
||||
else {
|
||||
buffer.append((char)b);
|
||||
}
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
//
|
||||
// Package visible methods
|
||||
|
@ -169,3 +169,4 @@ db471a7af03168e4441c245b1d9976f720a7cb77 jdk8-b44
|
||||
b92353a01aa049bc508fc56f0347d5934b7c4390 jdk8-b45
|
||||
8d2ed9d58453c8049715a72a6d26b6b66b37a94c jdk8-b46
|
||||
00b22b23269a57d0bb46c57753be2fe9a9d2c1a3 jdk8-b47
|
||||
3e4ab821f46166fcf63e8fe5c8046216003c941f jdk8-b48
|
||||
|
@ -3383,3 +3383,397 @@ included with JRE 7, JDK 7, and OpenJDK 7, except where noted:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
%% This notice is provided with respect to Mozilla Network Security
|
||||
Services (NSS), which is supplied with the JDK test suite in the OpenJDK
|
||||
source code repository. It is licensed under Mozilla Public License (MPL),
|
||||
version 2.0.
|
||||
|
||||
The NSS libraries are supplied in executable form, built from unmodified
|
||||
NSS source code labeled with the "NSS_3.13.1_RTM" release tag.
|
||||
|
||||
The NSS source code is available in the OpenJDK source code repository at:
|
||||
jdk/test/sun/security/pkcs11/nss/src
|
||||
|
||||
The NSS libraries are available in the OpenJDK source code repository at:
|
||||
jdk/test/sun/security/pkcs11/nss/lib
|
||||
|
||||
--- begin of LICENSE ---
|
||||
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
|
||||
--- end of LICENSE ---
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 1996, 2012, 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
|
||||
@ -44,15 +44,8 @@ ifneq ($(PLATFORM), windows)
|
||||
JGSS_WRAPPER = jgss/wrapper
|
||||
endif
|
||||
|
||||
# Build PKCS#11 on all platforms except 64-bit Windows.
|
||||
# We exclude windows-amd64 because we don't have any
|
||||
# 64-bit PKCS#11 implementations to test with on that platform.
|
||||
# Build PKCS#11 on all platforms
|
||||
PKCS11 = pkcs11
|
||||
ifeq ($(ARCH_DATA_MODEL), 64)
|
||||
ifeq ($(PLATFORM), windows)
|
||||
PKCS11 =
|
||||
endif
|
||||
endif
|
||||
|
||||
# Build Microsoft CryptoAPI provider only on Windows platform.
|
||||
MSCAPI =
|
||||
|
@ -32,10 +32,20 @@ import javax.swing.plaf.basic.BasicPanelUI;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class AquaPanelUI extends BasicPanelUI {
|
||||
static RecyclableSingleton<AquaPanelUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaPanelUI>(AquaPanelUI.class);
|
||||
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
return instance.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void update(final Graphics g, final JComponent c) {
|
||||
if (c.isOpaque()) {
|
||||
AquaUtils.fillRect(g, c);
|
||||
}
|
||||
paint(g, c);
|
||||
}
|
||||
}
|
||||
|
@ -319,4 +319,12 @@ public class AquaRootPaneUI extends BasicRootPaneUI implements AncestorListener,
|
||||
updateComponentTreeUIActivation(element, active);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void update(final Graphics g, final JComponent c) {
|
||||
if (c.isOpaque()) {
|
||||
AquaUtils.fillRect(g, c);
|
||||
}
|
||||
paint(g, c);
|
||||
}
|
||||
}
|
||||
|
@ -73,9 +73,7 @@ public class AquaToolBarUI extends BasicToolBarUI implements SwingConstants {
|
||||
g.translate(x, y);
|
||||
|
||||
if (c.isOpaque()) {
|
||||
final Color background = c.getBackground();
|
||||
g.setColor(background);
|
||||
g.fillRect(0, 0, w - 1, h - 1);
|
||||
AquaUtils.fillRect(g, c, c.getBackground(), 0, 0, w - 1, h - 1);
|
||||
}
|
||||
|
||||
final Color oldColor = g.getColor();
|
||||
@ -137,4 +135,12 @@ public class AquaToolBarUI extends BasicToolBarUI implements SwingConstants {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void update(final Graphics g, final JComponent c) {
|
||||
if (c.isOpaque()) {
|
||||
AquaUtils.fillRect(g, c);
|
||||
}
|
||||
paint(g, c);
|
||||
}
|
||||
}
|
||||
|
@ -28,18 +28,19 @@ package com.apple.laf;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.plaf.UIResource;
|
||||
|
||||
import sun.awt.AppContext;
|
||||
|
||||
import sun.lwawt.macosx.CImage;
|
||||
import sun.lwawt.macosx.CImage.Creator;
|
||||
import sun.lwawt.macosx.CPlatformWindow;
|
||||
import sun.swing.SwingUtilities2;
|
||||
|
||||
import com.apple.laf.AquaImageFactory.SlicedImageControl;
|
||||
@ -389,4 +390,51 @@ public class AquaUtils {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected static boolean isWindowTextured(final Component c) {
|
||||
if (!(c instanceof JComponent)) {
|
||||
return false;
|
||||
}
|
||||
final JRootPane pane = ((JComponent) c).getRootPane();
|
||||
if (pane == null) {
|
||||
return false;
|
||||
}
|
||||
Object prop = pane.getClientProperty(
|
||||
CPlatformWindow.WINDOW_BRUSH_METAL_LOOK);
|
||||
if (prop != null) {
|
||||
return Boolean.parseBoolean(prop.toString());
|
||||
}
|
||||
prop = pane.getClientProperty(CPlatformWindow.WINDOW_STYLE);
|
||||
return prop != null && "textured".equals(prop);
|
||||
}
|
||||
|
||||
private static Color resetAlpha(final Color color) {
|
||||
return new Color(color.getRed(), color.getGreen(), color.getBlue(), 0);
|
||||
}
|
||||
|
||||
protected static void fillRect(final Graphics g, final Component c) {
|
||||
fillRect(g, c, c.getBackground(), 0, 0, c.getWidth(), c.getHeight());
|
||||
}
|
||||
|
||||
protected static void fillRect(final Graphics g, final Component c,
|
||||
final Color color, final int x, final int y,
|
||||
final int w, final int h) {
|
||||
if (!(g instanceof Graphics2D)) {
|
||||
return;
|
||||
}
|
||||
final Graphics2D cg = (Graphics2D) g.create();
|
||||
try {
|
||||
if (color instanceof UIResource && isWindowTextured(c)
|
||||
&& color.equals(SystemColor.window)) {
|
||||
cg.setComposite(AlphaComposite.Src);
|
||||
cg.setColor(resetAlpha(color));
|
||||
} else {
|
||||
cg.setColor(color);
|
||||
}
|
||||
cg.fillRect(x, y, w, h);
|
||||
} finally {
|
||||
cg.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,16 +35,16 @@ class MacOSXPreferences extends AbstractPreferences {
|
||||
private static final String defaultAppName = "com.apple.java.util.prefs";
|
||||
|
||||
// true if this node is a child of userRoot or is userRoot
|
||||
private boolean isUser;
|
||||
private final boolean isUser;
|
||||
|
||||
// true if this node is userRoot or systemRoot
|
||||
private boolean isRoot;
|
||||
private final boolean isRoot;
|
||||
|
||||
// CF's storage location for this node and its keys
|
||||
private MacOSXPreferencesFile file;
|
||||
private final MacOSXPreferencesFile file;
|
||||
|
||||
// absolutePath() + "/"
|
||||
private String path;
|
||||
private final String path;
|
||||
|
||||
// User root and system root nodes
|
||||
private static MacOSXPreferences userRoot = null;
|
||||
@ -73,36 +73,40 @@ class MacOSXPreferences extends AbstractPreferences {
|
||||
|
||||
// Create a new root node. Called by getUserRoot() and getSystemRoot()
|
||||
// Synchronization is provided by the caller.
|
||||
private MacOSXPreferences(boolean newIsUser)
|
||||
{
|
||||
super(null, "");
|
||||
isUser = newIsUser;
|
||||
isRoot = true;
|
||||
|
||||
initFields();
|
||||
private MacOSXPreferences(boolean newIsUser) {
|
||||
this(null, "", false, true, newIsUser);
|
||||
}
|
||||
|
||||
|
||||
// Create a new non-root node with the given parent.
|
||||
// Called by childSpi().
|
||||
private MacOSXPreferences(MacOSXPreferences parent, String name)
|
||||
private MacOSXPreferences(MacOSXPreferences parent, String name) {
|
||||
this(parent, name, false, false, false);
|
||||
}
|
||||
|
||||
private MacOSXPreferences(MacOSXPreferences parent, String name,
|
||||
boolean isNew)
|
||||
{
|
||||
this(parent, name, isNew, false, false);
|
||||
}
|
||||
|
||||
private MacOSXPreferences(MacOSXPreferences parent, String name,
|
||||
boolean isNew, boolean isRoot, boolean isUser)
|
||||
{
|
||||
super(parent, name);
|
||||
isUser = isUserNode();
|
||||
isRoot = false;
|
||||
|
||||
initFields();
|
||||
}
|
||||
|
||||
|
||||
private void initFields()
|
||||
{
|
||||
this.isRoot = isRoot;
|
||||
if (isRoot)
|
||||
this.isUser = isUser;
|
||||
else
|
||||
this.isUser = isUserNode();
|
||||
path = isRoot ? absolutePath() : absolutePath() + "/";
|
||||
file = cfFileForNode(isUser);
|
||||
newNode = file.addNode(path);
|
||||
if (isNew)
|
||||
newNode = isNew;
|
||||
else
|
||||
newNode = file.addNode(path);
|
||||
}
|
||||
|
||||
|
||||
// Create and return the MacOSXPreferencesFile for this node.
|
||||
// Does not write anything to the file.
|
||||
private MacOSXPreferencesFile cfFileForNode(boolean isUser)
|
||||
@ -160,7 +164,7 @@ class MacOSXPreferences extends AbstractPreferences {
|
||||
// AbstractPreferences implementation
|
||||
@Override
|
||||
protected void removeNodeSpi()
|
||||
throws BackingStoreException
|
||||
throws BackingStoreException
|
||||
{
|
||||
// Disallow flush or sync between these two operations
|
||||
// (they may be manipulating two different files)
|
||||
@ -180,7 +184,7 @@ class MacOSXPreferences extends AbstractPreferences {
|
||||
// AbstractPreferences implementation
|
||||
@Override
|
||||
protected String[] childrenNamesSpi()
|
||||
throws BackingStoreException
|
||||
throws BackingStoreException
|
||||
{
|
||||
String[] result = file.getChildrenForNode(path);
|
||||
if (result == null) throw new BackingStoreException("Couldn't get list of children for node '" + path + "'");
|
||||
@ -190,7 +194,7 @@ class MacOSXPreferences extends AbstractPreferences {
|
||||
// AbstractPreferences implementation
|
||||
@Override
|
||||
protected String[] keysSpi()
|
||||
throws BackingStoreException
|
||||
throws BackingStoreException
|
||||
{
|
||||
String[] result = file.getKeysForNode(path);
|
||||
if (result == null) throw new BackingStoreException("Couldn't get list of keys for node '" + path + "'");
|
||||
@ -204,15 +208,15 @@ class MacOSXPreferences extends AbstractPreferences {
|
||||
// Add to parent's child list here and disallow sync
|
||||
// because parent and child might be in different files.
|
||||
synchronized(MacOSXPreferencesFile.class) {
|
||||
file.addChildToNode(path, name);
|
||||
return new MacOSXPreferences(this, name);
|
||||
boolean isNew = file.addChildToNode(path, name);
|
||||
return new MacOSXPreferences(this, name, isNew);
|
||||
}
|
||||
}
|
||||
|
||||
// AbstractPreferences override
|
||||
@Override
|
||||
public void flush()
|
||||
throws BackingStoreException
|
||||
throws BackingStoreException
|
||||
{
|
||||
// Flush should *not* check for removal, unlike sync, but should
|
||||
// prevent simultaneous removal.
|
||||
@ -227,7 +231,7 @@ class MacOSXPreferences extends AbstractPreferences {
|
||||
// AbstractPreferences implementation
|
||||
@Override
|
||||
protected void flushSpi()
|
||||
throws BackingStoreException
|
||||
throws BackingStoreException
|
||||
{
|
||||
// nothing here - overridden flush() doesn't call this
|
||||
}
|
||||
@ -235,7 +239,7 @@ class MacOSXPreferences extends AbstractPreferences {
|
||||
// AbstractPreferences override
|
||||
@Override
|
||||
public void sync()
|
||||
throws BackingStoreException
|
||||
throws BackingStoreException
|
||||
{
|
||||
synchronized(lock) {
|
||||
if (isRemoved())
|
||||
@ -256,7 +260,7 @@ class MacOSXPreferences extends AbstractPreferences {
|
||||
// AbstractPreferences implementation
|
||||
@Override
|
||||
protected void syncSpi()
|
||||
throws BackingStoreException
|
||||
throws BackingStoreException
|
||||
{
|
||||
// nothing here - overridden sync() doesn't call this
|
||||
}
|
||||
|
@ -360,11 +360,11 @@ class MacOSXPreferencesFile {
|
||||
}
|
||||
}
|
||||
|
||||
void addChildToNode(String path, String child)
|
||||
boolean addChildToNode(String path, String child)
|
||||
{
|
||||
synchronized(MacOSXPreferencesFile.class) {
|
||||
markChanged();
|
||||
addChildToNode(path, child+"/", appName, user, host);
|
||||
return addChildToNode(path, child+"/", appName, user, host);
|
||||
}
|
||||
}
|
||||
|
||||
@ -433,7 +433,7 @@ class MacOSXPreferencesFile {
|
||||
addNode(String path, String name, long user, long host);
|
||||
private static final native void
|
||||
removeNode(String path, String name, long user, long host);
|
||||
private static final native void
|
||||
private static final native boolean
|
||||
addChildToNode(String path, String child,
|
||||
String name, long user, long host);
|
||||
private static final native void
|
||||
|
@ -48,6 +48,9 @@ public class CGraphicsDevice extends GraphicsDevice {
|
||||
|
||||
private static AWTPermission fullScreenExclusivePermission;
|
||||
|
||||
// Save/restore DisplayMode for the Full Screen mode
|
||||
private DisplayMode originalMode;
|
||||
|
||||
public CGraphicsDevice(int displayID) {
|
||||
this.displayID = displayID;
|
||||
configs = new GraphicsConfiguration[] {
|
||||
@ -124,18 +127,22 @@ public class CGraphicsDevice extends GraphicsDevice {
|
||||
}
|
||||
|
||||
boolean fsSupported = isFullScreenSupported();
|
||||
|
||||
if (fsSupported && old != null) {
|
||||
// enter windowed mode (and restore original display mode)
|
||||
exitFullScreenExclusive(old);
|
||||
|
||||
// TODO: restore display mode
|
||||
if (originalMode != null) {
|
||||
setDisplayMode(originalMode);
|
||||
originalMode = null;
|
||||
}
|
||||
}
|
||||
|
||||
super.setFullScreenWindow(w);
|
||||
|
||||
if (fsSupported && w != null) {
|
||||
// TODO: save current display mode
|
||||
|
||||
if (isDisplayChangeSupported()) {
|
||||
originalMode = getDisplayMode();
|
||||
}
|
||||
// enter fullscreen mode
|
||||
enterFullScreenExclusive(w);
|
||||
}
|
||||
|
@ -68,11 +68,12 @@ public class CGLLayer extends CFRetainedResource {
|
||||
}
|
||||
|
||||
public boolean isOpaque() {
|
||||
return peer.isOpaque();
|
||||
return !peer.isTranslucent();
|
||||
}
|
||||
|
||||
public int getTransparency() {
|
||||
return (peer.isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT);
|
||||
return peer.isTranslucent() ? Transparency.TRANSLUCENT :
|
||||
Transparency.OPAQUE;
|
||||
}
|
||||
|
||||
public Object getDestination() {
|
||||
|
@ -424,8 +424,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
|
||||
@Override
|
||||
public final Graphics getGraphics() {
|
||||
Graphics g = getWindowPeerOrSelf().isOpaque() ? getOnscreenGraphics()
|
||||
: getOffscreenGraphics();
|
||||
final Graphics g = getOnscreenGraphics();
|
||||
if (g != null) {
|
||||
synchronized (getPeerTreeLock()){
|
||||
applyConstrain(g);
|
||||
@ -443,13 +442,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
final LWWindowPeer wp = getWindowPeerOrSelf();
|
||||
return wp.getOnscreenGraphics(getForeground(), getBackground(),
|
||||
getFont());
|
||||
}
|
||||
|
||||
public final Graphics getOffscreenGraphics() {
|
||||
final LWWindowPeer wp = getWindowPeerOrSelf();
|
||||
|
||||
return wp.getOffscreenGraphics(getForeground(), getBackground(),
|
||||
getFont());
|
||||
}
|
||||
|
||||
private void applyConstrain(final Graphics g) {
|
||||
@ -463,7 +456,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
}
|
||||
|
||||
//TODO Move this method to SG2D?
|
||||
private void SG2DConstraint(final SunGraphics2D sg2d, Region r) {
|
||||
void SG2DConstraint(final SunGraphics2D sg2d, Region r) {
|
||||
sg2d.constrainX = sg2d.transX;
|
||||
sg2d.constrainY = sg2d.transY;
|
||||
|
||||
@ -710,7 +703,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
// Obtain the metrics from the offscreen window where this peer is
|
||||
// mostly drawn to.
|
||||
// TODO: check for "use platform metrics" settings
|
||||
Graphics g = getWindowPeer().getOffscreenGraphics();
|
||||
Graphics g = getWindowPeer().getGraphics();
|
||||
try {
|
||||
if (g != null) {
|
||||
return g.getFontMetrics(f);
|
||||
@ -1011,14 +1004,33 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
@Override
|
||||
public final void applyShape(final Region shape) {
|
||||
synchronized (getStateLock()) {
|
||||
region = shape;
|
||||
if (region == shape || (region != null && region.equals(shape))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
applyShapeImpl(shape);
|
||||
}
|
||||
|
||||
void applyShapeImpl(final Region shape) {
|
||||
synchronized (getStateLock()) {
|
||||
if (shape != null) {
|
||||
region = Region.WHOLE_REGION.getIntersection(shape);
|
||||
} else {
|
||||
region = null;
|
||||
}
|
||||
}
|
||||
repaintParent(getBounds());
|
||||
}
|
||||
|
||||
protected final Region getRegion() {
|
||||
synchronized (getStateLock()) {
|
||||
return region == null ? Region.getInstance(getSize()) : region;
|
||||
return isShaped() ? region : Region.getInstance(getSize());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isShaped() {
|
||||
synchronized (getStateLock()) {
|
||||
return region != null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1386,11 +1398,6 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
}
|
||||
}
|
||||
|
||||
// Just a helper method, thus final
|
||||
protected final void flushOffscreenGraphics() {
|
||||
flushOffscreenGraphics(getSize());
|
||||
}
|
||||
|
||||
protected static final void flushOnscreenGraphics(){
|
||||
final OGLRenderQueue rq = OGLRenderQueue.getInstance();
|
||||
rq.lock();
|
||||
@ -1401,36 +1408,6 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Flushes the given rectangle from the back buffer to the screen.
|
||||
*/
|
||||
protected void flushOffscreenGraphics(Rectangle r) {
|
||||
flushOffscreenGraphics(r.x, r.y, r.width, r.height);
|
||||
}
|
||||
|
||||
private void flushOffscreenGraphics(int x, int y, int width, int height) {
|
||||
Image bb = getWindowPeerOrSelf().getBackBuffer();
|
||||
if (bb != null) {
|
||||
// g is a screen Graphics from the delegate
|
||||
final Graphics g = getOnscreenGraphics();
|
||||
|
||||
if (g != null && g instanceof Graphics2D) {
|
||||
try {
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
Point p = localToWindow(new Point(0, 0));
|
||||
Composite composite = g2d.getComposite();
|
||||
g2d.setComposite(AlphaComposite.Src);
|
||||
g.drawImage(bb, x, y, x + width, y + height, p.x + x,
|
||||
p.y + y, p.x + x + width, p.y + y + height,
|
||||
null);
|
||||
g2d.setComposite(composite);
|
||||
} finally {
|
||||
g.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by ContainerPeer to skip all the paint events during layout.
|
||||
*
|
||||
|
@ -58,9 +58,6 @@ final class LWRepaintArea extends RepaintArea {
|
||||
|
||||
private static void flushBuffers(final LWComponentPeer peer) {
|
||||
if (peer != null) {
|
||||
if (!peer.getWindowPeerOrSelf().isOpaque()) {
|
||||
peer.flushOffscreenGraphics();
|
||||
}
|
||||
peer.flushOnscreenGraphics();
|
||||
}
|
||||
}
|
||||
|
@ -522,12 +522,6 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
||||
postEvent(targetToAppContext(event.getSource()), event);
|
||||
}
|
||||
|
||||
// use peer's back buffer to implement non-opaque windows.
|
||||
@Override
|
||||
public boolean needUpdateWindow() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void grab(Window w) {
|
||||
if (w.getPeer() != null) {
|
||||
|
@ -37,6 +37,7 @@ import sun.awt.*;
|
||||
import sun.java2d.*;
|
||||
import sun.java2d.loops.Blit;
|
||||
import sun.java2d.loops.CompositeType;
|
||||
import sun.java2d.pipe.Region;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
public class LWWindowPeer
|
||||
@ -109,6 +110,10 @@ public class LWWindowPeer
|
||||
|
||||
private volatile boolean skipNextFocusChange;
|
||||
|
||||
private static final Color nonOpaqueBackground = new Color(0, 0, 0, 0);
|
||||
|
||||
private volatile boolean textured;
|
||||
|
||||
/**
|
||||
* Current modal blocker or null.
|
||||
*
|
||||
@ -169,6 +174,11 @@ public class LWWindowPeer
|
||||
setAlwaysOnTop(getTarget().isAlwaysOnTop());
|
||||
updateMinimumSize();
|
||||
|
||||
final Shape shape = getTarget().getShape();
|
||||
if (shape != null) {
|
||||
applyShape(Region.getInstance(shape, null));
|
||||
}
|
||||
|
||||
final float opacity = getTarget().getOpacity();
|
||||
if (opacity < 1.0f) {
|
||||
setOpacity(opacity);
|
||||
@ -178,7 +188,7 @@ public class LWWindowPeer
|
||||
|
||||
updateInsets(platformWindow.getInsets());
|
||||
if (getSurfaceData() == null) {
|
||||
replaceSurfaceData();
|
||||
replaceSurfaceData(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,7 +290,7 @@ public class LWWindowPeer
|
||||
// "buffer", that's why numBuffers - 1
|
||||
assert numBuffers > 1;
|
||||
|
||||
replaceSurfaceData(numBuffers - 1, caps);
|
||||
replaceSurfaceData(numBuffers - 1, caps, false);
|
||||
} catch (InvalidPipeException z) {
|
||||
throw new AWTException(z.toString());
|
||||
}
|
||||
@ -420,19 +430,44 @@ public class LWWindowPeer
|
||||
public final void setOpaque(final boolean isOpaque) {
|
||||
if (this.isOpaque != isOpaque) {
|
||||
this.isOpaque = isOpaque;
|
||||
getPlatformWindow().setOpaque(isOpaque);
|
||||
replaceSurfaceData();
|
||||
repaintPeer();
|
||||
updateOpaque();
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean isOpaque() {
|
||||
return isOpaque;
|
||||
private void updateOpaque() {
|
||||
getPlatformWindow().setOpaque(!isTranslucent());
|
||||
replaceSurfaceData(false);
|
||||
repaintPeer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWindow() {
|
||||
flushOffscreenGraphics();
|
||||
}
|
||||
|
||||
public final boolean isTextured() {
|
||||
return textured;
|
||||
}
|
||||
|
||||
public final void setTextured(final boolean isTextured) {
|
||||
textured = isTextured;
|
||||
}
|
||||
|
||||
public final boolean isTranslucent() {
|
||||
synchronized (getStateLock()) {
|
||||
/*
|
||||
* Textured window is a special case of translucent window.
|
||||
* The difference is only in nswindow background. So when we set
|
||||
* texture property our peer became fully translucent. It doesn't
|
||||
* fill background, create non opaque backbuffers and layer etc.
|
||||
*/
|
||||
return !isOpaque || isShaped() || isTextured();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
final void applyShapeImpl(final Region shape) {
|
||||
super.applyShapeImpl(shape);
|
||||
updateOpaque();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -587,7 +622,20 @@ public class LWWindowPeer
|
||||
getFont());
|
||||
if (g != null) {
|
||||
try {
|
||||
g.clearRect(0, 0, w, h);
|
||||
if (g instanceof Graphics2D) {
|
||||
((Graphics2D) g).setComposite(AlphaComposite.Src);
|
||||
}
|
||||
if (isTranslucent()) {
|
||||
g.setColor(nonOpaqueBackground);
|
||||
g.fillRect(0, 0, w, h);
|
||||
}
|
||||
if (!isTextured()) {
|
||||
if (g instanceof SunGraphics2D) {
|
||||
SG2DConstraint((SunGraphics2D) g, getRegion());
|
||||
}
|
||||
g.setColor(getBackground());
|
||||
g.fillRect(0, 0, w, h);
|
||||
}
|
||||
} finally {
|
||||
g.dispose();
|
||||
}
|
||||
@ -894,35 +942,6 @@ public class LWWindowPeer
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a back buffer Graphics to render all the
|
||||
* peers to. After the peer is painted, the back buffer contents
|
||||
* should be flushed to the screen. All the target painting
|
||||
* (Component.paint() method) should be done directly to the screen.
|
||||
*/
|
||||
protected final Graphics getOffscreenGraphics(Color fg, Color bg, Font f) {
|
||||
final Image bb = getBackBuffer();
|
||||
if (bb == null) {
|
||||
return null;
|
||||
}
|
||||
if (fg == null) {
|
||||
fg = SystemColor.windowText;
|
||||
}
|
||||
if (bg == null) {
|
||||
bg = SystemColor.window;
|
||||
}
|
||||
if (f == null) {
|
||||
f = DEFAULT_FONT;
|
||||
}
|
||||
final Graphics2D g = (Graphics2D) bb.getGraphics();
|
||||
if (g != null) {
|
||||
g.setColor(fg);
|
||||
g.setBackground(bg);
|
||||
g.setFont(f);
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
/*
|
||||
* May be called by delegate to provide SD to Java2D code.
|
||||
*/
|
||||
@ -933,11 +952,16 @@ public class LWWindowPeer
|
||||
}
|
||||
|
||||
private void replaceSurfaceData() {
|
||||
replaceSurfaceData(backBufferCount, backBufferCaps);
|
||||
replaceSurfaceData(true);
|
||||
}
|
||||
|
||||
private void replaceSurfaceData(boolean blit) {
|
||||
replaceSurfaceData(backBufferCount, backBufferCaps, blit);
|
||||
}
|
||||
|
||||
private void replaceSurfaceData(int newBackBufferCount,
|
||||
BufferCapabilities newBackBufferCaps) {
|
||||
BufferCapabilities newBackBufferCaps,
|
||||
boolean blit) {
|
||||
synchronized (surfaceDataLock) {
|
||||
final SurfaceData oldData = getSurfaceData();
|
||||
surfaceData = platformWindow.replaceSurfaceData();
|
||||
@ -950,7 +974,10 @@ public class LWWindowPeer
|
||||
if (getSurfaceData() != null && oldData != getSurfaceData()) {
|
||||
clearBackground(size.width, size.height);
|
||||
}
|
||||
blitSurfaceData(oldData, getSurfaceData());
|
||||
|
||||
if (blit) {
|
||||
blitSurfaceData(oldData, getSurfaceData());
|
||||
}
|
||||
|
||||
if (oldData != null && oldData != getSurfaceData()) {
|
||||
// TODO: drop oldData for D3D/WGL pipelines
|
||||
@ -965,11 +992,18 @@ public class LWWindowPeer
|
||||
Graphics g = backBuffer.getGraphics();
|
||||
try {
|
||||
Rectangle r = getBounds();
|
||||
g.setColor(getBackground());
|
||||
if (g instanceof Graphics2D) {
|
||||
((Graphics2D) g).setComposite(AlphaComposite.Src);
|
||||
}
|
||||
g.setColor(nonOpaqueBackground);
|
||||
g.fillRect(0, 0, r.width, r.height);
|
||||
if (g instanceof SunGraphics2D) {
|
||||
SG2DConstraint((SunGraphics2D) g, getRegion());
|
||||
}
|
||||
if (!isTextured()) {
|
||||
g.setColor(getBackground());
|
||||
g.fillRect(0, 0, r.width, r.height);
|
||||
}
|
||||
if (oldBB != null) {
|
||||
// Draw the old back buffer to the new one
|
||||
g.drawImage(oldBB, 0, 0, null);
|
||||
@ -993,7 +1027,7 @@ public class LWWindowPeer
|
||||
CompositeType.Src,
|
||||
dst.getSurfaceType());
|
||||
if (blit != null) {
|
||||
blit.Blit(src, dst, ((Graphics2D) getGraphics()).getComposite(),
|
||||
blit.Blit(src, dst, AlphaComposite.Src,
|
||||
getRegion(), 0, 0, 0, 0, size.width, size.height);
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
|
||||
Rectangle r = peer.getBounds();
|
||||
Image im = null;
|
||||
if (!r.isEmpty()) {
|
||||
int transparency = (peer.isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT);
|
||||
int transparency = peer.isTranslucent() ? Transparency.TRANSLUCENT : Transparency.OPAQUE;
|
||||
im = peer.getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency);
|
||||
}
|
||||
return im;
|
||||
|
@ -64,7 +64,7 @@ public class CPlatformView extends CFRetainedResource {
|
||||
}
|
||||
|
||||
public boolean isOpaque() {
|
||||
return peer.isOpaque();
|
||||
return !peer.isTranslucent();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -209,6 +209,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
private boolean undecorated; // initialized in getInitialStyleBits()
|
||||
private Rectangle normalBounds = null; // not-null only for undecorated maximized windows
|
||||
private CPlatformResponder responder;
|
||||
private volatile boolean zoomed = false; // from native perspective
|
||||
|
||||
public CPlatformWindow(final PeerType peerType) {
|
||||
super(0, true);
|
||||
@ -298,7 +299,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
|
||||
// If the target is a dialog, popup or tooltip we want it to ignore the brushed metal look.
|
||||
if (isPopup) {
|
||||
styleBits = SET(styleBits, TEXTURED, true);
|
||||
styleBits = SET(styleBits, TEXTURED, false);
|
||||
// Popups in applets don't activate applet's process
|
||||
styleBits = SET(styleBits, NONACTIVATING, true);
|
||||
}
|
||||
@ -372,6 +373,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
}
|
||||
}
|
||||
|
||||
peer.setTextured(IS(TEXTURED, styleBits));
|
||||
|
||||
return styleBits;
|
||||
}
|
||||
|
||||
@ -467,26 +470,42 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
nativeSetNSWindowBounds(getNSWindowPtr(), x, y, w, h);
|
||||
}
|
||||
|
||||
private void zoom() {
|
||||
private boolean isMaximized() {
|
||||
return undecorated ? this.normalBounds != null : zoomed;
|
||||
}
|
||||
|
||||
private void maximize() {
|
||||
if (isMaximized()) {
|
||||
return;
|
||||
}
|
||||
if (!undecorated) {
|
||||
zoomed = true;
|
||||
CWrapper.NSWindow.zoom(getNSWindowPtr());
|
||||
} else {
|
||||
// OS X handles -zoom incorrectly for undecorated windows
|
||||
final boolean isZoomed = this.normalBounds == null;
|
||||
deliverZoom(isZoomed);
|
||||
deliverZoom(true);
|
||||
|
||||
Rectangle toBounds;
|
||||
if (isZoomed) {
|
||||
this.normalBounds = peer.getBounds();
|
||||
long screen = CWrapper.NSWindow.screen(getNSWindowPtr());
|
||||
toBounds = CWrapper.NSScreen.visibleFrame(screen).getBounds();
|
||||
// Flip the y coordinate
|
||||
Rectangle frame = CWrapper.NSScreen.frame(screen).getBounds();
|
||||
toBounds.y = frame.height - toBounds.y - toBounds.height;
|
||||
} else {
|
||||
toBounds = normalBounds;
|
||||
this.normalBounds = null;
|
||||
}
|
||||
this.normalBounds = peer.getBounds();
|
||||
long screen = CWrapper.NSWindow.screen(getNSWindowPtr());
|
||||
Rectangle toBounds = CWrapper.NSScreen.visibleFrame(screen).getBounds();
|
||||
// Flip the y coordinate
|
||||
Rectangle frame = CWrapper.NSScreen.frame(screen).getBounds();
|
||||
toBounds.y = frame.height - toBounds.y - toBounds.height;
|
||||
setBounds(toBounds.x, toBounds.y, toBounds.width, toBounds.height);
|
||||
}
|
||||
}
|
||||
|
||||
private void unmaximize() {
|
||||
if (!isMaximized()) {
|
||||
return;
|
||||
}
|
||||
if (!undecorated) {
|
||||
zoomed = false;
|
||||
CWrapper.NSWindow.zoom(getNSWindowPtr());
|
||||
} else {
|
||||
deliverZoom(false);
|
||||
|
||||
Rectangle toBounds = this.normalBounds;
|
||||
this.normalBounds = null;
|
||||
setBounds(toBounds.x, toBounds.y, toBounds.width, toBounds.height);
|
||||
}
|
||||
}
|
||||
@ -499,9 +518,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
public void setVisible(boolean visible) {
|
||||
final long nsWindowPtr = getNSWindowPtr();
|
||||
|
||||
// 1. Process parent-child relationship when hiding
|
||||
// Process parent-child relationship when hiding
|
||||
if (!visible) {
|
||||
// 1a. Unparent my children
|
||||
// Unparent my children
|
||||
for (Window w : target.getOwnedWindows()) {
|
||||
WindowPeer p = (WindowPeer)w.getPeer();
|
||||
if (p instanceof LWWindowPeer) {
|
||||
@ -512,30 +531,17 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
}
|
||||
}
|
||||
|
||||
// 1b. Unparent myself
|
||||
// Unparent myself
|
||||
if (owner != null && owner.isVisible()) {
|
||||
CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), nsWindowPtr);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Configure stuff
|
||||
// Configure stuff
|
||||
updateIconImages();
|
||||
updateFocusabilityForAutoRequestFocus(false);
|
||||
|
||||
// 3. Manage the extended state when hiding
|
||||
if (!visible) {
|
||||
// Cancel out the current native state of the window
|
||||
switch (peer.getState()) {
|
||||
case Frame.ICONIFIED:
|
||||
CWrapper.NSWindow.deminiaturize(nsWindowPtr);
|
||||
break;
|
||||
case Frame.MAXIMIZED_BOTH:
|
||||
zoom();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Actually show or hide the window
|
||||
// Actually show or hide the window
|
||||
LWWindowPeer blocker = peer.getBlocker();
|
||||
if (blocker == null || !visible) {
|
||||
// If it ain't blocked, or is being hidden, go regular way
|
||||
@ -564,16 +570,19 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
}
|
||||
this.visible = visible;
|
||||
|
||||
// 5. Manage the extended state when showing
|
||||
// Manage the extended state when showing
|
||||
if (visible) {
|
||||
// Re-apply the extended state as expected in shared code
|
||||
// Apply the extended state as expected in shared code
|
||||
if (target instanceof Frame) {
|
||||
switch (((Frame)target).getExtendedState()) {
|
||||
case Frame.ICONIFIED:
|
||||
CWrapper.NSWindow.miniaturize(nsWindowPtr);
|
||||
break;
|
||||
case Frame.MAXIMIZED_BOTH:
|
||||
zoom();
|
||||
maximize();
|
||||
break;
|
||||
default: // NORMAL
|
||||
unmaximize(); // in case it was maximized, otherwise this is a no-op
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -581,12 +590,12 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
|
||||
nativeSynthesizeMouseEnteredExitedEvents(nsWindowPtr);
|
||||
|
||||
// 6. Configure stuff #2
|
||||
// Configure stuff #2
|
||||
updateFocusabilityForAutoRequestFocus(true);
|
||||
|
||||
// 7. Manage parent-child relationship when showing
|
||||
// Manage parent-child relationship when showing
|
||||
if (visible) {
|
||||
// 7a. Add myself as a child
|
||||
// Add myself as a child
|
||||
if (owner != null && owner.isVisible()) {
|
||||
CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(), nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
|
||||
if (target.isAlwaysOnTop()) {
|
||||
@ -594,7 +603,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
}
|
||||
}
|
||||
|
||||
// 7b. Add my own children to myself
|
||||
// Add my own children to myself
|
||||
for (Window w : target.getOwnedWindows()) {
|
||||
WindowPeer p = (WindowPeer)w.getPeer();
|
||||
if (p instanceof LWWindowPeer) {
|
||||
@ -609,7 +618,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
}
|
||||
}
|
||||
|
||||
// 8. Deal with the blocker of the window being shown
|
||||
// Deal with the blocker of the window being shown
|
||||
if (blocker != null && visible) {
|
||||
// Make sure the blocker is above its siblings
|
||||
((CPlatformWindow)blocker.getPlatformWindow()).orderAboveSiblings();
|
||||
@ -733,10 +742,19 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
@Override
|
||||
public void setOpaque(boolean isOpaque) {
|
||||
CWrapper.NSWindow.setOpaque(getNSWindowPtr(), isOpaque);
|
||||
if (!isOpaque) {
|
||||
if (!isOpaque && !peer.isTextured()) {
|
||||
long clearColor = CWrapper.NSColor.clearColor();
|
||||
CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor);
|
||||
}
|
||||
|
||||
//This is a temporary workaround. Looks like after 7124236 will be fixed
|
||||
//the correct place for invalidateShadow() is CGLayer.drawInCGLContext.
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
invalidateShadow();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -767,7 +785,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
if (prevWindowState == Frame.MAXIMIZED_BOTH) {
|
||||
// let's return into the normal states first
|
||||
// the zoom call toggles between the normal and the max states
|
||||
zoom();
|
||||
unmaximize();
|
||||
}
|
||||
CWrapper.NSWindow.miniaturize(nsWindowPtr);
|
||||
break;
|
||||
@ -776,14 +794,14 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
// let's return into the normal states first
|
||||
CWrapper.NSWindow.deminiaturize(nsWindowPtr);
|
||||
}
|
||||
zoom();
|
||||
maximize();
|
||||
break;
|
||||
case Frame.NORMAL:
|
||||
if (prevWindowState == Frame.ICONIFIED) {
|
||||
CWrapper.NSWindow.deminiaturize(nsWindowPtr);
|
||||
} else if (prevWindowState == Frame.MAXIMIZED_BOTH) {
|
||||
// the zoom call toggles between the normal and the max states
|
||||
zoom();
|
||||
unmaximize();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -805,6 +823,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
nativeSetEnabled(getNSWindowPtr(), !blocked);
|
||||
}
|
||||
|
||||
public final void invalidateShadow(){
|
||||
nativeRevalidateNSWindowShadow(getNSWindowPtr());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// UTILITY METHODS
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -749,6 +749,11 @@ public class LWCToolkit extends LWToolkit {
|
||||
(modalityType == Dialog.ModalityType.TOOLKIT_MODAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWindowShapingSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWindowTranslucencySupported() {
|
||||
return true;
|
||||
@ -759,6 +764,10 @@ public class LWCToolkit extends LWToolkit {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isSwingBackbufferTranslucencySupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enableInputMethodsForTextComponent() {
|
||||
return true;
|
||||
|
@ -641,7 +641,7 @@ Java_java_util_prefs_MacOSXPreferencesFile_removeNode
|
||||
|
||||
|
||||
// child must end with '/'
|
||||
JNIEXPORT void JNICALL
|
||||
JNIEXPORT Boolean JNICALL
|
||||
Java_java_util_prefs_MacOSXPreferencesFile_addChildToNode
|
||||
(JNIEnv *env, jobject klass, jobject jpath, jobject jchild,
|
||||
jobject jname, jlong juser, jlong jhost)
|
||||
@ -656,6 +656,7 @@ Java_java_util_prefs_MacOSXPreferencesFile_addChildToNode
|
||||
CFDictionaryRef node;
|
||||
CFStringRef topKey;
|
||||
CFMutableDictionaryRef topValue;
|
||||
Boolean beforeAdd = false;
|
||||
|
||||
if (!path || !child || !name) goto badparams;
|
||||
|
||||
@ -665,9 +666,12 @@ Java_java_util_prefs_MacOSXPreferencesFile_addChildToNode
|
||||
// copyMutableNode creates the node if necessary
|
||||
parent = copyMutableNode(path, name, user, host, &topKey, &topValue);
|
||||
throwIfNull(parent, "copyMutableNode failed");
|
||||
|
||||
beforeAdd = CFDictionaryContainsKey(parent, child);
|
||||
CFDictionaryAddValue(parent, child, node);
|
||||
|
||||
if (!beforeAdd)
|
||||
beforeAdd = CFDictionaryContainsKey(parent, child);
|
||||
else
|
||||
beforeAdd = false;
|
||||
CFPreferencesSetValue(topKey, topValue, name, user, host);
|
||||
|
||||
CFRelease(parent);
|
||||
@ -680,6 +684,7 @@ Java_java_util_prefs_MacOSXPreferencesFile_addChildToNode
|
||||
if (path) CFRelease(path);
|
||||
if (child) CFRelease(child);
|
||||
if (name) CFRelease(name);
|
||||
return beforeAdd;
|
||||
}
|
||||
|
||||
|
||||
|
@ -941,14 +941,17 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeRevalidateNSW
|
||||
(JNIEnv *env, jclass clazz, jlong windowPtr)
|
||||
{
|
||||
JNF_COCOA_ENTER(env);
|
||||
AWT_ASSERT_NOT_APPKIT_THREAD;
|
||||
|
||||
NSWindow *nsWindow = OBJC(windowPtr);
|
||||
[JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
if ([NSThread isMainThread]) {
|
||||
[nsWindow invalidateShadow];
|
||||
}];
|
||||
} else {
|
||||
[JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
[nsWindow invalidateShadow];
|
||||
}];
|
||||
}
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
/*
|
||||
* Convert the mode string to the more convinient bits per pixel value
|
||||
*/
|
||||
static int getBPPFromModeString(CFStringRef mode)
|
||||
static int getBPPFromModeString(CFStringRef mode)
|
||||
{
|
||||
if ((CFStringCompare(mode, CFSTR(kIO30BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)) {
|
||||
// This is a strange mode, where we using 10 bits per RGB component and pack it into 32 bits
|
||||
@ -44,7 +44,7 @@ static int getBPPFromModeString(CFStringRef mode)
|
||||
else if (CFStringCompare(mode, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -68,6 +68,11 @@ static CGDisplayModeRef getBestModeForParameters(CFArrayRef allModes, int w, int
|
||||
// One of the key parameters does not match
|
||||
continue;
|
||||
}
|
||||
|
||||
if (refrate == 0) { // REFRESH_RATE_UNKNOWN
|
||||
return cRef;
|
||||
}
|
||||
|
||||
// Refresh rate might be 0 in display mode and we ask for specific display rate
|
||||
// but if we do not find exact match then 0 refresh rate might be just Ok
|
||||
if (CGDisplayModeGetRefreshRate(cRef) == refrate) {
|
||||
@ -165,7 +170,10 @@ Java_sun_awt_CGraphicsDevice_nativeSetDisplayMode
|
||||
}
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
[JNFException raise:env as:kIllegalArgumentException reason:"Invalid display mode"];
|
||||
}
|
||||
|
||||
CFRelease(allModes);
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.text.MessageFormat;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@ -381,12 +382,15 @@ class Driver {
|
||||
String prefix = base.getName();
|
||||
if (prefix.length() < 3) prefix += "tmp";
|
||||
|
||||
File where = base.getParentFile();
|
||||
File where = (base.getParentFile() == null && suffix.equals(".bak"))
|
||||
? new File(".").getAbsoluteFile()
|
||||
: base.getParentFile();
|
||||
|
||||
if ( base.getParentFile() == null && suffix.equals(".bak"))
|
||||
where = new File(".").getAbsoluteFile();
|
||||
Path tmpfile = (where == null)
|
||||
? Files.createTempFile(prefix, suffix)
|
||||
: Files.createTempFile(where.toPath(), prefix, suffix);
|
||||
|
||||
return Files.createTempFile(where.toPath(), prefix, suffix).toFile();
|
||||
return tmpfile.toFile();
|
||||
}
|
||||
|
||||
static private
|
||||
|
@ -137,7 +137,7 @@ public final class HttpCookie implements Cloneable {
|
||||
|
||||
private HttpCookie(String name, String value, String header) {
|
||||
name = name.trim();
|
||||
if (name.length() == 0 || !isToken(name) || isReserved(name)) {
|
||||
if (name.length() == 0 || !isToken(name)) {
|
||||
throw new IllegalArgumentException("Illegal cookie name");
|
||||
}
|
||||
|
||||
@ -781,33 +781,6 @@ public final class HttpCookie implements Cloneable {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* @param name
|
||||
* the name to be tested
|
||||
*
|
||||
* @return {@code true} if the name is reserved by cookie specification,
|
||||
* {@code false} if it is not
|
||||
*/
|
||||
private static boolean isReserved(String name) {
|
||||
if (name.equalsIgnoreCase("Comment")
|
||||
|| name.equalsIgnoreCase("CommentURL") // rfc2965 only
|
||||
|| name.equalsIgnoreCase("Discard") // rfc2965 only
|
||||
|| name.equalsIgnoreCase("Domain")
|
||||
|| name.equalsIgnoreCase("Expires") // netscape draft only
|
||||
|| name.equalsIgnoreCase("Max-Age")
|
||||
|| name.equalsIgnoreCase("Path")
|
||||
|| name.equalsIgnoreCase("Port") // rfc2965 only
|
||||
|| name.equalsIgnoreCase("Secure")
|
||||
|| name.equalsIgnoreCase("Version")
|
||||
|| name.equalsIgnoreCase("HttpOnly")
|
||||
|| name.charAt(0) == '$')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse header string to cookie object.
|
||||
*
|
||||
|
@ -26,7 +26,6 @@
|
||||
package javax.security.auth.kerberos;
|
||||
|
||||
import java.io.*;
|
||||
import sun.security.krb5.Asn1Exception;
|
||||
import sun.security.krb5.KrbException;
|
||||
import sun.security.krb5.PrincipalName;
|
||||
import sun.security.krb5.Realm;
|
||||
@ -81,14 +80,12 @@ public final class KerberosPrincipal
|
||||
|
||||
public static final int KRB_NT_UID = 5;
|
||||
|
||||
|
||||
private transient String fullName;
|
||||
|
||||
private transient String realm;
|
||||
|
||||
private transient int nameType;
|
||||
|
||||
private static final char NAME_REALM_SEPARATOR = '@';
|
||||
|
||||
/**
|
||||
* Constructs a KerberosPrincipal from the provided string input. The
|
||||
@ -233,41 +230,35 @@ public final class KerberosPrincipal
|
||||
* realm in their DER-encoded form as specified in Section 5.2.2 of
|
||||
* <a href=http://www.ietf.org/rfc/rfc4120.txt> RFC4120</a>.
|
||||
*/
|
||||
|
||||
private void writeObject(ObjectOutputStream oos)
|
||||
throws IOException {
|
||||
throws IOException {
|
||||
|
||||
PrincipalName krb5Principal = null;
|
||||
PrincipalName krb5Principal;
|
||||
try {
|
||||
krb5Principal = new PrincipalName(fullName,nameType);
|
||||
krb5Principal = new PrincipalName(fullName, nameType);
|
||||
oos.writeObject(krb5Principal.asn1Encode());
|
||||
oos.writeObject(krb5Principal.getRealm().asn1Encode());
|
||||
} catch (Exception e) {
|
||||
IOException ioe = new IOException(e.getMessage());
|
||||
ioe.initCause(e);
|
||||
throw ioe;
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads this object from a stream (i.e., deserializes it)
|
||||
*/
|
||||
|
||||
private void readObject(ObjectInputStream ois)
|
||||
throws IOException, ClassNotFoundException {
|
||||
throws IOException, ClassNotFoundException {
|
||||
byte[] asn1EncPrincipal = (byte [])ois.readObject();
|
||||
byte[] encRealm = (byte [])ois.readObject();
|
||||
try {
|
||||
PrincipalName krb5Principal = new PrincipalName(new
|
||||
DerValue(asn1EncPrincipal));
|
||||
realm = (new Realm(new DerValue(encRealm))).toString();
|
||||
fullName = krb5Principal.toString() + NAME_REALM_SEPARATOR +
|
||||
realm.toString();
|
||||
Realm realmObject = new Realm(new DerValue(encRealm));
|
||||
PrincipalName krb5Principal = new PrincipalName(
|
||||
new DerValue(asn1EncPrincipal), realmObject);
|
||||
realm = realmObject.toString();
|
||||
fullName = krb5Principal.toString();
|
||||
nameType = krb5Principal.getNameType();
|
||||
} catch (Exception e) {
|
||||
IOException ioe = new IOException(e.getMessage());
|
||||
ioe.initCause(e);
|
||||
throw ioe;
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -288,9 +279,7 @@ public final class KerberosPrincipal
|
||||
* <a href=http://www.ietf.org/rfc/rfc4120.txt> RFC4120</a>.
|
||||
*
|
||||
* @return the name type.
|
||||
*
|
||||
*/
|
||||
|
||||
public int getNameType() {
|
||||
return nameType;
|
||||
}
|
||||
|
@ -1586,10 +1586,18 @@ public class JViewport extends JComponent implements Accessible
|
||||
int bdx = blitToX - blitFromX;
|
||||
int bdy = blitToY - blitFromY;
|
||||
|
||||
Composite oldComposite = null;
|
||||
// Shift the scrolled region
|
||||
if (g instanceof Graphics2D) {
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
oldComposite = g2d.getComposite();
|
||||
g2d.setComposite(AlphaComposite.Src);
|
||||
}
|
||||
rm.copyArea(this, g, blitFromX, blitFromY, blitW, blitH, bdx, bdy,
|
||||
false);
|
||||
|
||||
if (oldComposite != null) {
|
||||
((Graphics2D) g).setComposite(oldComposite);
|
||||
}
|
||||
// Paint the newly exposed region.
|
||||
int x = view.getX();
|
||||
int y = view.getY();
|
||||
|
@ -118,6 +118,11 @@ public class RepaintManager
|
||||
|
||||
// Whether or not a VolatileImage should be used for double-buffered painting
|
||||
static boolean volatileImageBufferEnabled = true;
|
||||
/**
|
||||
* Type of VolatileImage which should be used for double-buffered
|
||||
* painting.
|
||||
*/
|
||||
private static final int volatileBufferType;
|
||||
/**
|
||||
* Value of the system property awt.nativeDoubleBuffering.
|
||||
*/
|
||||
@ -204,6 +209,13 @@ public class RepaintManager
|
||||
((SunGraphicsEnvironment)ge).addDisplayChangedListener(
|
||||
new DisplayChangedHandler());
|
||||
}
|
||||
Toolkit tk = Toolkit.getDefaultToolkit();
|
||||
if ((tk instanceof SunToolkit)
|
||||
&& ((SunToolkit) tk).isSwingBackbufferTranslucencySupported()) {
|
||||
volatileBufferType = Transparency.TRANSLUCENT;
|
||||
} else {
|
||||
volatileBufferType = Transparency.OPAQUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -989,7 +1001,8 @@ public class RepaintManager
|
||||
if (image != null) {
|
||||
image.flush();
|
||||
}
|
||||
image = config.createCompatibleVolatileImage(width, height);
|
||||
image = config.createCompatibleVolatileImage(width, height,
|
||||
volatileBufferType);
|
||||
volatileMap.put(config, image);
|
||||
}
|
||||
return image;
|
||||
@ -1483,9 +1496,26 @@ public class RepaintManager
|
||||
for(y=clipY, maxy = clipY + clipH; y < maxy ; y += bh) {
|
||||
osg.translate(-x, -y);
|
||||
osg.setClip(x,y,bw,bh);
|
||||
if (volatileBufferType != Transparency.OPAQUE
|
||||
&& osg instanceof Graphics2D) {
|
||||
final Graphics2D g2d = (Graphics2D) osg;
|
||||
final Color oldBg = g2d.getBackground();
|
||||
g2d.setBackground(c.getBackground());
|
||||
g2d.clearRect(x, y, bw, bh);
|
||||
g2d.setBackground(oldBg);
|
||||
}
|
||||
c.paintToOffscreen(osg, x, y, bw, bh, maxx, maxy);
|
||||
g.setClip(x, y, bw, bh);
|
||||
g.drawImage(image, x, y, c);
|
||||
if (volatileBufferType != Transparency.OPAQUE
|
||||
&& g instanceof Graphics2D) {
|
||||
final Graphics2D g2d = (Graphics2D) g;
|
||||
final Composite oldComposite = g2d.getComposite();
|
||||
g2d.setComposite(AlphaComposite.Src);
|
||||
g2d.drawImage(image, x, y, c);
|
||||
g2d.setComposite(oldComposite);
|
||||
} else {
|
||||
g.drawImage(image, x, y, c);
|
||||
}
|
||||
osg.translate(x, y);
|
||||
}
|
||||
}
|
||||
|
@ -319,7 +319,8 @@ public class SwingUtilities implements SwingConstants
|
||||
newEvent = new MouseWheelEvent(newSource,
|
||||
sourceWheelEvent.getID(),
|
||||
sourceWheelEvent.getWhen(),
|
||||
sourceWheelEvent.getModifiers(),
|
||||
sourceWheelEvent.getModifiers()
|
||||
| sourceWheelEvent.getModifiersEx(),
|
||||
p.x,p.y,
|
||||
sourceWheelEvent.getXOnScreen(),
|
||||
sourceWheelEvent.getYOnScreen(),
|
||||
@ -334,7 +335,8 @@ public class SwingUtilities implements SwingConstants
|
||||
newEvent = new MenuDragMouseEvent(newSource,
|
||||
sourceMenuDragEvent.getID(),
|
||||
sourceMenuDragEvent.getWhen(),
|
||||
sourceMenuDragEvent.getModifiers(),
|
||||
sourceMenuDragEvent.getModifiers()
|
||||
| sourceMenuDragEvent.getModifiersEx(),
|
||||
p.x,p.y,
|
||||
sourceMenuDragEvent.getXOnScreen(),
|
||||
sourceMenuDragEvent.getYOnScreen(),
|
||||
@ -347,7 +349,8 @@ public class SwingUtilities implements SwingConstants
|
||||
newEvent = new MouseEvent(newSource,
|
||||
sourceEvent.getID(),
|
||||
sourceEvent.getWhen(),
|
||||
sourceEvent.getModifiers(),
|
||||
sourceEvent.getModifiers()
|
||||
| sourceEvent.getModifiersEx(),
|
||||
p.x,p.y,
|
||||
sourceEvent.getXOnScreen(),
|
||||
sourceEvent.getYOnScreen(),
|
||||
|
@ -440,7 +440,7 @@ public class TitledBorder extends AbstractBorder
|
||||
* @return the title-font of the titled border
|
||||
*/
|
||||
public Font getTitleFont() {
|
||||
return titleFont;
|
||||
return titleFont == null ? UIManager.getFont("TitledBorder.font") : titleFont;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -449,7 +449,7 @@ public class TitledBorder extends AbstractBorder
|
||||
* @return the title-color of the titled border
|
||||
*/
|
||||
public Color getTitleColor() {
|
||||
return titleColor;
|
||||
return titleColor == null ? UIManager.getColor("TitledBorder.titleColor") : titleColor;
|
||||
}
|
||||
|
||||
|
||||
@ -681,10 +681,6 @@ public class TitledBorder extends AbstractBorder
|
||||
if (font != null) {
|
||||
return font;
|
||||
}
|
||||
font = UIManager.getFont("TitledBorder.font");
|
||||
if (font != null) {
|
||||
return font;
|
||||
}
|
||||
if (c != null) {
|
||||
font = c.getFont();
|
||||
if (font != null) {
|
||||
@ -699,10 +695,6 @@ public class TitledBorder extends AbstractBorder
|
||||
if (color != null) {
|
||||
return color;
|
||||
}
|
||||
color = UIManager.getColor("TitledBorder.titleColor");
|
||||
if (color != null) {
|
||||
return color;
|
||||
}
|
||||
return (c != null)
|
||||
? c.getForeground()
|
||||
: null;
|
||||
|
@ -1984,6 +1984,13 @@ public abstract class SunToolkit extends Toolkit
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if swing backbuffer should be translucent.
|
||||
*/
|
||||
public boolean isSwingBackbufferTranslucencySupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not a containing top level window for the passed
|
||||
* component is
|
||||
@ -2105,25 +2112,41 @@ class PostEventQueue {
|
||||
private EventQueueItem queueTail = null;
|
||||
private final EventQueue eventQueue;
|
||||
|
||||
// For the case when queue is cleared but events are not posted
|
||||
private volatile boolean isFlushing = false;
|
||||
|
||||
PostEventQueue(EventQueue eq) {
|
||||
eventQueue = eq;
|
||||
}
|
||||
|
||||
public synchronized boolean noEvents() {
|
||||
return queueHead == null;
|
||||
return queueHead == null && !isFlushing;
|
||||
}
|
||||
|
||||
/*
|
||||
* Continually post pending AWTEvents to the Java EventQueue. The method
|
||||
* is synchronized to ensure the flush is completed before a new event
|
||||
* can be posted to this queue.
|
||||
*
|
||||
* 7177040: The method couldn't be wholly synchronized because of calls
|
||||
* of EventQueue.postEvent() that uses pushPopLock, otherwise it could
|
||||
* potentially lead to deadlock
|
||||
*/
|
||||
public synchronized void flush() {
|
||||
EventQueueItem tempQueue = queueHead;
|
||||
queueHead = queueTail = null;
|
||||
while (tempQueue != null) {
|
||||
eventQueue.postEvent(tempQueue.event);
|
||||
tempQueue = tempQueue.next;
|
||||
public void flush() {
|
||||
EventQueueItem tempQueue;
|
||||
synchronized (this) {
|
||||
tempQueue = queueHead;
|
||||
queueHead = queueTail = null;
|
||||
isFlushing = true;
|
||||
}
|
||||
try {
|
||||
while (tempQueue != null) {
|
||||
eventQueue.postEvent(tempQueue.event);
|
||||
tempQueue = tempQueue.next;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
isFlushing = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,8 +137,9 @@ public final class SunLayoutEngine implements LayoutEngine, LayoutEngineFactory
|
||||
|
||||
LayoutEngine e = (LayoutEngine)cache.get(key);
|
||||
if (e == null) {
|
||||
e = new SunLayoutEngine(key.copy());
|
||||
cache.put(key, e);
|
||||
LayoutEngineKey copy = key.copy();
|
||||
e = new SunLayoutEngine(copy);
|
||||
cache.put(copy, e);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.Surrogate;
|
||||
import sun.nio.cs.ArrayDecoder;
|
||||
import sun.nio.cs.ArrayEncoder;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
/*
|
||||
@ -107,7 +109,7 @@ public class DoubleByte {
|
||||
}
|
||||
|
||||
public static class Decoder extends CharsetDecoder
|
||||
implements DelegatableDecoder
|
||||
implements DelegatableDecoder, ArrayDecoder
|
||||
{
|
||||
|
||||
final char[][] b2c;
|
||||
@ -209,6 +211,29 @@ public class DoubleByte {
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
public int decode(byte[] src, int sp, int len, char[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
char repl = replacement().charAt(0);
|
||||
while (sp < sl) {
|
||||
int b1 = src[sp++] & 0xff;
|
||||
char c = b2cSB[b1];
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
if (sp < sl) {
|
||||
int b2 = src[sp++] & 0xff;
|
||||
if (b2 >= b2Min && b2 <= b2Max) {
|
||||
c = b2c[b1][b2 - b2Min];
|
||||
}
|
||||
}
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
c = repl;
|
||||
}
|
||||
}
|
||||
dst[dp++] = c;
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
|
||||
public void implReset() {
|
||||
super.implReset();
|
||||
}
|
||||
@ -228,6 +253,7 @@ public class DoubleByte {
|
||||
return UNMAPPABLE_DECODING;
|
||||
return b2c[b1][b2 - b2Min];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// IBM_EBCDIC_DBCS
|
||||
@ -367,6 +393,46 @@ public class DoubleByte {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
public int decode(byte[] src, int sp, int len, char[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
currentState = SBCS;
|
||||
char repl = replacement().charAt(0);
|
||||
while (sp < sl) {
|
||||
int b1 = src[sp++] & 0xff;
|
||||
if (b1 == SO) { // Shift out
|
||||
if (currentState != SBCS)
|
||||
dst[dp++] = repl;
|
||||
else
|
||||
currentState = DBCS;
|
||||
} else if (b1 == SI) {
|
||||
if (currentState != DBCS)
|
||||
dst[dp++] = repl;
|
||||
else
|
||||
currentState = SBCS;
|
||||
} else {
|
||||
char c = UNMAPPABLE_DECODING;
|
||||
if (currentState == SBCS) {
|
||||
c = b2cSB[b1];
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
c = repl;
|
||||
} else {
|
||||
if (sl == sp) {
|
||||
c = repl;
|
||||
} else {
|
||||
int b2 = src[sp++] & 0xff;
|
||||
if (b2 < b2Min || b2 > b2Max ||
|
||||
(c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
|
||||
c = repl;
|
||||
}
|
||||
}
|
||||
}
|
||||
dst[dp++] = c;
|
||||
}
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
}
|
||||
|
||||
// EBCDIC_DBCS_ONLY
|
||||
@ -405,9 +471,37 @@ public class DoubleByte {
|
||||
return CoderResult.malformedForLength(1);
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
|
||||
public int decode(byte[] src, int sp, int len, char[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
char repl = replacement().charAt(0);
|
||||
while (sp < sl) {
|
||||
int b1 = src[sp++] & 0xff;
|
||||
char c = b2cSB[b1];
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
if (sp < sl) {
|
||||
int b2 = src[sp++] & 0xff;
|
||||
if (b2 < b2Min || b2 > b2Max ||
|
||||
(c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
|
||||
if (b1 == SS2 || b1 == SS3) {
|
||||
sp--;
|
||||
}
|
||||
c = repl;
|
||||
}
|
||||
} else {
|
||||
c = repl;
|
||||
}
|
||||
}
|
||||
dst[dp++] = c;
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Encoder extends CharsetEncoder {
|
||||
public static class Encoder extends CharsetEncoder
|
||||
implements ArrayEncoder
|
||||
{
|
||||
final int MAX_SINGLEBYTE = 0xff;
|
||||
private final char[] c2b;
|
||||
private final char[] c2bIndex;
|
||||
@ -516,6 +610,35 @@ public class DoubleByte {
|
||||
return encodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
public int encode(char[] src, int sp, int len, byte[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
int dl = dst.length;
|
||||
while (sp < sl) {
|
||||
char c = src[sp++];
|
||||
int bb = encodeChar(c);
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
if (Character.isHighSurrogate(c) && sp < sl &&
|
||||
Character.isLowSurrogate(src[sp])) {
|
||||
sp++;
|
||||
}
|
||||
byte[] repl = replacement();
|
||||
dst[dp++] = repl[0];
|
||||
if (repl.length > 1)
|
||||
dst[dp++] = repl[1];
|
||||
continue;
|
||||
} //else
|
||||
if (bb > MAX_SINGLEBYTE) { // DoubleByte
|
||||
dst[dp++] = (byte)(bb >> 8);
|
||||
dst[dp++] = (byte)bb;
|
||||
} else { // SingleByte
|
||||
dst[dp++] = (byte)bb;
|
||||
}
|
||||
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
|
||||
public int encodeChar(char ch) {
|
||||
return c2b[c2bIndex[ch >> 8] + (ch & 0xff)];
|
||||
}
|
||||
@ -604,7 +727,6 @@ public class DoubleByte {
|
||||
}
|
||||
}
|
||||
|
||||
// EBCDIC_DBCS_ONLY
|
||||
public static class Encoder_EBCDIC_DBCSONLY extends Encoder {
|
||||
Encoder_EBCDIC_DBCSONLY(Charset cs, byte[] repl,
|
||||
char[] c2b, char[] c2bIndex) {
|
||||
@ -619,7 +741,6 @@ public class DoubleByte {
|
||||
}
|
||||
}
|
||||
|
||||
// for IBM_EBCDIC_DBCS
|
||||
public static class Encoder_EBCDIC extends Encoder {
|
||||
static final int SBCS = 0;
|
||||
static final int DBCS = 1;
|
||||
@ -741,6 +862,47 @@ public class DoubleByte {
|
||||
src.position(mark);
|
||||
}
|
||||
}
|
||||
|
||||
public int encode(char[] src, int sp, int len, byte[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
while (sp < sl) {
|
||||
char c = src[sp++];
|
||||
int bb = encodeChar(c);
|
||||
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
if (Character.isHighSurrogate(c) && sp < sl &&
|
||||
Character.isLowSurrogate(src[sp])) {
|
||||
sp++;
|
||||
}
|
||||
byte[] repl = replacement();
|
||||
dst[dp++] = repl[0];
|
||||
if (repl.length > 1)
|
||||
dst[dp++] = repl[1];
|
||||
continue;
|
||||
} //else
|
||||
if (bb > MAX_SINGLEBYTE) { // DoubleByte
|
||||
if (currentState == SBCS) {
|
||||
currentState = DBCS;
|
||||
dst[dp++] = SO;
|
||||
}
|
||||
dst[dp++] = (byte)(bb >> 8);
|
||||
dst[dp++] = (byte)bb;
|
||||
} else { // SingleByte
|
||||
if (currentState == DBCS) {
|
||||
currentState = SBCS;
|
||||
dst[dp++] = SI;
|
||||
}
|
||||
dst[dp++] = (byte)bb;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentState == DBCS) {
|
||||
currentState = SBCS;
|
||||
dst[dp++] = SI;
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
}
|
||||
|
||||
// EUC_SIMPLE
|
||||
|
@ -175,6 +175,40 @@ public class HKSCS {
|
||||
}
|
||||
}
|
||||
|
||||
public int decode(byte[] src, int sp, int len, char[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
char repl = replacement().charAt(0);
|
||||
while (sp < sl) {
|
||||
int b1 = src[sp++] & 0xff;
|
||||
char c = decodeSingle(b1);
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
if (sl == sp) {
|
||||
c = repl;
|
||||
} else {
|
||||
int b2 = src[sp++] & 0xff;
|
||||
if (b2 < b2Min || b2 > b2Max) {
|
||||
c = repl;
|
||||
} else if ((c = decodeDouble(b1, b2)) == UNMAPPABLE_DECODING) {
|
||||
c = decodeDoubleEx(b1, b2); //supp
|
||||
if (c == UNMAPPABLE_DECODING) {
|
||||
c = decodeBig5(b1, b2); //big5
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
c = repl;
|
||||
} else {
|
||||
// supplementary character in u+2xxxx area
|
||||
dst[dp++] = Surrogate.high(0x20000 + c);
|
||||
dst[dp++] = Surrogate.low(0x20000 + c);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dst[dp++] = c;
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
|
||||
public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
|
||||
if (src.hasArray() && dst.hasArray())
|
||||
return decodeArrayLoop(src, dst);
|
||||
@ -322,6 +356,36 @@ public class HKSCS {
|
||||
return encodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
public int encode(char[] src, int sp, int len, byte[] dst) {
|
||||
int dp = 0;
|
||||
int sl = sp + len;
|
||||
while (sp < sl) {
|
||||
char c = src[sp++];
|
||||
int bb = encodeChar(c);
|
||||
if (bb == UNMAPPABLE_ENCODING) {
|
||||
if (!Character.isHighSurrogate(c) || sp == sl ||
|
||||
!Character.isLowSurrogate(src[sp]) ||
|
||||
(bb = encodeSupp(Character.toCodePoint(c, src[sp++])))
|
||||
== UNMAPPABLE_ENCODING) {
|
||||
byte[] repl = replacement();
|
||||
dst[dp++] = repl[0];
|
||||
if (repl.length > 1)
|
||||
dst[dp++] = repl[1];
|
||||
continue;
|
||||
}
|
||||
sp++;
|
||||
}
|
||||
if (bb > MAX_SINGLEBYTE) { // DoubleByte
|
||||
dst[dp++] = (byte)(bb >> 8);
|
||||
dst[dp++] = (byte)bb;
|
||||
} else { // SingleByte
|
||||
dst[dp++] = (byte)bb;
|
||||
}
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
|
||||
|
||||
static char[] C2B_UNMAPPABLE = new char[0x100];
|
||||
static {
|
||||
Arrays.fill(C2B_UNMAPPABLE, (char)UNMAPPABLE_ENCODING);
|
||||
|
@ -27,10 +27,8 @@ package sun.security.jgss.krb5;
|
||||
|
||||
import org.ietf.jgss.*;
|
||||
import sun.security.jgss.spi.*;
|
||||
import javax.security.auth.kerberos.*;
|
||||
import sun.security.krb5.PrincipalName;
|
||||
import sun.security.krb5.KrbException;
|
||||
import sun.security.krb5.ServiceName;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
@ -119,8 +117,8 @@ public class Krb5NameElement
|
||||
hostName = components[1];
|
||||
|
||||
String principal = getHostBasedInstance(service, hostName);
|
||||
principalName = new ServiceName(principal,
|
||||
PrincipalName.KRB_NT_SRV_HST);
|
||||
principalName = new PrincipalName(principal,
|
||||
PrincipalName.KRB_NT_SRV_HST);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -464,8 +464,7 @@ public class Credentials {
|
||||
System.out.println(">>> DEBUG: ----Credentials----");
|
||||
System.out.println("\tclient: " + c.client.toString());
|
||||
System.out.println("\tserver: " + c.server.toString());
|
||||
System.out.println("\tticket: realm: " + c.ticket.realm.toString());
|
||||
System.out.println("\t sname: " + c.ticket.sname.toString());
|
||||
System.out.println("\tticket: sname: " + c.ticket.sname.toString());
|
||||
if (c.startTime != null) {
|
||||
System.out.println("\tstartTime: " + c.startTime.getTime());
|
||||
}
|
||||
|
@ -179,7 +179,6 @@ public class KrbApReq {
|
||||
KrbApReq(APOptions apOptions,
|
||||
Ticket ticket,
|
||||
EncryptionKey key,
|
||||
Realm crealm,
|
||||
PrincipalName cname,
|
||||
Checksum cksum,
|
||||
KerberosTime ctime,
|
||||
@ -189,7 +188,7 @@ public class KrbApReq {
|
||||
throws Asn1Exception, IOException,
|
||||
KdcErrException, KrbCryptoException {
|
||||
|
||||
init(apOptions, ticket, key, crealm, cname,
|
||||
init(apOptions, ticket, key, cname,
|
||||
cksum, ctime, subKey, seqNumber, authorizationData,
|
||||
KeyUsage.KU_PA_TGS_REQ_AUTHENTICATOR);
|
||||
|
||||
@ -208,7 +207,6 @@ public class KrbApReq {
|
||||
init(options,
|
||||
tgs_creds.ticket,
|
||||
tgs_creds.key,
|
||||
tgs_creds.client.getRealm(),
|
||||
tgs_creds.client,
|
||||
cksum,
|
||||
ctime,
|
||||
@ -221,7 +219,6 @@ public class KrbApReq {
|
||||
private void init(APOptions apOptions,
|
||||
Ticket ticket,
|
||||
EncryptionKey key,
|
||||
Realm crealm,
|
||||
PrincipalName cname,
|
||||
Checksum cksum,
|
||||
KerberosTime ctime,
|
||||
@ -232,7 +229,7 @@ public class KrbApReq {
|
||||
throws Asn1Exception, IOException,
|
||||
KdcErrException, KrbCryptoException {
|
||||
|
||||
createMessage(apOptions, ticket, key, crealm, cname,
|
||||
createMessage(apOptions, ticket, key, cname,
|
||||
cksum, ctime, subKey, seqNumber, authorizationData,
|
||||
usage);
|
||||
obuf = apReqMessg.asn1Encode();
|
||||
@ -289,9 +286,6 @@ public class KrbApReq {
|
||||
ctime = authenticator.ctime;
|
||||
cusec = authenticator.cusec;
|
||||
authenticator.ctime.setMicroSeconds(authenticator.cusec);
|
||||
authenticator.cname.setRealm(authenticator.crealm);
|
||||
apReqMessg.ticket.sname.setRealm(apReqMessg.ticket.realm);
|
||||
enc_ticketPart.cname.setRealm(enc_ticketPart.crealm);
|
||||
|
||||
if (!authenticator.cname.equals(enc_ticketPart.cname))
|
||||
throw new KrbApErrException(Krb5.KRB_AP_ERR_BADMATCH);
|
||||
@ -457,7 +451,6 @@ public class KrbApReq {
|
||||
private void createMessage(APOptions apOptions,
|
||||
Ticket ticket,
|
||||
EncryptionKey key,
|
||||
Realm crealm,
|
||||
PrincipalName cname,
|
||||
Checksum cksum,
|
||||
KerberosTime ctime,
|
||||
@ -474,8 +467,7 @@ public class KrbApReq {
|
||||
seqno = new Integer(seqNumber.current());
|
||||
|
||||
authenticator =
|
||||
new Authenticator(crealm,
|
||||
cname,
|
||||
new Authenticator(cname,
|
||||
cksum,
|
||||
ctime.getMicroSeconds(),
|
||||
ctime,
|
||||
|
@ -48,8 +48,7 @@ abstract class KrbAppMessage {
|
||||
HostAddress rAddress,
|
||||
boolean timestampRequired,
|
||||
boolean seqNumberRequired,
|
||||
PrincipalName packetPrincipal,
|
||||
Realm packetRealm)
|
||||
PrincipalName packetPrincipal)
|
||||
throws KrbApErrException {
|
||||
|
||||
if (!Krb5.AP_EMPTY_ADDRESSES_ALLOWED || sAddress != null) {
|
||||
|
@ -152,11 +152,10 @@ class KrbAsRep extends KrbKdcRep {
|
||||
|
||||
DerValue encoding = new DerValue(enc_as_rep_part);
|
||||
EncASRepPart enc_part = new EncASRepPart(encoding);
|
||||
rep.ticket.sname.setRealm(rep.ticket.realm);
|
||||
rep.encKDCRepPart = enc_part;
|
||||
|
||||
ASReq req = asReq.getMessage();
|
||||
check(req, rep);
|
||||
check(true, req, rep);
|
||||
|
||||
creds = new Credentials(
|
||||
rep.ticket,
|
||||
|
@ -115,10 +115,8 @@ public class KrbAsReq {
|
||||
}
|
||||
|
||||
if (sname == null) {
|
||||
sname = new PrincipalName("krbtgt" +
|
||||
PrincipalName.NAME_COMPONENT_SEPARATOR +
|
||||
cname.getRealmAsString(),
|
||||
PrincipalName.KRB_NT_SRV_INST);
|
||||
String realm = cname.getRealmAsString();
|
||||
sname = PrincipalName.tgsService(realm, realm);
|
||||
}
|
||||
|
||||
if (till == null) {
|
||||
@ -128,7 +126,6 @@ public class KrbAsReq {
|
||||
// enc-authorization-data and additional-tickets never in AS-REQ
|
||||
KDCReqBody kdc_req_body = new KDCReqBody(options,
|
||||
cname,
|
||||
cname.getRealm(),
|
||||
sname,
|
||||
from,
|
||||
till,
|
||||
|
@ -99,9 +99,6 @@ public final class KrbAsReqBuilder {
|
||||
// Called by other constructors
|
||||
private void init(PrincipalName cname)
|
||||
throws KrbException {
|
||||
if (cname.getRealm() == null) {
|
||||
cname.setRealm(Config.getInstance().getDefaultRealm());
|
||||
}
|
||||
this.cname = cname;
|
||||
state = State.INIT;
|
||||
}
|
||||
|
@ -96,12 +96,11 @@ public class KrbCred {
|
||||
PrincipalName princ = delegatedCreds.getClient();
|
||||
Realm realm = princ.getRealm();
|
||||
PrincipalName tgService = delegatedCreds.getServer();
|
||||
Realm tgsRealm = tgService.getRealm();
|
||||
|
||||
KrbCredInfo credInfo = new KrbCredInfo(sessionKey, realm,
|
||||
KrbCredInfo credInfo = new KrbCredInfo(sessionKey,
|
||||
princ, delegatedCreds.flags, delegatedCreds.authTime,
|
||||
delegatedCreds.startTime, delegatedCreds.endTime,
|
||||
delegatedCreds.renewTill, tgsRealm, tgService,
|
||||
delegatedCreds.renewTill, tgService,
|
||||
delegatedCreds.cAddr);
|
||||
|
||||
timeStamp = new KerberosTime(KerberosTime.NOW);
|
||||
@ -138,19 +137,13 @@ public class KrbCred {
|
||||
|
||||
KrbCredInfo credInfo = encPart.ticketInfo[0];
|
||||
EncryptionKey credInfoKey = credInfo.key;
|
||||
Realm prealm = credInfo.prealm;
|
||||
// XXX PrincipalName can store realm + principalname or
|
||||
// just principal name.
|
||||
PrincipalName pname = credInfo.pname;
|
||||
pname.setRealm(prealm);
|
||||
TicketFlags flags = credInfo.flags;
|
||||
KerberosTime authtime = credInfo.authtime;
|
||||
KerberosTime starttime = credInfo.starttime;
|
||||
KerberosTime endtime = credInfo.endtime;
|
||||
KerberosTime renewTill = credInfo.renewTill;
|
||||
Realm srealm = credInfo.srealm;
|
||||
PrincipalName sname = credInfo.sname;
|
||||
sname.setRealm(srealm);
|
||||
HostAddresses caddr = credInfo.caddr;
|
||||
|
||||
if (DEBUG) {
|
||||
|
@ -45,6 +45,10 @@ public class KrbException extends Exception {
|
||||
super(s);
|
||||
}
|
||||
|
||||
public KrbException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public KrbException(int i) {
|
||||
returnCode = i;
|
||||
}
|
||||
|
@ -35,28 +35,17 @@ import sun.security.krb5.internal.*;
|
||||
abstract class KrbKdcRep {
|
||||
|
||||
static void check(
|
||||
boolean isAsReq,
|
||||
KDCReq req,
|
||||
KDCRep rep
|
||||
) throws KrbApErrException {
|
||||
|
||||
if (!req.reqBody.cname.equalsWithoutRealm(rep.cname)) {
|
||||
if (isAsReq && !req.reqBody.cname.equals(rep.cname)) {
|
||||
rep.encKDCRepPart.key.destroy();
|
||||
throw new KrbApErrException(Krb5.KRB_AP_ERR_MODIFIED);
|
||||
}
|
||||
|
||||
/**** XXX
|
||||
if (!req.reqBody.crealm.equals(rep.crealm)) {
|
||||
rep.encKDCRepPart.key.destroy();
|
||||
throw new KrbApErrException(Krb5.KRB_AP_ERR_MODIFIED);
|
||||
}
|
||||
*****/
|
||||
|
||||
if (!req.reqBody.sname.equalsWithoutRealm(rep.encKDCRepPart.sname)) {
|
||||
rep.encKDCRepPart.key.destroy();
|
||||
throw new KrbApErrException(Krb5.KRB_AP_ERR_MODIFIED);
|
||||
}
|
||||
|
||||
if (!req.reqBody.crealm.equals(rep.encKDCRepPart.srealm)) {
|
||||
if (!req.reqBody.sname.equals(rep.encKDCRepPart.sname)) {
|
||||
rep.encKDCRepPart.key.destroy();
|
||||
throw new KrbApErrException(Krb5.KRB_AP_ERR_MODIFIED);
|
||||
}
|
||||
@ -73,7 +62,6 @@ abstract class KrbKdcRep {
|
||||
throw new KrbApErrException(Krb5.KRB_AP_ERR_MODIFIED);
|
||||
}
|
||||
|
||||
|
||||
for (int i = 1; i < 6; i++) {
|
||||
if (req.reqBody.kdcOptions.get(i) !=
|
||||
rep.encKDCRepPart.flags.get(i)) {
|
||||
|
@ -89,8 +89,7 @@ class KrbPriv extends KrbAppMessage {
|
||||
raddr,
|
||||
timestampRequired,
|
||||
seqNumberRequired,
|
||||
creds.client,
|
||||
creds.client.getRealm()
|
||||
creds.client
|
||||
);
|
||||
}
|
||||
|
||||
@ -151,8 +150,7 @@ class KrbPriv extends KrbAppMessage {
|
||||
HostAddress rAddress,
|
||||
boolean timestampRequired,
|
||||
boolean seqNumberRequired,
|
||||
PrincipalName cname,
|
||||
Realm crealm
|
||||
PrincipalName cname
|
||||
) throws Asn1Exception, KdcErrException,
|
||||
KrbApErrException, IOException, KrbCryptoException {
|
||||
|
||||
@ -172,8 +170,7 @@ class KrbPriv extends KrbAppMessage {
|
||||
rAddress,
|
||||
timestampRequired,
|
||||
seqNumberRequired,
|
||||
cname,
|
||||
crealm
|
||||
cname
|
||||
);
|
||||
|
||||
return enc_part.userData;
|
||||
|
@ -90,8 +90,7 @@ class KrbSafe extends KrbAppMessage {
|
||||
raddr,
|
||||
timestampRequired,
|
||||
seqNumberRequired,
|
||||
creds.client,
|
||||
creds.client.getRealm()
|
||||
creds.client
|
||||
);
|
||||
}
|
||||
|
||||
@ -154,8 +153,7 @@ class KrbSafe extends KrbAppMessage {
|
||||
HostAddress rAddress,
|
||||
boolean timestampRequired,
|
||||
boolean seqNumberRequired,
|
||||
PrincipalName cname,
|
||||
Realm crealm
|
||||
PrincipalName cname
|
||||
) throws Asn1Exception, KdcErrException,
|
||||
KrbApErrException, IOException, KrbCryptoException {
|
||||
|
||||
@ -177,8 +175,7 @@ class KrbSafe extends KrbAppMessage {
|
||||
rAddress,
|
||||
timestampRequired,
|
||||
seqNumberRequired,
|
||||
cname,
|
||||
crealm
|
||||
cname
|
||||
);
|
||||
|
||||
return krb_safe.safeBody.userData;
|
||||
|
@ -82,12 +82,11 @@ public class KrbTgsRep extends KrbKdcRep {
|
||||
byte[] enc_tgs_rep_part = rep.encPart.reset(enc_tgs_rep_bytes);
|
||||
ref = new DerValue(enc_tgs_rep_part);
|
||||
EncTGSRepPart enc_part = new EncTGSRepPart(ref);
|
||||
rep.ticket.sname.setRealm(rep.ticket.realm);
|
||||
rep.encKDCRepPart = enc_part;
|
||||
|
||||
check(req, rep);
|
||||
check(false, req, rep);
|
||||
|
||||
creds = new Credentials(rep.ticket,
|
||||
this.creds = new Credentials(rep.ticket,
|
||||
req.reqBody.cname,
|
||||
rep.ticket.sname,
|
||||
enc_part.key,
|
||||
@ -99,7 +98,6 @@ public class KrbTgsRep extends KrbKdcRep {
|
||||
enc_part.caddr
|
||||
);
|
||||
this.rep = rep;
|
||||
this.creds = creds;
|
||||
this.secondTicket = tgsReq.getSecondTicket();
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,6 @@ public class KrbTgsReq {
|
||||
asCreds.key,
|
||||
ctime,
|
||||
princName,
|
||||
princName.getRealm(),
|
||||
servName,
|
||||
from,
|
||||
till,
|
||||
@ -214,7 +213,6 @@ public class KrbTgsReq {
|
||||
EncryptionKey key,
|
||||
KerberosTime ctime,
|
||||
PrincipalName cname,
|
||||
Realm crealm,
|
||||
PrincipalName sname,
|
||||
KerberosTime from,
|
||||
KerberosTime till,
|
||||
@ -273,8 +271,6 @@ public class KrbTgsReq {
|
||||
KDCReqBody reqBody = new KDCReqBody(
|
||||
kdc_options,
|
||||
cname,
|
||||
// crealm,
|
||||
sname.getRealm(), // TO
|
||||
sname,
|
||||
from,
|
||||
req_till,
|
||||
@ -315,7 +311,6 @@ public class KrbTgsReq {
|
||||
new APOptions(),
|
||||
ticket,
|
||||
key,
|
||||
crealm,
|
||||
cname,
|
||||
cksum,
|
||||
ctime,
|
||||
|
@ -38,15 +38,25 @@ import java.util.Vector;
|
||||
import java.util.Locale;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Arrays;
|
||||
import sun.security.krb5.internal.ccache.CCacheOutputStream;
|
||||
import sun.security.krb5.internal.util.KerberosString;
|
||||
|
||||
|
||||
/**
|
||||
* This class encapsulates a Kerberos principal.
|
||||
* Implements the ASN.1 PrincipalName type and its realm in a single class.
|
||||
* <xmp>
|
||||
* Realm ::= KerberosString
|
||||
*
|
||||
* PrincipalName ::= SEQUENCE {
|
||||
* name-type [0] Int32,
|
||||
* name-string [1] SEQUENCE OF KerberosString
|
||||
* }
|
||||
* </xmp>
|
||||
* This class is immutable.
|
||||
* @see Realm
|
||||
*/
|
||||
public class PrincipalName
|
||||
implements Cloneable {
|
||||
public class PrincipalName implements Cloneable {
|
||||
|
||||
//name types
|
||||
|
||||
@ -80,8 +90,6 @@ public class PrincipalName
|
||||
*/
|
||||
public static final int KRB_NT_UID = 5;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* TGS Name
|
||||
*/
|
||||
@ -96,98 +104,109 @@ public class PrincipalName
|
||||
public static final String NAME_REALM_SEPARATOR_STR = "@";
|
||||
public static final String REALM_COMPONENT_SEPARATOR_STR = ".";
|
||||
|
||||
private int nameType;
|
||||
private String[] nameStrings; // Principal names don't mutate often
|
||||
// Instance fields.
|
||||
|
||||
private Realm nameRealm; // optional; a null realm means use default
|
||||
// Note: the nameRealm is not included in the default ASN.1 encoding
|
||||
/**
|
||||
* The name type, from PrincipalName's name-type field.
|
||||
*/
|
||||
private final int nameType;
|
||||
|
||||
// cached salt, might be changed by KDC info, not used in clone
|
||||
private String salt = null;
|
||||
/**
|
||||
* The name strings, from PrincipalName's name-strings field. This field
|
||||
* must be neither null nor empty. Each entry of it must also be neither
|
||||
* null nor empty. Make sure to clone the field when it's passed in or out.
|
||||
*/
|
||||
private final String[] nameStrings;
|
||||
|
||||
protected PrincipalName() {
|
||||
/**
|
||||
* The realm this principal belongs to.
|
||||
*/
|
||||
private final Realm nameRealm; // not null
|
||||
|
||||
// cached default salt, not used in clone
|
||||
private transient String salt = null;
|
||||
|
||||
// There are 3 basic constructors. All other constructors must call them.
|
||||
// All basic constructors must call validateNameStrings.
|
||||
// 1. From name components
|
||||
// 2. From name
|
||||
// 3. From DER encoding
|
||||
|
||||
/**
|
||||
* Creates a PrincipalName.
|
||||
*/
|
||||
public PrincipalName(int nameType, String[] nameStrings, Realm nameRealm) {
|
||||
if (nameRealm == null) {
|
||||
throw new IllegalArgumentException("Null realm not allowed");
|
||||
}
|
||||
validateNameStrings(nameStrings);
|
||||
this.nameType = nameType;
|
||||
this.nameStrings = nameStrings.clone();
|
||||
this.nameRealm = nameRealm;
|
||||
}
|
||||
|
||||
// This method is called by Windows NativeCred.c
|
||||
public PrincipalName(String[] nameParts, String realm) throws RealmException {
|
||||
this(KRB_NT_UNKNOWN, nameParts, new Realm(realm));
|
||||
}
|
||||
|
||||
public PrincipalName(String[] nameParts, int type)
|
||||
throws IllegalArgumentException, IOException {
|
||||
if (nameParts == null) {
|
||||
throw new IllegalArgumentException("Null input not allowed");
|
||||
}
|
||||
nameStrings = new String[nameParts.length];
|
||||
System.arraycopy(nameParts, 0, nameStrings, 0, nameParts.length);
|
||||
nameType = type;
|
||||
nameRealm = null;
|
||||
throws IllegalArgumentException, RealmException {
|
||||
this(type, nameParts, Realm.getDefault());
|
||||
}
|
||||
|
||||
public PrincipalName(String[] nameParts) throws IOException {
|
||||
this(nameParts, KRB_NT_UNKNOWN);
|
||||
// Validate a nameStrings argument
|
||||
private static void validateNameStrings(String[] ns) {
|
||||
if (ns == null) {
|
||||
throw new IllegalArgumentException("Null nameStrings not allowed");
|
||||
}
|
||||
if (ns.length == 0) {
|
||||
throw new IllegalArgumentException("Empty nameStrings not allowed");
|
||||
}
|
||||
for (String s: ns) {
|
||||
if (s == null) {
|
||||
throw new IllegalArgumentException("Null nameString not allowed");
|
||||
}
|
||||
if (s.isEmpty()) {
|
||||
throw new IllegalArgumentException("Empty nameString not allowed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
try {
|
||||
PrincipalName pName = (PrincipalName) super.clone();
|
||||
// Re-assign mutable fields
|
||||
if (nameStrings != null) {
|
||||
pName.nameStrings = nameStrings.clone();
|
||||
}
|
||||
if (nameRealm != null) {
|
||||
pName.nameRealm = (Realm)nameRealm.clone();
|
||||
}
|
||||
UNSAFE.putObject(this, NAME_STRINGS_OFFSET, nameStrings.clone());
|
||||
return pName;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
throw new AssertionError("Should never happen");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Added to workaround a bug where the equals method that takes a
|
||||
* PrincipalName is not being called but Object.equals(Object) is
|
||||
* being called.
|
||||
*/
|
||||
private static final long NAME_STRINGS_OFFSET;
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
static {
|
||||
try {
|
||||
sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
|
||||
NAME_STRINGS_OFFSET = unsafe.objectFieldOffset(
|
||||
PrincipalName.class.getDeclaredField("nameStrings"));
|
||||
UNSAFE = unsafe;
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof PrincipalName)
|
||||
return equals((PrincipalName)o);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(PrincipalName other) {
|
||||
|
||||
|
||||
if (!equalsWithoutRealm(other)) {
|
||||
return false;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((nameRealm != null && other.nameRealm == null) ||
|
||||
(nameRealm == null && other.nameRealm != null)) {
|
||||
return false;
|
||||
if (o instanceof PrincipalName) {
|
||||
PrincipalName other = (PrincipalName)o;
|
||||
return nameRealm.equals(other.nameRealm) &&
|
||||
Arrays.equals(nameStrings, other.nameStrings);
|
||||
}
|
||||
|
||||
if (nameRealm != null && other.nameRealm != null) {
|
||||
if (!nameRealm.equals(other.nameRealm)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean equalsWithoutRealm(PrincipalName other) {
|
||||
|
||||
if ((nameStrings != null && other.nameStrings == null) ||
|
||||
(nameStrings == null && other.nameStrings != null))
|
||||
return false;
|
||||
|
||||
if (nameStrings != null && other.nameStrings != null) {
|
||||
if (nameStrings.length != other.nameStrings.length)
|
||||
return false;
|
||||
for (int i = 0; i < nameStrings.length; i++)
|
||||
if (!nameStrings[i].equals(other.nameStrings[i]))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -208,20 +227,23 @@ public class PrincipalName
|
||||
* http://www.ietf.org/rfc/rfc4120.txt</a>.
|
||||
*
|
||||
* @param encoding a Der-encoded data.
|
||||
* @param realm the realm for this name
|
||||
* @exception Asn1Exception if an error occurs while decoding
|
||||
* an ASN1 encoded data.
|
||||
* @exception Asn1Exception if there is an ASN1 encoding error
|
||||
* @exception IOException if an I/O error occurs
|
||||
* @exception IllegalArgumentException if encoding is null
|
||||
* reading encoded data.
|
||||
*
|
||||
*/
|
||||
public PrincipalName(DerValue encoding)
|
||||
throws Asn1Exception, IOException {
|
||||
nameRealm = null;
|
||||
public PrincipalName(DerValue encoding, Realm realm)
|
||||
throws Asn1Exception, IOException {
|
||||
if (realm == null) {
|
||||
throw new IllegalArgumentException("Null realm not allowed");
|
||||
}
|
||||
nameRealm = realm;
|
||||
DerValue der;
|
||||
if (encoding == null) {
|
||||
throw new IllegalArgumentException("Null input not allowed");
|
||||
throw new IllegalArgumentException("Null encoding not allowed");
|
||||
}
|
||||
if (encoding.getTag() != DerValue.tag_Sequence) {
|
||||
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
|
||||
@ -243,14 +265,12 @@ public class PrincipalName
|
||||
DerValue subSubDer;
|
||||
while(subDer.getData().available() > 0) {
|
||||
subSubDer = subDer.getData().getDerValue();
|
||||
v.addElement(new KerberosString(subSubDer).toString());
|
||||
}
|
||||
if (v.size() > 0) {
|
||||
nameStrings = new String[v.size()];
|
||||
v.copyInto(nameStrings);
|
||||
} else {
|
||||
nameStrings = new String[] {""};
|
||||
String namePart = new KerberosString(subSubDer).toString();
|
||||
v.addElement(namePart);
|
||||
}
|
||||
nameStrings = new String[v.size()];
|
||||
v.copyInto(nameStrings);
|
||||
validateNameStrings(nameStrings);
|
||||
} else {
|
||||
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
|
||||
}
|
||||
@ -267,32 +287,35 @@ public class PrincipalName
|
||||
* more marshaled value.
|
||||
* @param explicitTag tag number.
|
||||
* @param optional indicate if this data field is optional
|
||||
* @return an instance of <code>PrincipalName</code>.
|
||||
*
|
||||
* @param realm the realm for the name
|
||||
* @return an instance of <code>PrincipalName</code>, or null if the
|
||||
* field is optional and missing.
|
||||
*/
|
||||
public static PrincipalName parse(DerInputStream data,
|
||||
byte explicitTag, boolean
|
||||
optional)
|
||||
throws Asn1Exception, IOException {
|
||||
optional,
|
||||
Realm realm)
|
||||
throws Asn1Exception, IOException, RealmException {
|
||||
|
||||
if ((optional) && (((byte)data.peekByte() & (byte)0x1F) !=
|
||||
explicitTag))
|
||||
return null;
|
||||
DerValue der = data.getDerValue();
|
||||
if (explicitTag != (der.getTag() & (byte)0x1F))
|
||||
if (explicitTag != (der.getTag() & (byte)0x1F)) {
|
||||
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
|
||||
else {
|
||||
} else {
|
||||
DerValue subDer = der.getData().getDerValue();
|
||||
return new PrincipalName(subDer);
|
||||
if (realm == null) {
|
||||
realm = Realm.getDefault();
|
||||
}
|
||||
return new PrincipalName(subDer, realm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This is protected because the definition of a principal
|
||||
// string is fixed
|
||||
// XXX Error checkin consistent with MIT krb5_parse_name
|
||||
// Code repetition, realm parsed again by class Realm
|
||||
protected static String[] parseName(String name) {
|
||||
private static String[] parseName(String name) {
|
||||
|
||||
Vector<String> tempStrings = new Vector<>();
|
||||
String temp = name;
|
||||
@ -312,13 +335,13 @@ public class PrincipalName
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
if (componentStart < i) {
|
||||
if (componentStart <= i) {
|
||||
component = temp.substring(componentStart, i);
|
||||
tempStrings.addElement(component);
|
||||
}
|
||||
componentStart = i + 1;
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
if (temp.charAt(i) == NAME_REALM_SEPARATOR) {
|
||||
/*
|
||||
* If this separator is escaped then don't treat it
|
||||
@ -337,11 +360,11 @@ public class PrincipalName
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i == temp.length())
|
||||
if (componentStart < i) {
|
||||
if (i == temp.length()) {
|
||||
component = temp.substring(componentStart, i);
|
||||
tempStrings.addElement(component);
|
||||
}
|
||||
@ -351,30 +374,26 @@ public class PrincipalName
|
||||
return result;
|
||||
}
|
||||
|
||||
public PrincipalName(String name, int type)
|
||||
throws RealmException {
|
||||
/**
|
||||
* Constructs a PrincipalName from a string.
|
||||
* @param name the name
|
||||
* @param type the type
|
||||
* @param realm the realm, null if not known. Note that when realm is not
|
||||
* null, it will be always used even if there is a realm part in name. When
|
||||
* realm is null, will read realm part from name, or try to map a realm
|
||||
* (for KRB_NT_SRV_HST), or use the default realm, or fail
|
||||
* @throws RealmException
|
||||
*/
|
||||
public PrincipalName(String name, int type, String realm)
|
||||
throws RealmException {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("Null name not allowed");
|
||||
}
|
||||
String[] nameParts = parseName(name);
|
||||
Realm tempRealm = null;
|
||||
String realmString = Realm.parseRealmAtSeparator(name);
|
||||
|
||||
if (realmString == null) {
|
||||
try {
|
||||
Config config = Config.getInstance();
|
||||
realmString = config.getDefaultRealm();
|
||||
} catch (KrbException e) {
|
||||
RealmException re =
|
||||
new RealmException(e.getMessage());
|
||||
re.initCause(e);
|
||||
throw re;
|
||||
}
|
||||
validateNameStrings(nameParts);
|
||||
if (realm == null) {
|
||||
realm = Realm.parseRealmAtSeparator(name);
|
||||
}
|
||||
|
||||
if (realmString != null)
|
||||
tempRealm = new Realm(realmString);
|
||||
|
||||
switch (type) {
|
||||
case KRB_NT_SRV_HST:
|
||||
if (nameParts.length >= 2) {
|
||||
@ -401,18 +420,22 @@ public class PrincipalName
|
||||
}
|
||||
nameStrings = nameParts;
|
||||
nameType = type;
|
||||
|
||||
if (realm != null) {
|
||||
nameRealm = new Realm(realm);
|
||||
} else {
|
||||
// We will try to get realm name from the mapping in
|
||||
// the configuration. If it is not specified
|
||||
// we will use the default realm. This nametype does
|
||||
// not allow a realm to be specified. The name string must of
|
||||
// the form service@host and this is internally changed into
|
||||
// service/host by Kerberos
|
||||
|
||||
String mapRealm = mapHostToRealm(nameParts[1]);
|
||||
if (mapRealm != null) {
|
||||
nameRealm = new Realm(mapRealm);
|
||||
} else {
|
||||
nameRealm = tempRealm;
|
||||
String mapRealm = mapHostToRealm(nameParts[1]);
|
||||
if (mapRealm != null) {
|
||||
nameRealm = new Realm(mapRealm);
|
||||
} else {
|
||||
nameRealm = Realm.getDefault();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KRB_NT_UNKNOWN:
|
||||
@ -422,20 +445,34 @@ public class PrincipalName
|
||||
case KRB_NT_UID:
|
||||
nameStrings = nameParts;
|
||||
nameType = type;
|
||||
nameRealm = tempRealm;
|
||||
if (realm != null) {
|
||||
nameRealm = new Realm(realm);
|
||||
} else {
|
||||
nameRealm = Realm.getDefault();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Illegal name type");
|
||||
}
|
||||
}
|
||||
|
||||
public PrincipalName(String name, int type) throws RealmException {
|
||||
this(name, type, (String)null);
|
||||
}
|
||||
|
||||
public PrincipalName(String name) throws RealmException {
|
||||
this(name, KRB_NT_UNKNOWN);
|
||||
}
|
||||
|
||||
public PrincipalName(String name, String realm) throws RealmException {
|
||||
this(name, KRB_NT_UNKNOWN);
|
||||
nameRealm = new Realm(realm);
|
||||
this(name, KRB_NT_UNKNOWN, realm);
|
||||
}
|
||||
|
||||
public static PrincipalName tgsService(String r1, String r2)
|
||||
throws KrbException {
|
||||
return new PrincipalName(PrincipalName.KRB_NT_SRV_INST,
|
||||
new String[] {PrincipalName.TGS_DEFAULT_SRV_NAME, r1},
|
||||
new Realm(r2));
|
||||
}
|
||||
|
||||
public String getRealmAsString() {
|
||||
@ -475,29 +512,17 @@ public class PrincipalName
|
||||
}
|
||||
|
||||
public String getRealmString() {
|
||||
if (nameRealm != null)
|
||||
return nameRealm.toString();
|
||||
return null;
|
||||
return nameRealm.toString();
|
||||
}
|
||||
|
||||
public Realm getRealm() {
|
||||
return nameRealm;
|
||||
}
|
||||
|
||||
public void setRealm(Realm new_nameRealm) throws RealmException {
|
||||
nameRealm = new_nameRealm;
|
||||
}
|
||||
|
||||
public void setRealm(String realmsString) throws RealmException {
|
||||
nameRealm = new Realm(realmsString);
|
||||
}
|
||||
|
||||
public String getSalt() {
|
||||
if (salt == null) {
|
||||
StringBuffer salt = new StringBuffer();
|
||||
if (nameRealm != null) {
|
||||
salt.append(nameRealm.toString());
|
||||
}
|
||||
salt.append(nameRealm.toString());
|
||||
for (int i = 0; i < nameStrings.length; i++) {
|
||||
salt.append(nameStrings[i]);
|
||||
}
|
||||
@ -513,11 +538,8 @@ public class PrincipalName
|
||||
str.append("/");
|
||||
str.append(nameStrings[i]);
|
||||
}
|
||||
if (nameRealm != null) {
|
||||
str.append("@");
|
||||
str.append(nameRealm.toString());
|
||||
}
|
||||
|
||||
str.append("@");
|
||||
str.append(nameRealm.toString());
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
@ -532,7 +554,8 @@ public class PrincipalName
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes a <code>PrincipalName</code> object.
|
||||
* Encodes a <code>PrincipalName</code> object. Note that only the type and
|
||||
* names are encoded. To encode the realm, call getRealm().asn1Encode().
|
||||
* @return the byte array of the encoded PrncipalName object.
|
||||
* @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
|
||||
* @exception IOException if an I/O error occurs while reading encoded data.
|
||||
@ -597,12 +620,10 @@ public class PrincipalName
|
||||
public void writePrincipal(CCacheOutputStream cos) throws IOException {
|
||||
cos.write32(nameType);
|
||||
cos.write32(nameStrings.length);
|
||||
if (nameRealm != null) {
|
||||
byte[] realmBytes = null;
|
||||
realmBytes = nameRealm.toString().getBytes();
|
||||
cos.write32(realmBytes.length);
|
||||
cos.write(realmBytes, 0, realmBytes.length);
|
||||
}
|
||||
byte[] realmBytes = null;
|
||||
realmBytes = nameRealm.toString().getBytes();
|
||||
cos.write32(realmBytes.length);
|
||||
cos.write(realmBytes, 0, realmBytes.length);
|
||||
byte[] bytes = null;
|
||||
for (int i = 0; i < nameStrings.length; i++) {
|
||||
bytes = nameStrings[i].getBytes();
|
||||
@ -611,31 +632,6 @@ public class PrincipalName
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a KRB_NT_SRV_INST name from the supplied
|
||||
* name components and realm.
|
||||
* @param primary the primary component of the name
|
||||
* @param instance the instance component of the name
|
||||
* @param realm the realm
|
||||
* @throws KrbException
|
||||
*/
|
||||
protected PrincipalName(String primary, String instance, String realm,
|
||||
int type)
|
||||
throws KrbException {
|
||||
|
||||
if (type != KRB_NT_SRV_INST) {
|
||||
throw new KrbException(Krb5.KRB_ERR_GENERIC, "Bad name type");
|
||||
}
|
||||
|
||||
String[] nParts = new String[2];
|
||||
nParts[0] = primary;
|
||||
nParts[1] = instance;
|
||||
|
||||
this.nameStrings = nParts;
|
||||
this.nameRealm = new Realm(realm);
|
||||
this.nameType = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the instance component of a name.
|
||||
* In a multi-component name such as a KRB_NT_SRV_INST
|
||||
|
@ -46,24 +46,29 @@ import sun.security.krb5.internal.util.KerberosString;
|
||||
* <xmp>
|
||||
* Realm ::= GeneralString
|
||||
* </xmp>
|
||||
* This class is immutable.
|
||||
*/
|
||||
public class Realm implements Cloneable {
|
||||
private String realm;
|
||||
private final String realm; // not null nor empty
|
||||
private static boolean DEBUG = Krb5.DEBUG;
|
||||
|
||||
private Realm() {
|
||||
}
|
||||
|
||||
public Realm(String name) throws RealmException {
|
||||
realm = parseRealm(name);
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
Realm new_realm = new Realm();
|
||||
if (realm != null) {
|
||||
new_realm.realm = new String(realm);
|
||||
public static Realm getDefault() throws RealmException {
|
||||
try {
|
||||
return new Realm(Config.getInstance().getDefaultRealm());
|
||||
} catch (RealmException re) {
|
||||
throw re;
|
||||
} catch (KrbException ke) {
|
||||
throw new RealmException(ke);
|
||||
}
|
||||
return new_realm;
|
||||
}
|
||||
|
||||
// Immutable class, no need to clone
|
||||
public Object clone() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
@ -76,21 +81,11 @@ public class Realm implements Cloneable {
|
||||
}
|
||||
|
||||
Realm that = (Realm)obj;
|
||||
if (this.realm != null && that.realm != null ) {
|
||||
return this.realm.equals(that.realm);
|
||||
} else {
|
||||
return (this.realm == null && that.realm == null);
|
||||
}
|
||||
return this.realm.equals(that.realm);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int result = 17 ;
|
||||
|
||||
if( realm != null ) {
|
||||
result = 37 * result + realm.hashCode();
|
||||
}
|
||||
|
||||
return result;
|
||||
return realm.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,6 +111,7 @@ public class Realm implements Cloneable {
|
||||
return realm;
|
||||
}
|
||||
|
||||
// Extract realm from a string like dummy@REALM
|
||||
public static String parseRealmAtSeparator(String name)
|
||||
throws RealmException {
|
||||
if (name == null) {
|
||||
@ -128,8 +124,12 @@ public class Realm implements Cloneable {
|
||||
while (i < temp.length()) {
|
||||
if (temp.charAt(i) == PrincipalName.NAME_REALM_SEPARATOR) {
|
||||
if (i == 0 || temp.charAt(i - 1) != '\\') {
|
||||
if (i + 1 < temp.length())
|
||||
if (i + 1 < temp.length()) {
|
||||
result = temp.substring(i + 1, temp.length());
|
||||
} else {
|
||||
throw new IllegalArgumentException
|
||||
("empty realm part not allowed");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -219,7 +219,8 @@ public class Realm implements Cloneable {
|
||||
* @return an instance of Realm.
|
||||
*
|
||||
*/
|
||||
public static Realm parse(DerInputStream data, byte explicitTag, boolean optional) throws Asn1Exception, IOException, RealmException {
|
||||
public static Realm parse(DerInputStream data, byte explicitTag, boolean optional)
|
||||
throws Asn1Exception, IOException, RealmException {
|
||||
if ((optional) && (((byte)data.peekByte() & (byte)0x1F) != explicitTag)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -47,4 +47,7 @@ public class RealmException extends KrbException {
|
||||
super(i,s);
|
||||
}
|
||||
|
||||
public RealmException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* (C) Copyright IBM Corp. 1999 All Rights Reserved.
|
||||
* Copyright 1997 The Open Group Research Institute. All rights reserved.
|
||||
*/
|
||||
|
||||
package sun.security.krb5;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
public class ServiceName extends PrincipalName {
|
||||
|
||||
public ServiceName(String name, int type) throws RealmException {
|
||||
super(name, type);
|
||||
|
||||
}
|
||||
public ServiceName(String name) throws RealmException {
|
||||
this(name, PrincipalName.KRB_NT_UNKNOWN);
|
||||
}
|
||||
|
||||
public ServiceName(String name, String realm) throws RealmException {
|
||||
this(name, PrincipalName.KRB_NT_UNKNOWN);
|
||||
setRealm(realm);
|
||||
}
|
||||
|
||||
public ServiceName (String service, String instance, String realm)
|
||||
throws KrbException
|
||||
{
|
||||
super(service, instance, realm, PrincipalName.KRB_NT_SRV_INST);
|
||||
}
|
||||
|
||||
}
|
@ -42,11 +42,10 @@ public class ASRep extends KDCRep {
|
||||
|
||||
public ASRep(
|
||||
PAData[] new_pAData,
|
||||
Realm new_crealm,
|
||||
PrincipalName new_cname,
|
||||
Ticket new_ticket,
|
||||
EncryptedData new_encPart) throws IOException {
|
||||
super(new_pAData, new_crealm, new_cname, new_ticket,
|
||||
super(new_pAData, new_cname, new_ticket,
|
||||
new_encPart, Krb5.KRB_AS_REP);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,6 @@ import java.math.BigInteger;
|
||||
public class Authenticator {
|
||||
|
||||
public int authenticator_vno;
|
||||
public Realm crealm;
|
||||
public PrincipalName cname;
|
||||
Checksum cksum; //optional
|
||||
public int cusec;
|
||||
@ -71,7 +70,6 @@ public class Authenticator {
|
||||
public AuthorizationData authorizationData; //optional
|
||||
|
||||
public Authenticator(
|
||||
Realm new_crealm,
|
||||
PrincipalName new_cname,
|
||||
Checksum new_cksum,
|
||||
int new_cusec,
|
||||
@ -80,7 +78,6 @@ public class Authenticator {
|
||||
Integer new_seqNumber,
|
||||
AuthorizationData new_authorizationData) {
|
||||
authenticator_vno = Krb5.AUTHNETICATOR_VNO;
|
||||
crealm = new_crealm;
|
||||
cname = new_cname;
|
||||
cksum = new_cksum;
|
||||
cusec = new_cusec;
|
||||
@ -131,8 +128,8 @@ public class Authenticator {
|
||||
if (authenticator_vno != 5) {
|
||||
throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
|
||||
}
|
||||
crealm = Realm.parse(der.getData(), (byte) 0x01, false);
|
||||
cname = PrincipalName.parse(der.getData(), (byte) 0x02, false);
|
||||
Realm crealm = Realm.parse(der.getData(), (byte) 0x01, false);
|
||||
cname = PrincipalName.parse(der.getData(), (byte) 0x02, false, crealm);
|
||||
cksum = Checksum.parse(der.getData(), (byte) 0x03, true);
|
||||
subDer = der.getData().getDerValue();
|
||||
if ((subDer.getTag() & (byte) 0x1F) == 0x04) {
|
||||
@ -180,7 +177,7 @@ public class Authenticator {
|
||||
DerOutputStream temp = new DerOutputStream();
|
||||
temp.putInteger(BigInteger.valueOf(authenticator_vno));
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte) 0x00), temp.toByteArray()));
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte) 0x01), crealm.asn1Encode()));
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte) 0x01), cname.getRealm().asn1Encode()));
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte) 0x02), cname.asn1Encode()));
|
||||
if (cksum != null) {
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte) 0x03), cksum.asn1Encode()));
|
||||
|
@ -72,23 +72,9 @@ rs.
|
||||
public static Credentials acquireServiceCreds(
|
||||
String service, Credentials ccreds)
|
||||
throws KrbException, IOException {
|
||||
ServiceName sname = new ServiceName(service);
|
||||
PrincipalName sname = new PrincipalName(service);
|
||||
String serviceRealm = sname.getRealmString();
|
||||
String localRealm = ccreds.getClient().getRealmString();
|
||||
String defaultRealm = Config.getInstance().getDefaultRealm();
|
||||
|
||||
if (localRealm == null) {
|
||||
PrincipalName temp = null;
|
||||
if ((temp = ccreds.getServer()) != null)
|
||||
localRealm = temp.getRealmString();
|
||||
}
|
||||
if (localRealm == null) {
|
||||
localRealm = defaultRealm;
|
||||
}
|
||||
if (serviceRealm == null) {
|
||||
serviceRealm = localRealm;
|
||||
sname.setRealm(serviceRealm);
|
||||
}
|
||||
|
||||
/*
|
||||
if (!localRealm.equalsIgnoreCase(serviceRealm)) { //do cross-realm auth entication
|
||||
@ -128,13 +114,12 @@ rs.
|
||||
|
||||
int i = 0, k = 0;
|
||||
Credentials cTgt = null, newTgt = null, theTgt = null;
|
||||
ServiceName tempService = null;
|
||||
PrincipalName tempService = null;
|
||||
String realm = null, newTgtRealm = null, theTgtRealm = null;
|
||||
|
||||
for (cTgt = ccreds, i = 0; i < realms.length;)
|
||||
{
|
||||
tempService = new ServiceName(PrincipalName.TGS_DEFAULT_SRV_NAME,
|
||||
serviceRealm, realms[i]);
|
||||
tempService = PrincipalName.tgsService(serviceRealm, realms[i]);
|
||||
|
||||
if (DEBUG)
|
||||
{
|
||||
@ -164,9 +149,7 @@ rs.
|
||||
newTgt == null && k > i; k--)
|
||||
{
|
||||
|
||||
tempService = new ServiceName(
|
||||
PrincipalName.TGS_DEFAULT_SRV_NAME,
|
||||
realms[k], realms[i]);
|
||||
tempService = PrincipalName.tgsService(realms[k], realms[i]);
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println(">>> Credentials acquireServiceCreds: inner loop: [" + k +"] tempService=" + tempService);
|
||||
@ -306,7 +289,7 @@ rs.
|
||||
* This method does the real job to request the service credential.
|
||||
*/
|
||||
private static Credentials serviceCreds(
|
||||
ServiceName service, Credentials ccreds)
|
||||
PrincipalName service, Credentials ccreds)
|
||||
throws KrbException, IOException {
|
||||
return new KrbTgsReq(ccreds, service).sendAndGetCreds();
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ public class EncASRepPart extends EncKDCRepPart {
|
||||
KerberosTime new_starttime,
|
||||
KerberosTime new_endtime,
|
||||
KerberosTime new_renewTill,
|
||||
Realm new_srealm,
|
||||
PrincipalName new_sname,
|
||||
HostAddresses new_caddr) {
|
||||
super(
|
||||
@ -59,7 +58,6 @@ public class EncASRepPart extends EncKDCRepPart {
|
||||
new_starttime,
|
||||
new_endtime,
|
||||
new_renewTill,
|
||||
new_srealm,
|
||||
new_sname,
|
||||
new_caddr,
|
||||
Krb5.KRB_ENC_AS_REP_PART
|
||||
|
@ -74,7 +74,6 @@ public class EncKDCRepPart {
|
||||
public KerberosTime starttime; //optional
|
||||
public KerberosTime endtime;
|
||||
public KerberosTime renewTill; //optional
|
||||
public Realm srealm;
|
||||
public PrincipalName sname;
|
||||
public HostAddresses caddr; //optional
|
||||
public int msgType; //not included in sequence
|
||||
@ -89,7 +88,6 @@ public class EncKDCRepPart {
|
||||
KerberosTime new_starttime,
|
||||
KerberosTime new_endtime,
|
||||
KerberosTime new_renewTill,
|
||||
Realm new_srealm,
|
||||
PrincipalName new_sname,
|
||||
HostAddresses new_caddr,
|
||||
int new_msgType) {
|
||||
@ -102,7 +100,6 @@ public class EncKDCRepPart {
|
||||
starttime = new_starttime;
|
||||
endtime = new_endtime;
|
||||
renewTill = new_renewTill;
|
||||
srealm = new_srealm;
|
||||
sname = new_sname;
|
||||
caddr = new_caddr;
|
||||
msgType = new_msgType;
|
||||
@ -158,8 +155,8 @@ public class EncKDCRepPart {
|
||||
starttime = KerberosTime.parse(der.getData(), (byte) 0x06, true);
|
||||
endtime = KerberosTime.parse(der.getData(), (byte) 0x07, false);
|
||||
renewTill = KerberosTime.parse(der.getData(), (byte) 0x08, true);
|
||||
srealm = Realm.parse(der.getData(), (byte) 0x09, false);
|
||||
sname = PrincipalName.parse(der.getData(), (byte) 0x0A, false);
|
||||
Realm srealm = Realm.parse(der.getData(), (byte) 0x09, false);
|
||||
sname = PrincipalName.parse(der.getData(), (byte) 0x0A, false, srealm);
|
||||
if (der.getData().available() > 0) {
|
||||
caddr = HostAddresses.parse(der.getData(), (byte) 0x0B, true);
|
||||
}
|
||||
@ -206,7 +203,7 @@ public class EncKDCRepPart {
|
||||
true, (byte) 0x08), renewTill.asn1Encode());
|
||||
}
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,
|
||||
true, (byte) 0x09), srealm.asn1Encode());
|
||||
true, (byte) 0x09), sname.getRealm().asn1Encode());
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,
|
||||
true, (byte) 0x0A), sname.asn1Encode());
|
||||
if (caddr != null) {
|
||||
|
@ -45,7 +45,6 @@ public class EncTGSRepPart extends EncKDCRepPart {
|
||||
KerberosTime new_starttime,
|
||||
KerberosTime new_endtime,
|
||||
KerberosTime new_renewTill,
|
||||
Realm new_srealm,
|
||||
PrincipalName new_sname,
|
||||
HostAddresses new_caddr) {
|
||||
super(
|
||||
@ -58,7 +57,6 @@ public class EncTGSRepPart extends EncKDCRepPart {
|
||||
new_starttime,
|
||||
new_endtime,
|
||||
new_renewTill,
|
||||
new_srealm,
|
||||
new_sname,
|
||||
new_caddr,
|
||||
Krb5.KRB_ENC_TGS_REP_PART);
|
||||
|
@ -65,7 +65,6 @@ public class EncTicketPart {
|
||||
|
||||
public TicketFlags flags;
|
||||
public EncryptionKey key;
|
||||
public Realm crealm;
|
||||
public PrincipalName cname;
|
||||
public TransitedEncoding transited;
|
||||
public KerberosTime authtime;
|
||||
@ -78,7 +77,6 @@ public class EncTicketPart {
|
||||
public EncTicketPart(
|
||||
TicketFlags new_flags,
|
||||
EncryptionKey new_key,
|
||||
Realm new_crealm,
|
||||
PrincipalName new_cname,
|
||||
TransitedEncoding new_transited,
|
||||
KerberosTime new_authtime,
|
||||
@ -89,7 +87,6 @@ public class EncTicketPart {
|
||||
AuthorizationData new_authorizationData) {
|
||||
flags = new_flags;
|
||||
key = new_key;
|
||||
crealm = new_crealm;
|
||||
cname = new_cname;
|
||||
transited = new_transited;
|
||||
authtime = new_authtime;
|
||||
@ -151,8 +148,8 @@ public class EncTicketPart {
|
||||
}
|
||||
flags = TicketFlags.parse(der.getData(), (byte) 0x00, false);
|
||||
key = EncryptionKey.parse(der.getData(), (byte) 0x01, false);
|
||||
crealm = Realm.parse(der.getData(), (byte) 0x02, false);
|
||||
cname = PrincipalName.parse(der.getData(), (byte) 0x03, false);
|
||||
Realm crealm = Realm.parse(der.getData(), (byte) 0x02, false);
|
||||
cname = PrincipalName.parse(der.getData(), (byte) 0x03, false, crealm);
|
||||
transited = TransitedEncoding.parse(der.getData(), (byte) 0x04, false);
|
||||
authtime = KerberosTime.parse(der.getData(), (byte) 0x05, false);
|
||||
starttime = KerberosTime.parse(der.getData(), (byte) 0x06, true);
|
||||
@ -186,7 +183,7 @@ public class EncTicketPart {
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,
|
||||
true, (byte) 0x01), key.asn1Encode());
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,
|
||||
true, (byte) 0x02), crealm.asn1Encode());
|
||||
true, (byte) 0x02), cname.getRealm().asn1Encode());
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,
|
||||
true, (byte) 0x03), cname.asn1Encode());
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,
|
||||
|
@ -61,7 +61,6 @@ import java.math.BigInteger;
|
||||
*/
|
||||
public class KDCRep {
|
||||
|
||||
public Realm crealm;
|
||||
public PrincipalName cname;
|
||||
public Ticket ticket;
|
||||
public EncryptedData encPart;
|
||||
@ -73,7 +72,6 @@ public class KDCRep {
|
||||
|
||||
public KDCRep(
|
||||
PAData[] new_pAData,
|
||||
Realm new_crealm,
|
||||
PrincipalName new_cname,
|
||||
Ticket new_ticket,
|
||||
EncryptedData new_encPart,
|
||||
@ -90,7 +88,6 @@ public class KDCRep {
|
||||
}
|
||||
}
|
||||
}
|
||||
crealm = new_crealm;
|
||||
cname = new_cname;
|
||||
ticket = new_ticket;
|
||||
encPart = new_encPart;
|
||||
@ -174,8 +171,8 @@ public class KDCRep {
|
||||
} else {
|
||||
pAData = null;
|
||||
}
|
||||
crealm = Realm.parse(der.getData(), (byte) 0x03, false);
|
||||
cname = PrincipalName.parse(der.getData(), (byte) 0x04, false);
|
||||
Realm crealm = Realm.parse(der.getData(), (byte) 0x03, false);
|
||||
cname = PrincipalName.parse(der.getData(), (byte) 0x04, false, crealm);
|
||||
ticket = Ticket.parse(der.getData(), (byte) 0x05, false);
|
||||
encPart = EncryptedData.parse(der.getData(), (byte) 0x06, false);
|
||||
if (der.getData().available() > 0) {
|
||||
@ -212,7 +209,7 @@ public class KDCRep {
|
||||
true, (byte) 0x02), temp);
|
||||
}
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,
|
||||
true, (byte) 0x03), crealm.asn1Encode());
|
||||
true, (byte) 0x03), cname.getRealm().asn1Encode());
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,
|
||||
true, (byte) 0x04), cname.asn1Encode());
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,
|
||||
|
@ -72,7 +72,6 @@ import java.math.BigInteger;
|
||||
public class KDCReqBody {
|
||||
public KDCOptions kdcOptions;
|
||||
public PrincipalName cname; //optional in ASReq only
|
||||
public Realm crealm;
|
||||
public PrincipalName sname; //optional
|
||||
public KerberosTime from; //optional
|
||||
public KerberosTime till;
|
||||
@ -87,7 +86,6 @@ public class KDCReqBody {
|
||||
public KDCReqBody(
|
||||
KDCOptions new_kdcOptions,
|
||||
PrincipalName new_cname, //optional in ASReq only
|
||||
Realm new_crealm,
|
||||
PrincipalName new_sname, //optional
|
||||
KerberosTime new_from, //optional
|
||||
KerberosTime new_till,
|
||||
@ -100,7 +98,6 @@ public class KDCReqBody {
|
||||
) throws IOException {
|
||||
kdcOptions = new_kdcOptions;
|
||||
cname = new_cname;
|
||||
crealm = new_crealm;
|
||||
sname = new_sname;
|
||||
from = new_from;
|
||||
till = new_till;
|
||||
@ -142,12 +139,22 @@ public class KDCReqBody {
|
||||
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
|
||||
}
|
||||
kdcOptions = KDCOptions.parse(encoding.getData(), (byte)0x00, false);
|
||||
cname = PrincipalName.parse(encoding.getData(), (byte)0x01, true);
|
||||
|
||||
// cname only appears in AS-REQ and it shares the realm field with
|
||||
// sname. This is the only place where realm comes after the name.
|
||||
// We first give cname a fake realm and reassign it the correct
|
||||
// realm after the realm field is read.
|
||||
cname = PrincipalName.parse(encoding.getData(), (byte)0x01, true,
|
||||
new Realm("PLACEHOLDER"));
|
||||
if ((msgType != Krb5.KRB_AS_REQ) && (cname != null)) {
|
||||
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
|
||||
}
|
||||
crealm = Realm.parse(encoding.getData(), (byte)0x02, false);
|
||||
sname = PrincipalName.parse(encoding.getData(), (byte)0x03, true);
|
||||
Realm realm = Realm.parse(encoding.getData(), (byte)0x02, false);
|
||||
if (cname != null) {
|
||||
cname = new PrincipalName(
|
||||
cname.getNameType(), cname.getNameStrings(), realm);
|
||||
}
|
||||
sname = PrincipalName.parse(encoding.getData(), (byte)0x03, true, realm);
|
||||
from = KerberosTime.parse(encoding.getData(), (byte)0x04, true);
|
||||
till = KerberosTime.parse(encoding.getData(), (byte)0x05, false);
|
||||
rtime = KerberosTime.parse(encoding.getData(), (byte)0x06, true);
|
||||
@ -223,9 +230,11 @@ public class KDCReqBody {
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), cname.asn1Encode()));
|
||||
}
|
||||
}
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x02), crealm.asn1Encode()));
|
||||
if (sname != null) {
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x02), sname.getRealm().asn1Encode()));
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x03), sname.asn1Encode()));
|
||||
} else if (cname != null) {
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x02), cname.getRealm().asn1Encode()));
|
||||
}
|
||||
if (from != null) {
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x04), from.asn1Encode()));
|
||||
|
@ -90,9 +90,7 @@ public class KRBError implements java.io.Serializable {
|
||||
private KerberosTime sTime;
|
||||
private Integer suSec;
|
||||
private int errorCode;
|
||||
private Realm crealm; //optional
|
||||
private PrincipalName cname; //optional
|
||||
private Realm realm;
|
||||
private PrincipalName sname;
|
||||
private String eText; //optional
|
||||
private byte[] eData; //optional
|
||||
@ -128,9 +126,7 @@ public class KRBError implements java.io.Serializable {
|
||||
KerberosTime new_sTime,
|
||||
Integer new_suSec,
|
||||
int new_errorCode,
|
||||
Realm new_crealm,
|
||||
PrincipalName new_cname,
|
||||
Realm new_realm,
|
||||
PrincipalName new_sname,
|
||||
String new_eText,
|
||||
byte[] new_eData
|
||||
@ -142,9 +138,7 @@ public class KRBError implements java.io.Serializable {
|
||||
sTime = new_sTime;
|
||||
suSec = new_suSec;
|
||||
errorCode = new_errorCode;
|
||||
crealm = new_crealm;
|
||||
cname = new_cname;
|
||||
realm = new_realm;
|
||||
sname = new_sname;
|
||||
eText = new_eText;
|
||||
eData = new_eData;
|
||||
@ -159,9 +153,7 @@ public class KRBError implements java.io.Serializable {
|
||||
KerberosTime new_sTime,
|
||||
Integer new_suSec,
|
||||
int new_errorCode,
|
||||
Realm new_crealm,
|
||||
PrincipalName new_cname,
|
||||
Realm new_realm,
|
||||
PrincipalName new_sname,
|
||||
String new_eText,
|
||||
byte[] new_eData,
|
||||
@ -174,9 +166,7 @@ public class KRBError implements java.io.Serializable {
|
||||
sTime = new_sTime;
|
||||
suSec = new_suSec;
|
||||
errorCode = new_errorCode;
|
||||
crealm = new_crealm;
|
||||
cname = new_cname;
|
||||
realm = new_realm;
|
||||
sname = new_sname;
|
||||
eText = new_eText;
|
||||
eData = new_eData;
|
||||
@ -359,10 +349,10 @@ public class KRBError implements java.io.Serializable {
|
||||
errorCode = subDer.getData().getBigInteger().intValue();
|
||||
}
|
||||
else throw new Asn1Exception(Krb5.ASN1_BAD_ID);
|
||||
crealm = Realm.parse(der.getData(), (byte)0x07, true);
|
||||
cname = PrincipalName.parse(der.getData(), (byte)0x08, true);
|
||||
realm = Realm.parse(der.getData(), (byte)0x09, false);
|
||||
sname = PrincipalName.parse(der.getData(), (byte)0x0A, false);
|
||||
Realm crealm = Realm.parse(der.getData(), (byte)0x07, true);
|
||||
cname = PrincipalName.parse(der.getData(), (byte)0x08, true, crealm);
|
||||
Realm realm = Realm.parse(der.getData(), (byte)0x09, false);
|
||||
sname = PrincipalName.parse(der.getData(), (byte)0x0A, false, realm);
|
||||
eText = null;
|
||||
eData = null;
|
||||
eCksum = null;
|
||||
@ -403,15 +393,9 @@ public class KRBError implements java.io.Serializable {
|
||||
System.out.println("\t suSec is " + suSec);
|
||||
System.out.println("\t error code is " + errorCode);
|
||||
System.out.println("\t error Message is " + Krb5.getErrorMessage(errorCode));
|
||||
if (crealm != null) {
|
||||
System.out.println("\t crealm is " + crealm.toString());
|
||||
}
|
||||
if (cname != null) {
|
||||
System.out.println("\t cname is " + cname.toString());
|
||||
}
|
||||
if (realm != null) {
|
||||
System.out.println("\t realm is " + realm.toString());
|
||||
}
|
||||
if (sname != null) {
|
||||
System.out.println("\t sname is " + sname.toString());
|
||||
}
|
||||
@ -458,14 +442,12 @@ public class KRBError implements java.io.Serializable {
|
||||
temp.putInteger(BigInteger.valueOf(errorCode));
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x06), temp);
|
||||
|
||||
if (crealm != null) {
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x07), crealm.asn1Encode());
|
||||
}
|
||||
if (cname != null) {
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x07), cname.getRealm().asn1Encode());
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x08), cname.asn1Encode());
|
||||
}
|
||||
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x09), realm.asn1Encode());
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x09), sname.getRealm().asn1Encode());
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0A), sname.asn1Encode());
|
||||
|
||||
if (eText != null) {
|
||||
@ -506,9 +488,7 @@ public class KRBError implements java.io.Serializable {
|
||||
isEqual(sTime, other.sTime) &&
|
||||
isEqual(suSec, other.suSec) &&
|
||||
errorCode == other.errorCode &&
|
||||
isEqual(crealm, other.crealm) &&
|
||||
isEqual(cname, other.cname) &&
|
||||
isEqual(realm, other.realm) &&
|
||||
isEqual(sname, other.sname) &&
|
||||
isEqual(eText, other.eText) &&
|
||||
java.util.Arrays.equals(eData, other.eData) &&
|
||||
@ -528,9 +508,7 @@ public class KRBError implements java.io.Serializable {
|
||||
if (sTime != null) result = 37 * result + sTime.hashCode();
|
||||
if (suSec != null) result = 37 * result + suSec.hashCode();
|
||||
result = 37 * result + errorCode;
|
||||
if (crealm != null) result = 37 * result + crealm.hashCode();
|
||||
if (cname != null) result = 37 * result + cname.hashCode();
|
||||
if (realm != null) result = 37 * result + realm.hashCode();
|
||||
if (sname != null) result = 37 * result + sname.hashCode();
|
||||
if (eText != null) result = 37 * result + eText.hashCode();
|
||||
result = 37 * result + Arrays.hashCode(eData);
|
||||
|
@ -63,14 +63,12 @@ import java.io.IOException;
|
||||
|
||||
public class KrbCredInfo {
|
||||
public EncryptionKey key;
|
||||
public Realm prealm; //optional
|
||||
public PrincipalName pname; //optional
|
||||
public TicketFlags flags; //optional
|
||||
public KerberosTime authtime; //optional
|
||||
public KerberosTime starttime; //optional
|
||||
public KerberosTime endtime; //optional
|
||||
public KerberosTime renewTill; //optional
|
||||
public Realm srealm; //optional
|
||||
public PrincipalName sname; //optional
|
||||
public HostAddresses caddr; //optional
|
||||
|
||||
@ -79,26 +77,22 @@ public class KrbCredInfo {
|
||||
|
||||
public KrbCredInfo(
|
||||
EncryptionKey new_key,
|
||||
Realm new_prealm,
|
||||
PrincipalName new_pname,
|
||||
TicketFlags new_flags,
|
||||
KerberosTime new_authtime,
|
||||
KerberosTime new_starttime,
|
||||
KerberosTime new_endtime,
|
||||
KerberosTime new_renewTill,
|
||||
Realm new_srealm,
|
||||
PrincipalName new_sname,
|
||||
HostAddresses new_caddr
|
||||
) {
|
||||
key = new_key;
|
||||
prealm = new_prealm;
|
||||
pname = new_pname;
|
||||
flags = new_flags;
|
||||
authtime = new_authtime;
|
||||
starttime = new_starttime;
|
||||
endtime = new_endtime;
|
||||
renewTill = new_renewTill;
|
||||
srealm = new_srealm;
|
||||
sname = new_sname;
|
||||
caddr = new_caddr;
|
||||
}
|
||||
@ -115,21 +109,20 @@ public class KrbCredInfo {
|
||||
if (encoding.getTag() != DerValue.tag_Sequence) {
|
||||
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
|
||||
}
|
||||
prealm = null;
|
||||
pname = null;
|
||||
flags = null;
|
||||
authtime = null;
|
||||
starttime = null;
|
||||
endtime = null;
|
||||
renewTill = null;
|
||||
srealm = null;
|
||||
sname = null;
|
||||
caddr = null;
|
||||
key = EncryptionKey.parse(encoding.getData(), (byte)0x00, false);
|
||||
Realm prealm = null, srealm = null;
|
||||
if (encoding.getData().available() > 0)
|
||||
prealm = Realm.parse(encoding.getData(), (byte)0x01, true);
|
||||
if (encoding.getData().available() > 0)
|
||||
pname = PrincipalName.parse(encoding.getData(), (byte)0x02, true);
|
||||
pname = PrincipalName.parse(encoding.getData(), (byte)0x02, true, prealm);
|
||||
if (encoding.getData().available() > 0)
|
||||
flags = TicketFlags.parse(encoding.getData(), (byte)0x03, true);
|
||||
if (encoding.getData().available() > 0)
|
||||
@ -143,7 +136,7 @@ public class KrbCredInfo {
|
||||
if (encoding.getData().available() > 0)
|
||||
srealm = Realm.parse(encoding.getData(), (byte)0x08, true);
|
||||
if (encoding.getData().available() > 0)
|
||||
sname = PrincipalName.parse(encoding.getData(), (byte)0x09, true);
|
||||
sname = PrincipalName.parse(encoding.getData(), (byte)0x09, true, srealm);
|
||||
if (encoding.getData().available() > 0)
|
||||
caddr = HostAddresses.parse(encoding.getData(), (byte)0x0A, true);
|
||||
if (encoding.getData().available() > 0)
|
||||
@ -159,10 +152,10 @@ public class KrbCredInfo {
|
||||
public byte[] asn1Encode() throws Asn1Exception, IOException {
|
||||
Vector<DerValue> v = new Vector<>();
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x00), key.asn1Encode()));
|
||||
if (prealm != null)
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), prealm.asn1Encode()));
|
||||
if (pname != null)
|
||||
if (pname != null) {
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), pname.getRealm().asn1Encode()));
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x02), pname.asn1Encode()));
|
||||
}
|
||||
if (flags != null)
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x03), flags.asn1Encode()));
|
||||
if (authtime != null)
|
||||
@ -173,10 +166,10 @@ public class KrbCredInfo {
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x06), endtime.asn1Encode()));
|
||||
if (renewTill != null)
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x07), renewTill.asn1Encode()));
|
||||
if (srealm != null)
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x08), srealm.asn1Encode()));
|
||||
if (sname != null)
|
||||
if (sname != null) {
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x08), sname.getRealm().asn1Encode()));
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x09), sname.asn1Encode()));
|
||||
}
|
||||
if (caddr != null)
|
||||
v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0A), caddr.asn1Encode()));
|
||||
DerValue der[] = new DerValue[v.size()];
|
||||
@ -190,8 +183,6 @@ public class KrbCredInfo {
|
||||
KrbCredInfo kcred = new KrbCredInfo();
|
||||
kcred.key = (EncryptionKey)key.clone();
|
||||
// optional fields
|
||||
if (prealm != null)
|
||||
kcred.prealm = (Realm)prealm.clone();
|
||||
if (pname != null)
|
||||
kcred.pname = (PrincipalName)pname.clone();
|
||||
if (flags != null)
|
||||
@ -204,8 +195,6 @@ public class KrbCredInfo {
|
||||
kcred.endtime = (KerberosTime)endtime.clone();
|
||||
if (renewTill != null)
|
||||
kcred.renewTill = (KerberosTime)renewTill.clone();
|
||||
if (srealm != null)
|
||||
kcred.srealm = (Realm)srealm.clone();
|
||||
if (sname != null)
|
||||
kcred.sname = (PrincipalName)sname.clone();
|
||||
if (caddr != null)
|
||||
|
@ -42,12 +42,11 @@ public class TGSRep extends KDCRep {
|
||||
|
||||
public TGSRep(
|
||||
PAData[] new_pAData,
|
||||
Realm new_crealm,
|
||||
PrincipalName new_cname,
|
||||
Ticket new_ticket,
|
||||
EncryptedData new_encPart
|
||||
) throws IOException {
|
||||
super(new_pAData, new_crealm, new_cname, new_ticket,
|
||||
super(new_pAData, new_cname, new_ticket,
|
||||
new_encPart, Krb5.KRB_TGS_REP);
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,6 @@ import java.math.BigInteger;
|
||||
|
||||
public class Ticket implements Cloneable {
|
||||
public int tkt_vno;
|
||||
public Realm realm;
|
||||
public PrincipalName sname;
|
||||
public EncryptedData encPart;
|
||||
|
||||
@ -69,7 +68,6 @@ public class Ticket implements Cloneable {
|
||||
|
||||
public Object clone() {
|
||||
Ticket new_ticket = new Ticket();
|
||||
new_ticket.realm = (Realm)realm.clone();
|
||||
new_ticket.sname = (PrincipalName)sname.clone();
|
||||
new_ticket.encPart = (EncryptedData)encPart.clone();
|
||||
new_ticket.tkt_vno = tkt_vno;
|
||||
@ -77,12 +75,10 @@ public class Ticket implements Cloneable {
|
||||
}
|
||||
|
||||
public Ticket(
|
||||
Realm new_realm,
|
||||
PrincipalName new_sname,
|
||||
EncryptedData new_encPart
|
||||
) {
|
||||
tkt_vno = Krb5.TICKET_VNO;
|
||||
realm = new_realm;
|
||||
sname = new_sname;
|
||||
encPart = new_encPart;
|
||||
}
|
||||
@ -123,8 +119,8 @@ public class Ticket implements Cloneable {
|
||||
tkt_vno = subDer.getData().getBigInteger().intValue();
|
||||
if (tkt_vno != Krb5.TICKET_VNO)
|
||||
throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
|
||||
realm = Realm.parse(der.getData(), (byte)0x01, false);
|
||||
sname = PrincipalName.parse(der.getData(), (byte)0x02, false);
|
||||
Realm srealm = Realm.parse(der.getData(), (byte)0x01, false);
|
||||
sname = PrincipalName.parse(der.getData(), (byte)0x02, false, srealm);
|
||||
encPart = EncryptedData.parse(der.getData(), (byte)0x03, false);
|
||||
if (der.getData().available() > 0)
|
||||
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
|
||||
@ -142,7 +138,7 @@ public class Ticket implements Cloneable {
|
||||
DerValue der[] = new DerValue[4];
|
||||
temp.putInteger(BigInteger.valueOf(tkt_vno));
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x00), temp);
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), realm.asn1Encode());
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), sname.getRealm().asn1Encode());
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x02), sname.asn1Encode());
|
||||
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x03), encPart.asn1Encode());
|
||||
temp = new DerOutputStream();
|
||||
|
@ -114,7 +114,6 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC
|
||||
// made public for KinitOptions to call directly
|
||||
public PrincipalName readPrincipal(int version) throws IOException, RealmException {
|
||||
int type, length, namelength, kret;
|
||||
PrincipalName p;
|
||||
String[] pname = null;
|
||||
String realm;
|
||||
/* Read principal type */
|
||||
@ -144,11 +143,13 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC
|
||||
realm = result[0];
|
||||
pname = new String[length];
|
||||
System.arraycopy(result, 1, pname, 0, length);
|
||||
p = new PrincipalName(pname, type);
|
||||
p.setRealm(realm);
|
||||
return new PrincipalName(type, pname, new Realm(realm));
|
||||
}
|
||||
try {
|
||||
return new PrincipalName(result, type);
|
||||
} catch (RealmException re) {
|
||||
return null;
|
||||
}
|
||||
else p = new PrincipalName(result, type);
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -342,10 +343,10 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC
|
||||
Credentials readCred(int version) throws IOException,RealmException, KrbApErrException, Asn1Exception {
|
||||
PrincipalName cpname = readPrincipal(version);
|
||||
if (DEBUG)
|
||||
System.out.println(">>>DEBUG <CCacheInputStream> client principal is " + cpname.toString());
|
||||
System.out.println(">>>DEBUG <CCacheInputStream> client principal is " + cpname);
|
||||
PrincipalName spname = readPrincipal(version);
|
||||
if (DEBUG)
|
||||
System.out.println(">>>DEBUG <CCacheInputStream> server principal is " + spname.toString());
|
||||
System.out.println(">>>DEBUG <CCacheInputStream> server principal is " + spname);
|
||||
EncryptionKey key = readKey(version);
|
||||
if (DEBUG)
|
||||
System.out.println(">>>DEBUG <CCacheInputStream> key type: " + key.getEType());
|
||||
|
@ -36,9 +36,7 @@ import sun.security.krb5.internal.*;
|
||||
public class Credentials {
|
||||
|
||||
PrincipalName cname;
|
||||
Realm crealm;
|
||||
PrincipalName sname;
|
||||
Realm srealm;
|
||||
EncryptionKey key;
|
||||
KerberosTime authtime;
|
||||
KerberosTime starttime;//optional
|
||||
@ -67,15 +65,7 @@ public class Credentials {
|
||||
Ticket new_ticket,
|
||||
Ticket new_secondTicket) {
|
||||
cname = (PrincipalName) new_cname.clone();
|
||||
if (new_cname.getRealm() != null) {
|
||||
crealm = (Realm) new_cname.getRealm().clone();
|
||||
}
|
||||
|
||||
sname = (PrincipalName) new_sname.clone();
|
||||
if (new_sname.getRealm() != null) {
|
||||
srealm = (Realm) new_sname.getRealm().clone();
|
||||
}
|
||||
|
||||
key = (EncryptionKey) new_key.clone();
|
||||
|
||||
authtime = (KerberosTime) new_authtime.clone();
|
||||
@ -110,7 +100,6 @@ public class Credentials {
|
||||
{
|
||||
return;
|
||||
}
|
||||
crealm = (Realm) kdcRep.crealm.clone();
|
||||
cname = (PrincipalName) kdcRep.cname.clone();
|
||||
ticket = (Ticket) kdcRep.ticket.clone();
|
||||
key = (EncryptionKey) kdcRep.encKDCRepPart.key.clone();
|
||||
@ -123,7 +112,6 @@ public class Credentials {
|
||||
if (kdcRep.encKDCRepPart.renewTill != null) {
|
||||
renewTill = (KerberosTime) kdcRep.encKDCRepPart.renewTill.clone();
|
||||
}
|
||||
srealm = (Realm) kdcRep.encKDCRepPart.srealm.clone();
|
||||
sname = (PrincipalName) kdcRep.encKDCRepPart.sname.clone();
|
||||
caddr = (HostAddresses) kdcRep.encKDCRepPart.caddr.clone();
|
||||
secondTicket = (Ticket) new_secondTicket.clone();
|
||||
@ -138,17 +126,7 @@ public class Credentials {
|
||||
|
||||
public Credentials(KDCRep kdcRep, Ticket new_ticket) {
|
||||
sname = (PrincipalName) kdcRep.encKDCRepPart.sname.clone();
|
||||
srealm = (Realm) kdcRep.encKDCRepPart.srealm.clone();
|
||||
try {
|
||||
sname.setRealm(srealm);
|
||||
} catch (RealmException e) {
|
||||
}
|
||||
cname = (PrincipalName) kdcRep.cname.clone();
|
||||
crealm = (Realm) kdcRep.crealm.clone();
|
||||
try {
|
||||
cname.setRealm(crealm);
|
||||
} catch (RealmException e) {
|
||||
}
|
||||
key = (EncryptionKey) kdcRep.encKDCRepPart.key.clone();
|
||||
authtime = (KerberosTime) kdcRep.encKDCRepPart.authtime.clone();
|
||||
if (kdcRep.encKDCRepPart.starttime != null) {
|
||||
@ -202,9 +180,6 @@ public class Credentials {
|
||||
}
|
||||
|
||||
public PrincipalName getServicePrincipal() throws RealmException {
|
||||
if (sname.getRealm() == null) {
|
||||
sname.setRealm(srealm);
|
||||
}
|
||||
return sname;
|
||||
}
|
||||
|
||||
|
@ -120,6 +120,6 @@ public abstract class CredentialsCache {
|
||||
public abstract void save() throws IOException, KrbException;
|
||||
public abstract Credentials[] getCredsList();
|
||||
public abstract Credentials getDefaultCreds();
|
||||
public abstract Credentials getCreds(PrincipalName sname, Realm srealm) ;
|
||||
public abstract Credentials getCreds(LoginOptions options, PrincipalName sname, Realm srealm) ;
|
||||
public abstract Credentials getCreds(PrincipalName sname);
|
||||
public abstract Credentials getCreds(LoginOptions options, PrincipalName sname);
|
||||
}
|
||||
|
@ -59,7 +59,6 @@ public class FileCredentialsCache extends CredentialsCache
|
||||
public int version;
|
||||
public Tag tag; // optional
|
||||
public PrincipalName primaryPrincipal;
|
||||
public Realm primaryRealm;
|
||||
private Vector<Credentials> credentialsList;
|
||||
private static String dir;
|
||||
private static boolean DEBUG = Krb5.DEBUG;
|
||||
@ -79,7 +78,6 @@ public class FileCredentialsCache extends CredentialsCache
|
||||
}
|
||||
if (principal != null) {
|
||||
fcc.primaryPrincipal = principal;
|
||||
fcc.primaryRealm = principal.getRealm();
|
||||
}
|
||||
fcc.load(cacheName);
|
||||
return fcc;
|
||||
@ -153,7 +151,6 @@ public class FileCredentialsCache extends CredentialsCache
|
||||
synchronized void init(PrincipalName principal, String name)
|
||||
throws IOException, KrbException {
|
||||
primaryPrincipal = principal;
|
||||
primaryRealm = principal.getRealm();
|
||||
CCacheOutputStream cos =
|
||||
new CCacheOutputStream(new FileOutputStream(name));
|
||||
version = KRB5_FCC_FVNO_3;
|
||||
@ -183,7 +180,6 @@ public class FileCredentialsCache extends CredentialsCache
|
||||
}
|
||||
} else
|
||||
primaryPrincipal = p;
|
||||
primaryRealm = primaryPrincipal.getRealm();
|
||||
credentialsList = new Vector<Credentials> ();
|
||||
while (cis.available() > 0) {
|
||||
Credentials cred = cis.readCred(version);
|
||||
@ -291,18 +287,16 @@ public class FileCredentialsCache extends CredentialsCache
|
||||
|
||||
}
|
||||
|
||||
public Credentials getCreds(LoginOptions options,
|
||||
PrincipalName sname, Realm srealm) {
|
||||
public Credentials getCreds(LoginOptions options, PrincipalName sname) {
|
||||
if (options == null) {
|
||||
return getCreds(sname, srealm);
|
||||
return getCreds(sname);
|
||||
} else {
|
||||
Credentials[] list = getCredsList();
|
||||
if (list == null) {
|
||||
return null;
|
||||
} else {
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
if (sname.match(list[i].sname) &&
|
||||
(srealm.toString().equals(list[i].srealm.toString()))) {
|
||||
if (sname.match(list[i].sname)) {
|
||||
if (list[i].flags.match(options)) {
|
||||
return list[i];
|
||||
}
|
||||
@ -317,16 +311,14 @@ public class FileCredentialsCache extends CredentialsCache
|
||||
/**
|
||||
* Gets a credentials for a specified service.
|
||||
* @param sname service principal name.
|
||||
* @param srealm the realm that the service belongs to.
|
||||
*/
|
||||
public Credentials getCreds(PrincipalName sname, Realm srealm) {
|
||||
public Credentials getCreds(PrincipalName sname) {
|
||||
Credentials[] list = getCredsList();
|
||||
if (list == null) {
|
||||
return null;
|
||||
} else {
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
if (sname.match(list[i].sname) &&
|
||||
(srealm.toString().equals(list[i].srealm.toString()))) {
|
||||
if (sname.match(list[i].sname)) {
|
||||
return list[i];
|
||||
}
|
||||
}
|
||||
@ -343,7 +335,7 @@ public class FileCredentialsCache extends CredentialsCache
|
||||
if (list[i].sname.toString().startsWith("krbtgt")) {
|
||||
String[] nameStrings = list[i].sname.getNameStrings();
|
||||
// find the TGT for the current realm krbtgt/realm@realm
|
||||
if (nameStrings[1].equals(list[i].srealm.toString())) {
|
||||
if (nameStrings[1].equals(list[i].sname.getRealm().toString())) {
|
||||
return list[i];
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public abstract class MemoryCredentialsCache extends CredentialsCache {
|
||||
|
||||
public abstract Credentials[] getCredsList();
|
||||
|
||||
public abstract Credentials getCreds(PrincipalName sname, Realm srealm) ;
|
||||
public abstract Credentials getCreds(PrincipalName sname) ;
|
||||
|
||||
public abstract PrincipalName getPrimaryPrincipal();
|
||||
|
||||
|
@ -83,8 +83,7 @@ public class KeyTabInputStream extends KrbDataInputStream implements KeyTabConst
|
||||
}
|
||||
int nameType = read(4);
|
||||
index -= 4;
|
||||
PrincipalName service = new PrincipalName(nameParts, nameType);
|
||||
service.setRealm(realm);
|
||||
PrincipalName service = new PrincipalName(nameType, nameParts, realm);
|
||||
KerberosTime timeStamp = readTimeStamp();
|
||||
|
||||
int keyVersion = read() & 0xff;
|
||||
|
@ -163,7 +163,7 @@ public final class KerberosClientKeyExchangeImpl
|
||||
|
||||
EncryptedData encPart = t.encPart;
|
||||
PrincipalName ticketSname = t.sname;
|
||||
Realm ticketRealm = t.realm;
|
||||
Realm ticketRealm = t.sname.getRealm();
|
||||
|
||||
String serverPrincipal = serverKeys[0].getPrincipal().getName();
|
||||
|
||||
@ -175,8 +175,7 @@ public final class KerberosClientKeyExchangeImpl
|
||||
*/
|
||||
|
||||
// Check that ticket Sname matches serverPrincipal
|
||||
String ticketPrinc = ticketSname.toString().concat("@" +
|
||||
ticketRealm.toString());
|
||||
String ticketPrinc = ticketSname.toString();
|
||||
if (!ticketPrinc.equals(serverPrincipal)) {
|
||||
if (debug != null && Debug.isOn("handshake"))
|
||||
System.out.println("Service principal in Ticket does not"
|
||||
@ -224,7 +223,6 @@ public final class KerberosClientKeyExchangeImpl
|
||||
|
||||
if (debug != null && Debug.isOn("handshake")) {
|
||||
System.out.println("server principal: " + serverPrincipal);
|
||||
System.out.println("realm: " + encTicketPart.crealm.toString());
|
||||
System.out.println("cname: " + encTicketPart.cname.toString());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
@ -393,7 +393,16 @@ OGLBlitSwToTexture(SurfaceDataRasInfo *srcInfo, OGLPixelFormat *pf,
|
||||
OGLSDOps *dstOps,
|
||||
jint dx1, jint dy1, jint dx2, jint dy2)
|
||||
{
|
||||
jboolean adjustAlpha = (pf != NULL && !pf->hasAlpha);
|
||||
j2d_glBindTexture(dstOps->textureTarget, dstOps->textureID);
|
||||
|
||||
if (adjustAlpha) {
|
||||
// if the source surface does not have an alpha channel,
|
||||
// we need to ensure that the alpha values are forced to 1.0f
|
||||
j2d_glPixelTransferf(GL_ALPHA_SCALE, 0.0f);
|
||||
j2d_glPixelTransferf(GL_ALPHA_BIAS, 1.0f);
|
||||
}
|
||||
|
||||
// in case pixel stride is not a multiple of scanline stride the copy
|
||||
// has to be done line by line (see 6207877)
|
||||
if (srcInfo->scanStride % srcInfo->pixelStride != 0) {
|
||||
@ -413,6 +422,11 @@ OGLBlitSwToTexture(SurfaceDataRasInfo *srcInfo, OGLPixelFormat *pf,
|
||||
dx1, dy1, dx2-dx1, dy2-dy1,
|
||||
pf->format, pf->type, srcInfo->rasBase);
|
||||
}
|
||||
if (adjustAlpha) {
|
||||
// restore scale/bias to their original values
|
||||
j2d_glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
|
||||
j2d_glPixelTransferf(GL_ALPHA_BIAS, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2012, 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
|
||||
@ -55,7 +55,7 @@ class LinuxUserDefinedFileAttributeView
|
||||
name = USER_NAMESPACE + name;
|
||||
byte[] bytes = name.getBytes();
|
||||
if (bytes.length > XATTR_NAME_MAX) {
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, "'" + name + "' is too big");
|
||||
}
|
||||
return bytes;
|
||||
@ -116,7 +116,7 @@ class LinuxUserDefinedFileAttributeView
|
||||
buffer = NativeBuffers.getNativeBuffer(size);
|
||||
continue;
|
||||
}
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, "Unable to get list of extended attributes: " +
|
||||
x.getMessage());
|
||||
}
|
||||
@ -138,7 +138,7 @@ class LinuxUserDefinedFileAttributeView
|
||||
// fgetxattr returns size if called with size==0
|
||||
return fgetxattr(fd, nameAsBytes(file,name), 0L, 0);
|
||||
} catch (UnixException x) {
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, "Unable to get size of extended attribute '" + name +
|
||||
"': " + x.getMessage());
|
||||
} finally {
|
||||
@ -191,7 +191,7 @@ class LinuxUserDefinedFileAttributeView
|
||||
} catch (UnixException x) {
|
||||
String msg = (x.errno() == ERANGE) ?
|
||||
"Insufficient space in buffer" : x.getMessage();
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, "Error reading extended attribute '" + name + "': " + msg);
|
||||
} finally {
|
||||
close(fd);
|
||||
@ -243,7 +243,7 @@ class LinuxUserDefinedFileAttributeView
|
||||
src.position(pos + rem);
|
||||
return rem;
|
||||
} catch (UnixException x) {
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, "Error writing extended attribute '" + name + "': " +
|
||||
x.getMessage());
|
||||
} finally {
|
||||
@ -264,7 +264,7 @@ class LinuxUserDefinedFileAttributeView
|
||||
try {
|
||||
fremovexattr(fd, nameAsBytes(file,name));
|
||||
} catch (UnixException x) {
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, "Unable to delete extended attribute '" + name + "': " + x.getMessage());
|
||||
} finally {
|
||||
close(fd);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2012, 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
|
||||
@ -246,7 +246,7 @@ class LinuxWatchService
|
||||
return x.asIOException(dir);
|
||||
}
|
||||
if (!attrs.isDirectory()) {
|
||||
return new NotDirectoryException(dir.getPathForExecptionMessage());
|
||||
return new NotDirectoryException(dir.getPathForExceptionMessage());
|
||||
}
|
||||
|
||||
// register with inotify (replaces existing mask if already registered)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2012, 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
|
||||
@ -324,7 +324,7 @@ class SolarisAclFileAttributeView
|
||||
return decode(address, n);
|
||||
} catch (UnixException x) {
|
||||
if ((x.errno() == ENOSYS) || !isAclsEnabled(fd)) {
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, x.getMessage() + " (file system does not support NFSv4 ACLs)");
|
||||
}
|
||||
x.rethrowAsIOException(file);
|
||||
@ -355,7 +355,7 @@ class SolarisAclFileAttributeView
|
||||
facl(fd, ACE_SETACL, n, address);
|
||||
} catch (UnixException x) {
|
||||
if ((x.errno() == ENOSYS) || !isAclsEnabled(fd)) {
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, x.getMessage() + " (file system does not support NFSv4 ACLs)");
|
||||
}
|
||||
if (x.errno() == EINVAL && (n < 3))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2012, 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
|
||||
@ -49,7 +49,7 @@ class SolarisUserDefinedFileAttributeView
|
||||
if (bytes.length <= 1 ||
|
||||
(bytes.length == 2 && bytes[1] == '.'))
|
||||
{
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, "'" + name + "' is not a valid name");
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,7 @@ class SolarisUserDefinedFileAttributeView
|
||||
}
|
||||
return Collections.unmodifiableList(list);
|
||||
} catch (UnixException x) {
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, "Unable to get list of extended attributes: " +
|
||||
x.getMessage());
|
||||
}
|
||||
@ -126,7 +126,7 @@ class SolarisUserDefinedFileAttributeView
|
||||
close(afd);
|
||||
}
|
||||
} catch (UnixException x) {
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, "Unable to get size of extended attribute '" + name +
|
||||
"': " + x.getMessage());
|
||||
}
|
||||
@ -165,7 +165,7 @@ class SolarisUserDefinedFileAttributeView
|
||||
fc.close();
|
||||
}
|
||||
} catch (UnixException x) {
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, "Unable to read extended attribute '" + name +
|
||||
"': " + x.getMessage());
|
||||
}
|
||||
@ -201,7 +201,7 @@ class SolarisUserDefinedFileAttributeView
|
||||
fc.close();
|
||||
}
|
||||
} catch (UnixException x) {
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, "Unable to write extended attribute '" + name +
|
||||
"': " + x.getMessage());
|
||||
}
|
||||
@ -224,7 +224,7 @@ class SolarisUserDefinedFileAttributeView
|
||||
close(dfd);
|
||||
}
|
||||
} catch (UnixException x) {
|
||||
throw new FileSystemException(file.getPathForExecptionMessage(),
|
||||
throw new FileSystemException(file.getPathForExceptionMessage(),
|
||||
null, "Unable to delete extended attribute '" + name +
|
||||
"': " + x.getMessage());
|
||||
} finally {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2012, 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
|
||||
@ -288,7 +288,7 @@ class SolarisWatchService
|
||||
return x.asIOException(dir);
|
||||
}
|
||||
if (!attrs.isDirectory()) {
|
||||
return new NotDirectoryException(dir.getPathForExecptionMessage());
|
||||
return new NotDirectoryException(dir.getPathForExceptionMessage());
|
||||
}
|
||||
|
||||
// return existing watch key after updating events if already
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2012, 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
|
||||
@ -383,8 +383,8 @@ class UnixCopyFile {
|
||||
} catch (UnixException x) {
|
||||
if (x.errno() == EXDEV) {
|
||||
throw new AtomicMoveNotSupportedException(
|
||||
source.getPathForExecptionMessage(),
|
||||
target.getPathForExecptionMessage(),
|
||||
source.getPathForExceptionMessage(),
|
||||
target.getPathForExceptionMessage(),
|
||||
x.errorString());
|
||||
}
|
||||
x.rethrowAsIOException(source, target);
|
||||
@ -420,7 +420,7 @@ class UnixCopyFile {
|
||||
return; // nothing to do as files are identical
|
||||
if (!flags.replaceExisting) {
|
||||
throw new FileAlreadyExistsException(
|
||||
target.getPathForExecptionMessage());
|
||||
target.getPathForExceptionMessage());
|
||||
}
|
||||
|
||||
// attempt to delete target
|
||||
@ -436,7 +436,7 @@ class UnixCopyFile {
|
||||
(x.errno() == EEXIST || x.errno() == ENOTEMPTY))
|
||||
{
|
||||
throw new DirectoryNotEmptyException(
|
||||
target.getPathForExecptionMessage());
|
||||
target.getPathForExceptionMessage());
|
||||
}
|
||||
x.rethrowAsIOException(target);
|
||||
}
|
||||
@ -489,7 +489,7 @@ class UnixCopyFile {
|
||||
(x.errno() == EEXIST || x.errno() == ENOTEMPTY))
|
||||
{
|
||||
throw new DirectoryNotEmptyException(
|
||||
source.getPathForExecptionMessage());
|
||||
source.getPathForExceptionMessage());
|
||||
}
|
||||
x.rethrowAsIOException(source);
|
||||
}
|
||||
@ -542,7 +542,7 @@ class UnixCopyFile {
|
||||
return; // nothing to do as files are identical
|
||||
if (!flags.replaceExisting)
|
||||
throw new FileAlreadyExistsException(
|
||||
target.getPathForExecptionMessage());
|
||||
target.getPathForExceptionMessage());
|
||||
try {
|
||||
if (targetAttrs.isDirectory()) {
|
||||
rmdir(target);
|
||||
@ -555,7 +555,7 @@ class UnixCopyFile {
|
||||
(x.errno() == EEXIST || x.errno() == ENOTEMPTY))
|
||||
{
|
||||
throw new DirectoryNotEmptyException(
|
||||
target.getPathForExecptionMessage());
|
||||
target.getPathForExceptionMessage());
|
||||
}
|
||||
x.rethrowAsIOException(target);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2012, 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
|
||||
@ -97,8 +97,8 @@ class UnixException extends Exception {
|
||||
}
|
||||
|
||||
void rethrowAsIOException(UnixPath file, UnixPath other) throws IOException {
|
||||
String a = (file == null) ? null : file.getPathForExecptionMessage();
|
||||
String b = (other == null) ? null : other.getPathForExecptionMessage();
|
||||
String a = (file == null) ? null : file.getPathForExceptionMessage();
|
||||
String b = (other == null) ? null : other.getPathForExceptionMessage();
|
||||
IOException x = translateToIOException(a, b);
|
||||
throw x;
|
||||
}
|
||||
@ -108,6 +108,6 @@ class UnixException extends Exception {
|
||||
}
|
||||
|
||||
IOException asIOException(UnixPath file) {
|
||||
return translateToIOException(file.getPathForExecptionMessage(), null);
|
||||
return translateToIOException(file.getPathForExceptionMessage(), null);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2012, 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
|
||||
@ -238,7 +238,7 @@ public abstract class UnixFileSystemProvider
|
||||
// DirectoryNotEmptyException if not empty
|
||||
if (attrs != null && attrs.isDirectory() &&
|
||||
(x.errno() == EEXIST || x.errno() == ENOTEMPTY))
|
||||
throw new DirectoryNotEmptyException(file.getPathForExecptionMessage());
|
||||
throw new DirectoryNotEmptyException(file.getPathForExceptionMessage());
|
||||
|
||||
x.rethrowAsIOException(file);
|
||||
return false;
|
||||
@ -401,7 +401,7 @@ public abstract class UnixFileSystemProvider
|
||||
return new UnixDirectoryStream(dir, ptr, filter);
|
||||
} catch (UnixException x) {
|
||||
if (x.errno() == ENOTDIR)
|
||||
throw new NotDirectoryException(dir.getPathForExecptionMessage());
|
||||
throw new NotDirectoryException(dir.getPathForExceptionMessage());
|
||||
x.rethrowAsIOException(dir);
|
||||
}
|
||||
}
|
||||
@ -421,7 +421,7 @@ public abstract class UnixFileSystemProvider
|
||||
if (dfd2 != -1)
|
||||
UnixNativeDispatcher.close(dfd2);
|
||||
if (x.errno() == UnixConstants.ENOTDIR)
|
||||
throw new NotDirectoryException(dir.getPathForExecptionMessage());
|
||||
throw new NotDirectoryException(dir.getPathForExceptionMessage());
|
||||
x.rethrowAsIOException(dir);
|
||||
}
|
||||
return new UnixSecureDirectoryStream(dir, dp, dfd2, filter);
|
||||
@ -490,7 +490,7 @@ public abstract class UnixFileSystemProvider
|
||||
return new UnixPath(link.getFileSystem(), target);
|
||||
} catch (UnixException x) {
|
||||
if (x.errno() == UnixConstants.EINVAL)
|
||||
throw new NotLinkException(link.getPathForExecptionMessage());
|
||||
throw new NotLinkException(link.getPathForExceptionMessage());
|
||||
x.rethrowAsIOException(link);
|
||||
return null; // keep compiler happy
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2012, 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
|
||||
@ -179,7 +179,7 @@ class UnixPath
|
||||
}
|
||||
|
||||
// use this message when throwing exceptions
|
||||
String getPathForExecptionMessage() {
|
||||
String getPathForExceptionMessage() {
|
||||
return toString();
|
||||
}
|
||||
|
||||
@ -780,7 +780,7 @@ class UnixPath
|
||||
x.setError(ELOOP);
|
||||
|
||||
if (x.errno() == ELOOP)
|
||||
throw new FileSystemException(getPathForExecptionMessage(), null,
|
||||
throw new FileSystemException(getPathForExceptionMessage(), null,
|
||||
x.getMessage() + " or unable to access attributes of symbolic link");
|
||||
|
||||
x.rethrowAsIOException(this);
|
||||
|
@ -196,7 +196,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||
struct addrinfo *next
|
||||
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
||||
if (!next) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||
ret = NULL;
|
||||
goto cleanupAndReturn;
|
||||
}
|
||||
@ -465,7 +465,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||
struct addrinfo *next
|
||||
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
||||
if (!next) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||
ret = NULL;
|
||||
goto cleanupAndReturn;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||
struct addrinfo *next
|
||||
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
||||
if (!next) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||
ret = NULL;
|
||||
goto cleanupAndReturn;
|
||||
}
|
||||
|
@ -804,7 +804,7 @@ static netif *enumInterfaces(JNIEnv *env) {
|
||||
do{ \
|
||||
_pointer = (_type)malloc( _size ); \
|
||||
if (_pointer == NULL) { \
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed"); \
|
||||
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed"); \
|
||||
return ifs; /* return untouched list */ \
|
||||
} \
|
||||
} while(0)
|
||||
|
@ -485,7 +485,7 @@ Java_java_net_PlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
||||
fullPacket = (char *)malloc(packetBufferLen);
|
||||
|
||||
if (!fullPacket) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Send buffer native heap allocation failed");
|
||||
return;
|
||||
} else {
|
||||
mallocedPacket = JNI_TRUE;
|
||||
@ -714,7 +714,7 @@ Java_java_net_PlainDatagramSocketImpl_peekData(JNIEnv *env, jobject this,
|
||||
fullPacket = (char *)malloc(packetBufferLen);
|
||||
|
||||
if (!fullPacket) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Peek buffer native heap allocation failed");
|
||||
return -1;
|
||||
} else {
|
||||
mallocedPacket = JNI_TRUE;
|
||||
@ -874,7 +874,7 @@ Java_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, jobject this,
|
||||
fullPacket = (char *)malloc(packetBufferLen);
|
||||
|
||||
if (!fullPacket) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Receive buffer native heap allocation failed");
|
||||
return;
|
||||
} else {
|
||||
mallocedPacket = JNI_TRUE;
|
||||
|
@ -206,9 +206,7 @@ public class Kinit {
|
||||
System.out.println(">>> Kinit realm name is " + realm);
|
||||
}
|
||||
|
||||
PrincipalName sname = new PrincipalName("krbtgt" + "/" + realm,
|
||||
PrincipalName.KRB_NT_SRV_INST);
|
||||
sname.setRealm(realm);
|
||||
PrincipalName sname = PrincipalName.tgsService(realm, realm);
|
||||
builder.setTarget(sname);
|
||||
|
||||
if (DEBUG) {
|
||||
|
@ -146,15 +146,6 @@ class KinitOptions {
|
||||
"Principal name: " + p +
|
||||
e.getMessage());
|
||||
}
|
||||
if (principal.getRealm() == null) {
|
||||
String realm =
|
||||
Config.getInstance().getDefault("default_realm",
|
||||
"libdefaults");
|
||||
if (realm != null) {
|
||||
principal.setRealm(realm);
|
||||
} else throw new IllegalArgumentException("invalid " +
|
||||
"Realm name");
|
||||
}
|
||||
} else if (this.password == null) {
|
||||
// Have already processed a Principal, this must be a password
|
||||
password = args[i].toCharArray();
|
||||
@ -175,16 +166,6 @@ class KinitOptions {
|
||||
}
|
||||
|
||||
PrincipalName getDefaultPrincipal() {
|
||||
String cname;
|
||||
String realm = null;
|
||||
try {
|
||||
realm = Config.getInstance().getDefaultRealm();
|
||||
} catch (KrbException e) {
|
||||
System.out.println ("Can not get default realm " +
|
||||
e.getMessage());
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
// get default principal name from the cachename if it is
|
||||
// available.
|
||||
@ -204,10 +185,6 @@ class KinitOptions {
|
||||
}
|
||||
PrincipalName p = cis.readPrincipal(version);
|
||||
cis.close();
|
||||
String temp = p.getRealmString();
|
||||
if (temp == null) {
|
||||
p.setRealm(realm);
|
||||
}
|
||||
if (DEBUG) {
|
||||
System.out.println(">>>KinitOptions principal name from "+
|
||||
"the cache is :" + p);
|
||||
@ -230,19 +207,15 @@ class KinitOptions {
|
||||
System.out.println(">>>KinitOptions default username is :"
|
||||
+ username);
|
||||
}
|
||||
if (realm != null) {
|
||||
try {
|
||||
PrincipalName p = new PrincipalName(username);
|
||||
if (p.getRealm() == null)
|
||||
p.setRealm(realm);
|
||||
return p;
|
||||
} catch (RealmException e) {
|
||||
// ignore exception , return null
|
||||
if (DEBUG) {
|
||||
System.out.println ("Exception in getting principal " +
|
||||
"name " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
PrincipalName p = new PrincipalName(username);
|
||||
return p;
|
||||
} catch (RealmException e) {
|
||||
// ignore exception , return null
|
||||
if (DEBUG) {
|
||||
System.out.println ("Exception in getting principal " +
|
||||
"name " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -273,9 +273,6 @@ public class Ktab {
|
||||
PrincipalName pname = null;
|
||||
try {
|
||||
pname = new PrincipalName(principal);
|
||||
if (pname.getRealm() == null) {
|
||||
pname.setRealm(Config.getInstance().getDefaultRealm());
|
||||
}
|
||||
} catch (KrbException e) {
|
||||
System.err.println("Failed to add " + principal +
|
||||
" to keytab.");
|
||||
@ -382,9 +379,6 @@ public class Ktab {
|
||||
PrincipalName pname = null;
|
||||
try {
|
||||
pname = new PrincipalName(principal);
|
||||
if (pname.getRealm() == null) {
|
||||
pname.setRealm(Config.getInstance().getDefaultRealm());
|
||||
}
|
||||
if (!forced) {
|
||||
String answer;
|
||||
BufferedReader cis =
|
||||
|
@ -265,7 +265,7 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketRece
|
||||
}
|
||||
fullPacket = (char *)malloc(packetBufferLen);
|
||||
if (!fullPacket) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@ -427,7 +427,7 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketSend
|
||||
}
|
||||
fullPacket = (char *)malloc(length);
|
||||
if (!fullPacket) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -197,7 +197,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||
struct addrinfo *next
|
||||
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
||||
if (!next) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||
ret = NULL;
|
||||
goto cleanupAndReturn;
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ int enumInterfaces(JNIEnv *env, netif **netifPP)
|
||||
}
|
||||
}
|
||||
if (curr == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
|
||||
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
|
||||
free_netif(netifP);
|
||||
free(tableP);
|
||||
return -1;
|
||||
@ -370,7 +370,7 @@ int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP)
|
||||
|
||||
netaddr *curr = (netaddr *)malloc(sizeof(netaddr));
|
||||
if (curr == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
|
||||
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
|
||||
free_netaddr(netaddrP);
|
||||
free(tableP);
|
||||
return -1;
|
||||
|
@ -243,7 +243,7 @@ jboolean exceedSizeLimit(JNIEnv *env, jint fd, jint addr, jint size)
|
||||
addrList = curr;
|
||||
}
|
||||
LeaveCriticalSection(&sizeCheckLock);
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||
return JNI_TRUE;
|
||||
}
|
||||
curr->addr = htonl((*addrp)->S_un.S_addr);
|
||||
@ -740,7 +740,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
||||
*/
|
||||
fullPacket = (char *)malloc(packetBufferLen);
|
||||
if (!fullPacket) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Send buf native heap allocation failed");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -1003,7 +1003,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_peekData(JNIEnv *env, jobject thi
|
||||
*/
|
||||
fullPacket = (char *)malloc(packetBufferLen);
|
||||
if (!fullPacket) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@ -1287,7 +1287,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_receive0(JNIEnv *env, jobject thi
|
||||
*/
|
||||
fullPacket = (char *)malloc(packetBufferLen);
|
||||
if (!fullPacket) {
|
||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
||||
JNU_ThrowOutOfMemoryError(env, "Receive buf native heap allocation failed");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -67,7 +67,6 @@ jmethodID encryptionKeyConstructor = 0;
|
||||
jmethodID ticketFlagsConstructor = 0;
|
||||
jmethodID kerberosTimeConstructor = 0;
|
||||
jmethodID krbcredsConstructor = 0;
|
||||
jmethodID setRealmMethod = 0;
|
||||
|
||||
/*
|
||||
* Function prototypes for internal routines
|
||||
@ -279,7 +278,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(
|
||||
}
|
||||
|
||||
principalNameConstructor = (*env)->GetMethodID(env, principalNameClass,
|
||||
"<init>", "([Ljava/lang/String;)V");
|
||||
"<init>", "([Ljava/lang/String;Ljava/lang/String;)V");
|
||||
if (principalNameConstructor == 0) {
|
||||
printf("LSA: Couldn't find PrincipalName constructor\n");
|
||||
return JNI_ERR;
|
||||
@ -318,14 +317,6 @@ JNIEXPORT jint JNICALL JNI_OnLoad(
|
||||
printf("LSA: Found KerberosTime constructor\n");
|
||||
}
|
||||
|
||||
// load the setRealm method in PrincipalName
|
||||
setRealmMethod = (*env)->GetMethodID(env, principalNameClass,
|
||||
"setRealm", "(Ljava/lang/String;)V");
|
||||
if (setRealmMethod == 0) {
|
||||
printf("LSA: Couldn't find setRealm in PrincipalName\n");
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
if (native_debug) {
|
||||
printf("LSA: Finished OnLoad processing\n");
|
||||
}
|
||||
@ -952,13 +943,12 @@ jobject BuildPrincipal(JNIEnv *env, PKERB_EXTERNAL_NAME principalName,
|
||||
|
||||
// Do I have to worry about storage reclamation here?
|
||||
}
|
||||
principal = (*env)->NewObject(env, principalNameClass,
|
||||
principalNameConstructor, stringArray);
|
||||
|
||||
// now set the realm in the principal
|
||||
realmLen = (ULONG)wcslen((PWCHAR)realm);
|
||||
realmStr = (*env)->NewString(env, (PWCHAR)realm, (USHORT)realmLen);
|
||||
(*env)->CallVoidMethod(env, principal, setRealmMethod, realmStr);
|
||||
|
||||
principal = (*env)->NewObject(env, principalNameClass,
|
||||
principalNameConstructor, stringArray, realmStr);
|
||||
|
||||
// free local resources
|
||||
LocalFree(realm);
|
||||
|
@ -122,9 +122,6 @@
|
||||
|
||||
# jdk_lang
|
||||
|
||||
# 7123972
|
||||
java/lang/annotation/loaderLeak/Main.java generic-all
|
||||
|
||||
# 6944188
|
||||
java/lang/management/ThreadMXBean/ThreadStateTest.java generic-all
|
||||
|
||||
@ -161,9 +158,6 @@ java/lang/Math/WorstCaseTests.java generic-all
|
||||
# 6988950
|
||||
demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java generic-all
|
||||
|
||||
# Need to be marked othervm, or changed to be samevm safe
|
||||
com/sun/jndi/rmi/registry/RegistryContext/UnbindIdempotent.java generic-all
|
||||
|
||||
# 7162111
|
||||
demo/jvmti/mtrace/TraceJFrame.java macosx-all
|
||||
javax/script/CauseExceptionTest.java macosx-all
|
||||
@ -268,21 +262,11 @@ java/nio/channels/Selector/OutOfBand.java macosx-all
|
||||
|
||||
# jdk_rmi
|
||||
|
||||
# 7140992
|
||||
java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java generic-all
|
||||
|
||||
# 6948101
|
||||
java/rmi/transport/pinLastArguments/PinLastArguments.java generic-all
|
||||
|
||||
# 7146541
|
||||
java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java linux-all
|
||||
|
||||
# 7132247
|
||||
java/rmi/registry/readTest/readTest.sh windows-all
|
||||
|
||||
# 7142596
|
||||
java/rmi/transport/pinClientSocketFactory/PinClientSocketFactory.java generic-all
|
||||
|
||||
############################################################################
|
||||
|
||||
# jdk_security
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user