Uploaded image for project: 'Directory Kerberos'
  1. Directory Kerberos
  2. DIRKRB-734

Miss-calculation of Bytes Read For Entry in Keytab

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.1.2, 2.0.1
    • None
    • None

    Description

      When using to read principal from a keytab file generated by a heimdal-kdc (version 7.5.0), it is throwing error because of miss-calculation of number of bytes read for an entry. The error is as follows:

      java.io.IOException: Unexpected octets len: 16716
          at org.apache.kerby.kerberos.kerb.KrbInputStream.readCountedOctets(KrbInputStream.java:72)
          at org.apache.kerby.kerberos.kerb.KrbInputStream.readKey(KrbInputStream.java:48)
          at org.apache.kerby.kerberos.kerb.keytab.KeytabEntry.load(KeytabEntry.java:55)
          at org.apache.kerby.kerberos.kerb.keytab.Keytab.readEntry(Keytab.java:203)
          at org.apache.kerby.kerberos.kerb.keytab.Keytab.readEntries(Keytab.java:189)
          at org.apache.kerby.kerberos.kerb.keytab.Keytab.doLoad(Keytab.java:161)
          at org.apache.kerby.kerberos.kerb.keytab.Keytab.load(Keytab.java:155)
          at org.apache.kerby.kerberos.kerb.keytab.Keytab.load(Keytab.java:143)
          at org.apache.kerby.kerberos.kerb.keytab.Keytab.loadKeytab(Keytab.java:55)
      

      The part of the code which is responsible for this error is https://github.com/apache/directory-kerby/blob/507c74bc3547e80b7102d3b7e5c753e67b60fb9a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/Keytab.java#L199. Here, we are trying to calculate the number of bytes read for an entry. But we are not considering the number of bytes denoting the size of an entry, which should be excluded from the calculation of bytes read for an entry.

      Attachments

        1. sample.keytab
          0.4 kB
          Farhan Khan

        Issue Links

          Activity

            People

              coheigea Colm O hEigeartaigh
              farhan5900 Farhan Khan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m