directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r224392 - /directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/operations/GetPrincipal.java
Date Fri, 22 Jul 2005 19:54:03 GMT
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();
     }
 }



Mime
View raw message