jdk/src/share/classes/sun/security/krb5/PrincipalName.java
author weijun
Thu, 04 Aug 2011 18:18:45 +0800
changeset 10141 664ba64d2472
parent 9035 1255eb81cc2f
child 10369 e9d2e59e53f0
permissions -rw-r--r--
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem Reviewed-by: valeriep
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
9035
1255eb81cc2f 7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents: 7977
diff changeset
     2
 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5455
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5455
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5455
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5455
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5455
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *  (C) Copyright IBM Corp. 1999 All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *  Copyright 1997 The Open Group Research Institute.  All rights reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
package sun.security.krb5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import sun.security.krb5.internal.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import sun.security.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.net.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.util.Vector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.math.BigInteger;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import sun.security.krb5.internal.ccache.CCacheOutputStream;
3949
00603a93b589 6862679: ESC: AD Authentication with user with umlauts fails
weijun
parents: 2918
diff changeset
    41
import sun.security.krb5.internal.util.KerberosString;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * This class encapsulates a Kerberos principal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
public class PrincipalName
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    implements Cloneable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    //name types
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * Name type not known
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    public static final int KRB_NT_UNKNOWN =   0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * Just the name of the principal as in DCE, or for users
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    public static final int KRB_NT_PRINCIPAL = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * Service and other unique instance (krbtgt)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    public static final int KRB_NT_SRV_INST =  2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * Service with host name as instance (telnet, rcommands)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    public static final int KRB_NT_SRV_HST =   3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * Service with host as remaining components
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    public static final int KRB_NT_SRV_XHST =  4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * Unique ID
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    public static final int KRB_NT_UID = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * TGS Name
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    public static final String TGS_DEFAULT_SRV_NAME = "krbtgt";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    public static final int TGS_DEFAULT_NT = KRB_NT_SRV_INST;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    public static final char NAME_COMPONENT_SEPARATOR = '/';
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    public static final char NAME_REALM_SEPARATOR = '@';
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public static final char REALM_COMPONENT_SEPARATOR = '.';
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public static final String NAME_COMPONENT_SEPARATOR_STR = "/";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    public static final String NAME_REALM_SEPARATOR_STR = "@";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    public static final String REALM_COMPONENT_SEPARATOR_STR = ".";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    private int nameType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    private String[] nameStrings;  // Principal names don't mutate often
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    private Realm nameRealm;  // optional; a null realm means use default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    // Note: the nameRealm is not included in the default ASN.1 encoding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
5455
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   104
    // cached salt, might be changed by KDC info, not used in clone
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    private String salt = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    protected PrincipalName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    public PrincipalName(String[] nameParts, int type)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        throws IllegalArgumentException, IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        if (nameParts == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            throw new IllegalArgumentException("Null input not allowed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        nameStrings = new String[nameParts.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        System.arraycopy(nameParts, 0, nameStrings, 0, nameParts.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        nameType = type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        nameRealm = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    public PrincipalName(String[] nameParts) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        this(nameParts, KRB_NT_UNKNOWN);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    public Object clone() {
5455
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   126
        try {
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   127
            PrincipalName pName = (PrincipalName) super.clone();
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   128
            // Re-assign mutable fields
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   129
            if (nameStrings != null) {
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   130
                pName.nameStrings = nameStrings.clone();
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   131
            }
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   132
            if (nameRealm != null) {
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   133
                pName.nameRealm = (Realm)nameRealm.clone();
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   134
            }
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   135
            return pName;
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   136
        } catch (CloneNotSupportedException ex) {
19d2395cfe3e 6856069: PrincipalName.clone() does not invoke super.clone()
weijun
parents: 3949
diff changeset
   137
            throw new AssertionError("Should never happen");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * Added to workaround a bug where the equals method that takes a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * PrincipalName is not being called but Object.equals(Object) is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * being called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    public boolean equals(Object o) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        if (o instanceof PrincipalName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            return equals((PrincipalName)o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    public boolean equals(PrincipalName other) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        if (!equalsWithoutRealm(other)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        if ((nameRealm != null && other.nameRealm == null) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            (nameRealm == null && other.nameRealm != null)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        if (nameRealm != null && other.nameRealm != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            if (!nameRealm.equals(other.nameRealm)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    boolean equalsWithoutRealm(PrincipalName other) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        if ((nameStrings != null && other.nameStrings == null) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            (nameStrings == null && other.nameStrings != null))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        if (nameStrings != null && other.nameStrings != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            if (nameStrings.length != other.nameStrings.length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            for (int i = 0; i < nameStrings.length; i++)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                if (!nameStrings[i].equals(other.nameStrings[i]))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                    return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * Returns the ASN.1 encoding of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * <xmp>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * PrincipalName    ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     *          name-type       [0] Int32,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     *          name-string     [1] SEQUENCE OF KerberosString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * KerberosString   ::= GeneralString (IA5String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * </xmp>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * This definition reflects the Network Working Group RFC 4120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * specification available at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * <a href="http://www.ietf.org/rfc/rfc4120.txt">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * http://www.ietf.org/rfc/rfc4120.txt</a>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * @param encoding a Der-encoded data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * @exception Asn1Exception if an error occurs while decoding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * an ASN1 encoded data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * @exception Asn1Exception if there is an ASN1 encoding error
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @exception IOException if an I/O error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * @exception IllegalArgumentException if encoding is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * reading encoded data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    public PrincipalName(DerValue encoding)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        throws Asn1Exception, IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        nameRealm = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        DerValue der;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        if (encoding == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            throw new IllegalArgumentException("Null input not allowed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        if (encoding.getTag() != DerValue.tag_Sequence) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            throw new Asn1Exception(Krb5.ASN1_BAD_ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        der = encoding.getData().getDerValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        if ((der.getTag() & 0x1F) == 0x00) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            BigInteger bint = der.getData().getBigInteger();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            nameType = bint.intValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            throw new Asn1Exception(Krb5.ASN1_BAD_ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        der = encoding.getData().getDerValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        if ((der.getTag() & 0x01F) == 0x01) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            DerValue subDer = der.getData().getDerValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
            if (subDer.getTag() != DerValue.tag_SequenceOf) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
                throw new Asn1Exception(Krb5.ASN1_BAD_ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
            }
7977
f47f211cd627 7008713: diamond conversion of kerberos5 and security tools
smarks
parents: 7183
diff changeset
   241
            Vector<String> v = new Vector<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
            DerValue subSubDer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
            while(subDer.getData().available() > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
                subSubDer = subDer.getData().getDerValue();
3949
00603a93b589 6862679: ESC: AD Authentication with user with umlauts fails
weijun
parents: 2918
diff changeset
   245
                v.addElement(new KerberosString(subSubDer).toString());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
            if (v.size() > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
                nameStrings = new String[v.size()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                v.copyInto(nameStrings);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                nameStrings = new String[] {""};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        } else  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
            throw new Asn1Exception(Krb5.ASN1_BAD_ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * Parse (unmarshal) a <code>PrincipalName</code> from a DER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * input stream.  This form
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * parsing might be used when expanding a value which is part of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * a constructed sequence and uses explicitly tagged type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * @exception Asn1Exception on error.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * @param data the Der input stream value, which contains one or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * more marshaled value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * @param explicitTag tag number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * @param optional indicate if this data field is optional
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * @return an instance of <code>PrincipalName</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    public static PrincipalName parse(DerInputStream data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
                                      byte explicitTag, boolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                                      optional)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        throws Asn1Exception, IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        if ((optional) && (((byte)data.peekByte() & (byte)0x1F) !=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
                           explicitTag))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        DerValue der = data.getDerValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        if (explicitTag != (der.getTag() & (byte)0x1F))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
            throw new Asn1Exception(Krb5.ASN1_BAD_ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
            DerValue subDer = der.getData().getDerValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
            return new PrincipalName(subDer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    // This is protected because the definition of a principal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    // string is fixed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    // XXX Error checkin consistent with MIT krb5_parse_name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    // Code repetition, realm parsed again by class Realm
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    protected static String[] parseName(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
7977
f47f211cd627 7008713: diamond conversion of kerberos5 and security tools
smarks
parents: 7183
diff changeset
   296
        Vector<String> tempStrings = new Vector<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        String temp = name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        int i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        int componentStart = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        String component;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        while (i < temp.length()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            if (temp.charAt(i) == NAME_COMPONENT_SEPARATOR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                 * If this separator is escaped then don't treat it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                 * as a separator
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                if (i > 0 && temp.charAt(i - 1) == '\\') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                    temp = temp.substring(0, i - 1) +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                        temp.substring(i, temp.length());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
                    continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
                    if (componentStart < i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
                        component = temp.substring(componentStart, i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
                        tempStrings.addElement(component);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                    componentStart = i + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
            } else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                if (temp.charAt(i) == NAME_REALM_SEPARATOR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
                    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
                     * If this separator is escaped then don't treat it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                     * as a separator
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
                     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
                    if (i > 0 && temp.charAt(i - 1) == '\\') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
                        temp = temp.substring(0, i - 1) +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
                            temp.substring(i, temp.length());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
                        continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
                        if (componentStart < i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
                            component = temp.substring(componentStart, i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
                            tempStrings.addElement(component);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
                        componentStart = i + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
                        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            i++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        if (i == temp.length())
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
        if (componentStart < i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
            component = temp.substring(componentStart, i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
            tempStrings.addElement(component);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        String[] result = new String[tempStrings.size()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        tempStrings.copyInto(result);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    public PrincipalName(String name, int type)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        throws RealmException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        if (name == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
            throw new IllegalArgumentException("Null name not allowed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        String[] nameParts = parseName(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        Realm tempRealm = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        String realmString = Realm.parseRealmAtSeparator(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        if (realmString == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
                Config config = Config.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
                realmString = config.getDefaultRealm();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
            } catch (KrbException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
                RealmException re =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
                    new RealmException(e.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
                re.initCause(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
                throw re;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        if (realmString != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
            tempRealm = new Realm(realmString);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        case KRB_NT_SRV_HST:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
            if (nameParts.length >= 2) {
2918
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   380
                String hostName = nameParts[1];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
                try {
2918
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   382
                    // RFC4120 does not recommend canonicalizing a hostname.
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   383
                    // However, for compatibility reason, we will try
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   384
                    // canonicalize it and see if the output looks better.
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   385
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   386
                    String canonicalized = (InetAddress.getByName(hostName)).
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   387
                            getCanonicalHostName();
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   388
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   389
                    // Looks if canonicalized is a longer format of hostName,
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   390
                    // we accept cases like
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   391
                    //     bunny -> bunny.rabbit.hole
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   392
                    if (canonicalized.toLowerCase()
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   393
                            .startsWith(hostName.toLowerCase()+".")) {
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   394
                        hostName = canonicalized;
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   395
                    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                } catch (UnknownHostException e) {
2918
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   397
                    // no canonicalization, use old
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
                }
2918
395b9ffa7cc6 6682516: SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
weijun
parents: 2
diff changeset
   399
                nameParts[1] = hostName.toLowerCase();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
            nameStrings = nameParts;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
            nameType = type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
                // We will try to get realm name from the mapping in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
                // the configuration. If it is not specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
                // we will use the default realm. This nametype does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
                // not allow a realm to be specified. The name string must of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
                // the form service@host and this is internally changed into
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
                // service/host by Kerberos
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
            String mapRealm =  mapHostToRealm(nameParts[1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
            if (mapRealm != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
                nameRealm = new Realm(mapRealm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
                nameRealm = tempRealm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        case KRB_NT_UNKNOWN:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        case KRB_NT_PRINCIPAL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        case KRB_NT_SRV_INST:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        case KRB_NT_SRV_XHST:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
        case KRB_NT_UID:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
            nameStrings = nameParts;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
            nameType = type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
            nameRealm = tempRealm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
            throw new IllegalArgumentException("Illegal name type");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    public PrincipalName(String name) throws RealmException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        this(name, KRB_NT_UNKNOWN);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
    public PrincipalName(String name, String realm) throws RealmException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        this(name, KRB_NT_UNKNOWN);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        nameRealm = new Realm(realm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    public String getRealmAsString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        return getRealmString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
    public String getPrincipalNameAsString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        StringBuffer temp = new StringBuffer(nameStrings[0]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        for (int i = 1; i < nameStrings.length; i++)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
            temp.append(nameStrings[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        return temp.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        return toString().hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    public String getName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        return toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    public int getNameType() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        return nameType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    public String[] getNameStrings() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        return nameStrings;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    public byte[][] toByteArray() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        byte[][] result = new byte[nameStrings.length][];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
        for (int i = 0; i < nameStrings.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
            result[i] = new byte[nameStrings[i].length()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
            result[i] = nameStrings[i].getBytes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
    public String getRealmString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
        if (nameRealm != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
            return nameRealm.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
    public Realm getRealm() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        return nameRealm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    public void setRealm(Realm new_nameRealm) throws RealmException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
        nameRealm = new_nameRealm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    public void setRealm(String realmsString) throws RealmException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
        nameRealm = new Realm(realmsString);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
    public String getSalt() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
        if (salt == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
            StringBuffer salt = new StringBuffer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
            if (nameRealm != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
                salt.append(nameRealm.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
            for (int i = 0; i < nameStrings.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
                salt.append(nameStrings[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
            return salt.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
        return salt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        StringBuffer str = new StringBuffer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
        for (int i = 0; i < nameStrings.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
            if (i > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
                str.append("/");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
            str.append(nameStrings[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
        if (nameRealm != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
            str.append("@");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
            str.append(nameRealm.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
        return str.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
    public String getNameString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
        StringBuffer str = new StringBuffer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
        for (int i = 0; i < nameStrings.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
            if (i > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
                str.append("/");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
            str.append(nameStrings[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
        return str.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     * Encodes a <code>PrincipalName</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     * @return the byte array of the encoded PrncipalName object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     * @exception IOException if an I/O error occurs while reading encoded data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
    public byte[] asn1Encode() throws Asn1Exception, IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
        DerOutputStream bytes = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
        DerOutputStream temp = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
        BigInteger bint = BigInteger.valueOf(this.nameType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
        temp.putInteger(bint);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
        bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x00), temp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
        temp = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
        DerValue der[] = new DerValue[nameStrings.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
        for (int i = 0; i < nameStrings.length; i++) {
3949
00603a93b589 6862679: ESC: AD Authentication with user with umlauts fails
weijun
parents: 2918
diff changeset
   549
            der[i] = new KerberosString(nameStrings[i]).toDerValue();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
        temp.putSequence(der);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
        bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), temp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
        temp = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
        temp.write(DerValue.tag_Sequence, bytes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
        return temp.toByteArray();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
     * Checks if two <code>PrincipalName</code> objects have identical values in their corresponding data fields.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     * @param pname the other <code>PrincipalName</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
     * @return true if two have identical values, otherwise, return false.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
    // It is used in <code>sun.security.krb5.internal.ccache</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
    public boolean match(PrincipalName pname) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
        boolean matched = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
        //name type is just a hint, no two names can be the same ignoring name type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
        // if (this.nameType != pname.nameType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
        //      matched = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
        // }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
        if ((this.nameRealm != null) && (pname.nameRealm != null)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
            if (!(this.nameRealm.toString().equalsIgnoreCase(pname.nameRealm.toString()))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
                matched = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
        if (this.nameStrings.length != pname.nameStrings.length) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
            matched = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
            for (int i = 0; i < this.nameStrings.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
                if (!(this.nameStrings[i].equalsIgnoreCase(pname.nameStrings[i]))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
                    matched = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
        return matched;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
     * Writes data field values of <code>PrincipalName</code> in FCC format to an output stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
     * @param cos a <code>CCacheOutputStream</code> for writing data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
     * @exception IOException if an I/O exception occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
     * @see sun.security.krb5.internal.ccache.CCacheOutputStream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
    public void writePrincipal(CCacheOutputStream cos) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
        cos.write32(nameType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
        cos.write32(nameStrings.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
        if (nameRealm != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
            byte[] realmBytes = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
            realmBytes = nameRealm.toString().getBytes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
            cos.write32(realmBytes.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
            cos.write(realmBytes, 0, realmBytes.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
        byte[] bytes = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
        for (int i = 0; i < nameStrings.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
            bytes = nameStrings[i].getBytes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
            cos.write32(bytes.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
            cos.write(bytes, 0, bytes.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     * Creates a KRB_NT_SRV_INST name from the supplied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     * name components and realm.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     * @param primary the primary component of the name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     * @param instance the instance component of the name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     * @param realm the realm
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     * @throws KrbException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
    protected PrincipalName(String primary, String instance, String realm,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
                            int type)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
        throws KrbException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
        if (type != KRB_NT_SRV_INST) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
            throw new KrbException(Krb5.KRB_ERR_GENERIC, "Bad name type");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
        String[] nParts = new String[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
        nParts[0] = primary;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
        nParts[1] = instance;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
        this.nameStrings = nParts;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
        this.nameRealm = new Realm(realm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        this.nameType = type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
     * Returns the instance component of a name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
     * In a multi-component name such as a KRB_NT_SRV_INST
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
     * name, the second component is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
     * Null is returned if there are not two or more
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
     * components in the name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
     * @returns instance component of a multi-component name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
    public String getInstanceComponent()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
        if (nameStrings != null && nameStrings.length >= 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
                return new String(nameStrings[1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
    static String mapHostToRealm(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
        String result = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
            String subname = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
            Config c = Config.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
            if ((result = c.getDefault(name, "domain_realm")) != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
                return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
                for (int i = 1; i < name.length(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
                    if ((name.charAt(i) == '.') && (i != name.length() - 1)) { //mapping could be .ibm.com = AUSTIN.IBM.COM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
                        subname = name.substring(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
                        result = c.getDefault(subname, "domain_realm");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
                        if (result != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
                            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
                        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
                            subname = name.substring(i + 1);      //or mapping could be ibm.com = AUSTIN.IBM.COM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
                            result = c.getDefault(subname, "domain_realm");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
                            if (result != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
                                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
        } catch (KrbException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
}