You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2005/07/22 21:54:03 UTC
svn commit: r224392 -
/directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/operations/GetPrincipal.java
Author: akarasulu
Date: Fri Jul 22 12:53:59 2005
New Revision: 224392
URL: http://svn.apache.org/viewcvs?rev=224392&view=rev
Log:
sometimes the key seems to be a string ... this should not be but just in case
I put in a few protective lines to detect whether it is a string or a byte[]
Modified:
directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/operations/GetPrincipal.java
Modified: directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/operations/GetPrincipal.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/operations/GetPrincipal.java?rev=224392&r1=224391&r2=224392&view=diff
==============================================================================
--- directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/operations/GetPrincipal.java (original)
+++ directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/operations/GetPrincipal.java Fri Jul 22 12:53:59 2005
@@ -129,30 +129,31 @@
private PrincipalStoreEntry getEntry( Attributes attrs ) throws NamingException
{
PrincipalStoreEntryModifier modifier = new PrincipalStoreEntryModifier();
-
String principal = ( String ) attrs.get( KerberosAttribute.PRINCIPAL ).get();
-
String encryptionType = ( String ) attrs.get( KerberosAttribute.TYPE ).get();
-
String keyVersionNumber = ( String ) attrs.get( KerberosAttribute.VERSION ).get();
if ( attrs.get( KerberosAttribute.SAM_TYPE ) != null )
{
String samType = ( String ) attrs.get( KerberosAttribute.SAM_TYPE ).get();
-
modifier.setSamType( SamType.getTypeByOrdinal( Integer.parseInt( samType ) ) );
}
- byte[] keyBytes = ( byte[] ) attrs.get( KerberosAttribute.KEY ).get();
+ Object key = attrs.get( KerberosAttribute.KEY ).get();
+ byte[] keyBytes = null;
+ if ( key instanceof String )
+ {
+ keyBytes = ( ( String ) key ).getBytes();
+ }
+ else
+ {
+ keyBytes = (byte[]) key;
+ }
+ modifier.setKey( keyBytes );
modifier.setPrincipal( new KerberosPrincipal( principal ) );
-
modifier.setEncryptionType( Integer.parseInt( encryptionType ) );
-
modifier.setKeyVersionNumber( Integer.parseInt( keyVersionNumber ) );
-
- modifier.setKey( keyBytes );
-
return modifier.getEntry();
}
}