2 * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2000, 2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: gssapi.h,v 1.9.128.2 2009/01/19 23:47:03 tbox Exp $ */
21 #define DST_GSSAPI_H 1
23 /*! \file dst/gssapi.h */
25 #include <isc/formatcheck.h>
27 #include <isc/platform.h>
28 #include <isc/types.h>
29 #include <dns/types.h>
34 * MSVC does not like macros in #include lines.
36 #include <gssapi/gssapi.h>
38 #include ISC_PLATFORM_GSSAPIHEADER
40 #ifndef GSS_SPNEGO_MECHANISM
41 #define GSS_SPNEGO_MECHANISM ((void*)0)
56 dst_gssapi_acquirecred(dns_name_t
*name
, isc_boolean_t initiate
,
59 * Acquires GSS credentials.
62 * 'name' is a valid name, preferably one known by the GSS provider
63 * 'initiate' indicates whether the credentials are for initiating or
65 * 'cred' is a pointer to NULL, which will be allocated with the
66 * credential handle. Call dst_gssapi_releasecred to free
70 * ISC_R_SUCCESS msg was successfully updated to include the
72 * other an error occurred while building the message
76 dst_gssapi_releasecred(gss_cred_id_t
*cred
);
78 * Releases GSS credentials. Calling this function does release the
79 * memory allocated for the credential in dst_gssapi_acquirecred()
82 * 'mctx' is a valid memory context
83 * 'cred' is a pointer to the credential to be released
86 * ISC_R_SUCCESS credential was released successfully
87 * other an error occurred while releaseing
92 dst_gssapi_initctx(dns_name_t
*name
, isc_buffer_t
*intoken
,
93 isc_buffer_t
*outtoken
, gss_ctx_id_t
*gssctx
);
95 * Initiates a GSS context.
98 * 'name' is a valid name, preferably one known by the GSS
100 * 'intoken' is a token received from the acceptor, or NULL if
102 * 'outtoken' is a buffer to receive the token generated by
103 * gss_init_sec_context() to be sent to the acceptor
104 * 'context' is a pointer to a valid gss_ctx_id_t
105 * (which may have the value GSS_C_NO_CONTEXT)
108 * ISC_R_SUCCESS msg was successfully updated to include the
110 * other an error occurred while building the message
114 dst_gssapi_acceptctx(gss_cred_id_t cred
,
115 isc_region_t
*intoken
, isc_buffer_t
**outtoken
,
116 gss_ctx_id_t
*context
, dns_name_t
*principal
,
119 * Accepts a GSS context.
122 * 'mctx' is a valid memory context
123 * 'cred' is the acceptor's valid GSS credential handle
124 * 'intoken' is a token received from the initiator
125 * 'outtoken' is a pointer a buffer pointer used to return the token
126 * generated by gss_accept_sec_context() to be sent to the
128 * 'context' is a valid pointer to receive the generated context handle.
129 * On the initial call, it should be a pointer to NULL, which
130 * will be allocated as a gss_ctx_id_t. Subsequent calls
131 * should pass in the handle generated on the first call.
132 * Call dst_gssapi_releasecred to delete the context and free
136 * 'outtoken' to != NULL && *outtoken == NULL.
139 * ISC_R_SUCCESS msg was successfully updated to include the
141 * other an error occurred while building the message
145 dst_gssapi_deletectx(isc_mem_t
*mctx
, gss_ctx_id_t
*gssctx
);
147 * Destroys a GSS context. This function deletes the context from the GSS
148 * provider and then frees the memory used by the context pointer.
151 * 'mctx' is a valid memory context
152 * 'context' is a valid GSS context
160 gss_log(int level
, const char *fmt
, ...)
161 ISC_FORMAT_PRINTF(2, 3);
163 * Logging function for GSS.
166 * 'level' is the log level to be used, as an integer
167 * 'fmt' is a printf format specifier
171 gss_error_tostring(isc_uint32_t major
, isc_uint32_t minor
,
172 char *buf
, size_t buflen
);
174 * Render a GSS major status/minor status pair into a string
177 * 'major' is a GSS major status code
178 * 'minor' is a GSS minor status code
181 * A string containing the text representation of the error codes.
182 * Users should copy the string if they wish to keep it.
186 dst_gssapi_identitymatchesrealmkrb5(dns_name_t
*signer
, dns_name_t
*name
,
189 * Compare a "signer" (in the format of a Kerberos-format Kerberos5
190 * principal: host/example.com@EXAMPLE.COM) to the realm name stored
191 * in "name" (which represents the realm name).
196 dst_gssapi_identitymatchesrealmms(dns_name_t
*signer
, dns_name_t
*name
,
199 * Compare a "signer" (in the format of a Kerberos-format Kerberos5
200 * principal: host/example.com@EXAMPLE.COM) to the realm name stored
201 * in "name" (which represents the realm name).
207 #endif /* DST_GSSAPI_H */