/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*/
/**
* Implements the ASN.1 Realm type.
*
* <xmp>
* Realm ::= GeneralString
* </xmp>
*/
private Realm() {
}
}
}
return new_realm;
}
if (this == obj) {
return true;
}
return false;
}
} else {
}
}
public int hashCode() {
int result = 17 ;
}
return result;
}
/**
* Constructs a Realm object.
* @param encoding a Der-encoded data.
* @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
* @exception IOException if an I/O error occurs while reading encoded data.
* @exception RealmException if an error occurs while parsing a Realm object.
*/
throw new IllegalArgumentException("encoding can not be null");
}
if (!isValidRealmString(realm))
}
return realm;
}
throws RealmException {
throw new IllegalArgumentException
("null input name is not allowed");
}
int i = 0;
break;
}
}
i++;
}
if (!isValidRealmString(result))
}
return result;
}
throw new IllegalArgumentException
("null input name is not allowed");
}
int i = 0;
break;
}
}
i++;
}
return result;
}
if (!isValidRealmString(result))
return result;
}
// This is protected because the definition of a realm
// string is fixed
return false;
return false;
return false;
}
}
return true;
}
/**
* Encodes a Realm object.
* @return the byte array of encoded KrbCredInfo 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.
*
*/
return out.toByteArray();
}
/**
* Parse (unmarshal) a realm from a DER input stream. This form
* parsing might be used when expanding a value which is part of
* a constructed sequence and uses explicitly tagged type.
*
* @exception Asn1Exception on error.
* @param data the Der input stream value, which contains one or more marshaled value.
* @param explicitTag tag number.
* @param optional indicate if this data field is optional
* @return an instance of Realm.
*
*/
public static Realm parse(DerInputStream data, byte explicitTag, boolean optional) throws Asn1Exception, IOException, RealmException {
return null;
}
} else {
}
}
/*
* First leg of realms parsing. Used by getRealmsList.
*/
throws KrbException {
}
if (DEBUG) {
}
if (DEBUG) {
+ retList[0]);
}
return retList;
}
return null;
}
/**
* Returns an array of realms that may be traversed to obtain
* a TGT from the initiating realm cRealm to the target realm
* sRealm.
* <br>
* There may be an arbitrary number of intermediate realms
* between cRealm and sRealm. The realms may be organized
* organized hierarchically, or the paths between them may be
* specified in the [capaths] stanza of the caller's
* Kerberos configuration file. The configuration file is consulted
* first. Then a hirarchical organization is assumed if no realms
* are found in the configuration file.
* <br>
* The returned list, if not null, contains cRealm as the first
* entry. sRealm is not included unless it is mistakenly listed
* in the configuration file as an intermediary realm.
*
* @param cRealm the initiating realm
* @param sRealm the target realm
* @returns array of realms
* @thows KrbException
*/
throws KrbException {
return retList;
}
/*
* Try [capaths].
*/
return retList;
}
/*
* Now assume the realms are organized hierarchically.
*/
return retList;
}
/**
* Parses the [capaths] stanza of the configuration file
* for a list of realms to traverse
* to obtain credentials from the initiating realm cRealm to
* the target realm sRealm.
* @param cRealm the initiating realm
* @param sRealm the target realm
* @returns array of realms
* @ throws KrbException
*/
/*
* parseCapaths works for a capaths organized such that
* for a given client realm C there is a tag C that
* contains subtags Ci ... Cn that completely define intermediate
* realms from C to target T. For example:
*
* [capaths]
* TIVOLI.COM = {
* IBM.COM = IBM_LDAPCENTRAL.COM MOONLITE.ORG
* IBM_LDAPCENTRAL.COM = LDAPCENTRAL.NET
* LDAPCENTRAL.NET = .
* }
*
* The tag TIVOLI.COM contains subtags IBM.COM, IBM_LDAPCENTRAL.COM
* and LDAPCENTRAL.NET that completely define the path from TIVOLI.COM
* to IBM.COM (TIVOLI.COM->LADAPCENTRAL.NET->IBM_LDAPCENTRAL.COM->IBM
* or TIVOLI.COM->MOONLITE.ORG->IBM.COM).
*
* A direct path is assumed for an intermediary whose entry is not
* "closed" by a "." In the above example, TIVOLI.COM is assumed
* to have a direct path to MOONLITE.ORG and MOONLITE.COM
* in turn to IBM.COM.
*/
try {
if (DEBUG) {
}
return null;
}
if (intermediaries == null) {
if (DEBUG) {
}
return null;
}
/*
* The half-established reversed-path, starting from the final target
* (sRealm), each item can be connected to by the next one.
* Might contains wrong item, if found, a bad track is performed
*/
tempTarget = sRealm;
out: do {
if (DEBUG) {
count++;
}
if (intermediaries != null &&
if (DEBUG) {
count + ": intermediaries=[" +
intermediaries + "]");
}
/*
* We have one or more space-separated intermediary realms.
* Stack them. A null is always added between intermedies of
* different targets. When this null is popped, it means none
* of the intermedies for this target is useful (because of
* infinite loop), the target is then removed from the partial
* tempList, and the next possible intermediary is tried.
*/
{
break out;
}
if (DEBUG) {
count +
": pushed realm on to stack: " +
}
} else if (DEBUG) {
count +
": ignoring realm: [" +
tempRealm + "]");
}
}
} else {
if (DEBUG) {
count +
": no intermediaries");
}
break;
}
/*
* Get next intermediary realm from the stack
*/
try {
if (DEBUG) {
}
}
} catch (EmptyStackException exc) {
tempTarget = null;
}
if (tempTarget == null) {
/*
* No more intermediaries. We're done.
*/
break;
}
if (DEBUG) {
": added intermediary to list: " +
}
} while (true);
return null;
}
// From (SREALM, T1, T2) to (CREALM, T2, T1)
}
"]=" + retList[i]);
}
}
return retList;
}
/**
* Build a list of realm that can be traversed
* to obtain credentials from the initiating realm cRealm
* for a service in the target realm sRealm.
* @param cRealm the initiating realm
* @param sRealm the target realm
* @returns array of realms
* @throws KrbException
*/
throws KrbException
{
// Parse the components and determine common part, if any.
new StringTokenizer(cRealm,
// Parse cRealm
}
if (DEBUG) {
cCount + " components:");
int j = 0;
while (j < cCount) {
}
}
// Parse sRealm
}
if (DEBUG) {
sCount + " components:");
int j = 0;
while (j < sCount) {
"]=" + sComponents[j++]);
}
}
// Determine common components, if any.
int commonComponents = 0;
//while (sCount > 0 && cCount > 0 &&
// sComponents[--sCount].equals(cComponents[--cCount]))
}
int cCommonStart = -1;
int sCommonStart = -1;
int links = 0;
if (commonComponents > 0) {
// components from common to ancestors
links += sCommonStart;
links += cCommonStart;
} else {
links++;
}
if (DEBUG) {
if (commonComponents > 0) {
commonComponents + " common component" +
+
"in cRealm (starts at index " +
cCommonStart + ")");
sCommonStart + ")");
} else
}
if (DEBUG) {
}
if (DEBUG) {
retList[0]);
}
// For an initiator realm A.B.C.D.COM,
// ie the issuer realm is the immediate descendant
// of the target realm.
int i;
//cTemp = substring(cRealm, cCount);
if (DEBUG) {
}
}
//cTemp = substring(sRealm, sCount);
if (DEBUG) {
}
}
return retList;
}
{
while(i < len && j != componentIndex) {
continue;
j++;
}
}
}
return;
int i = 0;
i++;
}
}
}