2014-12-02 16:52:38 -05:00
|
|
|
/***************************************************************************
|
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2016-03-12 06:59:52 -05:00
|
|
|
* Copyright (C) 2014 - 2016, Steve Holme, <steve_holme@hotmail.com>.
|
2015-01-08 14:23:53 -05:00
|
|
|
* Copyright (C) 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
2014-12-02 16:52:38 -05:00
|
|
|
*
|
|
|
|
* This software is licensed as described in the file COPYING, which
|
|
|
|
* you should have received as part of this distribution. The terms
|
2016-02-02 18:19:02 -05:00
|
|
|
* are also available at https://curl.haxx.se/docs/copyright.html.
|
2014-12-02 16:52:38 -05:00
|
|
|
*
|
|
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
* copies of the Software, and permit persons to whom the Software is
|
|
|
|
* furnished to do so, under the terms of the COPYING file.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
* RFC4752 The Kerberos V5 ("GSSAPI") SASL Mechanism
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#include "curl_setup.h"
|
|
|
|
|
2014-12-03 02:13:30 -05:00
|
|
|
#if defined(HAVE_GSSAPI) && defined(USE_KERBEROS5)
|
2014-12-02 16:52:38 -05:00
|
|
|
|
|
|
|
#include <curl/curl.h>
|
|
|
|
|
2015-09-12 06:48:24 -04:00
|
|
|
#include "vauth/vauth.h"
|
2014-12-02 16:52:38 -05:00
|
|
|
#include "curl_sasl.h"
|
|
|
|
#include "urldata.h"
|
2014-12-03 14:51:32 -05:00
|
|
|
#include "curl_base64.h"
|
|
|
|
#include "curl_gssapi.h"
|
2014-12-04 17:29:41 -05:00
|
|
|
#include "sendf.h"
|
2015-03-03 06:36:18 -05:00
|
|
|
#include "curl_printf.h"
|
2014-12-03 13:38:43 -05:00
|
|
|
|
2015-03-24 18:12:03 -04:00
|
|
|
/* The last #include files should be: */
|
|
|
|
#include "curl_memory.h"
|
2014-12-02 16:52:38 -05:00
|
|
|
#include "memdebug.h"
|
|
|
|
|
2016-03-20 07:56:07 -04:00
|
|
|
/*
|
|
|
|
* Curl_auth_is_gssapi_supported()
|
|
|
|
*
|
|
|
|
* This is used to evaluate if GSSAPI (Kerberos V5) is supported.
|
|
|
|
*
|
|
|
|
* Parameters: None
|
|
|
|
*
|
|
|
|
* Returns TRUE if Kerberos V5 is supported by the GSS-API library.
|
|
|
|
*/
|
|
|
|
bool Curl_auth_is_gssapi_supported(void)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-12-02 16:52:38 -05:00
|
|
|
/*
|
2016-03-13 07:28:42 -04:00
|
|
|
* Curl_auth_create_gssapi_user_message()
|
2014-12-02 16:52:38 -05:00
|
|
|
*
|
|
|
|
* This is used to generate an already encoded GSSAPI (Kerberos V5) user token
|
|
|
|
* message ready for sending to the recipient.
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
*
|
|
|
|
* data [in] - The session handle.
|
|
|
|
* userp [in] - The user name.
|
|
|
|
* passdwp [in] - The user's password.
|
2016-04-05 19:21:07 -04:00
|
|
|
* service [in] - The service type such as http, smtp, pop or imap.
|
2016-04-02 01:15:29 -04:00
|
|
|
* host [in[ - The host name.
|
2014-12-02 16:52:38 -05:00
|
|
|
* mutual_auth [in] - Flag specifing whether or not mutual authentication
|
|
|
|
* is enabled.
|
|
|
|
* chlg64 [in] - Pointer to the optional base64 encoded challenge
|
|
|
|
* message.
|
2016-03-12 06:59:52 -05:00
|
|
|
* krb5 [in/out] - The Kerberos 5 data struct being used and modified.
|
2014-12-02 16:52:38 -05:00
|
|
|
* outptr [in/out] - The address where a pointer to newly allocated memory
|
|
|
|
* holding the result will be stored upon completion.
|
|
|
|
* outlen [out] - The length of the output message.
|
|
|
|
*
|
|
|
|
* Returns CURLE_OK on success.
|
|
|
|
*/
|
2016-06-21 09:47:12 -04:00
|
|
|
CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
|
2014-12-02 16:52:38 -05:00
|
|
|
const char *userp,
|
|
|
|
const char *passwdp,
|
|
|
|
const char *service,
|
2016-04-02 01:15:29 -04:00
|
|
|
const char *host,
|
2014-12-02 16:52:38 -05:00
|
|
|
const bool mutual_auth,
|
|
|
|
const char *chlg64,
|
|
|
|
struct kerberos5data *krb5,
|
|
|
|
char **outptr, size_t *outlen)
|
|
|
|
{
|
2014-12-03 14:51:32 -05:00
|
|
|
CURLcode result = CURLE_OK;
|
|
|
|
size_t chlglen = 0;
|
|
|
|
unsigned char *chlg = NULL;
|
2016-04-02 01:25:30 -04:00
|
|
|
OM_uint32 major_status;
|
|
|
|
OM_uint32 minor_status;
|
|
|
|
OM_uint32 unused_status;
|
2014-12-03 14:51:32 -05:00
|
|
|
gss_buffer_desc spn_token = GSS_C_EMPTY_BUFFER;
|
|
|
|
gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER;
|
|
|
|
gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER;
|
|
|
|
|
2014-12-02 16:52:38 -05:00
|
|
|
(void) userp;
|
|
|
|
(void) passwdp;
|
|
|
|
|
2016-04-03 06:15:03 -04:00
|
|
|
if(!krb5->spn) {
|
2014-12-03 14:51:32 -05:00
|
|
|
/* Generate our SPN */
|
2016-04-03 15:26:03 -04:00
|
|
|
char *spn = Curl_auth_build_spn(service, NULL, host);
|
2014-12-03 14:51:32 -05:00
|
|
|
if(!spn)
|
|
|
|
return CURLE_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
/* Populate the SPN structure */
|
|
|
|
spn_token.value = spn;
|
|
|
|
spn_token.length = strlen(spn);
|
|
|
|
|
|
|
|
/* Import the SPN */
|
2016-04-02 01:25:30 -04:00
|
|
|
major_status = gss_import_name(&minor_status, &spn_token,
|
|
|
|
GSS_C_NT_HOSTBASED_SERVICE, &krb5->spn);
|
|
|
|
if(GSS_ERROR(major_status)) {
|
2016-03-29 10:13:46 -04:00
|
|
|
Curl_gss_log_error(data, "gss_import_name() failed: ",
|
2016-04-02 01:25:30 -04:00
|
|
|
major_status, minor_status);
|
2014-12-03 14:51:32 -05:00
|
|
|
|
2015-03-16 10:01:15 -04:00
|
|
|
free(spn);
|
2015-01-18 12:02:55 -05:00
|
|
|
|
2014-12-03 14:51:32 -05:00
|
|
|
return CURLE_OUT_OF_MEMORY;
|
|
|
|
}
|
2015-01-18 12:02:55 -05:00
|
|
|
|
2015-03-16 10:01:15 -04:00
|
|
|
free(spn);
|
2014-12-03 14:51:32 -05:00
|
|
|
}
|
2016-04-03 06:15:03 -04:00
|
|
|
|
2016-04-03 12:30:51 -04:00
|
|
|
if(chlg64 && *chlg64) {
|
2014-12-03 14:51:32 -05:00
|
|
|
/* Decode the base-64 encoded challenge message */
|
2016-04-03 12:17:20 -04:00
|
|
|
if(*chlg64 != '=') {
|
2014-12-03 14:51:32 -05:00
|
|
|
result = Curl_base64_decode(chlg64, &chlg, &chlglen);
|
|
|
|
if(result)
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ensure we have a valid challenge message */
|
2014-12-04 17:19:24 -05:00
|
|
|
if(!chlg) {
|
|
|
|
infof(data, "GSSAPI handshake failure (empty challenge message)\n");
|
|
|
|
|
2014-12-03 14:51:32 -05:00
|
|
|
return CURLE_BAD_CONTENT_ENCODING;
|
2014-12-04 17:19:24 -05:00
|
|
|
}
|
2014-12-03 14:51:32 -05:00
|
|
|
|
|
|
|
/* Setup the challenge "input" security buffer */
|
|
|
|
input_token.value = chlg;
|
|
|
|
input_token.length = chlglen;
|
|
|
|
}
|
|
|
|
|
2016-04-02 01:25:30 -04:00
|
|
|
major_status = Curl_gss_init_sec_context(data,
|
|
|
|
&minor_status,
|
|
|
|
&krb5->context,
|
|
|
|
krb5->spn,
|
|
|
|
&Curl_krb5_mech_oid,
|
|
|
|
GSS_C_NO_CHANNEL_BINDINGS,
|
|
|
|
&input_token,
|
|
|
|
&output_token,
|
|
|
|
mutual_auth,
|
|
|
|
NULL);
|
2014-12-03 14:51:32 -05:00
|
|
|
|
2016-04-03 12:30:51 -04:00
|
|
|
/* Free the decoded challenge as it is not required anymore */
|
2015-03-16 10:01:15 -04:00
|
|
|
free(input_token.value);
|
2014-12-03 14:51:32 -05:00
|
|
|
|
2016-04-02 01:25:30 -04:00
|
|
|
if(GSS_ERROR(major_status)) {
|
2014-12-03 14:51:32 -05:00
|
|
|
if(output_token.value)
|
2016-04-02 01:25:30 -04:00
|
|
|
gss_release_buffer(&unused_status, &output_token);
|
2014-12-03 14:51:32 -05:00
|
|
|
|
2016-03-29 10:13:46 -04:00
|
|
|
Curl_gss_log_error(data, "gss_init_sec_context() failed: ",
|
2016-04-02 01:25:30 -04:00
|
|
|
major_status, minor_status);
|
2014-12-03 14:51:32 -05:00
|
|
|
|
|
|
|
return CURLE_RECV_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(output_token.value && output_token.length) {
|
|
|
|
/* Base64 encode the response */
|
|
|
|
result = Curl_base64_encode(data, (char *) output_token.value,
|
|
|
|
output_token.length, outptr, outlen);
|
|
|
|
|
2016-04-02 01:25:30 -04:00
|
|
|
gss_release_buffer(&unused_status, &output_token);
|
2014-12-03 14:51:32 -05:00
|
|
|
}
|
2016-04-03 12:02:44 -04:00
|
|
|
else if(mutual_auth) {
|
|
|
|
*outptr = strdup("");
|
|
|
|
if(!*outptr)
|
|
|
|
result = CURLE_OUT_OF_MEMORY;
|
|
|
|
}
|
2014-12-03 14:51:32 -05:00
|
|
|
|
|
|
|
return result;
|
2014-12-02 16:52:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2016-03-13 07:28:42 -04:00
|
|
|
* Curl_auth_create_gssapi_security_message()
|
2014-12-02 16:52:38 -05:00
|
|
|
*
|
|
|
|
* This is used to generate an already encoded GSSAPI (Kerberos V5) security
|
|
|
|
* token message ready for sending to the recipient.
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
*
|
|
|
|
* data [in] - The session handle.
|
|
|
|
* chlg64 [in] - Pointer to the optional base64 encoded challenge message.
|
2016-03-12 06:59:52 -05:00
|
|
|
* krb5 [in/out] - The Kerberos 5 data struct being used and modified.
|
2014-12-02 16:52:38 -05:00
|
|
|
* outptr [in/out] - The address where a pointer to newly allocated memory
|
|
|
|
* holding the result will be stored upon completion.
|
|
|
|
* outlen [out] - The length of the output message.
|
|
|
|
*
|
|
|
|
* Returns CURLE_OK on success.
|
|
|
|
*/
|
2016-06-21 09:47:12 -04:00
|
|
|
CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
|
2014-12-02 16:52:38 -05:00
|
|
|
const char *chlg64,
|
|
|
|
struct kerberos5data *krb5,
|
|
|
|
char **outptr,
|
|
|
|
size_t *outlen)
|
|
|
|
{
|
2014-12-04 19:04:42 -05:00
|
|
|
CURLcode result = CURLE_OK;
|
|
|
|
size_t chlglen = 0;
|
|
|
|
size_t messagelen = 0;
|
|
|
|
unsigned char *chlg = NULL;
|
|
|
|
unsigned char *message = NULL;
|
2016-04-02 01:25:30 -04:00
|
|
|
OM_uint32 major_status;
|
|
|
|
OM_uint32 minor_status;
|
|
|
|
OM_uint32 unused_status;
|
2014-12-04 19:04:42 -05:00
|
|
|
gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER;
|
|
|
|
gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER;
|
|
|
|
unsigned int indata = 0;
|
|
|
|
unsigned int outdata = 0;
|
|
|
|
gss_qop_t qop = GSS_C_QOP_DEFAULT;
|
|
|
|
unsigned int sec_layer = 0;
|
|
|
|
unsigned int max_size = 0;
|
2014-12-28 14:19:14 -05:00
|
|
|
gss_name_t username = GSS_C_NO_NAME;
|
|
|
|
gss_buffer_desc username_token;
|
2014-12-04 19:04:42 -05:00
|
|
|
|
|
|
|
/* Decode the base-64 encoded input message */
|
|
|
|
if(strlen(chlg64) && *chlg64 != '=') {
|
|
|
|
result = Curl_base64_decode(chlg64, &chlg, &chlglen);
|
|
|
|
if(result)
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ensure we have a valid challenge message */
|
|
|
|
if(!chlg) {
|
|
|
|
infof(data, "GSSAPI handshake failure (empty security message)\n");
|
|
|
|
|
|
|
|
return CURLE_BAD_CONTENT_ENCODING;
|
|
|
|
}
|
|
|
|
|
2014-12-28 14:19:14 -05:00
|
|
|
/* Get the fully qualified username back from the context */
|
2016-04-02 01:25:30 -04:00
|
|
|
major_status = gss_inquire_context(&minor_status, krb5->context,
|
|
|
|
&username, NULL, NULL, NULL, NULL,
|
|
|
|
NULL, NULL);
|
|
|
|
if(GSS_ERROR(major_status)) {
|
2016-03-29 10:13:46 -04:00
|
|
|
Curl_gss_log_error(data, "gss_inquire_context() failed: ",
|
2016-04-02 01:25:30 -04:00
|
|
|
major_status, minor_status);
|
2014-12-28 14:19:14 -05:00
|
|
|
|
2015-03-16 10:01:15 -04:00
|
|
|
free(chlg);
|
2014-12-28 14:19:14 -05:00
|
|
|
|
|
|
|
return CURLE_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert the username from internal format to a displayable token */
|
2016-04-02 01:25:30 -04:00
|
|
|
major_status = gss_display_name(&minor_status, username,
|
|
|
|
&username_token, NULL);
|
|
|
|
if(GSS_ERROR(major_status)) {
|
2016-03-29 10:13:46 -04:00
|
|
|
Curl_gss_log_error(data, "gss_display_name() failed: ",
|
2016-04-02 01:25:30 -04:00
|
|
|
major_status, minor_status);
|
2014-12-28 14:19:14 -05:00
|
|
|
|
2015-03-16 10:01:15 -04:00
|
|
|
free(chlg);
|
2014-12-28 14:19:14 -05:00
|
|
|
|
|
|
|
return CURLE_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
2014-12-04 19:04:42 -05:00
|
|
|
/* Setup the challenge "input" security buffer */
|
|
|
|
input_token.value = chlg;
|
|
|
|
input_token.length = chlglen;
|
|
|
|
|
|
|
|
/* Decrypt the inbound challenge and obtain the qop */
|
2016-04-02 01:25:30 -04:00
|
|
|
major_status = gss_unwrap(&minor_status, krb5->context, &input_token,
|
|
|
|
&output_token, NULL, &qop);
|
|
|
|
if(GSS_ERROR(major_status)) {
|
2016-03-29 10:13:46 -04:00
|
|
|
Curl_gss_log_error(data, "gss_unwrap() failed: ",
|
2016-04-02 01:25:30 -04:00
|
|
|
major_status, minor_status);
|
2014-12-04 19:04:42 -05:00
|
|
|
|
2016-04-02 01:25:30 -04:00
|
|
|
gss_release_buffer(&unused_status, &username_token);
|
2015-03-16 10:01:15 -04:00
|
|
|
free(chlg);
|
2014-12-04 19:04:42 -05:00
|
|
|
|
|
|
|
return CURLE_BAD_CONTENT_ENCODING;
|
|
|
|
}
|
2014-12-02 16:52:38 -05:00
|
|
|
|
2014-12-04 19:04:42 -05:00
|
|
|
/* Not 4 octets long so fail as per RFC4752 Section 3.1 */
|
|
|
|
if(output_token.length != 4) {
|
|
|
|
infof(data, "GSSAPI handshake failure (invalid security data)\n");
|
|
|
|
|
2016-04-02 01:25:30 -04:00
|
|
|
gss_release_buffer(&unused_status, &username_token);
|
2015-03-16 10:01:15 -04:00
|
|
|
free(chlg);
|
2014-12-04 19:04:42 -05:00
|
|
|
|
|
|
|
return CURLE_BAD_CONTENT_ENCODING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the data out and free the challenge as it is not required anymore */
|
|
|
|
memcpy(&indata, output_token.value, 4);
|
2016-04-02 01:25:30 -04:00
|
|
|
gss_release_buffer(&unused_status, &output_token);
|
2015-03-16 10:01:15 -04:00
|
|
|
free(chlg);
|
2014-12-04 19:04:42 -05:00
|
|
|
|
|
|
|
/* Extract the security layer */
|
|
|
|
sec_layer = indata & 0x000000FF;
|
|
|
|
if(!(sec_layer & GSSAUTH_P_NONE)) {
|
|
|
|
infof(data, "GSSAPI handshake failure (invalid security layer)\n");
|
|
|
|
|
2016-04-02 01:25:30 -04:00
|
|
|
gss_release_buffer(&unused_status, &username_token);
|
2014-12-28 14:19:14 -05:00
|
|
|
|
2014-12-04 19:04:42 -05:00
|
|
|
return CURLE_BAD_CONTENT_ENCODING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Extract the maximum message size the server can receive */
|
|
|
|
max_size = ntohl(indata & 0xFFFFFF00);
|
|
|
|
if(max_size > 0) {
|
|
|
|
/* The server has told us it supports a maximum receive buffer, however, as
|
|
|
|
we don't require one unless we are encrypting data, we tell the server
|
|
|
|
our receive buffer is zero. */
|
|
|
|
max_size = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate our message */
|
2014-12-28 14:19:14 -05:00
|
|
|
messagelen = sizeof(outdata) + username_token.length + 1;
|
2014-12-04 19:04:42 -05:00
|
|
|
message = malloc(messagelen);
|
2014-12-28 14:19:14 -05:00
|
|
|
if(!message) {
|
2016-04-02 01:25:30 -04:00
|
|
|
gss_release_buffer(&unused_status, &username_token);
|
2014-12-28 14:19:14 -05:00
|
|
|
|
2014-12-04 19:04:42 -05:00
|
|
|
return CURLE_OUT_OF_MEMORY;
|
2014-12-28 14:19:14 -05:00
|
|
|
}
|
2014-12-04 19:04:42 -05:00
|
|
|
|
|
|
|
/* Populate the message with the security layer, client supported receive
|
|
|
|
message size and authorization identity including the 0x00 based
|
2016-04-05 19:21:07 -04:00
|
|
|
terminator. Note: Despite RFC4752 Section 3.1 stating "The authorization
|
2014-12-04 19:04:42 -05:00
|
|
|
identity is not terminated with the zero-valued (%x00) octet." it seems
|
|
|
|
necessary to include it. */
|
|
|
|
outdata = htonl(max_size) | sec_layer;
|
|
|
|
memcpy(message, &outdata, sizeof(outdata));
|
2014-12-28 14:19:14 -05:00
|
|
|
memcpy(message + sizeof(outdata), username_token.value,
|
|
|
|
username_token.length);
|
|
|
|
message[messagelen - 1] = '\0';
|
|
|
|
|
|
|
|
/* Free the username token as it is not required anymore */
|
2016-04-02 01:25:30 -04:00
|
|
|
gss_release_buffer(&unused_status, &username_token);
|
2014-12-04 19:04:42 -05:00
|
|
|
|
|
|
|
/* Setup the "authentication data" security buffer */
|
|
|
|
input_token.value = message;
|
|
|
|
input_token.length = messagelen;
|
|
|
|
|
|
|
|
/* Encrypt the data */
|
2016-04-02 01:25:30 -04:00
|
|
|
major_status = gss_wrap(&minor_status, krb5->context, 0,
|
|
|
|
GSS_C_QOP_DEFAULT, &input_token, NULL,
|
|
|
|
&output_token);
|
|
|
|
if(GSS_ERROR(major_status)) {
|
2016-03-29 10:13:46 -04:00
|
|
|
Curl_gss_log_error(data, "gss_wrap() failed: ",
|
2016-04-02 01:25:30 -04:00
|
|
|
major_status, minor_status);
|
2014-12-04 19:04:42 -05:00
|
|
|
|
2015-03-16 10:01:15 -04:00
|
|
|
free(message);
|
2014-12-04 19:04:42 -05:00
|
|
|
|
|
|
|
return CURLE_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Base64 encode the response */
|
|
|
|
result = Curl_base64_encode(data, (char *) output_token.value,
|
|
|
|
output_token.length, outptr, outlen);
|
|
|
|
|
|
|
|
/* Free the output buffer */
|
2016-04-02 01:25:30 -04:00
|
|
|
gss_release_buffer(&unused_status, &output_token);
|
2014-12-04 19:04:42 -05:00
|
|
|
|
|
|
|
/* Free the message buffer */
|
2015-03-16 10:01:15 -04:00
|
|
|
free(message);
|
2014-12-04 19:04:42 -05:00
|
|
|
|
|
|
|
return result;
|
2014-12-02 16:52:38 -05:00
|
|
|
}
|
|
|
|
|
2014-12-04 19:36:27 -05:00
|
|
|
/*
|
2016-03-13 07:28:42 -04:00
|
|
|
* Curl_auth_gssapi_cleanup()
|
2014-12-05 02:48:16 -05:00
|
|
|
*
|
2016-03-12 06:59:52 -05:00
|
|
|
* This is used to clean up the GSSAPI (Kerberos V5) specific data.
|
2014-12-05 02:48:16 -05:00
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
*
|
2016-03-12 06:59:52 -05:00
|
|
|
* krb5 [in/out] - The Kerberos 5 data struct being cleaned up.
|
2014-12-05 02:48:16 -05:00
|
|
|
*
|
|
|
|
*/
|
2016-03-13 07:28:42 -04:00
|
|
|
void Curl_auth_gssapi_cleanup(struct kerberos5data *krb5)
|
2014-12-02 16:52:38 -05:00
|
|
|
{
|
2014-12-03 13:57:48 -05:00
|
|
|
OM_uint32 minor_status;
|
|
|
|
|
|
|
|
/* Free our security context */
|
|
|
|
if(krb5->context != GSS_C_NO_CONTEXT) {
|
|
|
|
gss_delete_sec_context(&minor_status, &krb5->context, GSS_C_NO_BUFFER);
|
|
|
|
krb5->context = GSS_C_NO_CONTEXT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free the SPN */
|
|
|
|
if(krb5->spn != GSS_C_NO_NAME) {
|
|
|
|
gss_release_name(&minor_status, &krb5->spn);
|
|
|
|
krb5->spn = GSS_C_NO_NAME;
|
|
|
|
}
|
2014-12-02 16:52:38 -05:00
|
|
|
}
|
|
|
|
|
2014-12-03 02:13:30 -05:00
|
|
|
#endif /* HAVE_GSSAPI && USE_KERBEROS5 */
|