1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
samba-mirror/librpc/idl/krb5ccache.idl
Andrew Bartlett e6ef2fc224 librpc/idl: Check protocol version number in Kerberos ccache parser
The ccache file format version is checked by the switch in OPTIONAL_HEADER.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
2024-02-27 01:11:37 +00:00

156 lines
3.6 KiB
Plaintext

/*
krb5 credentials cache (version 3 or 4)
specification: https://web.mit.edu/kerberos/krb5-devel/doc/formats/ccache_file_format.html
krb5 keytab (version 2)
specification: https://web.mit.edu/kerberos/krb5-devel/doc/formats/keytab_file_format.html
*/
#include "idl_types.h"
[
uuid("1702b695-99ca-4f32-93e4-1e1c4d5ddb53"),
version(0.0),
pointer_default(unique),
helpstring("KRB5 credentials cache")
]
interface krb5ccache
{
typedef struct {
uint32 name_type;
uint32 component_count;
[flag(STR_SIZE4|STR_NOTERM|STR_UTF8)] string realm;
[flag(STR_SIZE4|STR_NOTERM|STR_UTF8)] string components[component_count];
} PRINCIPAL;
typedef struct {
uint16 enctype;
DATA_BLOB data;
} KEYBLOCK;
typedef struct {
uint16 addrtype;
DATA_BLOB data;
} ADDRESS;
typedef struct {
uint32 count;
ADDRESS data[count];
} ADDRESSES;
typedef struct {
uint16 ad_type;
DATA_BLOB data;
} AUTHDATUM;
typedef struct {
uint32 count;
AUTHDATUM data[count];
} AUTHDATA;
typedef struct {
PRINCIPAL client;
PRINCIPAL server;
KEYBLOCK keyblock;
uint32 authtime;
uint32 starttime;
uint32 endtime;
uint32 renew_till;
uint8 is_skey;
uint32 ticket_flags;
ADDRESSES addresses;
AUTHDATA authdata;
DATA_BLOB ticket;
DATA_BLOB second_ticket;
} CREDENTIAL;
typedef struct {
[value(0)] int32 kdc_sec_offset;
[value(0)] int32 kdc_usec_offset;
} DELTATIME_TAG;
typedef [nodiscriminant] union {
[case(1)] DELTATIME_TAG deltatime_tag;
} FIELD;
typedef struct {
[value(1)] uint16 tag;
[subcontext(2),switch_is(tag)] FIELD field;
} V4TAG;
typedef struct {
V4TAG tag;
/*
* We should allow for more than one tag to be properly parsed, but that
* would require manual parsing.
*/
[flag(NDR_REMAINING)] DATA_BLOB further_tags;
} V4TAGS;
typedef struct {
[subcontext(2)] V4TAGS v4tags;
} V4HEADER;
typedef [nodiscriminant] union {
/*
* We don't attempt to support file format versions 1 and 2 as they
* assume native CPU byte order, which makes no sense in PIDL.
*/
[case(3)] ;
[case(4)] V4HEADER v4header;
} OPTIONAL_HEADER;
/* Public structures. */
typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
[value(5),range(5,5)] uint8 pvno;
[value(4)] uint8 version;
[switch_is(version)] OPTIONAL_HEADER optional_header;
PRINCIPAL principal;
CREDENTIAL cred;
[flag(NDR_REMAINING)] DATA_BLOB further_creds;
} CCACHE;
typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
CREDENTIAL cred;
[flag(NDR_REMAINING)] DATA_BLOB further_creds;
} MULTIPLE_CREDENTIALS;
typedef struct {
uint16 length;
uint8 data[length];
} KEYTAB_KEYBLOCK;
typedef struct {
uint16 component_count;
[flag(STR_SIZE2|STR_NOTERM|STR_UTF8)] string realm;
[flag(STR_SIZE2|STR_NOTERM|STR_UTF8)] string components[component_count];
uint32 name_type;
} KEYTAB_PRINCIPAL;
typedef struct {
KEYTAB_PRINCIPAL principal;
uint32 timestamp;
uint8 key_version;
uint16 enctype;
KEYTAB_KEYBLOCK key;
uint32 full_key_version; /* We assume modern Heimdal or MIT 1.14 or later */
} KEYTAB_ENTRY;
/*
* This parser assumes a fresh keytab without negative lengths
* to indicate holes generated by MIT krb5 1.14
*/
typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
[value(5),range(5,5)] uint8 pvno;
[value(2),range(2,2)] uint8 version;
[subcontext(4)] KEYTAB_ENTRY entry;
[flag(NDR_REMAINING)] DATA_BLOB further_entry;
} KEYTAB;
typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
[subcontext(4)] KEYTAB_ENTRY entry;
[flag(NDR_REMAINING)] DATA_BLOB further_entry;
} MULTIPLE_KEYTAB_ENTRIES;
}