You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/11/15 01:47:59 UTC
svn commit: r1035112 - in
/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq:
KdcReqGrammar.java actions/StoreMsgType.java actions/StorePvno.java
Author: elecharny
Date: Mon Nov 15 00:47:58 2010
New Revision: 1035112
URL: http://svn.apache.org/viewvc?rev=1035112&view=rev
Log:
Added the processing of PVNO and msg-type for the KDC-REQ message
Added:
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StoreMsgType.java
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StorePvno.java
Modified:
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/KdcReqGrammar.java
Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/KdcReqGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/KdcReqGrammar.java?rev=1035112&r1=1035111&r2=1035112&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/KdcReqGrammar.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/KdcReqGrammar.java Mon Nov 15 00:47:58 2010
@@ -27,19 +27,8 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.kerberos.KerberosConstants;
import org.apache.directory.shared.kerberos.codec.actions.CheckNotNullLength;
import org.apache.directory.shared.kerberos.codec.kdcReq.actions.KdcReqInit;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.AddEType;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.AddTicket;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.ETypeSequence;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.StoreAddresses;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.StoreCName;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.StoreEncAuthorizationData;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.StoreFrom;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.StoreKdcOptions;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.StoreNonce;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.StoreRTime;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.StoreRealm;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.StoreSName;
-import org.apache.directory.shared.kerberos.codec.kdcReqBody.actions.StoreTill;
+import org.apache.directory.shared.kerberos.codec.kdcReq.actions.StoreMsgType;
+import org.apache.directory.shared.kerberos.codec.kdcReq.actions.StorePvno;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -79,331 +68,68 @@ public final class KdcReqGrammar extends
// --------------------------------------------------------------------------------------------
// Transition from KdcReq init to KdcReq SEQ
// --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
+ // KDC-REQ ::= SEQUENCE {
super.transitions[KdcReqStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
KdcReqStatesEnum.START_STATE, KdcReqStatesEnum.KDC_REQ_PVNO_TAG_STATE, UniversalTag.SEQUENCE.getValue(),
new KdcReqInit() );
// --------------------------------------------------------------------------------------------
- // Transition from KdcReqBody SEQ to kdc-options tag
+ // Transition from KdcReq SEQ to pvno tag
// --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // kdc-options [0]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_KDC_OPTIONS_TAG_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_KDC_OPTIONS_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_KDC_OPTIONS_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_KDC_OPTIONS_STATE, KerberosConstants.KDC_REQ_BODY_KDC_OPTIONS_TAG,
+ // KDC-REQ ::= SEQUENCE {
+ // pvno [1]
+ super.transitions[KdcReqStatesEnum.KDC_REQ_PVNO_TAG_STATE.ordinal()][KerberosConstants.KDC_REQ_PVNO_TAG] = new GrammarTransition(
+ KdcReqStatesEnum.KDC_REQ_PVNO_TAG_STATE, KdcReqStatesEnum.KDC_REQ_PVNO_TAG_STATE, KerberosConstants.KDC_REQ_PVNO_TAG,
new CheckNotNullLength() );
// --------------------------------------------------------------------------------------------
- // Transition from kdc-options tag to kdc-options value
+ // Transition from pvno tag to pvno value
// --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // kdc-options [0] KDCOptions
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_KDC_OPTIONS_STATE.ordinal()][UniversalTag.BIT_STRING.getValue()] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_KDC_OPTIONS_STATE, KdcReqStatesEnum.KDC_REQ_BODY_CNAME_OR_REALM_TAG_STATE, UniversalTag.BIT_STRING.getValue(),
- new StoreKdcOptions() );
+ // KDC-REQ ::= SEQUENCE {
+ // pvno [1] INTEGER (5) ,
+ super.transitions[KdcReqStatesEnum.KDC_REQ_PVNO_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
+ KdcReqStatesEnum.KDC_REQ_PVNO_TAG_STATE, KdcReqStatesEnum.KDC_REQ_PVNO_STATE, UniversalTag.INTEGER.getValue(),
+ new StorePvno() );
// --------------------------------------------------------------------------------------------
- // Transition from kdc-options value to cname tag
+ // Transition from pvno value to msg-type tag
// --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
+ // KDC-REQ ::= SEQUENCE {
// ...
- // cname [1]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_CNAME_OR_REALM_TAG_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_CNAME_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_CNAME_OR_REALM_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_CNAME_STATE, KerberosConstants.KDC_REQ_BODY_CNAME_TAG,
- new StoreCName() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from kdc-options value to realm tag (cname is empty)
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // realm [2]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_CNAME_OR_REALM_TAG_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_REALM_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_CNAME_OR_REALM_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_REALM_TAG_STATE, KerberosConstants.KDC_REQ_BODY_REALM_TAG,
+ // msg-type [2]
+ super.transitions[KdcReqStatesEnum.KDC_REQ_PVNO_STATE.ordinal()][KerberosConstants.KDC_REQ_MSG_TYPE_TAG] = new GrammarTransition(
+ KdcReqStatesEnum.KDC_REQ_PVNO_STATE, KdcReqStatesEnum.KDC_REQ_MSG_TYPE_TAG_STATE, KerberosConstants.KDC_REQ_MSG_TYPE_TAG,
new CheckNotNullLength() );
// --------------------------------------------------------------------------------------------
- // Transition from cname tag to realm tag
+ // Transition from msg-type tag to msg-type value
// --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
+ // KDC-REQ ::= SEQUENCE {
// ...
- // realm [2]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_CNAME_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_REALM_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_CNAME_STATE, KdcReqStatesEnum.KDC_REQ_BODY_REALM_TAG_STATE, KerberosConstants.KDC_REQ_BODY_REALM_TAG,
- new CheckNotNullLength() );
+ // msg-type [2] INTEGER (10 -- AS -- | 12 -- TGS --),
+ super.transitions[KdcReqStatesEnum.KDC_REQ_MSG_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
+ KdcReqStatesEnum.KDC_REQ_MSG_TYPE_TAG_STATE, KdcReqStatesEnum.KDC_REQ_MSG_TYPE_STATE, UniversalTag.INTEGER.getValue(),
+ new StoreMsgType() );
// --------------------------------------------------------------------------------------------
- // Transition from realm tag to realm value
+ // Transition from msg-type value tp padata tag
// --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
+ // KDC-REQ ::= SEQUENCE {
// ...
- // realm [2] Realm
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_REALM_TAG_STATE.ordinal()][UniversalTag.GENERAL_STRING.getValue()] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_REALM_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_SNAME_OR_FROM_OR_TILL_TAG_STATE, UniversalTag.GENERAL_STRING.getValue(),
- new StoreRealm() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from realm value to sname tag
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // sname [3]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_SNAME_OR_FROM_OR_TILL_TAG_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_SNAME_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_SNAME_OR_FROM_OR_TILL_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_SNAME_STATE, KerberosConstants.KDC_REQ_BODY_SNAME_TAG,
- new StoreSName() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from realm value to from tag (sname is empty)
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // from [4]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_SNAME_OR_FROM_OR_TILL_TAG_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_FROM_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_SNAME_OR_FROM_OR_TILL_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_FROM_STATE, KerberosConstants.KDC_REQ_BODY_FROM_TAG,
- new CheckNotNullLength() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from realm value to till tag (sname and from are empty)
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // till [5]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_SNAME_OR_FROM_OR_TILL_TAG_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_TILL_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_SNAME_OR_FROM_OR_TILL_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_TILL_STATE, KerberosConstants.KDC_REQ_BODY_TILL_TAG,
- new CheckNotNullLength() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from sname tag to from tag
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // from [4]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_SNAME_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_FROM_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_SNAME_STATE, KdcReqStatesEnum.KDC_REQ_BODY_FROM_STATE, KerberosConstants.KDC_REQ_BODY_FROM_TAG,
+ // padata [3]
+ super.transitions[KdcReqStatesEnum.KDC_REQ_MSG_TYPE_STATE.ordinal()][KerberosConstants.KDC_REQ_PA_DATA_TAG] = new GrammarTransition(
+ KdcReqStatesEnum.KDC_REQ_MSG_TYPE_STATE, KdcReqStatesEnum.KDC_REQ_PA_DATA_TAG_STATE, KerberosConstants.KDC_REQ_PA_DATA_TAG,
new CheckNotNullLength() );
- // --------------------------------------------------------------------------------------------
- // Transition from sname tag to till tag (from is empty)
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // till [5]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_SNAME_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_TILL_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_SNAME_STATE, KdcReqStatesEnum.KDC_REQ_BODY_TILL_STATE, KerberosConstants.KDC_REQ_BODY_TILL_TAG,
- new CheckNotNullLength() );
- // --------------------------------------------------------------------------------------------
- // Transition from from tag to from value
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // from [4] KerberosTime
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_FROM_STATE.ordinal()][UniversalTag.GENERALIZED_TIME.getValue()] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_FROM_STATE, KdcReqStatesEnum.KDC_REQ_BODY_TILL_TAG_STATE, UniversalTag.GENERALIZED_TIME.getValue(),
- new StoreFrom() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from till tag to till value
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // till [5]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_TILL_TAG_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_TILL_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_TILL_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_TILL_STATE, KerberosConstants.KDC_REQ_BODY_TILL_TAG,
- new CheckNotNullLength() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from till tag to till value
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // till [5] KerberosTime
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_TILL_STATE.ordinal()][UniversalTag.GENERALIZED_TIME.getValue()] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_TILL_STATE, KdcReqStatesEnum.KDC_REQ_BODY_RTIME_OR_NONCE_TAG_STATE, UniversalTag.GENERALIZED_TIME.getValue(),
- new StoreTill() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from till value to rtime
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // rtime [6]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_RTIME_OR_NONCE_TAG_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_RTIME_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_RTIME_OR_NONCE_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_RTIME_STATE, KerberosConstants.KDC_REQ_BODY_RTIME_TAG,
- new CheckNotNullLength() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from till value to nonce
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // nonce [7]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_RTIME_OR_NONCE_TAG_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_NONCE_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_RTIME_OR_NONCE_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_NONCE_STATE, KerberosConstants.KDC_REQ_BODY_NONCE_TAG,
- new CheckNotNullLength() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from rtime to nonce tag
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // rtime [6] KerberosTime
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_RTIME_STATE.ordinal()][UniversalTag.GENERALIZED_TIME.getValue()] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_RTIME_STATE, KdcReqStatesEnum.KDC_REQ_BODY_NONCE_TAG_STATE, UniversalTag.GENERALIZED_TIME.getValue(),
- new StoreRTime() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from nonce tag to nonce value
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // nonce [7] UInt32
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_NONCE_TAG_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_NONCE_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_NONCE_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_NONCE_STATE, KerberosConstants.KDC_REQ_BODY_NONCE_TAG,
- new CheckNotNullLength() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from nonce value to etype Tag
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // etype [8]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_NONCE_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_NONCE_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_TAG_STATE, UniversalTag.INTEGER.getValue(),
- new StoreNonce() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from etype Tag to etype Tag
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // etype [8]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_TAG_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_ETYPE_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_SEQ_STATE, KerberosConstants.KDC_REQ_BODY_ETYPE_TAG,
- new CheckNotNullLength() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from etype Tag to etype SEQ
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // etype [8] SEQUENCE OF
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_SEQ_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_SEQ_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_STATE, UniversalTag.SEQUENCE.getValue(),
- new ETypeSequence() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from etype SEQ to EType values
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // etype [8] SEQUENCE OF Int32
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_STATE, UniversalTag.INTEGER.getValue(),
- new AddEType() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from EType values to addresses
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // addresses [9]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_ADDRESSES_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ADDRESSES_STATE, KerberosConstants.KDC_REQ_BODY_ADDRESSES_TAG,
- new StoreAddresses() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from EType values to encAuthorizationData (addresses is empty)
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // enc-authorization-data [10]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_ENC_AUTHZ_DATA_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ENC_AUTH_DATA_STATE, KerberosConstants.KDC_REQ_BODY_ENC_AUTHZ_DATA_TAG,
- new StoreEncAuthorizationData() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from EType values to additionalTickets tag (addresses and enc-authorization data
- // are empty)
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // additional-tickets [11]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_ADDITIONAL_TICKETS_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_ETYPE_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ADDITIONAL_TICKETS_TAG_STATE, KerberosConstants.KDC_REQ_BODY_ADDITIONAL_TICKETS_TAG,
- new CheckNotNullLength() );
-
-
-
- // --------------------------------------------------------------------------------------------
- // Transition from addresses values to encAuthorizationData
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // enc-authorization-data [10]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_ADDRESSES_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_ENC_AUTHZ_DATA_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_ADDRESSES_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ENC_AUTH_DATA_STATE, KerberosConstants.KDC_REQ_BODY_ENC_AUTHZ_DATA_TAG,
- new StoreEncAuthorizationData() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from addresses values to additional-tickets tag
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // additional-tickets [11]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_ADDRESSES_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_ADDITIONAL_TICKETS_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_ADDRESSES_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ADDITIONAL_TICKETS_TAG_STATE, KerberosConstants.KDC_REQ_BODY_ADDITIONAL_TICKETS_TAG,
- new CheckNotNullLength() );
-
-
- // --------------------------------------------------------------------------------------------
- // Transition from encAuthorizationData to additional-tickets tag
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // additional-tickets [11]
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_ENC_AUTH_DATA_STATE.ordinal()][KerberosConstants.KDC_REQ_BODY_ADDITIONAL_TICKETS_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_ENC_AUTH_DATA_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ADDITIONAL_TICKETS_TAG_STATE, KerberosConstants.KDC_REQ_BODY_ADDITIONAL_TICKETS_TAG,
- new CheckNotNullLength() );
-
-
-
- // --------------------------------------------------------------------------------------------
- // Transition from additional-tickets tag to Ticket SEQUENCE
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // additional-tickets [11] SEQUENCE OF
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_ADDITIONAL_TICKETS_TAG_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_ADDITIONAL_TICKETS_TAG_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ADDITIONAL_TICKETS_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
- new CheckNotNullLength() );
-
- // --------------------------------------------------------------------------------------------
- // Transition from Ticket SEQUENCE to Ticket
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // additional-tickets [11] SEQUENCE OF Ticket
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_ADDITIONAL_TICKETS_SEQ_STATE.ordinal()][KerberosConstants.TICKET_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_ADDITIONAL_TICKETS_SEQ_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ADDITIONAL_TICKETS_STATE, KerberosConstants.TICKET_TAG,
- new AddTicket() );
- // --------------------------------------------------------------------------------------------
- // Transition from Ticket to Ticket
- // --------------------------------------------------------------------------------------------
- // KDC-REQ-BODY ::= SEQUENCE {
- // ...
- // additional-tickets [11] SEQUENCE OF Ticket
- super.transitions[KdcReqStatesEnum.KDC_REQ_BODY_ADDITIONAL_TICKETS_STATE.ordinal()][KerberosConstants.TICKET_TAG] = new GrammarTransition(
- KdcReqStatesEnum.KDC_REQ_BODY_ADDITIONAL_TICKETS_STATE, KdcReqStatesEnum.KDC_REQ_BODY_ADDITIONAL_TICKETS_STATE, KerberosConstants.TICKET_TAG,
- new AddTicket() );
}
/**
* Get the instance of this grammar
*
- * @return An instance on the KDC-REQ-BODY Grammar
+ * @return An instance on the KDC-REQ Grammar
*/
public static Grammar getInstance()
{
Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StoreMsgType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StoreMsgType.java?rev=1035112&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StoreMsgType.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StoreMsgType.java Mon Nov 15 00:47:58 2010
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.kerberos.codec.kdcReq.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.ber.tlv.Value;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.asn1.util.IntegerDecoder;
+import org.apache.directory.shared.asn1.util.IntegerDecoderException;
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.kerberos.KerberosMessageType;
+import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.kerberos.components.KdcReq;
+import org.apache.directory.shared.ldap.util.StringTools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to store the msg-type
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreMsgType extends GrammarAction
+{
+ /** The logger */
+ private static final Logger LOG = LoggerFactory.getLogger( StoreMsgType.class );
+
+ /** Speedup for logs */
+ private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+
+ /**
+ * Instantiates a new StoreMsgType action.
+ */
+ public StoreMsgType()
+ {
+ super( "KDC-REQ msg-type" );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void action( Asn1Container container ) throws DecoderException
+ {
+ KdcReqContainer kdcReqContainer = ( KdcReqContainer ) container;
+
+ TLV tlv = kdcReqContainer.getCurrentTLV();
+
+ // The Length should not be null and should be 1
+ if ( tlv.getLength() != 1 )
+ {
+ LOG.error( I18n.err( I18n.ERR_04066 ) );
+
+ // This will generate a PROTOCOL_ERROR
+ throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
+ }
+
+ KdcReq kdcReq = kdcReqContainer.getKdcReq();
+
+ Value value = tlv.getValue();
+
+ try
+ {
+ int msgType = IntegerDecoder.parse( value );
+ KerberosMessageType krbMsgType = KerberosMessageType.getTypeByOrdinal( msgType );
+
+ if ( ( krbMsgType != KerberosMessageType.AS_REQ ) && ( krbMsgType != KerberosMessageType.TGS_REQ ) )
+ {
+ LOG.error( I18n.err( I18n.ERR_04070, StringTools.dumpBytes( value.getData() ), "The msg-type should be AS-REQ or TGS-REQ" ) );
+
+ // This will generate a PROTOCOL_ERROR
+ throw new DecoderException( "The msg-type should be AS-REQ or TGS-REQ" );
+ }
+
+ kdcReq.setMsgType( krbMsgType );
+
+ if ( IS_DEBUG )
+ {
+ LOG.debug( "msg-type : {}", krbMsgType );
+ }
+ }
+ catch ( IntegerDecoderException ide )
+ {
+ LOG.error( I18n.err( I18n.ERR_04070, StringTools.dumpBytes( value.getData() ), ide
+ .getLocalizedMessage() ) );
+
+ // This will generate a PROTOCOL_ERROR
+ throw new DecoderException( ide.getMessage() );
+ }
+ }
+}
Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StorePvno.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StorePvno.java?rev=1035112&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StorePvno.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StorePvno.java Mon Nov 15 00:47:58 2010
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.kerberos.codec.kdcReq.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.ber.tlv.Value;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.asn1.util.IntegerDecoder;
+import org.apache.directory.shared.asn1.util.IntegerDecoderException;
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.kerberos.components.KdcReq;
+import org.apache.directory.shared.ldap.util.StringTools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to store the PVNO
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StorePvno extends GrammarAction
+{
+ /** The logger */
+ private static final Logger LOG = LoggerFactory.getLogger( StorePvno.class );
+
+ /** Speedup for logs */
+ private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+
+ /**
+ * Instantiates a new StorePvno action.
+ */
+ public StorePvno()
+ {
+ super( "KDC-REQ pvno" );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void action( Asn1Container container ) throws DecoderException
+ {
+ KdcReqContainer kdcReqContainer = ( KdcReqContainer ) container;
+
+ TLV tlv = kdcReqContainer.getCurrentTLV();
+
+ // The Length should not be null and should be 1
+ if ( tlv.getLength() != 1 )
+ {
+ LOG.error( I18n.err( I18n.ERR_04066 ) );
+
+ // This will generate a PROTOCOL_ERROR
+ throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
+ }
+
+ KdcReq kdcReq = kdcReqContainer.getKdcReq();
+
+ Value value = tlv.getValue();
+
+ try
+ {
+ int pvno = IntegerDecoder.parse( value );
+
+ if ( pvno != 5 )
+ {
+ LOG.error( I18n.err( I18n.ERR_04070, StringTools.dumpBytes( value.getData() ), "The PVNO should be 5" ) );
+
+ // This will generate a PROTOCOL_ERROR
+ throw new DecoderException( "The PVNO should be 5" );
+ }
+
+ kdcReq.setPvno( pvno );
+
+ if ( IS_DEBUG )
+ {
+ LOG.debug( "pvno : {}", pvno );
+ }
+ }
+ catch ( IntegerDecoderException ide )
+ {
+ LOG.error( I18n.err( I18n.ERR_04070, StringTools.dumpBytes( value.getData() ), ide
+ .getLocalizedMessage() ) );
+
+ // This will generate a PROTOCOL_ERROR
+ throw new DecoderException( ide.getMessage() );
+ }
+ }
+}