This patch adds a missing method required by OpenJDK builds
(see PR41686: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41686).
It also adds two toString() methods for KerberosTicket and KeyImpl.

ChangeLog:

2010-01-30  Andrew John Hughes  <ahug...@redhat.com>

        PR classpath/41686
        * javax/security/auth/kerberos/KerberosTicket.java:
        Fix formatting.
        (toString()): Add full implementation.
        (getSessionKeyType()): Implemented.
        * javax/security/auth/kerberos/KeyImpl.java:
        (toString()): Implemented.
-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8
Index: javax/security/auth/kerberos/KerberosTicket.java
===================================================================
RCS file: 
/sources/classpath/classpath/javax/security/auth/kerberos/KerberosTicket.java,v
retrieving revision 1.1
diff -u -u -r1.1 KerberosTicket.java
--- javax/security/auth/kerberos/KerberosTicket.java    3 Apr 2006 19:20:04 
-0000       1.1
+++ javax/security/auth/kerberos/KerberosTicket.java    30 Jan 2010 01:36:10 
-0000
@@ -54,7 +54,7 @@
  * This class represents a Kerberos ticket.  See the Kerberos
  * authentication RFC for more information:
  * <a href="http://www.ietf.org/rfc/rfc1510.txt";>RFC 1510</a>.
- * 
+ *
  * @since 1.4
  */
 public class KerberosTicket
@@ -86,16 +86,16 @@
 
   /**
    * Create a new ticket given all the facts about it.
-   * 
+   *
    * Note that flags may be null or "short"; any flags not specified
    * will be taken to be false.
-   * 
+   *
    * If the key is not renewable, then renewTill may be null.
-   * 
+   *
    * If authTime is null, then it is taken to be the same as startTime.
-   * 
+   *
    * If clientAddresses is null, then the ticket can be used anywhere.
-   * 
+   *
    * @param asn1Encoding the contents of the ticket, as ASN1
    * @param client the client principal
    * @param server the server principal
@@ -279,7 +279,7 @@
   {
     return (Date) startTime.clone();
   }
-  
+
   /**
    * Return the end time for this ticket.
    */
@@ -287,7 +287,7 @@
   {
     return (Date) endTime.clone();
   }
-  
+
   /**
    * Return the renewal time for this ticket.  For a non-renewable
    * ticket, this will return null.
@@ -334,6 +334,39 @@
 
   public String toString()
   {
-    return "FIXME bob";
+    return getClass().getName() +
+      "[client=" + client +
+      ",server=" + server +
+      ",sessionKey=" + sessionKey +
+      ",flags=" + flags +
+      ",authTime=" + authTime +
+      ",startTime= " + startTime +
+      ",endTime=" + endTime +
+      ",renewTill=" + renewTill +
+      ",clientAddresses=" + clientAddresses +
+      "]";
+  }
+
+  /**
+   * <p>
+   * Returns the type of the session key in accordance with
+   * RFC1510.  This usually corresponds to the encryption
+   * algorithm used by the key, though more than one algorithm
+   * may use the same key type (e.g. DES with different checksum
+   * mechanisms and chaining modes). Negative values are reserved
+   * for local use.  Non-negative values are for officially assigned
+   * type fields.  The RFC defines:
+   * </p>
+   * <ul>
+   * <li>0 &mdash; null</li>
+   * <li>1 &mdash; DES (in CBC mode with either MD4 or MD5 checksums)</li>
+   * </ul>
+   *
+   * @return the type of session key used by this ticket.
+   */
+  public final int getSessionKeyType()
+  {
+    return sessionKey.type;
   }
+
 }
Index: javax/security/auth/kerberos/KeyImpl.java
===================================================================
RCS file: 
/sources/classpath/classpath/javax/security/auth/kerberos/KeyImpl.java,v
retrieving revision 1.1
diff -u -u -r1.1 KeyImpl.java
--- javax/security/auth/kerberos/KeyImpl.java   3 Apr 2006 19:20:04 -0000       
1.1
+++ javax/security/auth/kerberos/KeyImpl.java   30 Jan 2010 01:36:10 -0000
@@ -90,4 +90,13 @@
     // FIXME.
     return null;
   }
+
+  public String toString()
+  {
+    return getClass().getName() +
+      "[type=" + type +
+      ",algorithm=" + algorithm +
+      "]";
+  }
+
 }

Reply via email to