aboutsummaryrefslogtreecommitdiff
path: root/snckrb5.c
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-01-08 15:39:24 +0100
committerGuido Guenther <agx@sigxcpu.org>2009-01-08 15:39:24 +0100
commit7bb8b22d8da0f6a398e2102a20d885d885339496 (patch)
tree94e1c50195604b3bd532cc703e90f9eb96e80d67 /snckrb5.c
import initial version
from https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/dd6fc290-0201-0010-c190-86ce775d5673
Diffstat (limited to 'snckrb5.c')
-rw-r--r--snckrb5.c1060
1 files changed, 1060 insertions, 0 deletions
diff --git a/snckrb5.c b/snckrb5.c
new file mode 100644
index 0000000..f706278
--- /dev/null
+++ b/snckrb5.c
@@ -0,0 +1,1060 @@
+static char * this_File = "snckrb5.c";
+static char * cvs_id =
+ "$Id: snckrb5.c,v 1.1.1.1 1999/08/24 14:36:21 d019080 Exp $";
+/*
+ * (C) Copyright 1999 SAP AG Walldorf
+ *
+ * SAP AG DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL SAP AG BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+
+
+/************************************************************************/
+/* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */
+/* */
+/* Configurable Parameters that describe the characteristics */
+/* of the security mechanism to which this adapter interfaces */
+/* To register a MECH_PREFIX or MECH_ID with SAP, */
+/* send a request via Email to <Martin.Rex@sap-ag.de> including */
+/* the following information: */
+/* - mechanism OID of gssapi mechanism */
+/* - gssapi mechanism name (for open protocol specs) */
+/* OR product name of proprietary gssapi mechanism */
+/* - default nametype OID */
+/* - proposed printable prefix (up to seven characters) */
+/* - Email address of technical contact */
+/* */
+/* In case you're implementing a published gssapi mechanism spec, */
+/* a SAPGSS_MECH_ID and SAPGSS_MECH_PREFIX may already be assigned. */
+/* You can check the "sncgss.h" Header file first. */
+/* */
+/* */
+/* ADAPTER_MECH_NAME Name of gssapi mechanism protocol */
+/* (for open protocol specifications) */
+/* OR name of a software product for */
+/* a proprietary gssapi mechanism */
+/* */
+/* ADAPTER_MECH_PREFIX (must REGISTER with SAP) */
+/* ASCII-string up to 7 chars to */
+/* identify the mechanism */
+/* */
+/* ADAPTER_MECH_ID (must REGISTER with SAP) */
+/* numeric constant taken from the */
+/* SAPGSS_MECH_ID enumerator in "sncgss.h" */
+/* */
+/* ADAPTER_MECHANISM_OID ASN.1 OID (written as gss_OID_desc) */
+/* of the gssapi mechanism to which this */
+/* SNC-Adapter will be linked */
+/* */
+/* ADAPTER_NAMETYPE_OID ASN.1 OID (written as gss_OID_desc) */
+/* of the default/canonical/native nametype*/
+/* of above gssapi mechanism */
+/* */
+/* ADAPTER_MAJOR_REVISION cosmetic, no functional purpose */
+/* ADAPTER_MINOR_REVISION cosmetic, no functional purpose */
+/* */
+/* ADAPTER_CONF_AVAIL (0 or 1) REQUIRED */
+/* implementation guarantees availability */
+/* of message confidentiality protection */
+/* for all established security contexts */
+/* */
+/* ADAPTER_INTEG_AVAIL (0 or 1) REQUIRED */
+/* implementation guarantees availability */
+/* of message integrity protection for all */
+/* established security contexts */
+/* */
+/* ADAPTER_MUTUAL_AUTH (0 or 1) REQUIRED */
+/* implemenation guarantees availability */
+/* of mutual authentication on security */
+/* contexts. Absence of mutual auth is */
+/* a serious security problem in */
+/* distributed applications */
+/* */
+/* ADAPTER_REPLAY_PROT (0 or 1) REQUIRED */
+/* implementation guarantees availability */
+/* of replay detection of protected */
+/* messages on all security contexts. */
+/* SAP R/3 process all messages on a */
+/* particular security context strictly */
+/* sequential, so it's acceptable */
+/* if replay detection is only available */
+/* in combination with sequence protection */
+/* */
+/* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */
+/************************************************************************/
+
+
+#define ADAPTER_MECH_NAME SAPGSS_KERBEROS5_NAME
+ /* Name of the gssapi mechanism or product */
+ /* that this SNC-Adapter interfaces to */
+ /* (less than 80 characters, please !!) */
+
+
+#define ADAPTER_MECH_PREFIX SAPGSS_KERBEROS5_PREFIX
+ /* Mech prefix for mechanism */
+ /* (register this prefix with SAP) */
+ /* Alphanumeric, must be <= 7 characters long */
+ /* This prefix may be used within SNC-Names */
+ /* i.e. "p/sapntlm:NTDomain\User" */
+
+
+#define ADAPTER_MECH_ID SAPGSS_ID_KERBEROS5
+ /* Mechanism identifier */
+ /* numeric (16-bit unsigned integer) */
+ /* used internally by SNC for tagging */
+ /* and to distinguish different gssapi mechs */
+
+
+ /* ASN.1 OID of the gssapi mechanism to which this */
+ /* SNC-Adapter is linked */
+#define ADAPTER_MECHANISM_OID SAPGSS_KERBEROS5_MECH_OID
+
+ /* ASN.1 OID of the default/canonical nametype that */
+ /* this gssapi mechanism will accept with gss_import_name() */
+ /* and emit with gss_display_name() for canonical names */
+#define ADAPTER_NAMETYPE_OID SAPGSS_KERBEROS5_CNAME_OID
+
+
+/*******************/
+/* 16-bit Integers */
+/*******************/
+#define ADAPTER_MAJOR_REVISION 1 /* indicates API changes */
+
+#define ADAPTER_MINOR_REVISION 0 /* indicates fixes or */
+ /* cosmetic changes */
+
+/*******************/
+/* BOOLEAN values */
+/*******************/
+#define ADAPTER_CONF_AVAIL 1 /* Confidentiality available */
+#define ADAPTER_INTEG_AVAIL 1 /* Integrity available */
+
+#define ADAPTER_MUTUAL_AUTH 1 /* supports mutual authentication */
+#define ADAPTER_REPLAY_PROT 1 /* supports message replay detection */
+
+
+/************************************************************************/
+/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
+/************************************************************************/
+
+
+
+
+/* Some ANSI-C standard headers */
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/**********************************************************************/
+/* */
+/* Microsoft Windows DLL support */
+/* */
+/**********************************************************************/
+
+#ifdef _WIN32
+# include <windows.h>
+ BOOL APIENTRY
+ DllMain(HANDLE hInst, DWORD ul_reason_being_called, LPVOID lpReserved)
+ {
+ return 1;
+
+ UNREFERENCED_PARAMETER(hInst);
+ UNREFERENCED_PARAMETER(ul_reason_being_called);
+ UNREFERENCED_PARAMETER(lpReserved);
+ }
+#else
+
+# if defined(_WINDOWS)
+# include <windows.h>
+# ifndef UNREFERENCED_PARAMETER
+# define UNREFERENCED_PARAMETER(x) ((x)=(x))
+# endif
+
+ BOOL CALLBACK
+ LibMain (HINSTANCE hInst, WORD wDataSeg, WORD cbHeap, LPSTR CmdLine)
+ {
+ UNREFERENCED_PARAMETER(hInst);
+ UNREFERENCED_PARAMETER(wDataSeg);
+ UNREFERENCED_PARAMETER(cbHeap);
+ UNREFERENCED_PARAMETER(CmdLine);
+
+ return 1;
+ }
+
+ int CALLBACK __export
+ WEP(int nParam)
+ {
+ UNREFERENCED_PARAMETER(nParam);
+
+ return 1;
+ }
+# endif
+
+#endif
+
+/**********************************************************************/
+/* */
+/* Import interface */
+/* - include files of other projects */
+/* Declare gss_* function prototypes as __declspec(dllimport) */
+/* */
+/**********************************************************************/
+
+#include "platform.h"
+
+#undef DLL_DATA_DECO
+#undef DLL_FUNC_DECO
+#define DLL_DATA_DECO IMPORT_DATA
+#define DLL_FUNC_DECO IMPORT_FUNCTION
+#include "gssapi_2.h"
+
+/**********************************************************************/
+/* */
+/* Export interface */
+/* - header files of this project */
+/* Declare our sapgss_* function prototypes as __declspec(dllexport) */
+/* */
+/**********************************************************************/
+
+#undef DLL_DATA_DECO
+#undef DLL_FUNC_DECO
+#define DLL_DATA_DECO EXPORT_DATA
+#define DLL_FUNC_DECO EXPORT_FUNCTION
+#include "sncgss.h"
+
+
+
+
+/************************************************************************/
+/* (27-jun-95) Martin Rex */
+/* With the following two macros one can convert macros into */
+/* string literals to include them in constant strings. */
+/* see ANSI-C, X3.159-1989 section 3.8.3.2 and example on pg. 93 */
+/************************************************************************/
+#define LITERAL_MACRO(x) # x
+#define XLITERAL_MACRO(x) LITERAL_MACRO(x)
+
+
+
+
+/****************************************************/
+/* we don't need to export/share OID data at the */
+/* shared library interface for SAP R/3, */
+/* and is not part of the draft-ietf-cat-wingss-... */
+/****************************************************/
+
+static gss_OID_desc oids[] = {
+ ADAPTER_NAMETYPE_OID, /* nametype OID for canonical printable name */
+ ADAPTER_MECHANISM_OID /* mechanism OID of the gssapi mechanism */
+};
+
+static gss_OID sapsnc_nt_canon_printable_name = &(oids[0]);
+static gss_OID sapsnc_mech_oid = &(oids[1]);
+
+#define SAPSNC_CANON_NAME_OID sapsnc_nt_canon_printable_name
+
+/**********************************************************************
+ * sapsnc_init_adapter():
+ *
+ * Description:
+ * This function must be called before other functions of the
+ * gss-api are used. It sets up all translation pointers
+ * exported by the gss-api.
+ *
+ * Parameters:
+ * p_info IN REF the structure referenced by this
+ * pointer (see sapgss.h) describes
+ * some characteristics of the security
+ * mechanism to which this adapter interfaces
+ *
+ * p_length IN Length of the structure supplied by the
+ * SNC-Layer.
+ * Initialization policy for future enhancements:
+ * * SNC-Layer zeroes out structure before calling.
+ * * future extensions must be appended to the
+ * existing structure only
+ * * Unknown structure elements will not be changed.
+ * * The Adapter must initialize only fields known
+ * to the calling SNC-layer
+ * (i.e. no elements past p_length)
+ *
+ * Returns:
+ * 0 Initialization o.k.
+ * -1 FAILURE -- something is definitely broken if this happens
+ **********************************************************************/
+OM_uint32 EXPORT_FUNCTION
+sapsnc_init_adapter( struct sapgss_info_s *p_info, size_t p_length,
+ int adapter_idx )
+{
+ UNREFERENCED_PARAMETER(adapter_idx);
+
+ if ( p_info==NULL || p_length<=SNCADAPT_BASIC_INFO_LEN ) {
+
+ /* At least we want to fill in the basic set of information */
+ return(1);
+
+ } else {
+
+ memset( p_info, 0, p_length );
+
+ p_info->major_rev = (int) ADAPTER_MAJOR_REVISION;
+ p_info->minor_rev = (int) ADAPTER_MINOR_REVISION;
+
+ p_info->adapter_name =
+ "External SNC-Adapter"
+ " (Rev " XLITERAL_MACRO(ADAPTER_MAJOR_REVISION)
+ "." XLITERAL_MACRO(ADAPTER_MINOR_REVISION) ") to "
+ ADAPTER_MECH_NAME;
+
+ p_info->mech_id = ADAPTER_MECH_ID;
+
+ p_info->nt_canonical_name = SAPSNC_CANON_NAME_OID;
+ p_info->nt_private_name1 = sapsnc_nt_canon_printable_name;
+ p_info->nt_private_name2 = (gss_OID_desc *)0;
+ p_info->nt_private_name3 = (gss_OID_desc *)0;
+ p_info->nt_private_name4 = (gss_OID_desc *)0;
+
+ p_info->integ_avail = ADAPTER_INTEG_AVAIL;
+ p_info->conf_avail = ADAPTER_CONF_AVAIL;
+ p_info->unused1 = 0; /* historic/expirmental, MUST be 0 */
+ p_info->export_sec_context = 1; /* required functionality, MUST be 1 */
+ p_info->mutual_auth = ADAPTER_MUTUAL_AUTH;
+ p_info->replay_prot = ADAPTER_REPLAY_PROT;
+
+ p_info->unused2 = 0; /* historic/experimental, MUST be 0 */
+
+ p_info->mech_prefix_string = ADAPTER_MECH_PREFIX;
+
+ if ( p_length>=SNCADAPT_INFO_LEN(mech_oid) ) {
+ p_info->mech_oid = sapsnc_mech_oid;
+ }
+
+ }
+
+ /* Initialize future elements only if the supplied structure is large */
+ /* enough, */
+ /* i.e. the calling SNC-layer is as recent or newer as the adapter */
+
+ return(0);
+
+} /* sapsnc_init_adapter() */
+
+
+
+/*
+ * sapsnc_export_cname_blob()
+ *
+ * BETTER LEAVE THIS ALONE !!
+ *
+ * This call was a temporary intermediate before the two calls
+ * gss_canonicalize_name() and gss_export_name() were added
+ * to the GSS-API v2 spec.
+ *
+ * However it is still required for R/3 up to 3.1H components
+ * and for interoperability with those components or incomplete
+ * gssapi v2 implementations of (MIT) Kerberos 5 and SECUDE
+ */
+
+OM_uint32 EXPORT_FUNCTION
+sapsnc_export_cname_blob(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_name_t in_name, /* input_name */
+ gss_buffer_t out_identity, /* output_name_buffer */
+ int adapter_idx
+ )
+{
+ UNREFERENCED_PARAMETER(adapter_idx);
+ UNREFERENCED_PARAMETER(in_name);
+
+ if ( out_identity!=NULL ) {
+ out_identity->length = 0;
+ out_identity->value = NULL;
+ }
+
+ if ( min_stat!=NULL )
+ (*min_stat) = 0;
+
+ return(GSS_S_FAILURE);
+
+} /* sapsnc_export_cname_blob() */
+
+
+
+/*
+ * sapsnc_export_cname_blob()
+ *
+ * BETTER LEAVE THIS ALONE !!
+ *
+ * This call was a temporary intermediate before the two calls
+ * gss_canonicalize_name() and gss_export_name() were added
+ * to the GSS-API v2 spec.
+ *
+ * However it is still required for R/3 up to 3.1H components
+ * and for interoperability with those components or incomplete
+ * gssapi v2 implementations of (MIT) Kerberos 5 and SECUDE
+ */
+OM_uint32 EXPORT_FUNCTION
+sapsnc_import_cname_blob(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_buffer_t in_identity, /* input_name_buffer */
+ gss_name_t * out_name, /* output_name */
+ int adapter_idx
+ )
+{
+ UNREFERENCED_PARAMETER(adapter_idx);
+
+ return( gss_import_name( min_stat, in_identity,
+ (gss_OID)SAPSNC_CANON_NAME_OID, out_name ) );
+
+} /* sapsnc_import_cname_blob() */
+
+
+/*********************************************************************
+ *
+ * All functions following this comment are CALL ADAPTERS
+ * to the GSS-API functions.
+ *
+ *********************************************************************/
+
+/**********************************************************************/
+/**********************************************************************/
+/******************* *******************/
+/******************* GSS-API v1 ( RFC 1508/1509 ) *******************/
+/******************* *******************/
+/**********************************************************************/
+/**********************************************************************/
+
+
+/* sapgss_acquire_cred() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_acquire_cred(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_name_t my_gss_name, /* desired_name */
+ OM_uint32 in_lifetime, /* time_req */
+ gss_OID_set in_mechs, /* desired_mechs */
+ gss_cred_usage_t in_cred_usage, /* cred_usage */
+ gss_cred_id_t * out_cred, /* output_cred_handle */
+ gss_OID_set * out_mechs, /* actual_mechs */
+ OM_uint32 * out_lifetime /* time_rec */
+ )
+{
+ return( gss_acquire_cred( min_stat, my_gss_name, in_lifetime,
+ in_mechs, in_cred_usage,
+ out_cred, out_mechs, out_lifetime ) );
+}
+
+
+
+/* sapgss_release_cred() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_release_cred(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_cred_id_t * in_cred /* cred_handle */
+ )
+{
+ return( gss_release_cred( min_stat, in_cred ) );
+}
+
+
+
+/* sapgss_init_sec_context() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_init_sec_context(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_cred_id_t in_cred, /* claimant_cred_handle */
+ gss_ctx_id_t * in_context, /* context_handle */
+ gss_name_t in_name, /* target_name */
+ gss_OID in_mech, /* mech_type */
+ OM_uint32 in_service_opts, /* req_flags */
+ OM_uint32 in_lifetime, /* time_req */
+ gss_channel_bindings_t
+ in_channel_bind, /* input_chan_bindings */
+ gss_buffer_t in_token, /* input_token */
+ gss_OID * out_mech, /* actual_mech_type */
+ gss_buffer_t out_token, /* output_token */
+ OM_uint32 * out_service_opts, /* ret_flags */
+ OM_uint32 * out_lifetime /* time_rec */
+ )
+{
+ return( gss_init_sec_context( min_stat, in_cred, in_context, in_name,
+ in_mech, in_service_opts, in_lifetime,
+ in_channel_bind, in_token, out_mech,
+ out_token, out_service_opts, out_lifetime ) );
+}
+
+
+
+/* sapgss_accept_sec_context() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_accept_sec_context(
+ OM_uint32 *min_stat, /* minor_status */
+ gss_ctx_id_t *in_context, /* context_handle */
+ gss_cred_id_t in_cred, /* verifier_cred_handle */
+ gss_buffer_t in_token, /* input_token_buffer */
+ gss_channel_bindings_t
+ in_channel_bind, /* input_chan_bindings */
+ gss_name_t *peer_name, /* src_name */
+ gss_OID *out_mech, /* mech_type */
+ gss_buffer_t out_token, /* output_token */
+ OM_uint32 *out_service_opts, /* ret_flags */
+ OM_uint32 *out_lifetime, /* time_rec */
+ gss_cred_id_t *out_cred /* delegated_cred_handle */
+ )
+{
+ return( gss_accept_sec_context( min_stat, in_context, in_cred, in_token,
+ in_channel_bind, peer_name, out_mech,
+ out_token, out_service_opts, out_lifetime,
+ out_cred ) );
+}
+
+
+
+/* sapgss_process_context_token() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_process_context_token(
+ OM_uint32 *min_stat, /* minor_status */
+ gss_ctx_id_t in_context, /* context_handle */
+ gss_buffer_t in_token /* token_buffer */
+ )
+{
+ return( gss_process_context_token( min_stat, in_context, in_token ) );
+}
+
+
+
+/* sapgss_delete_sec_context() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_delete_sec_context(
+ OM_uint32 *min_stat, /* minor_status */
+ gss_ctx_id_t *in_context, /* context_handle */
+ gss_buffer_t out_token /* output_token */
+ )
+{
+ return( gss_delete_sec_context( min_stat, in_context, out_token ) );
+}
+
+
+
+/* sapgss_context_time() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_context_time(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_ctx_id_t in_context, /* context_handle */
+ OM_uint32 * out_lifetime /* time_rec */
+ )
+{
+ return( gss_context_time( min_stat, in_context, out_lifetime ) );
+}
+
+
+
+/* sapgss_get_mic() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_get_mic(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_ctx_id_t in_context, /* context_handle */
+ gss_qop_t in_qop, /* qop_req */
+ gss_buffer_t in_msg, /* message_buffer */
+ gss_buffer_t out_token /* message_token */
+ )
+{
+ return( gss_get_mic( min_stat, in_context, in_qop, in_msg, out_token ) );
+}
+
+
+
+/* sapgss_verify_mic() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_verify_mic(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_ctx_id_t in_context, /* context_handle */
+ gss_buffer_t in_msg, /* message_buffer */
+ gss_buffer_t in_token, /* token_buffer */
+ gss_qop_t * out_qop /* qop_state */
+ )
+{
+ return( gss_verify_mic( min_stat, in_context, in_msg, in_token, out_qop ) );
+}
+
+
+
+/* sapgss_wrap() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_wrap(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_ctx_id_t in_context, /* context_handle */
+ int in_want_conf, /* conf_req_flag */
+ gss_qop_t in_qop, /* qop_req */
+ gss_buffer_t in_msg, /* input_message_buffer */
+ int * out_is_conf, /* conf_state */
+ gss_buffer_t out_token /* output_message_buffer */
+ )
+{
+ return( gss_wrap( min_stat, in_context, in_want_conf,
+ in_qop, in_msg, out_is_conf, out_token ) );
+}
+
+
+
+/* sapgss_unwrap() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_unwrap(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_ctx_id_t in_context, /* context_handle */
+ gss_buffer_t in_token, /* input_message_buffer */
+ gss_buffer_t out_msg, /* output_message_buffer */
+ int * out_is_conf, /* conf_state */
+ gss_qop_t * out_qop /* qop_state */
+ )
+{
+ return( gss_unwrap( min_stat, in_context, in_token,
+ out_msg, out_is_conf, out_qop ) );
+}
+
+
+
+/* sapgss_display_status() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_display_status(
+ OM_uint32 *min_stat, /* minor_status */
+ OM_uint32 in_status, /* status_value */
+ int in_status_type, /* status_type */
+ gss_OID in_mech, /* mech_type */
+ OM_uint32 *out_more_text, /* message_context */
+ gss_buffer_t out_text /* status_string */
+ )
+{
+ return( gss_display_status( min_stat, in_status, in_status_type,
+ in_mech, out_more_text, out_text ) );
+}
+
+
+
+/*
+ * sapgss_indicate_mechs()
+ *
+ * IMPORTANT: This call MUST return the correct mech_OID
+ * for this implementation in the first position of the
+ * out_mechs OID array!
+ */
+OM_uint32 EXPORT_FUNCTION
+sapgss_indicate_mechs(
+ OM_uint32 *min_stat, /* minor_status */
+ gss_OID_set *out_mechs /* mech_set */
+ )
+{
+ OM_uint32 maj_stat;
+ OM_uint32 min_stat2;
+
+ maj_stat = gss_indicate_mechs( min_stat, out_mechs );
+
+ if ( maj_stat==GSS_S_COMPLETE ) {
+ if ( out_mechs==NULL
+ || (*out_mechs)==GSS_C_NO_OID_SET
+ || (*out_mechs)->count==0
+ || (*out_mechs)->elements==GSS_C_NO_OID
+ || ((*out_mechs)->elements[0]).length!=sapsnc_mech_oid->length
+ || memcmp( ((*out_mechs)->elements[0]).elements,
+ sapsnc_mech_oid->elements, sapsnc_mech_oid->length )!=0 ) {
+
+ (void)sapgss_release_oid_set( &min_stat2, out_mechs );
+
+ (*out_mechs) = GSS_C_NO_OID_SET;
+ (*min_stat) = 0;
+
+ return(GSS_S_BAD_MECH);
+
+ }
+ }
+
+ return(maj_stat);
+
+}
+
+
+
+/* sapgss_compare_name() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_compare_name(
+ OM_uint32 *min_stat, /* minor_status */
+ gss_name_t in_name1, /* name1 */
+ gss_name_t in_name2, /* name2 */
+ int *out_are_equal /* name_equal */
+ )
+{
+ return( gss_compare_name( min_stat, in_name1, in_name2, out_are_equal ) );
+}
+
+
+
+/* sapgss_display_name() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_display_name(
+ OM_uint32 *min_stat, /* minor_status */
+ gss_name_t in_name, /* input_name */
+ gss_buffer_t out_identity, /* output_name_buffer */
+ gss_OID *out_oid /* output_name_type */
+ )
+{
+ return( gss_display_name( min_stat, in_name, out_identity, out_oid ) );
+}
+
+
+
+/* sapgss_import_name() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_import_name(
+ OM_uint32 *min_stat, /* minor_status */
+ gss_buffer_t in_identity, /* input_name_buffer */
+ gss_OID in_oid, /* input_name_type */
+ gss_name_t *out_name /* output_name */
+ )
+{
+ return( gss_import_name( min_stat, in_identity, in_oid, out_name ) );
+}
+
+
+
+/* sapgss_release_name() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_release_name(
+ OM_uint32 *min_stat, /* minor_status */
+ gss_name_t *in_name /* input_name */
+ )
+{
+ return( gss_release_name( min_stat, in_name ) );
+}
+
+
+
+/* sapgss_release_buffer() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_release_buffer(
+ OM_uint32 *min_stat, /* minor_status */
+ gss_buffer_t in_buffer /* buffer */
+ )
+{
+ return( gss_release_buffer( min_stat, in_buffer ) );
+}
+
+
+
+/* sapgss_release_oid_set() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_release_oid_set(
+ OM_uint32 *min_stat, /* minor_status */
+ gss_OID_set *in_oids /* set */
+ )
+{
+ return( gss_release_oid_set( min_stat, in_oids ) );
+}
+
+
+
+/* sapgss_inquire_cred() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_inquire_cred(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_cred_id_t in_cred, /* cred_handle */
+ gss_name_t * out_name, /* name */
+ OM_uint32 * out_lifetime, /* lifetime */
+ gss_cred_usage_t * out_cred_usage, /* cred_usage */
+ gss_OID_set * out_mechs /* mechanisms */
+ )
+{
+ return( gss_inquire_cred( min_stat, in_cred, out_name,
+ out_lifetime, out_cred_usage, out_mechs ) );
+}
+
+
+/**********************************************************************/
+/**********************************************************************/
+/******************* ********************/
+/******************* New fuctions for GSS-API v2 ********************/
+/******************* ********************/
+/**********************************************************************/
+/**********************************************************************/
+
+/*
+ * sapgss_add_cred()
+ *
+ * Status: not used by SNC in R/3 release 3.x and 4.0
+ *
+ */
+OM_uint32 EXPORT_FUNCTION
+sapgss_add_cred(
+ OM_uint32 FAR * min_stat, /* minor_status */
+ gss_cred_id_t input_cred_handle, /* input_cred_handle */
+ gss_name_t desired_name, /* desired_name */
+ gss_OID desired_mech, /* desired_mech */
+ gss_cred_usage_t cred_usage, /* cred_usage */
+ OM_uint32 initiator_time_req, /* initiator_time_req */
+ OM_uint32 acceptor_time_req, /* acceptor_time_req */
+ gss_cred_id_t FAR * output_cred_handle, /* output_cred_handle */
+ gss_OID_set FAR * actual_mechs, /* actual_mechs */
+ OM_uint32 FAR * initiator_time_rec, /* initiator_time_rec */
+ OM_uint32 FAR * acceptor_time_rec /* acceptor_time_rec */
+ )
+{
+ return( gss_add_cred( min_stat, input_cred_handle, desired_name,
+ desired_mech, cred_usage, initiator_time_req,
+ acceptor_time_req,
+ output_cred_handle, actual_mechs,
+ initiator_time_rec, acceptor_time_rec ) );
+}
+
+
+
+/*
+ * sapgss_inquire_cred_by_mech()
+ *
+ * Status: not used by SNC in R/3 release 3.x and 4.0
+ * this may change in future releases
+ */
+OM_uint32 EXPORT_FUNCTION
+sapgss_inquire_cred_by_mech(
+ OM_uint32 FAR * min_stat, /* minor_status */
+ gss_cred_id_t cred_handle, /* cred_handle */
+ gss_OID mech_type, /* mech_type */
+ gss_name_t FAR * name, /* name */
+ OM_uint32 FAR * initiator_lifetime, /* initiator_lifetime */
+ OM_uint32 FAR * acceptor_lifetime, /* acceptor_lifetime */
+ gss_cred_usage_t FAR * cred_usage /* cred_usage */
+ )
+{
+ return( gss_inquire_cred_by_mech( min_stat, cred_handle, mech_type,
+ name, initiator_lifetime,
+ acceptor_lifetime, cred_usage ) );
+}
+
+
+
+/* sapgss_inquire_context() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_inquire_context(
+ OM_uint32 *min_stat, /* minor_status */
+ gss_ctx_id_t in_context, /* context_handle */
+ gss_name_t *out_myname, /* initiator_name */
+ gss_name_t *out_peername, /* acceptor_name */
+ OM_uint32 *out_lifetime, /* lifetime_rec */
+ gss_OID *out_mech, /* mech_type */
+ OM_uint32 *out_service_opts, /* ctx_flags */
+ int *out_initiator, /* locally_initiated */
+ int *out_open /* open */
+ )
+{
+ return( gss_inquire_context( min_stat, in_context, out_myname,
+ out_peername, out_lifetime, out_mech,
+ out_service_opts, out_initiator, out_open) );
+}
+
+
+
+/*
+ * sapgss_wrap_size_limit()
+ *
+ * Status: not used by SNC in R/3 release 3.x and 4.0
+ * this may change in future releases
+ */
+OM_uint32 EXPORT_FUNCTION
+sapgss_wrap_size_limit(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_ctx_id_t in_context, /* context handle */
+ int in_want_conf, /* conf_req_flag */
+ gss_qop_t qop_req, /* qop_req */
+ OM_uint32 out_size, /* requested output size */
+ OM_uint32 * max_in_size /* maximum input size */
+ )
+{
+ return( gss_wrap_size_limit( min_stat, in_context, in_want_conf,
+ qop_req, out_size, max_in_size) );
+}
+
+
+
+/* sapgss_export_sec_context() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_export_sec_context(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_ctx_id_t * in_ctx, /* context_handle */
+ gss_buffer_t out_buffer /* interprocess_token */
+ )
+{
+ return( gss_export_sec_context( min_stat, in_ctx, out_buffer ) );
+}
+
+
+
+/* sapgss_import_sec_context() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_import_sec_context(
+ OM_uint32 * min_stat, /* minor_status */
+ gss_buffer_t in_buffer, /* interprocess_token */
+ gss_ctx_id_t * out_ctx /* context_handle */
+ )
+{
+ return( gss_import_sec_context( min_stat, in_buffer, out_ctx ) );
+}
+
+
+
+/*
+ * sapgss_create_empty_oid_set()
+ *
+ * Status: don't care
+ */
+OM_uint32 EXPORT_FUNCTION
+sapgss_create_empty_oid_set(
+ OM_uint32 FAR * min_stat, /* minor_status */
+ gss_OID_set FAR * oid_set /* oid_set */
+ )
+{
+ return( gss_create_empty_oid_set( min_stat, oid_set ) );
+}
+
+
+
+/*
+ * sapgss_add_oid_set_member()
+ *
+ * Status: don't care
+ */
+OM_uint32 EXPORT_FUNCTION
+sapgss_add_oid_set_member(
+ OM_uint32 FAR * min_stat, /* minor_status */
+ gss_OID member_oid, /* member_oid */
+ gss_OID_set FAR * oid_set /* oid_set */
+ )
+{
+ return( gss_add_oid_set_member( min_stat, member_oid, oid_set ) );
+}
+
+
+
+/*
+ * sapgss_test_oid_set_member()
+ *
+ * Status: don't care
+ */
+OM_uint32 EXPORT_FUNCTION
+sapgss_test_oid_set_member(
+ OM_uint32 FAR * min_stat, /* minor_status */
+ gss_OID member, /* member */
+ gss_OID_set set, /* set */
+ int FAR * present /* present */
+ )
+{
+ return( gss_test_oid_set_member( min_stat, member, set, present ) );
+}
+
+
+
+/*
+ * sapgss_inquire_names_for_mech()
+ *
+ * Status: not used by SNC in R/3 release 3.x and 4.0
+ * this may change in future releases
+ */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_inquire_names_for_mech(
+ OM_uint32 FAR * min_stat, /* minor_status */
+ gss_OID mech_oid, /* mechanism_oid */
+ gss_OID_set FAR * name_types /* name_types */
+ )
+{
+ return( gss_inquire_names_for_mech( min_stat, mech_oid, name_types ) );
+}
+
+
+
+/*
+ * sapgss_inquire_mechs_for_name()
+ *
+ * Status: don't care
+ */
+OM_uint32 EXPORT_FUNCTION
+sapgss_inquire_mechs_for_name(
+ OM_uint32 FAR * min_stat, /* minor_status */
+ gss_name_t input_name, /* input_name */
+ gss_OID_set FAR * mech_set /* mechanism_oids */
+ )
+{
+ return( gss_inquire_mechs_for_name( min_stat, input_name, mech_set ) );
+}
+
+
+/* sapgss_canonicalize_name() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_canonicalize_name(
+ OM_uint32 FAR * min_stat, /* minor_status */
+ gss_name_t input_name, /* input_name */
+ gss_OID mech_type, /* mech_type */
+ gss_name_t FAR * output_name /* output_name */
+ )
+{
+ return( gss_canonicalize_name( min_stat, input_name,
+ mech_type, output_name ) );
+}
+
+
+/* sapgss_export_name() */
+
+OM_uint32 EXPORT_FUNCTION
+sapgss_export_name(
+ OM_uint32 FAR * min_stat, /* minor_status */
+ gss_name_t input_name, /* input_name */
+ gss_buffer_t output_name_blob /* output_name_blob */
+ )
+{
+ return( gss_export_name( min_stat, input_name, output_name_blob ) );
+}
+
+
+/*
+ * sapgss_duplicate_name()
+ *
+ * Status: Don't care
+ */
+OM_uint32 EXPORT_FUNCTION
+sapgss_duplicate_name(
+ OM_uint32 FAR * min_stat, /* minor_status */
+ gss_name_t src_name, /* src_name */
+ gss_name_t FAR * dest_name /* dest_name */
+ )
+{
+ return( gss_duplicate_name( min_stat, src_name, dest_name ) );
+}
+
+
+/* end of snckrb5.c */
+