• Tomáš Trnka's avatar
    sunrpc: fix stripping of padded MIC tokens · c32ec877
    Tomáš Trnka authored
    commit c0cb8bf3 upstream.
    
    The length of the GSS MIC token need not be a multiple of four bytes.
    It is then padded by XDR to a multiple of 4 B, but unwrap_integ_data()
    would previously only trim mic.len + 4 B. The remaining up to three
    bytes would then trigger a check in nfs4svc_decode_compoundargs(),
    leading to a "garbage args" error and mount failure:
    
    nfs4svc_decode_compoundargs: compound not properly padded!
    nfsd: failed to decode arguments!
    
    This would prevent older clients using the pre-RFC 4121 MIC format
    (37-byte MIC including a 9-byte OID) from mounting exports from v3.9+
    servers using krb5i.
    
    The trimming was introduced by commit 4c190e2f ("sunrpc: trim off
    trailing checksum before returning decrypted or integrity authenticated
    buffer").
    
    Fixes: 4c190e2f "unrpc: trim off trailing checksum..."
    Signed-off-by: default avatarTomáš Trnka <ttrnka@mail.muni.cz>
    Acked-by: default avatarJeff Layton <jlayton@poochiereds.net>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
    Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
    c32ec877
svcauth_gss.c 45.7 KB