jdk/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java
changeset 13247 74902cfeb9c6
parent 11011 d14a696e3ab5
child 22093 741504ef3df7
equal deleted inserted replaced
13246:a54c4f70775c 13247:74902cfeb9c6
   112      * principal name at the first place.
   112      * principal name at the first place.
   113      */
   113      */
   114     // made public for KinitOptions to call directly
   114     // made public for KinitOptions to call directly
   115     public PrincipalName readPrincipal(int version) throws IOException, RealmException {
   115     public PrincipalName readPrincipal(int version) throws IOException, RealmException {
   116         int type, length, namelength, kret;
   116         int type, length, namelength, kret;
   117         PrincipalName p;
       
   118         String[] pname = null;
   117         String[] pname = null;
   119         String realm;
   118         String realm;
   120         /* Read principal type */
   119         /* Read principal type */
   121         if (version == KRB5_FCC_FVNO_1) {
   120         if (version == KRB5_FCC_FVNO_1) {
   122             type = KRB5_NT_UNKNOWN;
   121             type = KRB5_NT_UNKNOWN;
   142         }
   141         }
   143         if (isRealm(result[0])) {
   142         if (isRealm(result[0])) {
   144             realm = result[0];
   143             realm = result[0];
   145             pname = new String[length];
   144             pname = new String[length];
   146             System.arraycopy(result, 1, pname, 0, length);
   145             System.arraycopy(result, 1, pname, 0, length);
   147             p = new PrincipalName(pname, type);
   146             return new PrincipalName(type, pname, new Realm(realm));
   148             p.setRealm(realm);
   147         }
   149         }
   148         try {
   150         else p = new PrincipalName(result, type);
   149             return new PrincipalName(result, type);
   151         return p;
   150         } catch (RealmException re) {
       
   151             return null;
       
   152         }
   152     }
   153     }
   153 
   154 
   154     /*
   155     /*
   155      * In practice, a realm is named by uppercasing the DNS domain name. we currently
   156      * In practice, a realm is named by uppercasing the DNS domain name. we currently
   156      * rely on this to determine if the string within the principal identifier is realm
   157      * rely on this to determine if the string within the principal identifier is realm
   340      * returns null.
   341      * returns null.
   341      */
   342      */
   342     Credentials readCred(int version) throws IOException,RealmException, KrbApErrException, Asn1Exception {
   343     Credentials readCred(int version) throws IOException,RealmException, KrbApErrException, Asn1Exception {
   343         PrincipalName cpname = readPrincipal(version);
   344         PrincipalName cpname = readPrincipal(version);
   344         if (DEBUG)
   345         if (DEBUG)
   345             System.out.println(">>>DEBUG <CCacheInputStream>  client principal is " + cpname.toString());
   346             System.out.println(">>>DEBUG <CCacheInputStream>  client principal is " + cpname);
   346         PrincipalName spname = readPrincipal(version);
   347         PrincipalName spname = readPrincipal(version);
   347         if (DEBUG)
   348         if (DEBUG)
   348             System.out.println(">>>DEBUG <CCacheInputStream> server principal is " + spname.toString());
   349             System.out.println(">>>DEBUG <CCacheInputStream> server principal is " + spname);
   349         EncryptionKey key = readKey(version);
   350         EncryptionKey key = readKey(version);
   350         if (DEBUG)
   351         if (DEBUG)
   351             System.out.println(">>>DEBUG <CCacheInputStream> key type: " + key.getEType());
   352             System.out.println(">>>DEBUG <CCacheInputStream> key type: " + key.getEType());
   352         long times[] = readTimes();
   353         long times[] = readTimes();
   353         KerberosTime authtime = new KerberosTime(times[0]);
   354         KerberosTime authtime = new KerberosTime(times[0]);