You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Guotao Yu (Jira)" <ji...@apache.org> on 2025/07/12 12:14:00 UTC

[jira] [Created] (DIRKRB-777) Cannot decode HostAddress using CredCacheInputStream

Guotao Yu created DIRKRB-777:
--------------------------------

             Summary: Cannot decode HostAddress using CredCacheInputStream
                 Key: DIRKRB-777
                 URL: https://issues.apache.org/jira/browse/DIRKRB-777
             Project: Directory Kerberos
          Issue Type: Bug
    Affects Versions: 2.1.0
            Reporter: Guotao Yu


In CredCacheOutputStream, HostAddress is serialized in this way.

 
{code:java}
public void writeAddress(HostAddress address) throws IOException {
    write(address.getAddrType().getValue());
    write(address.getAddress().length);
    write(address.getAddress(), 0,
          address.getAddress().length);
} {code}
HostAddrType is serialized as an int type, However, in CredCacheInputStream, it is read as a short type.
{code:java}
public HostAddress readAddress() throws IOException {
    int typeValue = readShort();
    HostAddrType addrType = HostAddrType.fromValue(typeValue);
    if (addrType == HostAddrType.NONE) {
        throw new IOException("Invalid host address type");
    }
    byte[] addrData = readCountedOctets();
    if (addrData == null) {
        throw new IOException("Invalid host address data");
    }
    HostAddress addr = new HostAddress();
    addr.setAddrType(addrType);
    addr.setAddress(addrData);

    return addr;
} {code}
This results in the deserialized HostAddrType being an illegal type.
So for me the library is unusable.
h4. 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org