/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1/* include/kcm.h - Kerberos cache manager protocol declarations */2/*3* Copyright (C) 2014 by the Massachusetts Institute of Technology.4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9*10* * Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12*13* * Redistributions in binary form must reproduce the above copyright14* notice, this list of conditions and the following disclaimer in15* the documentation and/or other materials provided with the16* distribution.17*18* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS21* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE22* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,23* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES24* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR25* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)26* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,27* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)28* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED29* OF THE POSSIBILITY OF SUCH DAMAGE.30*/3132#ifndef KCM_H33#define KCM_H3435#define KCM_PROTOCOL_VERSION_MAJOR 236#define KCM_PROTOCOL_VERSION_MINOR 03738#define KCM_UUID_LEN 163940/* This should ideally be in RUNSTATEDIR, but Heimdal uses a hardcoded41* /var/run, and we need to use the same default path. */42#define DEFAULT_KCM_SOCKET_PATH "/var/run/.heim_org.h5l.kcm-socket"43#define DEFAULT_KCM_MACH_SERVICE "org.h5l.kcm"4445/*46* All requests begin with:47* major version (1 bytes)48* minor version (1 bytes)49* opcode (16-bit big-endian)50*51* All replies begin with a 32-bit big-endian reply code.52*53* Parameters are appended to the request or reply with no delimiters. Flags,54* time offsets, and lengths are stored as 32-bit big-endian integers. Names55* are marshalled as zero-terminated strings. Principals and credentials are56* marshalled in the v4 FILE ccache format. UUIDs are 16 bytes. UUID lists57* are not delimited, so nothing can come after them.58*59* Flag words must use Heimdal flag values, which are not the same as MIT krb560* values for KRB5_GC and KRB5_TC constants. The same flag word may contain61* both kinds of flags in Heimdal, but not in MIT krb5. Defines for the62* applicable Heimdal flag values are given below using KCM_GC and KCM_TC63* prefixes.64*/6566#define KCM_GC_CACHED (1U << 0)6768#define KCM_TC_DONT_MATCH_REALM (1U << 31)69#define KCM_TC_MATCH_KEYTYPE (1U << 30)70#define KCM_TC_MATCH_SRV_NAMEONLY (1U << 29)71#define KCM_TC_MATCH_FLAGS_EXACT (1U << 28)72#define KCM_TC_MATCH_FLAGS (1U << 27)73#define KCM_TC_MATCH_TIMES_EXACT (1U << 26)74#define KCM_TC_MATCH_TIMES (1U << 25)75#define KCM_TC_MATCH_AUTHDATA (1U << 24)76#define KCM_TC_MATCH_2ND_TKT (1U << 23)77#define KCM_TC_MATCH_IS_SKEY (1U << 22)7879/* Opcodes without comments are currently unused in the MIT client80* implementation. */81typedef enum kcm_opcode {82KCM_OP_NOOP,83KCM_OP_GET_NAME,84KCM_OP_RESOLVE,85KCM_OP_GEN_NEW, /* () -> (name) */86KCM_OP_INITIALIZE, /* (name, princ) -> () */87KCM_OP_DESTROY, /* (name) -> () */88KCM_OP_STORE, /* (name, cred) -> () */89KCM_OP_RETRIEVE, /* (name, flags, credtag) -> (cred) */90KCM_OP_GET_PRINCIPAL, /* (name) -> (princ) */91KCM_OP_GET_CRED_UUID_LIST, /* (name) -> (uuid, ...) */92KCM_OP_GET_CRED_BY_UUID, /* (name, uuid) -> (cred) */93KCM_OP_REMOVE_CRED, /* (name, flags, credtag) -> () */94KCM_OP_SET_FLAGS,95KCM_OP_CHOWN,96KCM_OP_CHMOD,97KCM_OP_GET_INITIAL_TICKET,98KCM_OP_GET_TICKET,99KCM_OP_MOVE_CACHE,100KCM_OP_GET_CACHE_UUID_LIST, /* () -> (uuid, ...) */101KCM_OP_GET_CACHE_BY_UUID, /* (uuid) -> (name) */102KCM_OP_GET_DEFAULT_CACHE, /* () -> (name) */103KCM_OP_SET_DEFAULT_CACHE, /* (name) -> () */104KCM_OP_GET_KDC_OFFSET, /* (name) -> (offset) */105KCM_OP_SET_KDC_OFFSET, /* (name, offset) -> () */106KCM_OP_ADD_NTLM_CRED,107KCM_OP_HAVE_NTLM_CRED,108KCM_OP_DEL_NTLM_CRED,109KCM_OP_DO_NTLM_AUTH,110KCM_OP_GET_NTLM_USER_LIST,111112/* MIT extensions */113KCM_OP_MIT_EXTENSION_BASE = 13000,114KCM_OP_GET_CRED_LIST, /* (name) -> (count, count*{len, cred}) */115KCM_OP_REPLACE, /* (name, offset, princ,116* count, count*{len, cred}) -> () */117} kcm_opcode;118119#endif /* KCM_H */120121122