| 1 |
/* |
| 2 |
* Copyright (c) 1997 - 2007 Kungliga Tekniska Högskolan |
| 3 |
* (Royal Institute of Technology, Stockholm, Sweden). |
| 4 |
* All rights reserved. |
| 5 |
* |
| 6 |
* Portions Copyright (c) 2009 Apple Inc. All rights reserved. |
| 7 |
* |
| 8 |
* Redistribution and use in source and binary forms, with or without |
| 9 |
* modification, are permitted provided that the following conditions |
| 10 |
* are met: |
| 11 |
* |
| 12 |
* 1. Redistributions of source code must retain the above copyright |
| 13 |
* notice, this list of conditions and the following disclaimer. |
| 14 |
* |
| 15 |
* 2. Redistributions in binary form must reproduce the above copyright |
| 16 |
* notice, this list of conditions and the following disclaimer in the |
| 17 |
* documentation and/or other materials provided with the distribution. |
| 18 |
* |
| 19 |
* 3. Neither the name of the Institute nor the names of its contributors |
| 20 |
* may be used to endorse or promote products derived from this software |
| 21 |
* without specific prior written permission. |
| 22 |
* |
| 23 |
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND |
| 24 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 25 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 26 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE |
| 27 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 28 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 29 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 30 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 31 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 |
* SUCH DAMAGE. |
| 34 |
*/ |
| 35 |
|
| 36 |
/* $Id$ */ |
| 37 |
|
| 38 |
#ifndef __KRB5_H__ |
| 39 |
#define __KRB5_H__ |
| 40 |
|
| 41 |
#include <time.h> |
| 42 |
#include <krb5-types.h> |
| 43 |
|
| 44 |
#include <asn1_err.h> |
| 45 |
#include <krb5_err.h> |
| 46 |
#include <heim_err.h> |
| 47 |
#include <k524_err.h> |
| 48 |
|
| 49 |
#include <krb5_asn1.h> |
| 50 |
|
| 51 |
/* name confusion with MIT */ |
| 52 |
#ifndef KRB5KDC_ERR_KEY_EXP |
| 53 |
#define KRB5KDC_ERR_KEY_EXP KRB5KDC_ERR_KEY_EXPIRED |
| 54 |
#endif |
| 55 |
|
| 56 |
#ifdef _WIN32 |
| 57 |
#define KRB5_CALLCONV __stdcall |
| 58 |
#else |
| 59 |
#define KRB5_CALLCONV |
| 60 |
#endif |
| 61 |
|
| 62 |
/* simple constants */ |
| 63 |
|
| 64 |
#ifndef TRUE |
| 65 |
#define TRUE 1 |
| 66 |
#define FALSE 0 |
| 67 |
#endif |
| 68 |
|
| 69 |
typedef int krb5_boolean; |
| 70 |
|
| 71 |
typedef int32_t krb5_error_code; |
| 72 |
|
| 73 |
typedef int32_t krb5_kvno; |
| 74 |
|
| 75 |
typedef uint32_t krb5_flags; |
| 76 |
|
| 77 |
typedef void *krb5_pointer; |
| 78 |
typedef const void *krb5_const_pointer; |
| 79 |
|
| 80 |
struct krb5_crypto_data; |
| 81 |
typedef struct krb5_crypto_data *krb5_crypto; |
| 82 |
|
| 83 |
struct krb5_get_creds_opt_data; |
| 84 |
typedef struct krb5_get_creds_opt_data *krb5_get_creds_opt; |
| 85 |
|
| 86 |
struct krb5_digest_data; |
| 87 |
typedef struct krb5_digest_data *krb5_digest; |
| 88 |
struct krb5_ntlm_data; |
| 89 |
typedef struct krb5_ntlm_data *krb5_ntlm; |
| 90 |
|
| 91 |
struct krb5_pac_data; |
| 92 |
typedef struct krb5_pac_data *krb5_pac; |
| 93 |
|
| 94 |
typedef struct krb5_rd_req_in_ctx_data *krb5_rd_req_in_ctx; |
| 95 |
typedef struct krb5_rd_req_out_ctx_data *krb5_rd_req_out_ctx; |
| 96 |
|
| 97 |
typedef CKSUMTYPE krb5_cksumtype; |
| 98 |
|
| 99 |
typedef Checksum krb5_checksum; |
| 100 |
|
| 101 |
typedef ENCTYPE krb5_enctype; |
| 102 |
|
| 103 |
typedef struct krb5_get_init_creds_ctx *krb5_init_creds_context; |
| 104 |
|
| 105 |
typedef heim_octet_string krb5_data; |
| 106 |
|
| 107 |
/* PKINIT related forward declarations */ |
| 108 |
struct ContentInfo; |
| 109 |
struct krb5_pk_identity; |
| 110 |
struct krb5_pk_cert; |
| 111 |
|
| 112 |
/* krb5_enc_data is a mit compat structure */ |
| 113 |
typedef struct krb5_enc_data { |
| 114 |
krb5_enctype enctype; |
| 115 |
krb5_kvno kvno; |
| 116 |
krb5_data ciphertext; |
| 117 |
} krb5_enc_data; |
| 118 |
|
| 119 |
/* alternative names */ |
| 120 |
#define ENCTYPE_NULL KRB5_ENCTYPE_NULL |
| 121 |
#define ENCTYPE_DES_CBC_CRC KRB5_ENCTYPE_DES_CBC_CRC |
| 122 |
#define ENCTYPE_DES_CBC_MD4 KRB5_ENCTYPE_DES_CBC_MD4 |
| 123 |
#define ENCTYPE_DES_CBC_MD5 KRB5_ENCTYPE_DES_CBC_MD5 |
| 124 |
#define ENCTYPE_DES3_CBC_MD5 KRB5_ENCTYPE_DES3_CBC_MD5 |
| 125 |
#define ENCTYPE_OLD_DES3_CBC_SHA1 KRB5_ENCTYPE_OLD_DES3_CBC_SHA1 |
| 126 |
#define ENCTYPE_SIGN_DSA_GENERATE KRB5_ENCTYPE_SIGN_DSA_GENERATE |
| 127 |
#define ENCTYPE_ENCRYPT_RSA_PRIV KRB5_ENCTYPE_ENCRYPT_RSA_PRIV |
| 128 |
#define ENCTYPE_ENCRYPT_RSA_PUB KRB5_ENCTYPE_ENCRYPT_RSA_PUB |
| 129 |
#define ENCTYPE_DES3_CBC_SHA1 KRB5_ENCTYPE_DES3_CBC_SHA1 |
| 130 |
#define ENCTYPE_AES128_CTS_HMAC_SHA1_96 KRB5_ENCTYPE_AES128_CTS_HMAC_SHA1_96 |
| 131 |
#define ENCTYPE_AES256_CTS_HMAC_SHA1_96 KRB5_ENCTYPE_AES256_CTS_HMAC_SHA1_96 |
| 132 |
#define ENCTYPE_ARCFOUR_HMAC KRB5_ENCTYPE_ARCFOUR_HMAC_MD5 |
| 133 |
#define ENCTYPE_ARCFOUR_HMAC_MD5 KRB5_ENCTYPE_ARCFOUR_HMAC_MD5 |
| 134 |
#define ENCTYPE_ARCFOUR_HMAC_MD5_56 KRB5_ENCTYPE_ARCFOUR_HMAC_MD5_56 |
| 135 |
#define ENCTYPE_ENCTYPE_PK_CROSS KRB5_ENCTYPE_ENCTYPE_PK_CROSS |
| 136 |
#define ENCTYPE_DES_CBC_NONE KRB5_ENCTYPE_DES_CBC_NONE |
| 137 |
#define ENCTYPE_DES3_CBC_NONE KRB5_ENCTYPE_DES3_CBC_NONE |
| 138 |
#define ENCTYPE_DES_CFB64_NONE KRB5_ENCTYPE_DES_CFB64_NONE |
| 139 |
#define ENCTYPE_DES_PCBC_NONE KRB5_ENCTYPE_DES_PCBC_NONE |
| 140 |
#define ETYPE_NULL KRB5_ENCTYPE_NULL |
| 141 |
#define ETYPE_DES_CBC_CRC KRB5_ENCTYPE_DES_CBC_CRC |
| 142 |
#define ETYPE_DES_CBC_MD4 KRB5_ENCTYPE_DES_CBC_MD4 |
| 143 |
#define ETYPE_DES_CBC_MD5 KRB5_ENCTYPE_DES_CBC_MD5 |
| 144 |
#define ETYPE_DES3_CBC_MD5 KRB5_ENCTYPE_DES3_CBC_MD5 |
| 145 |
#define ETYPE_OLD_DES3_CBC_SHA1 KRB5_ENCTYPE_OLD_DES3_CBC_SHA1 |
| 146 |
#define ETYPE_SIGN_DSA_GENERATE KRB5_ENCTYPE_SIGN_DSA_GENERATE |
| 147 |
#define ETYPE_ENCRYPT_RSA_PRIV KRB5_ENCTYPE_ENCRYPT_RSA_PRIV |
| 148 |
#define ETYPE_ENCRYPT_RSA_PUB KRB5_ENCTYPE_ENCRYPT_RSA_PUB |
| 149 |
#define ETYPE_DES3_CBC_SHA1 KRB5_ENCTYPE_DES3_CBC_SHA1 |
| 150 |
#define ETYPE_AES128_CTS_HMAC_SHA1_96 KRB5_ENCTYPE_AES128_CTS_HMAC_SHA1_96 |
| 151 |
#define ETYPE_AES256_CTS_HMAC_SHA1_96 KRB5_ENCTYPE_AES256_CTS_HMAC_SHA1_96 |
| 152 |
#define ETYPE_AES128_CTS_HMAC_SHA256_128 KRB5_ENCTYPE_AES128_CTS_HMAC_SHA256_128 |
| 153 |
#define ETYPE_AES256_CTS_HMAC_SHA384_192 KRB5_ENCTYPE_AES256_CTS_HMAC_SHA384_192 |
| 154 |
#define ETYPE_ARCFOUR_HMAC_MD5 KRB5_ENCTYPE_ARCFOUR_HMAC_MD5 |
| 155 |
#define ETYPE_ARCFOUR_HMAC_MD5_56 KRB5_ENCTYPE_ARCFOUR_HMAC_MD5_56 |
| 156 |
#define ETYPE_ENCTYPE_PK_CROSS KRB5_ENCTYPE_ENCTYPE_PK_CROSS |
| 157 |
#define ETYPE_ARCFOUR_MD4 KRB5_ENCTYPE_ARCFOUR_MD4 |
| 158 |
#define ETYPE_ARCFOUR_HMAC_OLD KRB5_ENCTYPE_ARCFOUR_HMAC_OLD |
| 159 |
#define ETYPE_ARCFOUR_HMAC_OLD_EXP KRB5_ENCTYPE_ARCFOUR_HMAC_OLD_EXP |
| 160 |
#define ETYPE_DES_CBC_NONE KRB5_ENCTYPE_DES_CBC_NONE |
| 161 |
#define ETYPE_DES3_CBC_NONE KRB5_ENCTYPE_DES3_CBC_NONE |
| 162 |
#define ETYPE_DES_CFB64_NONE KRB5_ENCTYPE_DES_CFB64_NONE |
| 163 |
#define ETYPE_DES_PCBC_NONE KRB5_ENCTYPE_DES_PCBC_NONE |
| 164 |
#define ETYPE_DIGEST_MD5_NONE KRB5_ENCTYPE_DIGEST_MD5_NONE |
| 165 |
#define ETYPE_CRAM_MD5_NONE KRB5_ENCTYPE_CRAM_MD5_NONE |
| 166 |
|
| 167 |
/* PDU types */ |
| 168 |
typedef enum krb5_pdu { |
| 169 |
KRB5_PDU_ERROR = 0, |
| 170 |
KRB5_PDU_TICKET = 1, |
| 171 |
KRB5_PDU_AS_REQUEST = 2, |
| 172 |
KRB5_PDU_AS_REPLY = 3, |
| 173 |
KRB5_PDU_TGS_REQUEST = 4, |
| 174 |
KRB5_PDU_TGS_REPLY = 5, |
| 175 |
KRB5_PDU_AP_REQUEST = 6, |
| 176 |
KRB5_PDU_AP_REPLY = 7, |
| 177 |
KRB5_PDU_KRB_SAFE = 8, |
| 178 |
KRB5_PDU_KRB_PRIV = 9, |
| 179 |
KRB5_PDU_KRB_CRED = 10, |
| 180 |
KRB5_PDU_NONE = 11 /* See krb5_get_permitted_enctypes() */ |
| 181 |
} krb5_pdu; |
| 182 |
|
| 183 |
typedef PADATA_TYPE krb5_preauthtype; |
| 184 |
|
| 185 |
typedef enum krb5_key_usage { |
| 186 |
KRB5_KU_PA_ENC_TIMESTAMP = 1, |
| 187 |
/* AS-REQ PA-ENC-TIMESTAMP padata timestamp, encrypted with the |
| 188 |
client key (section 5.4.1) */ |
| 189 |
KRB5_KU_TICKET = 2, |
| 190 |
/* AS-REP Ticket and TGS-REP Ticket (includes tgs session key or |
| 191 |
application session key), encrypted with the service key |
| 192 |
(section 5.4.2) */ |
| 193 |
KRB5_KU_AS_REP_ENC_PART = 3, |
| 194 |
/* AS-REP encrypted part (includes tgs session key or application |
| 195 |
session key), encrypted with the client key (section 5.4.2) */ |
| 196 |
KRB5_KU_TGS_REQ_AUTH_DAT_SESSION = 4, |
| 197 |
/* TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the tgs |
| 198 |
session key (section 5.4.1) */ |
| 199 |
KRB5_KU_TGS_REQ_AUTH_DAT_SUBKEY = 5, |
| 200 |
/* TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the tgs |
| 201 |
authenticator subkey (section 5.4.1) */ |
| 202 |
KRB5_KU_TGS_REQ_AUTH_CKSUM = 6, |
| 203 |
/* TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator cksum, keyed |
| 204 |
with the tgs session key (sections 5.3.2, 5.4.1) */ |
| 205 |
KRB5_KU_TGS_REQ_AUTH = 7, |
| 206 |
/* TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator (includes tgs |
| 207 |
authenticator subkey), encrypted with the tgs session key |
| 208 |
(section 5.3.2) */ |
| 209 |
KRB5_KU_TGS_REP_ENC_PART_SESSION = 8, |
| 210 |
/* TGS-REP encrypted part (includes application session key), |
| 211 |
encrypted with the tgs session key (section 5.4.2) */ |
| 212 |
KRB5_KU_TGS_REP_ENC_PART_SUB_KEY = 9, |
| 213 |
/* TGS-REP encrypted part (includes application session key), |
| 214 |
encrypted with the tgs authenticator subkey (section 5.4.2) */ |
| 215 |
KRB5_KU_AP_REQ_AUTH_CKSUM = 10, |
| 216 |
/* AP-REQ Authenticator cksum, keyed with the application session |
| 217 |
key (section 5.3.2) */ |
| 218 |
KRB5_KU_AP_REQ_AUTH = 11, |
| 219 |
/* AP-REQ Authenticator (includes application authenticator |
| 220 |
subkey), encrypted with the application session key (section |
| 221 |
5.3.2) */ |
| 222 |
KRB5_KU_AP_REQ_ENC_PART = 12, |
| 223 |
/* AP-REP encrypted part (includes application session subkey), |
| 224 |
encrypted with the application session key (section 5.5.2) */ |
| 225 |
KRB5_KU_KRB_PRIV = 13, |
| 226 |
/* KRB-PRIV encrypted part, encrypted with a key chosen by the |
| 227 |
application (section 5.7.1) */ |
| 228 |
KRB5_KU_KRB_CRED = 14, |
| 229 |
/* KRB-CRED encrypted part, encrypted with a key chosen by the |
| 230 |
application (section 5.8.1) */ |
| 231 |
KRB5_KU_KRB_SAFE_CKSUM = 15, |
| 232 |
/* KRB-SAFE cksum, keyed with a key chosen by the application |
| 233 |
(section 5.6.1) */ |
| 234 |
KRB5_KU_OTHER_ENCRYPTED = 16, |
| 235 |
/* Data which is defined in some specification outside of |
| 236 |
Kerberos to be encrypted using an RFC1510 encryption type. */ |
| 237 |
KRB5_KU_OTHER_CKSUM = 17, |
| 238 |
/* Data which is defined in some specification outside of |
| 239 |
Kerberos to be checksummed using an RFC1510 checksum type. */ |
| 240 |
KRB5_KU_KRB_ERROR = 18, |
| 241 |
/* Krb-error checksum */ |
| 242 |
KRB5_KU_AD_KDC_ISSUED = 19, |
| 243 |
/* AD-KDCIssued checksum */ |
| 244 |
KRB5_KU_MANDATORY_TICKET_EXTENSION = 20, |
| 245 |
/* Checksum for Mandatory Ticket Extensions */ |
| 246 |
KRB5_KU_AUTH_DATA_TICKET_EXTENSION = 21, |
| 247 |
/* Checksum in Authorization Data in Ticket Extensions */ |
| 248 |
KRB5_KU_USAGE_SEAL = 22, |
| 249 |
/* seal in GSSAPI krb5 mechanism */ |
| 250 |
KRB5_KU_USAGE_SIGN = 23, |
| 251 |
/* sign in GSSAPI krb5 mechanism */ |
| 252 |
KRB5_KU_USAGE_SEQ = 24, |
| 253 |
/* SEQ in GSSAPI krb5 mechanism */ |
| 254 |
KRB5_KU_USAGE_ACCEPTOR_SEAL = 22, |
| 255 |
/* acceptor sign in GSSAPI CFX krb5 mechanism */ |
| 256 |
KRB5_KU_USAGE_ACCEPTOR_SIGN = 23, |
| 257 |
/* acceptor seal in GSSAPI CFX krb5 mechanism */ |
| 258 |
KRB5_KU_USAGE_INITIATOR_SEAL = 24, |
| 259 |
/* initiator sign in GSSAPI CFX krb5 mechanism */ |
| 260 |
KRB5_KU_USAGE_INITIATOR_SIGN = 25, |
| 261 |
/* initiator seal in GSSAPI CFX krb5 mechanism */ |
| 262 |
KRB5_KU_PA_SERVER_REFERRAL_DATA = 22, |
| 263 |
/* encrypted server referral data */ |
| 264 |
KRB5_KU_SAM_CHECKSUM = 25, |
| 265 |
/* Checksum for the SAM-CHECKSUM field */ |
| 266 |
KRB5_KU_SAM_ENC_TRACK_ID = 26, |
| 267 |
/* Encryption of the SAM-TRACK-ID field */ |
| 268 |
KRB5_KU_PA_SERVER_REFERRAL = 26, |
| 269 |
/* Keyusage for the server referral in a TGS req */ |
| 270 |
KRB5_KU_SAM_ENC_NONCE_SAD = 27, |
| 271 |
/* Encryption of the SAM-NONCE-OR-SAD field */ |
| 272 |
KRB5_KU_PA_PKINIT_KX = 44, |
| 273 |
/* Encryption type of the kdc session contribution in pk-init */ |
| 274 |
KRB5_KU_AS_REQ = 56, |
| 275 |
/* Checksum of over the AS-REQ send by the KDC in PA-REQ-ENC-PA-REP */ |
| 276 |
KRB5_KU_FAST_REQ_CHKSUM = 50, |
| 277 |
/* FAST armor checksum */ |
| 278 |
KRB5_KU_FAST_ENC = 51, |
| 279 |
/* FAST armor encryption */ |
| 280 |
KRB5_KU_FAST_REP = 52, |
| 281 |
/* FAST armor reply */ |
| 282 |
KRB5_KU_FAST_FINISHED = 53, |
| 283 |
/* FAST finished checksum */ |
| 284 |
KRB5_KU_ENC_CHALLENGE_CLIENT = 54, |
| 285 |
/* fast challenge from client */ |
| 286 |
KRB5_KU_ENC_CHALLENGE_KDC = 55, |
| 287 |
/* fast challenge from kdc */ |
| 288 |
KRB5_KU_DIGEST_ENCRYPT = -18, |
| 289 |
/* Encryption key usage used in the digest encryption field */ |
| 290 |
KRB5_KU_DIGEST_OPAQUE = -19, |
| 291 |
/* Checksum key usage used in the digest opaque field */ |
| 292 |
KRB5_KU_KRB5SIGNEDPATH = -21, |
| 293 |
/* Checksum key usage on KRB5SignedPath */ |
| 294 |
KRB5_KU_CANONICALIZED_NAMES = -23, |
| 295 |
/* Checksum key usage on PA-CANONICALIZED */ |
| 296 |
KRB5_KU_H5L_COOKIE = -25 |
| 297 |
/* encrypted foo */ |
| 298 |
} krb5_key_usage; |
| 299 |
|
| 300 |
typedef krb5_key_usage krb5_keyusage; |
| 301 |
|
| 302 |
typedef enum krb5_salttype { |
| 303 |
KRB5_PW_SALT = KRB5_PADATA_PW_SALT, |
| 304 |
KRB5_AFS3_SALT = KRB5_PADATA_AFS3_SALT |
| 305 |
}krb5_salttype; |
| 306 |
|
| 307 |
typedef struct krb5_salt { |
| 308 |
krb5_salttype salttype; |
| 309 |
krb5_data saltvalue; |
| 310 |
} krb5_salt; |
| 311 |
|
| 312 |
typedef ETYPE_INFO krb5_preauthinfo; |
| 313 |
|
| 314 |
typedef struct { |
| 315 |
krb5_preauthtype type; |
| 316 |
krb5_preauthinfo info; /* list of preauthinfo for this type */ |
| 317 |
} krb5_preauthdata_entry; |
| 318 |
|
| 319 |
typedef struct krb5_preauthdata { |
| 320 |
unsigned len; |
| 321 |
krb5_preauthdata_entry *val; |
| 322 |
}krb5_preauthdata; |
| 323 |
|
| 324 |
typedef enum krb5_address_type { |
| 325 |
KRB5_ADDRESS_INET = 2, |
| 326 |
KRB5_ADDRESS_NETBIOS = 20, |
| 327 |
KRB5_ADDRESS_INET6 = 24, |
| 328 |
KRB5_ADDRESS_ADDRPORT = 256, |
| 329 |
KRB5_ADDRESS_IPPORT = 257 |
| 330 |
} krb5_address_type; |
| 331 |
|
| 332 |
enum { |
| 333 |
AP_OPTS_USE_SESSION_KEY = 1, |
| 334 |
AP_OPTS_MUTUAL_REQUIRED = 2, |
| 335 |
AP_OPTS_USE_SUBKEY = 4 /* library internal */ |
| 336 |
}; |
| 337 |
|
| 338 |
typedef HostAddress krb5_address; |
| 339 |
|
| 340 |
typedef HostAddresses krb5_addresses; |
| 341 |
|
| 342 |
typedef krb5_enctype krb5_keytype; |
| 343 |
|
| 344 |
enum krb5_keytype_old { |
| 345 |
KEYTYPE_NULL = ETYPE_NULL, |
| 346 |
KEYTYPE_DES = ETYPE_DES_CBC_CRC, |
| 347 |
KEYTYPE_DES3 = ETYPE_OLD_DES3_CBC_SHA1, |
| 348 |
KEYTYPE_AES128 = ETYPE_AES128_CTS_HMAC_SHA1_96, |
| 349 |
KEYTYPE_AES256 = ETYPE_AES256_CTS_HMAC_SHA1_96, |
| 350 |
KEYTYPE_ARCFOUR = ETYPE_ARCFOUR_HMAC_MD5, |
| 351 |
KEYTYPE_ARCFOUR_56 = ETYPE_ARCFOUR_HMAC_MD5_56 |
| 352 |
}; |
| 353 |
|
| 354 |
typedef EncryptionKey krb5_keyblock; |
| 355 |
|
| 356 |
typedef AP_REQ krb5_ap_req; |
| 357 |
|
| 358 |
struct krb5_cc_ops; |
| 359 |
|
| 360 |
#ifdef _WIN32 |
| 361 |
#define KRB5_USE_PATH_TOKENS 1 |
| 362 |
#endif |
| 363 |
|
| 364 |
#ifdef KRB5_USE_PATH_TOKENS |
| 365 |
#define KRB5_DEFAULT_CCFILE_ROOT "%{TEMP}/krb5cc_" |
| 366 |
#else |
| 367 |
#define KRB5_DEFAULT_CCFILE_ROOT "/tmp/krb5cc_" |
| 368 |
#endif |
| 369 |
|
| 370 |
#define KRB5_DEFAULT_CCROOT "FILE:" KRB5_DEFAULT_CCFILE_ROOT |
| 371 |
|
| 372 |
#define KRB5_ACCEPT_NULL_ADDRESSES(C) \ |
| 373 |
krb5_config_get_bool_default((C), NULL, TRUE, \ |
| 374 |
"libdefaults", "accept_null_addresses", \ |
| 375 |
NULL) |
| 376 |
|
| 377 |
typedef void *krb5_cc_cursor; |
| 378 |
typedef struct krb5_cccol_cursor_data *krb5_cccol_cursor; |
| 379 |
|
| 380 |
typedef struct krb5_ccache_data { |
| 381 |
const struct krb5_cc_ops *ops; |
| 382 |
krb5_data data; |
| 383 |
int initialized; /* if non-zero: krb5_cc_initialize() called, now empty */ |
| 384 |
}krb5_ccache_data; |
| 385 |
|
| 386 |
typedef struct krb5_ccache_data *krb5_ccache; |
| 387 |
|
| 388 |
typedef struct krb5_context_data *krb5_context; |
| 389 |
|
| 390 |
typedef Realm krb5_realm; |
| 391 |
typedef const char *krb5_const_realm; /* stupid language */ |
| 392 |
|
| 393 |
#define krb5_realm_length(r) strlen(r) |
| 394 |
#define krb5_realm_data(r) (r) |
| 395 |
|
| 396 |
typedef Principal krb5_principal_data; |
| 397 |
typedef struct Principal *krb5_principal; |
| 398 |
typedef const struct Principal *krb5_const_principal; |
| 399 |
typedef struct Principals *krb5_principals; |
| 400 |
|
| 401 |
typedef time_t krb5_deltat; |
| 402 |
typedef time_t krb5_timestamp; |
| 403 |
|
| 404 |
typedef struct krb5_times { |
| 405 |
krb5_timestamp authtime; |
| 406 |
krb5_timestamp starttime; |
| 407 |
krb5_timestamp endtime; |
| 408 |
krb5_timestamp renew_till; |
| 409 |
} krb5_times; |
| 410 |
|
| 411 |
typedef union { |
| 412 |
TicketFlags b; |
| 413 |
krb5_flags i; |
| 414 |
} krb5_ticket_flags; |
| 415 |
|
| 416 |
/* options for krb5_get_in_tkt() */ |
| 417 |
#define KDC_OPT_FORWARDABLE (1 << 1) |
| 418 |
#define KDC_OPT_FORWARDED (1 << 2) |
| 419 |
#define KDC_OPT_PROXIABLE (1 << 3) |
| 420 |
#define KDC_OPT_PROXY (1 << 4) |
| 421 |
#define KDC_OPT_ALLOW_POSTDATE (1 << 5) |
| 422 |
#define KDC_OPT_POSTDATED (1 << 6) |
| 423 |
#define KDC_OPT_RENEWABLE (1 << 8) |
| 424 |
#define KDC_OPT_REQUEST_ANONYMOUS (1 << 14) |
| 425 |
#define KDC_OPT_DISABLE_TRANSITED_CHECK (1 << 26) |
| 426 |
#define KDC_OPT_RENEWABLE_OK (1 << 27) |
| 427 |
#define KDC_OPT_ENC_TKT_IN_SKEY (1 << 28) |
| 428 |
#define KDC_OPT_RENEW (1 << 30) |
| 429 |
#define KDC_OPT_VALIDATE (1 << 31) |
| 430 |
|
| 431 |
typedef union { |
| 432 |
KDCOptions b; |
| 433 |
krb5_flags i; |
| 434 |
} krb5_kdc_flags; |
| 435 |
|
| 436 |
/* flags for krb5_verify_ap_req */ |
| 437 |
|
| 438 |
#define KRB5_VERIFY_AP_REQ_IGNORE_INVALID (1 << 0) |
| 439 |
|
| 440 |
#define KRB5_GC_CACHED (1U << 0) |
| 441 |
#define KRB5_GC_USER_USER (1U << 1) |
| 442 |
#define KRB5_GC_EXPIRED_OK (1U << 2) |
| 443 |
#define KRB5_GC_NO_STORE (1U << 3) |
| 444 |
#define KRB5_GC_FORWARDABLE (1U << 4) |
| 445 |
#define KRB5_GC_NO_TRANSIT_CHECK (1U << 5) |
| 446 |
#define KRB5_GC_CONSTRAINED_DELEGATION (1U << 6) |
| 447 |
#define KRB5_GC_CANONICALIZE (1U << 7) |
| 448 |
#define KRB5_GC_ANONYMOUS (1U << 8) |
| 449 |
|
| 450 |
/* constants for compare_creds (and cc_retrieve_cred) */ |
| 451 |
#define KRB5_TC_DONT_MATCH_REALM (1U << 31) |
| 452 |
#define KRB5_TC_MATCH_KEYTYPE (1U << 30) |
| 453 |
#define KRB5_TC_MATCH_KTYPE KRB5_TC_MATCH_KEYTYPE /* MIT name */ |
| 454 |
#define KRB5_TC_MATCH_SRV_NAMEONLY (1 << 29) |
| 455 |
#define KRB5_TC_MATCH_FLAGS_EXACT (1 << 28) |
| 456 |
#define KRB5_TC_MATCH_FLAGS (1 << 27) |
| 457 |
#define KRB5_TC_MATCH_TIMES_EXACT (1 << 26) |
| 458 |
#define KRB5_TC_MATCH_TIMES (1 << 25) |
| 459 |
#define KRB5_TC_MATCH_AUTHDATA (1 << 24) |
| 460 |
#define KRB5_TC_MATCH_2ND_TKT (1 << 23) |
| 461 |
#define KRB5_TC_MATCH_IS_SKEY (1 << 22) |
| 462 |
|
| 463 |
/* constants for get_flags and set_flags */ |
| 464 |
#define KRB5_TC_OPENCLOSE 0x00000001 |
| 465 |
#define KRB5_TC_NOTICKET 0x00000002 |
| 466 |
|
| 467 |
typedef AuthorizationData krb5_authdata; |
| 468 |
|
| 469 |
typedef KRB_ERROR krb5_error; |
| 470 |
|
| 471 |
typedef struct krb5_creds { |
| 472 |
krb5_principal client; |
| 473 |
krb5_principal server; |
| 474 |
krb5_keyblock session; |
| 475 |
krb5_times times; |
| 476 |
krb5_data ticket; |
| 477 |
krb5_data second_ticket; |
| 478 |
krb5_authdata authdata; |
| 479 |
krb5_addresses addresses; |
| 480 |
krb5_ticket_flags flags; |
| 481 |
} krb5_creds; |
| 482 |
|
| 483 |
typedef struct krb5_cc_cache_cursor_data *krb5_cc_cache_cursor; |
| 484 |
|
| 485 |
#define KRB5_CC_OPS_VERSION 3 |
| 486 |
|
| 487 |
typedef struct krb5_cc_ops { |
| 488 |
int version; |
| 489 |
const char *prefix; |
| 490 |
const char* (KRB5_CALLCONV * get_name)(krb5_context, krb5_ccache); |
| 491 |
krb5_error_code (KRB5_CALLCONV * resolve)(krb5_context, krb5_ccache *, const char *); |
| 492 |
krb5_error_code (KRB5_CALLCONV * gen_new)(krb5_context, krb5_ccache *); |
| 493 |
krb5_error_code (KRB5_CALLCONV * init)(krb5_context, krb5_ccache, krb5_principal); |
| 494 |
krb5_error_code (KRB5_CALLCONV * destroy)(krb5_context, krb5_ccache); |
| 495 |
krb5_error_code (KRB5_CALLCONV * close)(krb5_context, krb5_ccache); |
| 496 |
krb5_error_code (KRB5_CALLCONV * store)(krb5_context, krb5_ccache, krb5_creds*); |
| 497 |
krb5_error_code (KRB5_CALLCONV * retrieve)(krb5_context, krb5_ccache, |
| 498 |
krb5_flags, const krb5_creds*, krb5_creds *); |
| 499 |
krb5_error_code (KRB5_CALLCONV * get_princ)(krb5_context, krb5_ccache, krb5_principal*); |
| 500 |
krb5_error_code (KRB5_CALLCONV * get_first)(krb5_context, krb5_ccache, krb5_cc_cursor *); |
| 501 |
krb5_error_code (KRB5_CALLCONV * get_next)(krb5_context, krb5_ccache, |
| 502 |
krb5_cc_cursor*, krb5_creds*); |
| 503 |
krb5_error_code (KRB5_CALLCONV * end_get)(krb5_context, krb5_ccache, krb5_cc_cursor*); |
| 504 |
krb5_error_code (KRB5_CALLCONV * remove_cred)(krb5_context, krb5_ccache, |
| 505 |
krb5_flags, krb5_creds*); |
| 506 |
krb5_error_code (KRB5_CALLCONV * set_flags)(krb5_context, krb5_ccache, krb5_flags); |
| 507 |
int (KRB5_CALLCONV * get_version)(krb5_context, krb5_ccache); |
| 508 |
krb5_error_code (KRB5_CALLCONV * get_cache_first)(krb5_context, krb5_cc_cursor *); |
| 509 |
krb5_error_code (KRB5_CALLCONV * get_cache_next)(krb5_context, krb5_cc_cursor, |
| 510 |
krb5_ccache *); |
| 511 |
krb5_error_code (KRB5_CALLCONV * end_cache_get)(krb5_context, krb5_cc_cursor); |
| 512 |
krb5_error_code (KRB5_CALLCONV * move)(krb5_context, krb5_ccache, krb5_ccache); |
| 513 |
krb5_error_code (KRB5_CALLCONV * get_default_name)(krb5_context, char **); |
| 514 |
krb5_error_code (KRB5_CALLCONV * set_default)(krb5_context, krb5_ccache); |
| 515 |
krb5_error_code (KRB5_CALLCONV * lastchange)(krb5_context, krb5_ccache, krb5_timestamp *); |
| 516 |
krb5_error_code (KRB5_CALLCONV * set_kdc_offset)(krb5_context, krb5_ccache, krb5_deltat); |
| 517 |
krb5_error_code (KRB5_CALLCONV * get_kdc_offset)(krb5_context, krb5_ccache, krb5_deltat *); |
| 518 |
} krb5_cc_ops; |
| 519 |
|
| 520 |
struct krb5_log_facility; |
| 521 |
|
| 522 |
struct krb5_config_binding { |
| 523 |
enum { krb5_config_string, krb5_config_list } type; |
| 524 |
char *name; |
| 525 |
struct krb5_config_binding *next; |
| 526 |
union { |
| 527 |
char *string; |
| 528 |
struct krb5_config_binding *list; |
| 529 |
void *generic; |
| 530 |
} u; |
| 531 |
}; |
| 532 |
|
| 533 |
typedef struct krb5_config_binding krb5_config_binding; |
| 534 |
|
| 535 |
typedef krb5_config_binding krb5_config_section; |
| 536 |
|
| 537 |
typedef struct krb5_ticket { |
| 538 |
EncTicketPart ticket; |
| 539 |
krb5_principal client; |
| 540 |
krb5_principal server; |
| 541 |
} krb5_ticket; |
| 542 |
|
| 543 |
typedef Authenticator krb5_authenticator_data; |
| 544 |
|
| 545 |
typedef krb5_authenticator_data *krb5_authenticator; |
| 546 |
|
| 547 |
struct krb5_rcache_data; |
| 548 |
typedef struct krb5_rcache_data *krb5_rcache; |
| 549 |
typedef Authenticator krb5_donot_replay; |
| 550 |
|
| 551 |
#define KRB5_STORAGE_HOST_BYTEORDER 0x01 /* old */ |
| 552 |
#define KRB5_STORAGE_PRINCIPAL_WRONG_NUM_COMPONENTS 0x02 |
| 553 |
#define KRB5_STORAGE_PRINCIPAL_NO_NAME_TYPE 0x04 |
| 554 |
#define KRB5_STORAGE_KEYBLOCK_KEYTYPE_TWICE 0x08 |
| 555 |
#define KRB5_STORAGE_BYTEORDER_MASK 0x60 |
| 556 |
#define KRB5_STORAGE_BYTEORDER_BE 0x00 /* default */ |
| 557 |
#define KRB5_STORAGE_BYTEORDER_LE 0x20 |
| 558 |
#define KRB5_STORAGE_BYTEORDER_HOST 0x40 |
| 559 |
#define KRB5_STORAGE_CREDS_FLAGS_WRONG_BITORDER 0x80 |
| 560 |
|
| 561 |
struct krb5_storage_data; |
| 562 |
typedef struct krb5_storage_data krb5_storage; |
| 563 |
|
| 564 |
typedef struct krb5_keytab_entry { |
| 565 |
krb5_principal principal; |
| 566 |
krb5_kvno vno; |
| 567 |
krb5_keyblock keyblock; |
| 568 |
uint32_t timestamp; |
| 569 |
uint32_t flags; |
| 570 |
krb5_principals aliases; |
| 571 |
} krb5_keytab_entry; |
| 572 |
|
| 573 |
typedef struct krb5_kt_cursor { |
| 574 |
int fd; |
| 575 |
krb5_storage *sp; |
| 576 |
void *data; |
| 577 |
} krb5_kt_cursor; |
| 578 |
|
| 579 |
struct krb5_keytab_data; |
| 580 |
|
| 581 |
typedef struct krb5_keytab_data *krb5_keytab; |
| 582 |
|
| 583 |
#define KRB5_KT_PREFIX_MAX_LEN 30 |
| 584 |
|
| 585 |
struct krb5_keytab_data { |
| 586 |
const char *prefix; |
| 587 |
krb5_error_code (KRB5_CALLCONV * resolve)(krb5_context, const char*, krb5_keytab); |
| 588 |
krb5_error_code (KRB5_CALLCONV * get_name)(krb5_context, krb5_keytab, char*, size_t); |
| 589 |
krb5_error_code (KRB5_CALLCONV * close)(krb5_context, krb5_keytab); |
| 590 |
krb5_error_code (KRB5_CALLCONV * destroy)(krb5_context, krb5_keytab); |
| 591 |
krb5_error_code (KRB5_CALLCONV * get)(krb5_context, krb5_keytab, krb5_const_principal, |
| 592 |
krb5_kvno, krb5_enctype, krb5_keytab_entry*); |
| 593 |
krb5_error_code (KRB5_CALLCONV * start_seq_get)(krb5_context, krb5_keytab, krb5_kt_cursor*); |
| 594 |
krb5_error_code (KRB5_CALLCONV * next_entry)(krb5_context, krb5_keytab, |
| 595 |
krb5_keytab_entry*, krb5_kt_cursor*); |
| 596 |
krb5_error_code (KRB5_CALLCONV * end_seq_get)(krb5_context, krb5_keytab, krb5_kt_cursor*); |
| 597 |
krb5_error_code (KRB5_CALLCONV * add)(krb5_context, krb5_keytab, krb5_keytab_entry*); |
| 598 |
krb5_error_code (KRB5_CALLCONV * remove)(krb5_context, krb5_keytab, krb5_keytab_entry*); |
| 599 |
void *data; |
| 600 |
int32_t version; |
| 601 |
}; |
| 602 |
|
| 603 |
typedef struct krb5_keytab_data krb5_kt_ops; |
| 604 |
|
| 605 |
struct krb5_keytab_key_proc_args { |
| 606 |
krb5_keytab keytab; |
| 607 |
krb5_principal principal; |
| 608 |
}; |
| 609 |
|
| 610 |
typedef struct krb5_keytab_key_proc_args krb5_keytab_key_proc_args; |
| 611 |
|
| 612 |
typedef struct krb5_replay_data { |
| 613 |
krb5_timestamp timestamp; |
| 614 |
int32_t usec; |
| 615 |
uint32_t seq; |
| 616 |
} krb5_replay_data; |
| 617 |
|
| 618 |
/* flags for krb5_auth_con_setflags */ |
| 619 |
enum { |
| 620 |
KRB5_AUTH_CONTEXT_DO_TIME = 1, |
| 621 |
KRB5_AUTH_CONTEXT_RET_TIME = 2, |
| 622 |
KRB5_AUTH_CONTEXT_DO_SEQUENCE = 4, |
| 623 |
KRB5_AUTH_CONTEXT_RET_SEQUENCE = 8, |
| 624 |
KRB5_AUTH_CONTEXT_PERMIT_ALL = 16, |
| 625 |
KRB5_AUTH_CONTEXT_USE_SUBKEY = 32, |
| 626 |
KRB5_AUTH_CONTEXT_CLEAR_FORWARDED_CRED = 64 |
| 627 |
}; |
| 628 |
|
| 629 |
/* flags for krb5_auth_con_genaddrs */ |
| 630 |
enum { |
| 631 |
KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR = 1, |
| 632 |
KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR = 3, |
| 633 |
KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR = 4, |
| 634 |
KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR = 12 |
| 635 |
}; |
| 636 |
|
| 637 |
typedef struct krb5_auth_context_data { |
| 638 |
unsigned int flags; |
| 639 |
|
| 640 |
krb5_address *local_address; |
| 641 |
krb5_address *remote_address; |
| 642 |
int16_t local_port; |
| 643 |
int16_t remote_port; |
| 644 |
krb5_keyblock *keyblock; |
| 645 |
krb5_keyblock *local_subkey; |
| 646 |
krb5_keyblock *remote_subkey; |
| 647 |
|
| 648 |
uint32_t local_seqnumber; |
| 649 |
uint32_t remote_seqnumber; |
| 650 |
|
| 651 |
krb5_authenticator authenticator; |
| 652 |
|
| 653 |
krb5_pointer i_vector; |
| 654 |
|
| 655 |
krb5_rcache rcache; |
| 656 |
|
| 657 |
krb5_keytype keytype; /* ¿requested key type ? */ |
| 658 |
krb5_cksumtype cksumtype; /* ¡requested checksum type! */ |
| 659 |
|
| 660 |
AuthorizationData *auth_data; |
| 661 |
|
| 662 |
}krb5_auth_context_data, *krb5_auth_context; |
| 663 |
|
| 664 |
typedef struct { |
| 665 |
KDC_REP kdc_rep; |
| 666 |
EncKDCRepPart enc_part; |
| 667 |
KRB_ERROR error; |
| 668 |
} krb5_kdc_rep; |
| 669 |
|
| 670 |
extern const char *heimdal_version, *heimdal_long_version; |
| 671 |
|
| 672 |
typedef void (KRB5_CALLCONV * krb5_log_log_func_t)(const char*, const char*, void*); |
| 673 |
typedef void (KRB5_CALLCONV * krb5_log_close_func_t)(void*); |
| 674 |
|
| 675 |
typedef struct krb5_log_facility { |
| 676 |
char *program; |
| 677 |
int len; |
| 678 |
struct facility *val; |
| 679 |
} krb5_log_facility; |
| 680 |
|
| 681 |
typedef EncAPRepPart krb5_ap_rep_enc_part; |
| 682 |
|
| 683 |
#define KRB5_RECVAUTH_IGNORE_VERSION 1 |
| 684 |
|
| 685 |
#define KRB5_SENDAUTH_VERSION "KRB5_SENDAUTH_V1.0" |
| 686 |
|
| 687 |
#define KRB5_TGS_NAME_SIZE (6) |
| 688 |
#define KRB5_TGS_NAME ("krbtgt") |
| 689 |
#define KRB5_WELLKNOWN_NAME ("WELLKNOWN") |
| 690 |
#define KRB5_ANON_NAME ("ANONYMOUS") |
| 691 |
#define KRB5_ANON_REALM ("WELLKNOWN:ANONYMOUS") |
| 692 |
#define KRB5_WELLKNOWN_ORG_H5L_REALM ("WELLKNOWN:ORG.H5L") |
| 693 |
#define KRB5_DIGEST_NAME ("digest") |
| 694 |
|
| 695 |
|
| 696 |
#define KRB5_PKU2U_REALM_NAME ("WELLKNOWN:PKU2U") |
| 697 |
#define KRB5_LKDC_REALM_NAME ("WELLKNOWN:COM.APPLE.LKDC") |
| 698 |
|
| 699 |
#define KRB5_GSS_HOSTBASED_SERVICE_NAME ("WELLKNOWN:ORG.H5L.HOSTBASED-SERVICE") |
| 700 |
#define KRB5_GSS_REFERALS_REALM_NAME ("WELLKNOWN:ORG.H5L.REFERALS-REALM") |
| 701 |
|
| 702 |
typedef enum { |
| 703 |
KRB5_PROMPT_TYPE_PASSWORD = 0x1, |
| 704 |
KRB5_PROMPT_TYPE_NEW_PASSWORD = 0x2, |
| 705 |
KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN = 0x3, |
| 706 |
KRB5_PROMPT_TYPE_PREAUTH = 0x4, |
| 707 |
KRB5_PROMPT_TYPE_INFO = 0x5 |
| 708 |
} krb5_prompt_type; |
| 709 |
|
| 710 |
typedef struct _krb5_prompt { |
| 711 |
const char *prompt; |
| 712 |
int hidden; |
| 713 |
krb5_data *reply; |
| 714 |
krb5_prompt_type type; |
| 715 |
} krb5_prompt; |
| 716 |
|
| 717 |
typedef int (KRB5_CALLCONV * krb5_prompter_fct)(krb5_context /*context*/, |
| 718 |
void * /*data*/, |
| 719 |
const char * /*name*/, |
| 720 |
const char * /*banner*/, |
| 721 |
int /*num_prompts*/, |
| 722 |
krb5_prompt /*prompts*/[]); |
| 723 |
typedef krb5_error_code (KRB5_CALLCONV * krb5_key_proc)(krb5_context /*context*/, |
| 724 |
krb5_enctype /*type*/, |
| 725 |
krb5_salt /*salt*/, |
| 726 |
krb5_const_pointer /*keyseed*/, |
| 727 |
krb5_keyblock ** /*key*/); |
| 728 |
typedef krb5_error_code (KRB5_CALLCONV * krb5_decrypt_proc)(krb5_context /*context*/, |
| 729 |
krb5_keyblock * /*key*/, |
| 730 |
krb5_key_usage /*usage*/, |
| 731 |
krb5_const_pointer /*decrypt_arg*/, |
| 732 |
krb5_kdc_rep * /*dec_rep*/); |
| 733 |
typedef krb5_error_code (KRB5_CALLCONV * krb5_s2k_proc)(krb5_context /*context*/, |
| 734 |
krb5_enctype /*type*/, |
| 735 |
krb5_const_pointer /*keyseed*/, |
| 736 |
krb5_salt /*salt*/, |
| 737 |
krb5_data * /*s2kparms*/, |
| 738 |
krb5_keyblock ** /*key*/); |
| 739 |
|
| 740 |
struct _krb5_get_init_creds_opt_private; |
| 741 |
|
| 742 |
struct _krb5_get_init_creds_opt { |
| 743 |
krb5_flags flags; |
| 744 |
krb5_deltat tkt_life; |
| 745 |
krb5_deltat renew_life; |
| 746 |
int forwardable; |
| 747 |
int proxiable; |
| 748 |
int anonymous; |
| 749 |
int change_password_prompt; |
| 750 |
krb5_enctype *etype_list; |
| 751 |
int etype_list_length; |
| 752 |
krb5_addresses *address_list; |
| 753 |
/* XXX the next three should not be used, as they may be |
| 754 |
removed later */ |
| 755 |
krb5_preauthtype *preauth_list; |
| 756 |
int preauth_list_length; |
| 757 |
krb5_data *salt; |
| 758 |
struct _krb5_get_init_creds_opt_private *opt_private; |
| 759 |
}; |
| 760 |
|
| 761 |
typedef struct _krb5_get_init_creds_opt krb5_get_init_creds_opt; |
| 762 |
|
| 763 |
#define KRB5_GET_INIT_CREDS_OPT_TKT_LIFE 0x0001 |
| 764 |
#define KRB5_GET_INIT_CREDS_OPT_RENEW_LIFE 0x0002 |
| 765 |
#define KRB5_GET_INIT_CREDS_OPT_FORWARDABLE 0x0004 |
| 766 |
#define KRB5_GET_INIT_CREDS_OPT_PROXIABLE 0x0008 |
| 767 |
#define KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST 0x0010 |
| 768 |
#define KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST 0x0020 |
| 769 |
#define KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST 0x0040 |
| 770 |
#define KRB5_GET_INIT_CREDS_OPT_SALT 0x0080 /* no supported */ |
| 771 |
#define KRB5_GET_INIT_CREDS_OPT_ANONYMOUS 0x0100 |
| 772 |
#define KRB5_GET_INIT_CREDS_OPT_DISABLE_TRANSITED_CHECK 0x0200 |
| 773 |
#define KRB5_GET_INIT_CREDS_OPT_CHANGE_PASSWORD_PROMPT 0x0400 |
| 774 |
|
| 775 |
/* krb5_init_creds_step flags argument */ |
| 776 |
#define KRB5_INIT_CREDS_STEP_FLAG_CONTINUE 0x0001 |
| 777 |
|
| 778 |
typedef struct _krb5_verify_init_creds_opt { |
| 779 |
krb5_flags flags; |
| 780 |
int ap_req_nofail; |
| 781 |
} krb5_verify_init_creds_opt; |
| 782 |
|
| 783 |
#define KRB5_VERIFY_INIT_CREDS_OPT_AP_REQ_NOFAIL 0x0001 |
| 784 |
|
| 785 |
typedef struct krb5_verify_opt { |
| 786 |
unsigned int flags; |
| 787 |
krb5_ccache ccache; |
| 788 |
krb5_keytab keytab; |
| 789 |
krb5_boolean secure; |
| 790 |
const char *service; |
| 791 |
} krb5_verify_opt; |
| 792 |
|
| 793 |
#define KRB5_VERIFY_LREALMS 1 |
| 794 |
#define KRB5_VERIFY_NO_ADDRESSES 2 |
| 795 |
|
| 796 |
#define KRB5_KPASSWD_VERS_CHANGEPW 1 |
| 797 |
#define KRB5_KPASSWD_VERS_SETPW 0xff80 |
| 798 |
|
| 799 |
#define KRB5_KPASSWD_SUCCESS 0 |
| 800 |
#define KRB5_KPASSWD_MALFORMED 1 |
| 801 |
#define KRB5_KPASSWD_HARDERROR 2 |
| 802 |
#define KRB5_KPASSWD_AUTHERROR 3 |
| 803 |
#define KRB5_KPASSWD_SOFTERROR 4 |
| 804 |
#define KRB5_KPASSWD_ACCESSDENIED 5 |
| 805 |
#define KRB5_KPASSWD_BAD_VERSION 6 |
| 806 |
#define KRB5_KPASSWD_INITIAL_FLAG_NEEDED 7 |
| 807 |
|
| 808 |
#define KPASSWD_PORT 464 |
| 809 |
|
| 810 |
/* types for the new krbhst interface */ |
| 811 |
struct krb5_krbhst_data; |
| 812 |
typedef struct krb5_krbhst_data *krb5_krbhst_handle; |
| 813 |
|
| 814 |
#define KRB5_KRBHST_KDC 1 |
| 815 |
#define KRB5_KRBHST_ADMIN 2 |
| 816 |
#define KRB5_KRBHST_CHANGEPW 3 |
| 817 |
#define KRB5_KRBHST_KRB524 4 |
| 818 |
#define KRB5_KRBHST_KCA 5 |
| 819 |
|
| 820 |
typedef struct krb5_krbhst_info { |
| 821 |
enum { KRB5_KRBHST_UDP, |
| 822 |
KRB5_KRBHST_TCP, |
| 823 |
KRB5_KRBHST_HTTP } proto; |
| 824 |
unsigned short port; |
| 825 |
unsigned short def_port; |
| 826 |
struct addrinfo *ai; |
| 827 |
struct krb5_krbhst_info *next; |
| 828 |
char hostname[1]; /* has to come last */ |
| 829 |
} krb5_krbhst_info; |
| 830 |
|
| 831 |
/* flags for krb5_krbhst_init_flags (and krb5_send_to_kdc_flags) */ |
| 832 |
enum { |
| 833 |
KRB5_KRBHST_FLAGS_MASTER = 1, |
| 834 |
KRB5_KRBHST_FLAGS_LARGE_MSG = 2 |
| 835 |
}; |
| 836 |
|
| 837 |
typedef krb5_error_code (*krb5_sendto_prexmit)(krb5_context, int, void *, int, krb5_data *); |
| 838 |
typedef krb5_error_code |
| 839 |
(KRB5_CALLCONV * krb5_send_to_kdc_func)(krb5_context, void *, krb5_krbhst_info *, time_t, |
| 840 |
const krb5_data *, krb5_data *); |
| 841 |
|
| 842 |
/** flags for krb5_parse_name_flags */ |
| 843 |
enum { |
| 844 |
KRB5_PRINCIPAL_PARSE_NO_REALM = 1, /**< Require that there are no realm */ |
| 845 |
KRB5_PRINCIPAL_PARSE_REQUIRE_REALM = 2, /**< Require a realm present */ |
| 846 |
KRB5_PRINCIPAL_PARSE_ENTERPRISE = 4, /**< Parse as a NT-ENTERPRISE name */ |
| 847 |
KRB5_PRINCIPAL_PARSE_IGNORE_REALM = 8, /**< Ignore realm if present */ |
| 848 |
KRB5_PRINCIPAL_PARSE_NO_DEF_REALM = 16 /**< Don't default the realm */ |
| 849 |
}; |
| 850 |
|
| 851 |
/** flags for krb5_unparse_name_flags */ |
| 852 |
enum { |
| 853 |
KRB5_PRINCIPAL_UNPARSE_SHORT = 1, /**< No realm if it is the default realm */ |
| 854 |
KRB5_PRINCIPAL_UNPARSE_NO_REALM = 2, /**< No realm */ |
| 855 |
KRB5_PRINCIPAL_UNPARSE_DISPLAY = 4 /**< No quoting */ |
| 856 |
}; |
| 857 |
|
| 858 |
typedef struct krb5_sendto_ctx_data *krb5_sendto_ctx; |
| 859 |
|
| 860 |
#define KRB5_SENDTO_DONE 0 |
| 861 |
#define KRB5_SENDTO_RESET 1 |
| 862 |
#define KRB5_SENDTO_CONTINUE 2 |
| 863 |
#define KRB5_SENDTO_TIMEOUT 3 |
| 864 |
#define KRB5_SENDTO_INITIAL 4 |
| 865 |
#define KRB5_SENDTO_FILTER 5 |
| 866 |
#define KRB5_SENDTO_FAILED 6 |
| 867 |
#define KRB5_SENDTO_KRBHST 7 |
| 868 |
|
| 869 |
typedef krb5_error_code |
| 870 |
(KRB5_CALLCONV * krb5_sendto_ctx_func)(krb5_context, krb5_sendto_ctx, void *, |
| 871 |
const krb5_data *, int *); |
| 872 |
|
| 873 |
struct krb5_plugin; |
| 874 |
enum krb5_plugin_type { |
| 875 |
PLUGIN_TYPE_DATA = 1, |
| 876 |
PLUGIN_TYPE_FUNC |
| 877 |
}; |
| 878 |
|
| 879 |
#define KRB5_PLUGIN_INVOKE_ALL 1 |
| 880 |
|
| 881 |
struct credentials; /* this is to keep the compiler happy */ |
| 882 |
struct getargs; |
| 883 |
struct sockaddr; |
| 884 |
|
| 885 |
/** |
| 886 |
* Semi private, not stable yet |
| 887 |
*/ |
| 888 |
|
| 889 |
typedef struct krb5_crypto_iov { |
| 890 |
unsigned int flags; |
| 891 |
/* ignored */ |
| 892 |
#define KRB5_CRYPTO_TYPE_EMPTY 0 |
| 893 |
/* OUT krb5_crypto_length(KRB5_CRYPTO_TYPE_HEADER) */ |
| 894 |
#define KRB5_CRYPTO_TYPE_HEADER 1 |
| 895 |
/* IN and OUT */ |
| 896 |
#define KRB5_CRYPTO_TYPE_DATA 2 |
| 897 |
/* IN */ |
| 898 |
#define KRB5_CRYPTO_TYPE_SIGN_ONLY 3 |
| 899 |
/* (only for encryption) OUT krb5_crypto_length(KRB5_CRYPTO_TYPE_TRAILER) */ |
| 900 |
#define KRB5_CRYPTO_TYPE_PADDING 4 |
| 901 |
/* OUT krb5_crypto_length(KRB5_CRYPTO_TYPE_TRAILER) */ |
| 902 |
#define KRB5_CRYPTO_TYPE_TRAILER 5 |
| 903 |
/* OUT krb5_crypto_length(KRB5_CRYPTO_TYPE_CHECKSUM) */ |
| 904 |
#define KRB5_CRYPTO_TYPE_CHECKSUM 6 |
| 905 |
krb5_data data; |
| 906 |
} krb5_crypto_iov; |
| 907 |
|
| 908 |
|
| 909 |
/* Glue for MIT */ |
| 910 |
|
| 911 |
typedef struct { |
| 912 |
int32_t lr_type; |
| 913 |
krb5_timestamp value; |
| 914 |
} krb5_last_req_entry; |
| 915 |
|
| 916 |
typedef krb5_error_code |
| 917 |
(KRB5_CALLCONV * krb5_gic_process_last_req)(krb5_context, krb5_last_req_entry **, void *); |
| 918 |
|
| 919 |
typedef struct { |
| 920 |
krb5_enctype ks_enctype; |
| 921 |
krb5int32 ks_salttype; |
| 922 |
}krb5_key_salt_tuple; |
| 923 |
|
| 924 |
/* |
| 925 |
* Name canonicalization rule options |
| 926 |
*/ |
| 927 |
|
| 928 |
typedef enum krb5_name_canon_rule_options { |
| 929 |
KRB5_NCRO_GC_ONLY = 1 << 0, |
| 930 |
KRB5_NCRO_USE_REFERRALS = 1 << 1, |
| 931 |
KRB5_NCRO_NO_REFERRALS = 1 << 2, |
| 932 |
KRB5_NCRO_USE_FAST = 1 << 3, |
| 933 |
KRB5_NCRO_USE_DNSSEC = 1 << 4, |
| 934 |
KRB5_NCRO_LOOKUP_REALM = 1 << 5 |
| 935 |
} krb5_name_canon_rule_options; |
| 936 |
|
| 937 |
typedef struct krb5_name_canon_rule_data *krb5_name_canon_rule; |
| 938 |
typedef const struct krb5_name_canon_rule_data *krb5_const_name_canon_rule; |
| 939 |
typedef struct krb5_name_canon_iterator_data *krb5_name_canon_iterator; |
| 940 |
|
| 941 |
/* |
| 942 |
* krb5_get_init_creds_opt_set_pkinit flags |
| 943 |
*/ |
| 944 |
|
| 945 |
#define KRB5_GIC_OPT_PKINIT_USE_ENCKEY 2 /* use RSA, not DH */ |
| 946 |
#define KRB5_GIC_OPT_PKINIT_ANONYMOUS 4 /* anonymous PKINIT */ |
| 947 |
#define KRB5_GIC_OPT_PKINIT_BTMM 8 /* reserved by Apple */ |
| 948 |
#define KRB5_GIC_OPT_PKINIT_NO_KDC_ANCHOR 16 /* do not authenticate KDC */ |
| 949 |
|
| 950 |
/* |
| 951 |
* _krb5_principal_is_anonymous() flags |
| 952 |
*/ |
| 953 |
#define KRB5_ANON_MATCH_AUTHENTICATED 1 /* authenticated with anon flag */ |
| 954 |
#define KRB5_ANON_MATCH_UNAUTHENTICATED 2 /* anonymous PKINIT */ |
| 955 |
#define KRB5_ANON_IGNORE_NAME_TYPE 4 /* don't check the name type */ |
| 956 |
#define KRB5_ANON_MATCH_ANY ( KRB5_ANON_MATCH_AUTHENTICATED | \ |
| 957 |
KRB5_ANON_MATCH_UNAUTHENTICATED ) |
| 958 |
#define KRB5_ANON_MATCH_ANY_NONT ( KRB5_ANON_MATCH_ANY | \ |
| 959 |
KRB5_ANON_IGNORE_NAME_TYPE ) |
| 960 |
|
| 961 |
/* |
| 962 |
* |
| 963 |
*/ |
| 964 |
|
| 965 |
struct hx509_certs_data; |
| 966 |
|
| 967 |
#include <krb5-protos.h> |
| 968 |
|
| 969 |
/* variables */ |
| 970 |
|
| 971 |
extern KRB5_LIB_VARIABLE const char *krb5_config_file; |
| 972 |
extern KRB5_LIB_VARIABLE const char *krb5_defkeyname; |
| 973 |
|
| 974 |
|
| 975 |
extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_acc_ops; |
| 976 |
extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_dcc_ops; |
| 977 |
extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_fcc_ops; |
| 978 |
extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_mcc_ops; |
| 979 |
extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_kcm_ops; |
| 980 |
extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_akcm_ops; |
| 981 |
extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_scc_ops; |
| 982 |
|
| 983 |
extern KRB5_LIB_VARIABLE const krb5_kt_ops krb5_fkt_ops; |
| 984 |
extern KRB5_LIB_VARIABLE const krb5_kt_ops krb5_wrfkt_ops; |
| 985 |
extern KRB5_LIB_VARIABLE const krb5_kt_ops krb5_javakt_ops; |
| 986 |
extern KRB5_LIB_VARIABLE const krb5_kt_ops krb5_mkt_ops; |
| 987 |
extern KRB5_LIB_VARIABLE const krb5_kt_ops krb5_akf_ops; |
| 988 |
extern KRB5_LIB_VARIABLE const krb5_kt_ops krb5_any_ops; |
| 989 |
|
| 990 |
extern KRB5_LIB_VARIABLE const char *krb5_cc_type_api; |
| 991 |
extern KRB5_LIB_VARIABLE const char *krb5_cc_type_file; |
| 992 |
extern KRB5_LIB_VARIABLE const char *krb5_cc_type_memory; |
| 993 |
extern KRB5_LIB_VARIABLE const char *krb5_cc_type_kcm; |
| 994 |
extern KRB5_LIB_VARIABLE const char *krb5_cc_type_scc; |
| 995 |
extern KRB5_LIB_VARIABLE const char *krb5_cc_type_dcc; |
| 996 |
|
| 997 |
/* clang analyzer workarounds */ |
| 998 |
|
| 999 |
#ifdef __clang_analyzer__ |
| 1000 |
/* |
| 1001 |
* The clang analyzer (lint) can't know that krb5_enomem() always returns |
| 1002 |
* non-zero, so code like: |
| 1003 |
* |
| 1004 |
* if ((x = malloc(...)) == NULL) |
| 1005 |
* ret = krb5_enomem(context) |
| 1006 |
* if (ret == 0) |
| 1007 |
* *x = ...; |
| 1008 |
* |
| 1009 |
* causes false positives. |
| 1010 |
* |
| 1011 |
* The fix is to make krb5_enomem() a macro that always evaluates to ENOMEM. |
| 1012 |
*/ |
| 1013 |
#define krb5_enomem(c) (krb5_enomem(c), ENOMEM) |
| 1014 |
#endif |
| 1015 |
|
| 1016 |
#endif /* __KRB5_H__ */ |
| 1017 |
|