directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: rev 56469 - in incubator/directory/kerberos/trunk/source/main/org/apache/kerberos: io/decoder messages/value
Date Wed, 03 Nov 2004 04:12:08 GMT
Author: erodriguez
Date: Tue Nov  2 20:12:07 2004
New Revision: 56469

Modified:
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/LastRequest.java
Log:
Implemented LastRequest handling.

Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java
Tue Nov  2 20:12:07 2004
@@ -181,7 +181,7 @@
 	protected HostAddress decodeHostAddress(DERSequence sequence) {
 		
 		HostAddressType type = HostAddressType.NULL;
-		byte[] value = new byte[0];
+		byte[] value = null;
 		
 		for (Enumeration e = sequence.getObjects(); e.hasMoreElements();) {
 			DERTaggedObject object = ((DERTaggedObject) e.nextElement());
@@ -288,13 +288,51 @@
 	lr-type[0]               INTEGER,
 	lr-value[1]              KerberosTime
 	}*/
-	protected void decodeLastRequest() {};
+	protected LastRequest decodeLastRequest(DERSequence sequence) {
+		
+		LastRequestEntry[] entries = new LastRequestEntry[sequence.size()];
+		
+		int i = 0;
+		for (Enumeration e = sequence.getObjects(); e.hasMoreElements();) {
+			DERSequence object = ((DERSequence) e.nextElement());
+			LastRequestEntry entry = decodeLastRequestEntry(object);
+			entries[i] = entry;
+			i++;
+		}
+		
+		return new LastRequest(entries);
+	}
+	
+	protected LastRequestEntry decodeLastRequestEntry(DERSequence sequence) {
+		
+		LastRequestType type = LastRequestType.NONE;
+		KerberosTime value = null;
+		
+		for (Enumeration e = sequence.getObjects(); e.hasMoreElements();) {
+			DERTaggedObject object = ((DERTaggedObject) e.nextElement());
+			int tag = object.getTagNo();
+			DERObject derObject = object.getObject();
+			switch (tag) {
+				case 0:
+					DERInteger tag0 = (DERInteger)derObject;
+					type = LastRequestType.getTypeByOrdinal(tag0.getValue().intValue());
+					break;
+				case 1:
+					DERGeneralizedTime tag1 = (DERGeneralizedTime)derObject;
+					value = decodeKerberosTime(tag1);
+					break;
+			    default:
+			    	System.out.println(derObject);
+			    	break;
+			}
+		}
+		return new LastRequestEntry(type, value);
+	}
 	
 	/*
-	TransitedEncoding ::=         SEQUENCE {
-        tr-type[0]  INTEGER, -- must be registered
-        contents[1]          OCTET STRING
-    }*/
+	 * TransitedEncoding ::= SEQUENCE { tr-type[0] INTEGER, -- must be
+	 * registered contents[1] OCTET STRING }
+	 */
 	protected TransitedEncoding decodeTransitedEncoding(DERSequence sequence) {
 		TransitedEncodingType type = TransitedEncodingType.NULL;
 		byte[] contents = null;

Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/LastRequest.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/LastRequest.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/LastRequest.java
Tue Nov  2 20:12:07 2004
@@ -24,6 +24,10 @@
 		_entries[0] = new LastRequestEntry(LastRequestType.NONE, new KerberosTime());
 	}
 	
+	public LastRequest(LastRequestEntry[] entries) {
+		_entries = entries;
+	}
+	
 	public LastRequestEntry[] getEntries() {
 		return _entries;
 	}

Mime
View raw message