jdk/src/share/classes/sun/security/jgss/GSSNameImpl.java
changeset 4533 eb8cec364323
parent 2 90ce3da70b43
child 5506 202f599c92aa
equal deleted inserted replaced
4532:f39917c8cf46 4533:eb8cec364323
     1 /*
     1 /*
     2  * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Sun designates this
     7  * published by the Free Software Foundation.  Sun designates this
    79  * @since 1.4
    79  * @since 1.4
    80  */
    80  */
    81 
    81 
    82 public class GSSNameImpl implements GSSName {
    82 public class GSSNameImpl implements GSSName {
    83 
    83 
       
    84     /**
       
    85      * The old Oid used in RFC 2853. Now supported as
       
    86      * input parameters in:
       
    87      *
       
    88      * 1. The four overloaded GSSManager.createName(*) methods
       
    89      * 2. GSSManager.getMechsForName(Oid)
       
    90      *
       
    91      * Note that even if a GSSName is created with this old Oid,
       
    92      * its internal name type and getStringNameType() output are
       
    93      * always the new value.
       
    94      */
       
    95     final static Oid oldHostbasedServiceName;
       
    96 
       
    97     static {
       
    98         Oid tmp = null;
       
    99         try {
       
   100             tmp = new Oid("1.3.6.1.5.6.2");
       
   101         } catch (Exception e) {
       
   102             // should never happen
       
   103         }
       
   104         oldHostbasedServiceName = tmp;
       
   105     }
       
   106 
    84     private GSSManagerImpl gssManager = null;
   107     private GSSManagerImpl gssManager = null;
    85 
   108 
    86     /*
   109     /*
    87      * Store whatever the application passed in. We will use this to
   110      * Store whatever the application passed in. We will use this to
    88      * get individual mechanisms to create name elements as and when
   111      * get individual mechanisms to create name elements as and when
   132                         Object appName,
   155                         Object appName,
   133                         Oid appNameType,
   156                         Oid appNameType,
   134                         Oid mech)
   157                         Oid mech)
   135         throws GSSException {
   158         throws GSSException {
   136 
   159 
       
   160         if (oldHostbasedServiceName.equals(appNameType)) {
       
   161             appNameType = GSSName.NT_HOSTBASED_SERVICE;
       
   162         }
   137         if (appName == null)
   163         if (appName == null)
   138             throw new GSSExceptionImpl(GSSException.BAD_NAME,
   164             throw new GSSExceptionImpl(GSSException.BAD_NAME,
   139                                    "Cannot import null name");
   165                                    "Cannot import null name");
   140         if (mech == null) mech = ProviderList.DEFAULT_MECH_OID;
   166         if (mech == null) mech = ProviderList.DEFAULT_MECH_OID;
   141         if (NT_EXPORT_NAME.equals(appNameType)) {
   167         if (NT_EXPORT_NAME.equals(appNameType)) {