gssapi_link.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2000-2002, 2004-2009, 2011-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
* $Id: gssapi_link.c,v 1.17 2011/03/28 05:32:16 marka Exp $
*/
#include <config.h>
#ifdef GSSAPI
#include "dst_internal.h"
#include "dst_parse.h"
#define INITIAL_BUFFER_SIZE 1024
#define BUFFER_EXTRA 1024
#define REGION_TO_GBUFFER(r, gb) \
do { \
} while (0)
#define GBUFFER_TO_REGION(gb, r) \
do { \
} while (0)
struct dst_gssapi_signverifyctx {
};
/*%
* Allocate a temporary "context" for use in gathering data for signing
* or verifying.
*/
static isc_result_t
return (ISC_R_NOMEMORY);
if (result != ISC_R_SUCCESS) {
return (result);
}
return (ISC_R_SUCCESS);
}
/*%
*/
static void
}
}
/*%
* Add data to our running buffer of data we will be signing or verifying.
* This code will see if the new data will fit in our existing buffer, and
* copy it in if it will. If not, it will attempt to allocate a larger
* buffer and copy old+new into it, and free the old buffer.
*/
static isc_result_t
isc_region_t r;
unsigned int length;
if (result == ISC_R_SUCCESS)
return (ISC_R_SUCCESS);
if (result != ISC_R_SUCCESS)
return (result);
(void)isc_buffer_copyregion(newbuffer, &r);
return (ISC_R_SUCCESS);
}
/*%
* Sign.
*/
static isc_result_t
char buf[1024];
/*
* Convert the data we wish to sign into a structure gssapi can
* understand.
*/
/*
* Generate the signature.
*/
&gsig);
/*
* If it did not complete, we log the result and return a generic
* failure code.
*/
if (gret != GSS_S_COMPLETE) {
return (ISC_R_FAILURE);
}
/*
* If it will not fit in our allocated buffer, return that we need
* more space.
*/
return (ISC_R_NOSPACE);
}
/*
* Copy the output into our buffer space, and release the gssapi
* allocated space.
*/
return (ISC_R_SUCCESS);
}
/*%
* Verify.
*/
static isc_result_t
isc_region_t message, r;
unsigned char *buf;
char err[1024];
/*
* Convert the data we wish to sign into a structure gssapi can
* understand.
*/
/*
* XXXMLG
* It seem that gss_verify_mic() modifies the signature buffer,
* at least on Heimdal's implementation. Copy it here to an allocated
* buffer.
*/
return (ISC_R_FAILURE);
REGION_TO_GBUFFER(r, gsig);
/*
* Verify the data.
*/
/*
* Convert return codes into something useful to us.
*/
if (gret != GSS_S_COMPLETE) {
if (gret == GSS_S_DEFECTIVE_TOKEN ||
gret == GSS_S_BAD_SIG ||
gret == GSS_S_DUPLICATE_TOKEN ||
gret == GSS_S_OLD_TOKEN ||
gret == GSS_S_UNSEQ_TOKEN ||
gret == GSS_S_GAP_TOKEN ||
gret == GSS_S_CONTEXT_EXPIRED ||
gret == GSS_S_NO_CONTEXT ||
gret == GSS_S_FAILURE)
return(DST_R_VERIFYFAILURE);
else
return (ISC_R_FAILURE);
}
return (ISC_R_SUCCESS);
}
static isc_boolean_t
/* No idea */
}
static isc_result_t
/* No idea */
return (ISC_R_FAILURE);
}
static isc_boolean_t
return (ISC_TRUE);
}
static void
}
static isc_result_t
unsigned int len;
isc_buffer_t *b = NULL;
isc_region_t r;
if ((len % 4) != 0U)
return (ISC_R_BADBASE64);
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS) {
isc_buffer_free(&b);
return (result);
}
isc_buffer_remainingregion(b, &r);
if (major != GSS_S_COMPLETE) {
isc_buffer_free(&b);
return (ISC_R_FAILURE);
}
isc_buffer_free(&b);
return (ISC_R_SUCCESS);
}
static isc_result_t
char *buf;
isc_buffer_t b;
isc_region_t r;
&gssbuffer);
if (major != GSS_S_COMPLETE) {
return (ISC_R_FAILURE);
}
return (ISC_R_FAILURE);
return (ISC_R_NOMEMORY);
}
return (ISC_R_SUCCESS);
}
static dst_func_t gssapi_functions = {
NULL, /*%< createctx2 */
NULL, /*%< verify2 */
NULL, /*%< computesecret */
NULL, /*%< paramcompare */
NULL, /*%< todns */
NULL, /*%< fromdns */
NULL, /*%< tofile */
NULL, /*%< parse */
NULL, /*%< cleanup */
NULL, /*%< fromlabel */
};
*funcp = &gssapi_functions;
return (ISC_R_SUCCESS);
}
#else
int gssapi_link_unneeded = 1;
#endif
/*! \file */