diff options
| author | Tom Yu <tlyu@mit.edu> | 2008-10-15 21:58:43 +0000 |
|---|---|---|
| committer | Tom Yu <tlyu@mit.edu> | 2008-10-15 21:58:43 +0000 |
| commit | a898a72410a38b03ff7c7691ceeea973e3eec6ca (patch) | |
| tree | fdd601d15bb96904df7b684048381bb3b9d0e1d3 /src/lib/gssapi/generic | |
| parent | 07292e360eb8cad0151ed76edee11a9ce8ca925e (diff) | |
| download | krb5-a898a72410a38b03ff7c7691ceeea973e3eec6ca.tar.gz krb5-a898a72410a38b03ff7c7691ceeea973e3eec6ca.tar.xz krb5-a898a72410a38b03ff7c7691ceeea973e3eec6ca.zip | |
Untabify. Normalize whitespace. Reindent. Fix some of the most
egregious formatting quirks. Add emacs mode settings to flag
untabified source files.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20876 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/gssapi/generic')
| -rw-r--r-- | src/lib/gssapi/generic/disp_com_err_status.c | 43 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/disp_major_status.c | 405 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/gssapi.hin | 701 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/gssapiP_generic.h | 249 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/gssapi_generic.c | 73 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/gssapi_generic.h | 11 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/maptest.c | 13 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/rel_buffer.c | 22 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/rel_oid_set.c | 22 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/util_buffer.c | 17 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/util_canonhost.c | 42 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/util_errmap.c | 129 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/util_localhost.c | 22 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/util_ordering.c | 281 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/util_set.c | 83 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/util_token.c | 311 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/util_validate.c | 364 | ||||
| -rw-r--r-- | src/lib/gssapi/generic/utl_nohash_validate.c | 78 |
18 files changed, 1443 insertions, 1423 deletions
diff --git a/src/lib/gssapi/generic/disp_com_err_status.c b/src/lib/gssapi/generic/disp_com_err_status.c index c04b67265e..baf7e70379 100644 --- a/src/lib/gssapi/generic/disp_com_err_status.c +++ b/src/lib/gssapi/generic/disp_com_err_status.c @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -37,30 +38,30 @@ static const char * const no_error = "No error"; /**/ /* if status_type == GSS_C_GSS_CODE, return up to three error messages, - for routine errors, call error, and status, in that order. - message_context == 0 : print the routine error - message_context == 1 : print the calling error - message_context > 2 : print supplementary info bit (message_context-2) + for routine errors, call error, and status, in that order. + message_context == 0 : print the routine error + message_context == 1 : print the calling error + message_context > 2 : print supplementary info bit (message_context-2) if status_type == GSS_C_MECH_CODE, return the output from error_message() - */ +*/ OM_uint32 g_display_com_err_status(minor_status, status_value, status_string) - OM_uint32 *minor_status; - OM_uint32 status_value; - gss_buffer_t status_string; + OM_uint32 *minor_status; + OM_uint32 status_value; + gss_buffer_t status_string; { - status_string->length = 0; - status_string->value = NULL; + status_string->length = 0; + status_string->value = NULL; - (void) gssint_initialize_library(); + (void) gssint_initialize_library(); - if (! g_make_string_buffer(((status_value == 0)?no_error: - error_message(status_value)), - status_string)) { - *minor_status = ENOMEM; - return(GSS_S_FAILURE); - } - *minor_status = 0; - return(GSS_S_COMPLETE); + if (! g_make_string_buffer(((status_value == 0)?no_error: + error_message(status_value)), + status_string)) { + *minor_status = ENOMEM; + return(GSS_S_FAILURE); + } + *minor_status = 0; + return(GSS_S_COMPLETE); } diff --git a/src/lib/gssapi/generic/disp_major_status.c b/src/lib/gssapi/generic/disp_major_status.c index 0648192a19..f9ff281477 100644 --- a/src/lib/gssapi/generic/disp_major_status.c +++ b/src/lib/gssapi/generic/disp_major_status.c @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -38,57 +39,57 @@ /**/ static const char * const calling_error_string[] = { - NULL, - "A required input parameter could not be read", - "A required input parameter could not be written", - "A parameter was malformed", + NULL, + "A required input parameter could not be read", + "A required input parameter could not be written", + "A parameter was malformed", }; - + static const char * const calling_error = "calling error"; #define GSS_CALLING_ERROR_STR(x) \ GSS_ERROR_STR((x), calling_error_string, GSS_CALLING_ERROR, \ - GSS_S_CALL_INACCESSIBLE_READ, GSS_S_CALL_BAD_STRUCTURE, \ - GSS_CALLING_ERROR_FIELD) + GSS_S_CALL_INACCESSIBLE_READ, GSS_S_CALL_BAD_STRUCTURE, \ + GSS_CALLING_ERROR_FIELD) /**/ static const char * const routine_error_string[] = { - NULL, - "An unsupported mechanism was requested", - "An invalid name was supplied", - "A supplied name was of an unsupported type", - "Incorrect channel bindings were supplied", - "An invalid status code was supplied", - "A token had an invalid signature", - "No credentials were supplied", - "No context has been established", - "A token was invalid", - "A credential was invalid", - "The referenced credentials have expired", - "The context has expired", - "Miscellaneous failure", - "The quality-of-protection requested could not be provided", - "The operation is forbidden by the local security policy", - "The operation or option is not available", -}; + NULL, + "An unsupported mechanism was requested", + "An invalid name was supplied", + "A supplied name was of an unsupported type", + "Incorrect channel bindings were supplied", + "An invalid status code was supplied", + "A token had an invalid signature", + "No credentials were supplied", + "No context has been established", + "A token was invalid", + "A credential was invalid", + "The referenced credentials have expired", + "The context has expired", + "Miscellaneous failure", + "The quality-of-protection requested could not be provided", + "The operation is forbidden by the local security policy", + "The operation or option is not available", +}; static const char * const routine_error = "routine error"; #define GSS_ROUTINE_ERROR_STR(x) \ GSS_ERROR_STR((x), routine_error_string, GSS_ROUTINE_ERROR, \ - GSS_S_BAD_MECH, GSS_S_FAILURE, \ - GSS_ROUTINE_ERROR_FIELD) + GSS_S_BAD_MECH, GSS_S_FAILURE, \ + GSS_ROUTINE_ERROR_FIELD) /**/ /* this becomes overly gross after about 4 strings */ static const char * const sinfo_string[] = { - "The routine must be called again to complete its function", - "The token was a duplicate of an earlier token", - "The token's validity period has expired", - "A later token has already been processed", + "The routine must be called again to complete its function", + "The token was a duplicate of an earlier token", + "The token's validity period has expired", + "A later token has already been processed", }; static const char * const sinfo_code = "supplementary info code"; @@ -107,203 +108,203 @@ static const char * const unknown_error = "Unknown %s (field = %d)"; /**/ -static int +static int display_unknown(kind, value, buffer) - const char *kind; - OM_uint32 value; - gss_buffer_t buffer; + const char *kind; + OM_uint32 value; + gss_buffer_t buffer; { - char *str; + char *str; - if (asprintf(&str, unknown_error, kind, value) < 0) - return(0); + if (asprintf(&str, unknown_error, kind, value) < 0) + return(0); - buffer->length = strlen(str); - buffer->value = str; + buffer->length = strlen(str); + buffer->value = str; - return(1); + return(1); } /* code should be set to the calling error field */ static OM_uint32 display_calling(minor_status, code, status_string) - OM_uint32 *minor_status; - OM_uint32 code; - gss_buffer_t status_string; + OM_uint32 *minor_status; + OM_uint32 code; + gss_buffer_t status_string; { - const char *str; - - if ((str = GSS_CALLING_ERROR_STR(code))) { - if (! g_make_string_buffer(str, status_string)) { - *minor_status = ENOMEM; - return(GSS_S_FAILURE); - } - } else { - if (! display_unknown(calling_error, GSS_CALLING_ERROR_FIELD(code), - status_string)) { - *minor_status = ENOMEM; - return(GSS_S_FAILURE); - } - } - *minor_status = 0; - return(GSS_S_COMPLETE); + const char *str; + + if ((str = GSS_CALLING_ERROR_STR(code))) { + if (! g_make_string_buffer(str, status_string)) { + *minor_status = ENOMEM; + return(GSS_S_FAILURE); + } + } else { + if (! display_unknown(calling_error, GSS_CALLING_ERROR_FIELD(code), + status_string)) { + *minor_status = ENOMEM; + return(GSS_S_FAILURE); + } + } + *minor_status = 0; + return(GSS_S_COMPLETE); } /* code should be set to the routine error field */ static OM_uint32 display_routine(minor_status, code, status_string) - OM_uint32 *minor_status; - OM_uint32 code; - gss_buffer_t status_string; + OM_uint32 *minor_status; + OM_uint32 code; + gss_buffer_t status_string; { - const char *str; - - if ((str = GSS_ROUTINE_ERROR_STR(code))) { - if (! g_make_string_buffer(str, status_string)) { - *minor_status = ENOMEM; - return(GSS_S_FAILURE); - } - } else { - if (! display_unknown(routine_error, GSS_ROUTINE_ERROR_FIELD(code), - status_string)) { - *minor_status = ENOMEM; - return(GSS_S_FAILURE); - } - } - *minor_status = 0; - return(GSS_S_COMPLETE); + const char *str; + + if ((str = GSS_ROUTINE_ERROR_STR(code))) { + if (! g_make_string_buffer(str, status_string)) { + *minor_status = ENOMEM; + return(GSS_S_FAILURE); + } + } else { + if (! display_unknown(routine_error, GSS_ROUTINE_ERROR_FIELD(code), + status_string)) { + *minor_status = ENOMEM; + return(GSS_S_FAILURE); + } + } + *minor_status = 0; + return(GSS_S_COMPLETE); } /* code should be set to the bit offset (log_2) of a supplementary info bit */ static OM_uint32 display_bit(minor_status, code, status_string) - OM_uint32 *minor_status; - OM_uint32 code; - gss_buffer_t status_string; + OM_uint32 *minor_status; + OM_uint32 code; + gss_buffer_t status_string; { - const char *str; - - if ((str = GSS_SINFO_STR(code))) { - if (! g_make_string_buffer(str, status_string)) { - *minor_status = ENOMEM; - return(GSS_S_FAILURE); - } - } else { - if (! display_unknown(sinfo_code, 1<<code, status_string)) { - *minor_status = ENOMEM; - return(GSS_S_FAILURE); - } - } - *minor_status = 0; - return(GSS_S_COMPLETE); + const char *str; + + if ((str = GSS_SINFO_STR(code))) { + if (! g_make_string_buffer(str, status_string)) { + *minor_status = ENOMEM; + return(GSS_S_FAILURE); + } + } else { + if (! display_unknown(sinfo_code, 1<<code, status_string)) { + *minor_status = ENOMEM; + return(GSS_S_FAILURE); + } + } + *minor_status = 0; + return(GSS_S_COMPLETE); } /**/ /* return error messages, for routine errors, call error, and status, in that order. - message_context == 0 : print the routine error - message_context == 1 : print the calling error - message_context > 2 : print supplementary info bit (message_context-2) - */ - -OM_uint32 g_display_major_status(minor_status, status_value, - message_context, status_string) - OM_uint32 *minor_status; - OM_uint32 status_value; - OM_uint32 *message_context; - gss_buffer_t status_string; + message_context == 0 : print the routine error + message_context == 1 : print the calling error + message_context > 2 : print supplementary info bit (message_context-2) +*/ + +OM_uint32 g_display_major_status(minor_status, status_value, + message_context, status_string) + OM_uint32 *minor_status; + OM_uint32 status_value; + OM_uint32 *message_context; + gss_buffer_t status_string; { - OM_uint32 ret, tmp; - int bit; - - /*** deal with no error at all specially */ - - if (status_value == 0) { - if (! g_make_string_buffer(no_error, status_string)) { - *minor_status = ENOMEM; - return(GSS_S_FAILURE); - } - *message_context = 0; - *minor_status = 0; - return(GSS_S_COMPLETE); - } - - /*** do routine error */ - - if (*message_context == 0) { - if ((tmp = GSS_ROUTINE_ERROR(status_value))) { - status_value -= tmp; - if ((ret = display_routine(minor_status, tmp, status_string))) - return(ret); - *minor_status = 0; - if (status_value) { - (*message_context)++; - return(GSS_S_COMPLETE); - } else { - *message_context = 0; - return(GSS_S_COMPLETE); - } - } else { - (*message_context)++; - } - } else { - status_value -= GSS_ROUTINE_ERROR(status_value); - } - - /*** do calling error */ - - if (*message_context == 1) { - if ((tmp = GSS_CALLING_ERROR(status_value))) { - status_value -= tmp; - if ((ret = display_calling(minor_status, tmp, status_string))) - return(ret); - *minor_status = 0; - if (status_value) { - (*message_context)++; - return(GSS_S_COMPLETE); - } else { - *message_context = 0; - return(GSS_S_COMPLETE); - } - } else { - (*message_context)++; - } - } else { - status_value -= GSS_CALLING_ERROR(status_value); - } - - /*** do sinfo bits (*message_context == 2 + number of bits done) */ - - tmp = GSS_SUPPLEMENTARY_INFO_FIELD(status_value); - /* mask off the bits which have been done */ - if (*message_context > 2) { - tmp &= ~LSBMASK(*message_context-3); - status_value &= ~LSBMASK(*message_context-3); - } - - if (!tmp) { - /* bogon input - there should be something left */ - *minor_status = (OM_uint32) G_BAD_MSG_CTX; - return(GSS_S_FAILURE); - } - - /* compute the bit offset */ - /*SUPPRESS 570*/ - for (bit=0; (((OM_uint32) 1)<<bit) != LSBGET(tmp); bit++) ; - - /* print it */ - if ((ret = display_bit(minor_status, bit, status_string))) - return(ret); - - /* compute the new status_value/message_context */ - status_value -= ((OM_uint32) 1)<<bit; - - if (status_value) { - *message_context = bit+3; - return(GSS_S_COMPLETE); - } else { - *message_context = 0; - return(GSS_S_COMPLETE); - } + OM_uint32 ret, tmp; + int bit; + + /*** deal with no error at all specially */ + + if (status_value == 0) { + if (! g_make_string_buffer(no_error, status_string)) { + *minor_status = ENOMEM; + return(GSS_S_FAILURE); + } + *message_context = 0; + *minor_status = 0; + return(GSS_S_COMPLETE); + } + + /*** do routine error */ + + if (*message_context == 0) { + if ((tmp = GSS_ROUTINE_ERROR(status_value))) { + status_value -= tmp; + if ((ret = display_routine(minor_status, tmp, status_string))) + return(ret); + *minor_status = 0; + if (status_value) { + (*message_context)++; + return(GSS_S_COMPLETE); + } else { + *message_context = 0; + return(GSS_S_COMPLETE); + } + } else { + (*message_context)++; + } + } else { + status_value -= GSS_ROUTINE_ERROR(status_value); + } + + /*** do calling error */ + + if (*message_context == 1) { + if ((tmp = GSS_CALLING_ERROR(status_value))) { + status_value -= tmp; + if ((ret = display_calling(minor_status, tmp, status_string))) + return(ret); + *minor_status = 0; + if (status_value) { + (*message_context)++; + return(GSS_S_COMPLETE); + } else { + *message_context = 0; + return(GSS_S_COMPLETE); + } + } else { + (*message_context)++; + } + } else { + status_value -= GSS_CALLING_ERROR(status_value); + } + + /*** do sinfo bits (*message_context == 2 + number of bits done) */ + + tmp = GSS_SUPPLEMENTARY_INFO_FIELD(status_value); + /* mask off the bits which have been done */ + if (*message_context > 2) { + tmp &= ~LSBMASK(*message_context-3); + status_value &= ~LSBMASK(*message_context-3); + } + + if (!tmp) { + /* bogon input - there should be something left */ + *minor_status = (OM_uint32) G_BAD_MSG_CTX; + return(GSS_S_FAILURE); + } + + /* compute the bit offset */ + /*SUPPRESS 570*/ + for (bit=0; (((OM_uint32) 1)<<bit) != LSBGET(tmp); bit++) ; + + /* print it */ + if ((ret = display_bit(minor_status, bit, status_string))) + return(ret); + + /* compute the new status_value/message_context */ + status_value -= ((OM_uint32) 1)<<bit; + + if (status_value) { + *message_context = bit+3; + return(GSS_S_COMPLETE); + } else { + *message_context = 0; + return(GSS_S_COMPLETE); + } } diff --git a/src/lib/gssapi/generic/gssapi.hin b/src/lib/gssapi/generic/gssapi.hin index ef55febcfc..4dc33133b6 100644 --- a/src/lib/gssapi/generic/gssapi.hin +++ b/src/lib/gssapi/generic/gssapi.hin @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -28,10 +29,10 @@ */ #if defined(__MACH__) && defined(__APPLE__) -# include <TargetConditionals.h> -# if TARGET_RT_MAC_CFM -# error "Use KfM 4.0 SDK headers for CFM compilation." -# endif +# include <TargetConditionals.h> +# if TARGET_RT_MAC_CFM +# error "Use KfM 4.0 SDK headers for CFM compilation." +# endif #endif #ifdef __cplusplus @@ -85,73 +86,73 @@ typedef struct gss_ctx_id_struct * gss_ctx_id_t; typedef uint32_t gss_uint32; typedef int32_t gss_int32; -#ifdef OM_STRING +#ifdef OM_STRING /* * We have included the xom.h header file. Use the definition for * OM_object identifier. */ -typedef OM_object_identifier gss_OID_desc, *gss_OID; -#else /* OM_STRING */ +typedef OM_object_identifier gss_OID_desc, *gss_OID; +#else /* OM_STRING */ /* * We can't use X/Open definitions, so roll our own. */ -typedef gss_uint32 OM_uint32; +typedef gss_uint32 OM_uint32; typedef struct gss_OID_desc_struct { - OM_uint32 length; - void *elements; + OM_uint32 length; + void *elements; } gss_OID_desc, *gss_OID; -#endif /* OM_STRING */ +#endif /* OM_STRING */ typedef struct gss_OID_set_desc_struct { - size_t count; - gss_OID elements; + size_t count; + gss_OID elements; } gss_OID_set_desc, *gss_OID_set; typedef struct gss_buffer_desc_struct { - size_t length; - void *value; + size_t length; + void *value; } gss_buffer_desc, *gss_buffer_t; typedef struct gss_channel_bindings_struct { - OM_uint32 initiator_addrtype; - gss_buffer_desc initiator_address; - OM_uint32 acceptor_addrtype; - gss_buffer_desc acceptor_address; - gss_buffer_desc application_data; + OM_uint32 initiator_addrtype; + gss_buffer_desc initiator_address; + OM_uint32 acceptor_addrtype; + gss_buffer_desc acceptor_address; + gss_buffer_desc application_data; } *gss_channel_bindings_t; /* * For now, define a QOP-type as an OM_uint32 (pending resolution of ongoing * discussions). */ -typedef OM_uint32 gss_qop_t; -typedef int gss_cred_usage_t; +typedef OM_uint32 gss_qop_t; +typedef int gss_cred_usage_t; /* * Flag bits for context-level services. */ -#define GSS_C_DELEG_FLAG 1 -#define GSS_C_MUTUAL_FLAG 2 -#define GSS_C_REPLAY_FLAG 4 -#define GSS_C_SEQUENCE_FLAG 8 -#define GSS_C_CONF_FLAG 16 -#define GSS_C_INTEG_FLAG 32 -#define GSS_C_ANON_FLAG 64 -#define GSS_C_PROT_READY_FLAG 128 -#define GSS_C_TRANS_FLAG 256 +#define GSS_C_DELEG_FLAG 1 +#define GSS_C_MUTUAL_FLAG 2 +#define GSS_C_REPLAY_FLAG 4 +#define GSS_C_SEQUENCE_FLAG 8 +#define GSS_C_CONF_FLAG 16 +#define GSS_C_INTEG_FLAG 32 +#define GSS_C_ANON_FLAG 64 +#define GSS_C_PROT_READY_FLAG 128 +#define GSS_C_TRANS_FLAG 256 /* * Credential usage options */ -#define GSS_C_BOTH 0 -#define GSS_C_INITIATE 1 -#define GSS_C_ACCEPT 2 +#define GSS_C_BOTH 0 +#define GSS_C_INITIATE 1 +#define GSS_C_ACCEPT 2 /* * Status code types for gss_display_status */ -#define GSS_C_GSS_CODE 1 +#define GSS_C_GSS_CODE 1 #define GSS_C_MECH_CODE 2 /* @@ -197,8 +198,8 @@ typedef int gss_cred_usage_t; * Some alternate names for a couple of the above values. These are defined * for V1 compatibility. */ -#define GSS_C_NULL_OID GSS_C_NO_OID -#define GSS_C_NULL_OID_SET GSS_C_NO_OID_SET +#define GSS_C_NULL_OID GSS_C_NO_OID +#define GSS_C_NULL_OID_SET GSS_C_NO_OID_SET /* * Define the default Quality of Protection for per-message services. Note @@ -244,7 +245,7 @@ typedef int gss_cred_usage_t; ((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET)) #define GSS_ERROR(x) \ ((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \ - (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))) + (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))) /* * Now the actual status code definitions @@ -407,301 +408,311 @@ GSS_DLLIMP extern gss_OID GSS_C_NT_EXPORT_NAME; /* Function Prototypes */ -OM_uint32 KRB5_CALLCONV gss_acquire_cred -(OM_uint32 *, /* minor_status */ - gss_name_t, /* desired_name */ - OM_uint32, /* time_req */ - gss_OID_set, /* desired_mechs */ - gss_cred_usage_t, /* cred_usage */ - gss_cred_id_t *, /* output_cred_handle */ - gss_OID_set *, /* actual_mechs */ - OM_uint32 * /* time_rec */ - ); - -OM_uint32 KRB5_CALLCONV gss_release_cred -(OM_uint32 *, /* minor_status */ - gss_cred_id_t * /* cred_handle */ - ); - -OM_uint32 KRB5_CALLCONV gss_init_sec_context -(OM_uint32 *, /* minor_status */ - gss_cred_id_t, /* claimant_cred_handle */ - gss_ctx_id_t *, /* context_handle */ - gss_name_t, /* target_name */ - gss_OID, /* mech_type (used to be const) */ - OM_uint32, /* req_flags */ - OM_uint32, /* time_req */ - gss_channel_bindings_t, /* input_chan_bindings */ - gss_buffer_t, /* input_token */ - gss_OID *, /* actual_mech_type */ - gss_buffer_t, /* output_token */ - OM_uint32 *, /* ret_flags */ - OM_uint32 * /* time_rec */ - ); - -OM_uint32 KRB5_CALLCONV gss_accept_sec_context -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t *, /* context_handle */ - gss_cred_id_t, /* acceptor_cred_handle */ - gss_buffer_t, /* input_token_buffer */ - gss_channel_bindings_t, /* input_chan_bindings */ - gss_name_t *, /* src_name */ - gss_OID *, /* mech_type */ - gss_buffer_t, /* output_token */ - OM_uint32 *, /* ret_flags */ - OM_uint32 *, /* time_rec */ - gss_cred_id_t * /* delegated_cred_handle */ - ); - -OM_uint32 KRB5_CALLCONV gss_process_context_token -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - gss_buffer_t /* token_buffer */ - ); - -OM_uint32 KRB5_CALLCONV gss_delete_sec_context -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t *, /* context_handle */ - gss_buffer_t /* output_token */ - ); - -OM_uint32 KRB5_CALLCONV gss_context_time -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - OM_uint32 * /* time_rec */ - ); +OM_uint32 KRB5_CALLCONV +gss_acquire_cred( + OM_uint32 *, /* minor_status */ + gss_name_t, /* desired_name */ + OM_uint32, /* time_req */ + gss_OID_set, /* desired_mechs */ + gss_cred_usage_t, /* cred_usage */ + gss_cred_id_t *, /* output_cred_handle */ + gss_OID_set *, /* actual_mechs */ + OM_uint32 *); /* time_rec */ + +OM_uint32 KRB5_CALLCONV +gss_release_cred( + OM_uint32 *, /* minor_status */ + gss_cred_id_t *); /* cred_handle */ + +OM_uint32 KRB5_CALLCONV +gss_init_sec_context( + OM_uint32 *, /* minor_status */ + gss_cred_id_t, /* claimant_cred_handle */ + gss_ctx_id_t *, /* context_handle */ + gss_name_t, /* target_name */ + gss_OID, /* mech_type (used to be const) */ + OM_uint32, /* req_flags */ + OM_uint32, /* time_req */ + gss_channel_bindings_t, /* input_chan_bindings */ + gss_buffer_t, /* input_token */ + gss_OID *, /* actual_mech_type */ + gss_buffer_t, /* output_token */ + OM_uint32 *, /* ret_flags */ + OM_uint32 *); /* time_rec */ + +OM_uint32 KRB5_CALLCONV +gss_accept_sec_context( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t *, /* context_handle */ + gss_cred_id_t, /* acceptor_cred_handle */ + gss_buffer_t, /* input_token_buffer */ + gss_channel_bindings_t, /* input_chan_bindings */ + gss_name_t *, /* src_name */ + gss_OID *, /* mech_type */ + gss_buffer_t, /* output_token */ + OM_uint32 *, /* ret_flags */ + OM_uint32 *, /* time_rec */ + gss_cred_id_t *); /* delegated_cred_handle */ + +OM_uint32 KRB5_CALLCONV +gss_process_context_token( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_buffer_t); /* token_buffer */ + + +OM_uint32 KRB5_CALLCONV +gss_delete_sec_context( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t *, /* context_handle */ + gss_buffer_t); /* output_token */ + + +OM_uint32 KRB5_CALLCONV +gss_context_time( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + OM_uint32 *); /* time_rec */ + /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_get_mic -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - gss_qop_t, /* qop_req */ - gss_buffer_t, /* message_buffer */ - gss_buffer_t /* message_token */ - ); +OM_uint32 KRB5_CALLCONV +gss_get_mic( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_qop_t, /* qop_req */ + gss_buffer_t, /* message_buffer */ + gss_buffer_t); /* message_token */ + /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_verify_mic -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - gss_buffer_t, /* message_buffer */ - gss_buffer_t, /* message_token */ - gss_qop_t * /* qop_state */ - ); +OM_uint32 KRB5_CALLCONV +gss_verify_mic(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_buffer_t, /* message_buffer */ + gss_buffer_t, /* message_token */ + gss_qop_t * /* qop_state */ +); /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_wrap -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - int, /* conf_req_flag */ - gss_qop_t, /* qop_req */ - gss_buffer_t, /* input_message_buffer */ - int *, /* conf_state */ - gss_buffer_t /* output_message_buffer */ - ); +OM_uint32 KRB5_CALLCONV +gss_wrap( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + int, /* conf_req_flag */ + gss_qop_t, /* qop_req */ + gss_buffer_t, /* input_message_buffer */ + int *, /* conf_state */ + gss_buffer_t); /* output_message_buffer */ + /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_unwrap -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - gss_buffer_t, /* input_message_buffer */ - gss_buffer_t, /* output_message_buffer */ - int *, /* conf_state */ - gss_qop_t * /* qop_state */ - ); - -OM_uint32 KRB5_CALLCONV gss_display_status -(OM_uint32 *, /* minor_status */ - OM_uint32, /* status_value */ - int, /* status_type */ - gss_OID, /* mech_type (used to be const) */ - OM_uint32 *, /* message_context */ - gss_buffer_t /* status_string */ - ); - -OM_uint32 KRB5_CALLCONV gss_indicate_mechs -(OM_uint32 *, /* minor_status */ - gss_OID_set * /* mech_set */ - ); - -OM_uint32 KRB5_CALLCONV gss_compare_name -(OM_uint32 *, /* minor_status */ - gss_name_t, /* name1 */ - gss_name_t, /* name2 */ - int * /* name_equal */ - ); - -OM_uint32 KRB5_CALLCONV gss_display_name -(OM_uint32 *, /* minor_status */ - gss_name_t, /* input_name */ - gss_buffer_t, /* output_name_buffer */ - gss_OID * /* output_name_type */ - ); - -OM_uint32 KRB5_CALLCONV gss_import_name -(OM_uint32 *, /* minor_status */ - gss_buffer_t, /* input_name_buffer */ - gss_OID, /* input_name_type(used to be const) */ - gss_name_t * /* output_name */ - ); - -OM_uint32 KRB5_CALLCONV gss_release_name -(OM_uint32 *, /* minor_status */ - gss_name_t * /* input_name */ - ); - -OM_uint32 KRB5_CALLCONV gss_release_buffer -(OM_uint32 *, /* minor_status */ - gss_buffer_t /* buffer */ - ); - -OM_uint32 KRB5_CALLCONV gss_release_oid_set -(OM_uint32 *, /* minor_status */ - gss_OID_set * /* set */ - ); - -OM_uint32 KRB5_CALLCONV gss_inquire_cred -(OM_uint32 *, /* minor_status */ - gss_cred_id_t, /* cred_handle */ - gss_name_t *, /* name */ - OM_uint32 *, /* lifetime */ - gss_cred_usage_t *, /* cred_usage */ - gss_OID_set * /* mechanisms */ - ); +OM_uint32 KRB5_CALLCONV +gss_unwrap( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_buffer_t, /* input_message_buffer */ + gss_buffer_t, /* output_message_buffer */ + int *, /* conf_state */ + gss_qop_t *); /* qop_state */ + + +OM_uint32 KRB5_CALLCONV +gss_display_status( + OM_uint32 *, /* minor_status */ + OM_uint32, /* status_value */ + int, /* status_type */ + gss_OID, /* mech_type (used to be const) */ + OM_uint32 *, /* message_context */ + gss_buffer_t); /* status_string */ + + +OM_uint32 KRB5_CALLCONV +gss_indicate_mechs( + OM_uint32 *, /* minor_status */ + gss_OID_set *); /* mech_set */ + + +OM_uint32 KRB5_CALLCONV +gss_compare_name( + OM_uint32 *, /* minor_status */ + gss_name_t, /* name1 */ + gss_name_t, /* name2 */ + int *); /* name_equal */ + + +OM_uint32 KRB5_CALLCONV +gss_display_name( + OM_uint32 *, /* minor_status */ + gss_name_t, /* input_name */ + gss_buffer_t, /* output_name_buffer */ + gss_OID *); /* output_name_type */ + + +OM_uint32 KRB5_CALLCONV +gss_import_name( + OM_uint32 *, /* minor_status */ + gss_buffer_t, /* input_name_buffer */ + gss_OID, /* input_name_type(used to be const) */ + gss_name_t *); /* output_name */ + +OM_uint32 KRB5_CALLCONV +gss_release_name( + OM_uint32 *, /* minor_status */ + gss_name_t *); /* input_name */ + +OM_uint32 KRB5_CALLCONV +gss_release_buffer( + OM_uint32 *, /* minor_status */ + gss_buffer_t); /* buffer */ + +OM_uint32 KRB5_CALLCONV +gss_release_oid_set( + OM_uint32 *, /* minor_status */ + gss_OID_set *); /* set */ + +OM_uint32 KRB5_CALLCONV +gss_inquire_cred( + OM_uint32 *, /* minor_status */ + gss_cred_id_t, /* cred_handle */ + gss_name_t *, /* name */ + OM_uint32 *, /* lifetime */ + gss_cred_usage_t *, /* cred_usage */ + gss_OID_set *); /* mechanisms */ /* Last argument new for V2 */ -OM_uint32 KRB5_CALLCONV gss_inquire_context -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - gss_name_t *, /* src_name */ - gss_name_t *, /* targ_name */ - OM_uint32 *, /* lifetime_rec */ - gss_OID *, /* mech_type */ - OM_uint32 *, /* ctx_flags */ - int *, /* locally_initiated */ - int * /* open */ - ); +OM_uint32 KRB5_CALLCONV +gss_inquire_context( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_name_t *, /* src_name */ + gss_name_t *, /* targ_name */ + OM_uint32 *, /* lifetime_rec */ + gss_OID *, /* mech_type */ + OM_uint32 *, /* ctx_flags */ + int *, /* locally_initiated */ + int *); /* open */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_wrap_size_limit -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - int, /* conf_req_flag */ - gss_qop_t, /* qop_req */ - OM_uint32, /* req_output_size */ - OM_uint32 * /* max_input_size */ - ); +OM_uint32 KRB5_CALLCONV +gss_wrap_size_limit( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + int, /* conf_req_flag */ + gss_qop_t, /* qop_req */ + OM_uint32, /* req_output_size */ + OM_uint32 *); /* max_input_size */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_import_name_object -(OM_uint32 *, /* minor_status */ - void *, /* input_name */ - gss_OID, /* input_name_type */ - gss_name_t * /* output_name */ - ); +OM_uint32 KRB5_CALLCONV +gss_import_name_object( + OM_uint32 *, /* minor_status */ + void *, /* input_name */ + gss_OID, /* input_name_type */ + gss_name_t *); /* output_name */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_export_name_object -(OM_uint32 *, /* minor_status */ - gss_name_t, /* input_name */ - gss_OID, /* desired_name_type */ - void ** /* output_name */ - ); +OM_uint32 KRB5_CALLCONV +gss_export_name_object( + OM_uint32 *, /* minor_status */ + gss_name_t, /* input_name */ + gss_OID, /* desired_name_type */ + void **); /* output_name */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_add_cred -(OM_uint32 *, /* minor_status */ - gss_cred_id_t, /* input_cred_handle */ - gss_name_t, /* desired_name */ - gss_OID, /* desired_mech */ - gss_cred_usage_t, /* cred_usage */ - OM_uint32, /* initiator_time_req */ - OM_uint32, /* acceptor_time_req */ - gss_cred_id_t *, /* output_cred_handle */ - gss_OID_set *, /* actual_mechs */ - OM_uint32 *, /* initiator_time_rec */ - OM_uint32 * /* acceptor_time_rec */ - ); +OM_uint32 KRB5_CALLCONV +gss_add_cred( + OM_uint32 *, /* minor_status */ + gss_cred_id_t, /* input_cred_handle */ + gss_name_t, /* desired_name */ + gss_OID, /* desired_mech */ + gss_cred_usage_t, /* cred_usage */ + OM_uint32, /* initiator_time_req */ + OM_uint32, /* acceptor_time_req */ + gss_cred_id_t *, /* output_cred_handle */ + gss_OID_set *, /* actual_mechs */ + OM_uint32 *, /* initiator_time_rec */ + OM_uint32 *); /* acceptor_time_rec */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_inquire_cred_by_mech -(OM_uint32 *, /* minor_status */ - gss_cred_id_t, /* cred_handle */ - gss_OID, /* mech_type */ - gss_name_t *, /* name */ - OM_uint32 *, /* initiator_lifetime */ - OM_uint32 *, /* acceptor_lifetime */ - gss_cred_usage_t * /* cred_usage */ - ); +OM_uint32 KRB5_CALLCONV +gss_inquire_cred_by_mech( + OM_uint32 *, /* minor_status */ + gss_cred_id_t, /* cred_handle */ + gss_OID, /* mech_type */ + gss_name_t *, /* name */ + OM_uint32 *, /* initiator_lifetime */ + OM_uint32 *, /* acceptor_lifetime */ + gss_cred_usage_t *); /* cred_usage */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_export_sec_context -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t *, /* context_handle */ - gss_buffer_t /* interprocess_token */ - ); +OM_uint32 KRB5_CALLCONV +gss_export_sec_context( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t *, /* context_handle */ + gss_buffer_t); /* interprocess_token */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_import_sec_context -(OM_uint32 *, /* minor_status */ - gss_buffer_t, /* interprocess_token */ - gss_ctx_id_t * /* context_handle */ - ); +OM_uint32 KRB5_CALLCONV +gss_import_sec_context( + OM_uint32 *, /* minor_status */ + gss_buffer_t, /* interprocess_token */ + gss_ctx_id_t *); /* context_handle */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_release_oid -(OM_uint32 *, /* minor_status */ - gss_OID * /* oid */ - ); +OM_uint32 KRB5_CALLCONV +gss_release_oid( + OM_uint32 *, /* minor_status */ + gss_OID *); /* oid */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_create_empty_oid_set -(OM_uint32 *, /* minor_status */ - gss_OID_set * /* oid_set */ - ); +OM_uint32 KRB5_CALLCONV +gss_create_empty_oid_set( + OM_uint32 *, /* minor_status */ + gss_OID_set *); /* oid_set */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_add_oid_set_member -(OM_uint32 *, /* minor_status */ - gss_OID, /* member_oid */ - gss_OID_set * /* oid_set */ - ); +OM_uint32 KRB5_CALLCONV +gss_add_oid_set_member( + OM_uint32 *, /* minor_status */ + gss_OID, /* member_oid */ + gss_OID_set *); /* oid_set */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_test_oid_set_member -(OM_uint32 *, /* minor_status */ - gss_OID, /* member */ - gss_OID_set, /* set */ - int * /* present */ - ); +OM_uint32 KRB5_CALLCONV +gss_test_oid_set_member( + OM_uint32 *, /* minor_status */ + gss_OID, /* member */ + gss_OID_set, /* set */ + int *); /* present */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_str_to_oid -(OM_uint32 *, /* minor_status */ - gss_buffer_t, /* oid_str */ - gss_OID * /* oid */ - ); +OM_uint32 KRB5_CALLCONV +gss_str_to_oid( + OM_uint32 *, /* minor_status */ + gss_buffer_t, /* oid_str */ + gss_OID *); /* oid */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_oid_to_str -(OM_uint32 *, /* minor_status */ - gss_OID, /* oid */ - gss_buffer_t /* oid_str */ - ); +OM_uint32 KRB5_CALLCONV +gss_oid_to_str( + OM_uint32 *, /* minor_status */ + gss_OID, /* oid */ + gss_buffer_t); /* oid_str */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_inquire_names_for_mech -(OM_uint32 *, /* minor_status */ - gss_OID, /* mechanism */ - gss_OID_set * /* name_types */ - ); +OM_uint32 KRB5_CALLCONV +gss_inquire_names_for_mech( + OM_uint32 *, /* minor_status */ + gss_OID, /* mechanism */ + gss_OID_set *); /* name_types */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_inquire_mechs_for_name( - OM_uint32 *, /* minor_status */ - const gss_name_t, /* input_name */ - gss_OID_set * /* mech_types */ -); +OM_uint32 KRB5_CALLCONV +gss_inquire_mechs_for_name( + OM_uint32 *, /* minor_status */ + const gss_name_t, /* input_name */ + gss_OID_set *); /* mech_types */ /* * The following routines are obsolete variants of gss_get_mic, gss_wrap, @@ -710,62 +721,62 @@ OM_uint32 KRB5_CALLCONV gss_inquire_mechs_for_name( * entrypoints (as opposed to #defines) should be provided, to allow GSSAPI * V1 applications to link against GSSAPI V2 implementations. */ -OM_uint32 KRB5_CALLCONV gss_sign -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - int, /* qop_req */ - gss_buffer_t, /* message_buffer */ - gss_buffer_t /* message_token */ - ); - -OM_uint32 KRB5_CALLCONV gss_verify -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - gss_buffer_t, /* message_buffer */ - gss_buffer_t, /* token_buffer */ - int * /* qop_state */ - ); - -OM_uint32 KRB5_CALLCONV gss_seal -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - int, /* conf_req_flag */ - int, /* qop_req */ - gss_buffer_t, /* input_message_buffer */ - int *, /* conf_state */ - gss_buffer_t /* output_message_buffer */ - ); - -OM_uint32 KRB5_CALLCONV gss_unseal -(OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - gss_buffer_t, /* input_message_buffer */ - gss_buffer_t, /* output_message_buffer */ - int *, /* conf_state */ - int * /* qop_state */ - ); +OM_uint32 KRB5_CALLCONV +gss_sign( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + int, /* qop_req */ + gss_buffer_t, /* message_buffer */ + gss_buffer_t); /* message_token */ + +OM_uint32 KRB5_CALLCONV +gss_verify( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_buffer_t, /* message_buffer */ + gss_buffer_t, /* token_buffer */ + int *); /* qop_state */ + +OM_uint32 KRB5_CALLCONV +gss_seal( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + int, /* conf_req_flag */ + int, /* qop_req */ + gss_buffer_t, /* input_message_buffer */ + int *, /* conf_state */ + gss_buffer_t); /* output_message_buffer */ + +OM_uint32 KRB5_CALLCONV +gss_unseal( + OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_buffer_t, /* input_message_buffer */ + gss_buffer_t, /* output_message_buffer */ + int *, /* conf_state */ + int *); /* qop_state */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_export_name -(OM_uint32 *, /* minor_status */ - const gss_name_t, /* input_name */ - gss_buffer_t /* exported_name */ - ); +OM_uint32 KRB5_CALLCONV +gss_export_name( + OM_uint32 *, /* minor_status */ + const gss_name_t, /* input_name */ + gss_buffer_t); /* exported_name */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_duplicate_name -(OM_uint32 *, /* minor_status */ - const gss_name_t, /* input_name */ - gss_name_t * /* dest_name */ - ); +OM_uint32 KRB5_CALLCONV +gss_duplicate_name( + OM_uint32 *, /* minor_status */ + const gss_name_t, /* input_name */ + gss_name_t *); /* dest_name */ /* New for V2 */ -OM_uint32 KRB5_CALLCONV gss_canonicalize_name -(OM_uint32 *, /* minor_status */ - const gss_name_t, /* input_name */ - const gss_OID, /* mech_type */ - gss_name_t * /* output_name */ - ); +OM_uint32 KRB5_CALLCONV +gss_canonicalize_name( + OM_uint32 *, /* minor_status */ + const gss_name_t, /* input_name */ + const gss_OID, /* mech_type */ + gss_name_t *); /* output_name */ #if TARGET_OS_MAC # pragma pack(pop) diff --git a/src/lib/gssapi/generic/gssapiP_generic.h b/src/lib/gssapi/generic/gssapiP_generic.h index c4a030d186..747c6fe6c5 100644 --- a/src/lib/gssapi/generic/gssapiP_generic.h +++ b/src/lib/gssapi/generic/gssapiP_generic.h @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -48,48 +49,48 @@ typedef UINT64_TYPE gssint_uint64; /** helper macros **/ -#define g_OID_equal(o1, o2) \ - (((o1)->length == (o2)->length) && \ - (memcmp((o1)->elements, (o2)->elements, (o1)->length) == 0)) +#define g_OID_equal(o1, o2) \ + (((o1)->length == (o2)->length) && \ + (memcmp((o1)->elements, (o2)->elements, (o1)->length) == 0)) /* this code knows that an int on the wire is 32 bits. The type of num should be at least this big, or the extra shifts may do weird things */ -#define TWRITE_INT(ptr, num, bigend) \ - (ptr)[0] = (char) ((bigend)?((num)>>24):((num)&0xff)); \ - (ptr)[1] = (char) ((bigend)?(((num)>>16)&0xff):(((num)>>8)&0xff)); \ - (ptr)[2] = (char) ((bigend)?(((num)>>8)&0xff):(((num)>>16)&0xff)); \ - (ptr)[3] = (char) ((bigend)?((num)&0xff):((num)>>24)); \ +#define TWRITE_INT(ptr, num, bigend) \ + (ptr)[0] = (char) ((bigend)?((num)>>24):((num)&0xff)); \ + (ptr)[1] = (char) ((bigend)?(((num)>>16)&0xff):(((num)>>8)&0xff)); \ + (ptr)[2] = (char) ((bigend)?(((num)>>8)&0xff):(((num)>>16)&0xff)); \ + (ptr)[3] = (char) ((bigend)?((num)&0xff):((num)>>24)); \ (ptr) += 4; -#define TWRITE_INT16(ptr, num, bigend) \ - (ptr)[0] = (char) ((bigend)?((num)>>24):((num)&0xff)); \ - (ptr)[1] = (char) ((bigend)?(((num)>>16)&0xff):(((num)>>8)&0xff)); \ +#define TWRITE_INT16(ptr, num, bigend) \ + (ptr)[0] = (char) ((bigend)?((num)>>24):((num)&0xff)); \ + (ptr)[1] = (char) ((bigend)?(((num)>>16)&0xff):(((num)>>8)&0xff)); \ (ptr) += 2; -#define TREAD_INT(ptr, num, bigend) \ - (num) = (((ptr)[0]<<((bigend)?24: 0)) | \ - ((ptr)[1]<<((bigend)?16: 8)) | \ - ((ptr)[2]<<((bigend)? 8:16)) | \ - ((ptr)[3]<<((bigend)? 0:24))); \ +#define TREAD_INT(ptr, num, bigend) \ + (num) = (((ptr)[0]<<((bigend)?24: 0)) | \ + ((ptr)[1]<<((bigend)?16: 8)) | \ + ((ptr)[2]<<((bigend)? 8:16)) | \ + ((ptr)[3]<<((bigend)? 0:24))); \ (ptr) += 4; -#define TREAD_INT16(ptr, num, bigend) \ - (num) = (((ptr)[0]<<((bigend)?24: 0)) | \ - ((ptr)[1]<<((bigend)?16: 8))); \ +#define TREAD_INT16(ptr, num, bigend) \ + (num) = (((ptr)[0]<<((bigend)?24: 0)) | \ + ((ptr)[1]<<((bigend)?16: 8))); \ (ptr) += 2; -#define TWRITE_STR(ptr, str, len) \ - memcpy((ptr), (char *) (str), (len)); \ +#define TWRITE_STR(ptr, str, len) \ + memcpy((ptr), (char *) (str), (len)); \ (ptr) += (len); -#define TREAD_STR(ptr, str, len) \ - (str) = (ptr); \ +#define TREAD_STR(ptr, str, len) \ + (str) = (ptr); \ (ptr) += (len); -#define TWRITE_BUF(ptr, buf, bigend) \ - TWRITE_INT((ptr), (buf).length, (bigend)); \ +#define TWRITE_BUF(ptr, buf, bigend) \ + TWRITE_INT((ptr), (buf).length, (bigend)); \ TWRITE_STR((ptr), (buf).value, (buf).length); /** malloc wrappers; these may actually do something later */ @@ -104,38 +105,38 @@ typedef UINT64_TYPE gssint_uint64; /** helper functions **/ /* hide names from applications, especially glib applications */ -#define g_set_init gssint_g_set_init -#define g_set_destroy gssint_g_set_destroy -#define g_set_entry_add gssint_g_set_entry_add -#define g_set_entry_delete gssint_g_set_entry_delete -#define g_set_entry_get gssint_g_set_entry_get -#define g_save_name gssint_g_save_name -#define g_save_cred_id gssint_g_save_cred_id -#define g_save_ctx_id gssint_g_save_ctx_id -#define g_save_lucidctx_id gssint_g_save_lucidctx_id -#define g_validate_name gssint_g_validate_name -#define g_validate_cred_id gssint_g_validate_cred_id -#define g_validate_ctx_id gssint_g_validate_ctx_id -#define g_validate_lucidctx_id gssint_g_validate_lucidctx_id -#define g_delete_name gssint_g_delete_name -#define g_delete_cred_id gssint_g_delete_cred_id -#define g_delete_ctx_id gssint_g_delete_ctx_id -#define g_delete_lucidctx_id gssint_g_delete_lucidctx_id -#define g_make_string_buffer gssint_g_make_string_buffer -#define g_token_size gssint_g_token_size -#define g_make_token_header gssint_g_make_token_header -#define g_verify_token_header gssint_g_verify_token_header -#define g_display_major_status gssint_g_display_major_status -#define g_display_com_err_status gssint_g_display_com_err_status -#define g_order_init gssint_g_order_init -#define g_order_check gssint_g_order_check -#define g_order_free gssint_g_order_free -#define g_queue_size gssint_g_queue_size -#define g_queue_externalize gssint_g_queue_externalize -#define g_queue_internalize gssint_g_queue_internalize -#define g_canonicalize_host gssint_g_canonicalize_host -#define g_local_host_name gssint_g_local_host_name -#define g_strdup gssint_g_strdup +#define g_set_init gssint_g_set_init +#define g_set_destroy gssint_g_set_destroy +#define g_set_entry_add gssint_g_set_entry_add +#define g_set_entry_delete gssint_g_set_entry_delete +#define g_set_entry_get gssint_g_set_entry_get +#define g_save_name gssint_g_save_name +#define g_save_cred_id gssint_g_save_cred_id +#define g_save_ctx_id gssint_g_save_ctx_id +#define g_save_lucidctx_id gssint_g_save_lucidctx_id +#define g_validate_name gssint_g_validate_name +#define g_validate_cred_id gssint_g_validate_cred_id +#define g_validate_ctx_id gssint_g_validate_ctx_id +#define g_validate_lucidctx_id gssint_g_validate_lucidctx_id +#define g_delete_name gssint_g_delete_name +#define g_delete_cred_id gssint_g_delete_cred_id +#define g_delete_ctx_id gssint_g_delete_ctx_id +#define g_delete_lucidctx_id gssint_g_delete_lucidctx_id +#define g_make_string_buffer gssint_g_make_string_buffer +#define g_token_size gssint_g_token_size +#define g_make_token_header gssint_g_make_token_header +#define g_verify_token_header gssint_g_verify_token_header +#define g_display_major_status gssint_g_display_major_status +#define g_display_com_err_status gssint_g_display_com_err_status +#define g_order_init gssint_g_order_init +#define g_order_check gssint_g_order_check +#define g_order_free gssint_g_order_free +#define g_queue_size gssint_g_queue_size +#define g_queue_externalize gssint_g_queue_externalize +#define g_queue_internalize gssint_g_queue_internalize +#define g_canonicalize_host gssint_g_canonicalize_host +#define g_local_host_name gssint_g_local_host_name +#define g_strdup gssint_g_strdup typedef struct _g_set_elt *g_set_elt; typedef struct { @@ -170,25 +171,25 @@ int g_make_string_buffer (const char *str, gss_buffer_t buffer); unsigned int g_token_size (const gss_OID_desc * mech, unsigned int body_size); void g_make_token_header (const gss_OID_desc * mech, unsigned int body_size, - unsigned char **buf, int tok_type); + unsigned char **buf, int tok_type); -gss_int32 g_verify_token_header (const gss_OID_desc * mech, - unsigned int *body_size, - unsigned char **buf, int tok_type, - unsigned int toksize_in, - int wrapper_required); +gss_int32 g_verify_token_header (const gss_OID_desc * mech, + unsigned int *body_size, + unsigned char **buf, int tok_type, + unsigned int toksize_in, + int wrapper_required); OM_uint32 g_display_major_status (OM_uint32 *minor_status, - OM_uint32 status_value, - OM_uint32 *message_context, - gss_buffer_t status_string); + OM_uint32 status_value, + OM_uint32 *message_context, + gss_buffer_t status_string); OM_uint32 g_display_com_err_status (OM_uint32 *minor_status, - OM_uint32 status_value, - gss_buffer_t status_string); + OM_uint32 status_value, + gss_buffer_t status_string); gss_int32 g_order_init (void **queue, gssint_uint64 seqnum, - int do_replay, int do_sequence, int wide); + int do_replay, int do_sequence, int wide); gss_int32 g_order_check (void **queue, gssint_uint64 seqnum); @@ -196,70 +197,70 @@ void g_order_free (void **queue); gss_uint32 g_queue_size(void *vqueue, size_t *sizep); gss_uint32 g_queue_externalize(void *vqueue, unsigned char **buf, - size_t *lenremain); + size_t *lenremain); gss_uint32 g_queue_internalize(void **vqueue, unsigned char **buf, - size_t *lenremain); + size_t *lenremain); char *g_strdup (char *str); /** declarations of internal name mechanism functions **/ -OM_uint32 generic_gss_release_buffer -(OM_uint32*, /* minor_status */ - gss_buffer_t /* buffer */ - ); - -OM_uint32 generic_gss_release_oid_set -(OM_uint32*, /* minor_status */ - gss_OID_set* /* set */ - ); - -OM_uint32 generic_gss_release_oid -(OM_uint32*, /* minor_status */ - gss_OID* /* set */ - ); - -OM_uint32 generic_gss_copy_oid -(OM_uint32 *, /* minor_status */ - const gss_OID_desc * const, /* oid */ - gss_OID * /* new_oid */ - ); - -OM_uint32 generic_gss_create_empty_oid_set -(OM_uint32 *, /* minor_status */ - gss_OID_set * /* oid_set */ - ); - -OM_uint32 generic_gss_add_oid_set_member -(OM_uint32 *, /* minor_status */ - const gss_OID_desc * const, /* member_oid */ - gss_OID_set * /* oid_set */ - ); - -OM_uint32 generic_gss_test_oid_set_member -(OM_uint32 *, /* minor_status */ - const gss_OID_desc * const, /* member */ - gss_OID_set, /* set */ - int * /* present */ - ); - -OM_uint32 generic_gss_oid_to_str -(OM_uint32 *, /* minor_status */ - const gss_OID_desc * const, /* oid */ - gss_buffer_t /* oid_str */ - ); - -OM_uint32 generic_gss_str_to_oid -(OM_uint32 *, /* minor_status */ - gss_buffer_t, /* oid_str */ - gss_OID * /* oid */ - ); +OM_uint32 +generic_gss_release_buffer( + OM_uint32 *, /* minor_status */ + gss_buffer_t); /* buffer */ + +OM_uint32 +generic_gss_release_oid_set( + OM_uint32 *, /* minor_status */ + gss_OID_set *); /* set */ + +OM_uint32 +generic_gss_release_oid( + OM_uint32 *, /* minor_status */ + gss_OID *); /* set */ + +OM_uint32 +generic_gss_copy_oid( + OM_uint32 *, /* minor_status */ + const gss_OID_desc * const, /* oid */ + gss_OID *); /* new_oid */ + +OM_uint32 +generic_gss_create_empty_oid_set( + OM_uint32 *, /* minor_status */ + gss_OID_set *); /* oid_set */ + +OM_uint32 +generic_gss_add_oid_set_member( + OM_uint32 *, /* minor_status */ + const gss_OID_desc * const, /* member_oid */ + gss_OID_set *); /* oid_set */ + +OM_uint32 +generic_gss_test_oid_set_member( + OM_uint32 *, /* minor_status */ + const gss_OID_desc * const, /* member */ + gss_OID_set, /* set */ + int *); /* present */ + +OM_uint32 +generic_gss_oid_to_str( + OM_uint32 *, /* minor_status */ + const gss_OID_desc * const, /* oid */ + gss_buffer_t); /* oid_str */ + +OM_uint32 +generic_gss_str_to_oid( + OM_uint32 *, /* minor_status */ + gss_buffer_t, /* oid_str */ + gss_OID *); /* oid */ int gssint_mecherrmap_init(void); void gssint_mecherrmap_destroy(void); OM_uint32 gssint_mecherrmap_map(OM_uint32 minor, const gss_OID_desc *oid); int gssint_mecherrmap_get(OM_uint32 minor, gss_OID mech_oid, - OM_uint32 *mech_minor); + OM_uint32 *mech_minor); OM_uint32 gssint_mecherrmap_map_errcode(OM_uint32 errcode); #endif /* _GSSAPIP_GENERIC_H_ */ diff --git a/src/lib/gssapi/generic/gssapi_generic.c b/src/lib/gssapi/generic/gssapi_generic.c index db92abb96b..b5314ed7b6 100644 --- a/src/lib/gssapi/generic/gssapi_generic.c +++ b/src/lib/gssapi/generic/gssapi_generic.c @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -37,37 +38,37 @@ static const gss_OID_desc const_oids[] = { /* * The implementation must reserve static storage for a - * gss_OID_desc object containing the value */ + * gss_OID_desc object containing the value */ {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01"}, /* corresponding to an object-identifier value of - * {iso(1) member-body(2) United States(840) mit(113554) - * infosys(1) gssapi(2) generic(1) user_name(1)}. The constant - * GSS_C_NT_USER_NAME should be initialized to point - * to that gss_OID_desc. - */ - + * {iso(1) member-body(2) United States(840) mit(113554) + * infosys(1) gssapi(2) generic(1) user_name(1)}. The constant + * GSS_C_NT_USER_NAME should be initialized to point + * to that gss_OID_desc. + */ + /* - * The implementation must reserve static storage for a - * gss_OID_desc object containing the value */ + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value */ {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02"}, /* corresponding to an object-identifier value of - * {iso(1) member-body(2) United States(840) mit(113554) - * infosys(1) gssapi(2) generic(1) machine_uid_name(2)}. - * The constant GSS_C_NT_MACHINE_UID_NAME should be - * initialized to point to that gss_OID_desc. - */ - + * {iso(1) member-body(2) United States(840) mit(113554) + * infosys(1) gssapi(2) generic(1) machine_uid_name(2)}. + * The constant GSS_C_NT_MACHINE_UID_NAME should be + * initialized to point to that gss_OID_desc. + */ + /* - * The implementation must reserve static storage for a - * gss_OID_desc object containing the value */ + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value */ {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03"}, /* corresponding to an object-identifier value of - * {iso(1) member-body(2) United States(840) mit(113554) - * infosys(1) gssapi(2) generic(1) string_uid_name(3)}. - * The constant GSS_C_NT_STRING_UID_NAME should be - * initialized to point to that gss_OID_desc. - */ - + * {iso(1) member-body(2) United States(840) mit(113554) + * infosys(1) gssapi(2) generic(1) string_uid_name(3)}. + * The constant GSS_C_NT_STRING_UID_NAME should be + * initialized to point to that gss_OID_desc. + */ + /* * The implementation must reserve static storage for a * gss_OID_desc object containing the value */ @@ -85,15 +86,15 @@ static const gss_OID_desc const_oids[] = { * parameter, but should not be emitted by GSS-API * implementations */ - + /* * The implementation must reserve static storage for a * gss_OID_desc object containing the value */ - {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04"}, - /* corresponding to an object-identifier value of - * {iso(1) member-body(2) Unites States(840) mit(113554) - * infosys(1) gssapi(2) generic(1) service_name(4)}. - * The constant GSS_C_NT_HOSTBASED_SERVICE should be + {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04"}, + /* corresponding to an object-identifier value of + * {iso(1) member-body(2) Unites States(840) mit(113554) + * infosys(1) gssapi(2) generic(1) service_name(4)}. + * The constant GSS_C_NT_HOSTBASED_SERVICE should be * initialized to point to that gss_OID_desc. */ @@ -107,7 +108,7 @@ static const gss_OID_desc const_oids[] = { * and GSS_C_NT_ANONYMOUS should be initialized to point * to that gss_OID_desc. */ - + /* * The implementation must reserve static storage for a * gss_OID_desc object containing the value */ @@ -124,8 +125,8 @@ static const gss_OID_desc const_oids[] = { * * Constants of the form GSS_C_NT_* are specified by rfc 2744. * - * Constants of the form gss_nt_* are the original MIT krb5 names - * found in gssapi_generic.h. They are provided for compatibility. */ + * Constants of the form gss_nt_* are the original MIT krb5 names + * found in gssapi_generic.h. They are provided for compatibility. */ GSS_DLLIMP gss_OID GSS_C_NT_USER_NAME = oids+0; GSS_DLLIMP gss_OID gss_nt_user_name = oids+0; @@ -137,7 +138,7 @@ GSS_DLLIMP gss_OID GSS_C_NT_STRING_UID_NAME = oids+2; GSS_DLLIMP gss_OID gss_nt_string_uid_name = oids+2; GSS_DLLIMP gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = oids+3; -gss_OID gss_nt_service_name_v2 = oids+3; +gss_OID gss_nt_service_name_v2 = oids+3; GSS_DLLIMP gss_OID GSS_C_NT_HOSTBASED_SERVICE = oids+4; GSS_DLLIMP gss_OID gss_nt_service_name = oids+4; @@ -145,4 +146,4 @@ GSS_DLLIMP gss_OID gss_nt_service_name = oids+4; GSS_DLLIMP gss_OID GSS_C_NT_ANONYMOUS = oids+5; GSS_DLLIMP gss_OID GSS_C_NT_EXPORT_NAME = oids+6; -gss_OID gss_nt_exported_name = oids+6; +gss_OID gss_nt_exported_name = oids+6; diff --git a/src/lib/gssapi/generic/gssapi_generic.h b/src/lib/gssapi/generic/gssapi_generic.h index bf3c2af59c..eee79655e6 100644 --- a/src/lib/gssapi/generic/gssapi_generic.h +++ b/src/lib/gssapi/generic/gssapi_generic.h @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -30,8 +31,8 @@ #include <gssapi/gssapi.h> #if defined(__cplusplus) && !defined(GSSAPIGENERIC_BEGIN_DECLS) -#define GSSAPIGENERIC_BEGIN_DECLS extern "C" { -#define GSSAPIGENERIC_END_DECLS } +#define GSSAPIGENERIC_BEGIN_DECLS extern "C" { +#define GSSAPIGENERIC_END_DECLS } #else #define GSSAPIGENERIC_BEGIN_DECLS #define GSSAPIGENERIC_END_DECLS @@ -40,7 +41,7 @@ GSSAPIGENERIC_BEGIN_DECLS /* Deprecated MIT krb5 oid names provided for compatibility. - * The correct oids (GSS_C_NT_USER_NAME, etc) from rfc 2744 + * The correct oids (GSS_C_NT_USER_NAME, etc) from rfc 2744 * are defined in gssapi.h. */ GSS_DLLIMP extern gss_OID gss_nt_user_name; diff --git a/src/lib/gssapi/generic/maptest.c b/src/lib/gssapi/generic/maptest.c index 28b4b06337..ce594218d2 100644 --- a/src/lib/gssapi/generic/maptest.c +++ b/src/lib/gssapi/generic/maptest.c @@ -1,3 +1,4 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ #include <stdio.h> #include <stdarg.h> #include <assert.h> @@ -11,13 +12,13 @@ static int eltcp(elt *dest, elt src) static int eltcmp(elt left, elt right) { if (left.a < right.a) - return -1; + return -1; if (left.a > right.a) - return 1; + return 1; if (left.b < right.b) - return -1; + return -1; if (left.b > right.b) - return 1; + return 1; return 0; } static void eltprt(elt v, FILE *f) @@ -27,9 +28,9 @@ static void eltprt(elt v, FILE *f) static int intcmp(int left, int right) { if (left < right) - return -1; + return -1; if (left > right) - return 1; + return 1; return 0; } static void intprt(int v, FILE *f) diff --git a/src/lib/gssapi/generic/rel_buffer.c b/src/lib/gssapi/generic/rel_buffer.c index 5558881845..8b35e80371 100644 --- a/src/lib/gssapi/generic/rel_buffer.c +++ b/src/lib/gssapi/generic/rel_buffer.c @@ -1,8 +1,9 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* #ident "@(#)g_rel_buffer.c 1.2 96/02/06 SMI" */ /* * Copyright 1996 by Sun Microsystems, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -12,7 +13,7 @@ * without specific, written prior permission. Sun Microsystems makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -34,23 +35,22 @@ #endif OM_uint32 -generic_gss_release_buffer (minor_status, - buffer) - OM_uint32 * minor_status; - gss_buffer_t buffer; +generic_gss_release_buffer( + OM_uint32 *minor_status, + gss_buffer_t buffer) { if (minor_status) - *minor_status = 0; + *minor_status = 0; /* if buffer is NULL, return */ if (buffer == GSS_C_NO_BUFFER) - return(GSS_S_COMPLETE); + return(GSS_S_COMPLETE); if (buffer->value) { - free(buffer->value); - buffer->length = 0; - buffer->value = NULL; + free(buffer->value); + buffer->length = 0; + buffer->value = NULL; } return (GSS_S_COMPLETE); diff --git a/src/lib/gssapi/generic/rel_oid_set.c b/src/lib/gssapi/generic/rel_oid_set.c index bd7f3cb2cf..137a513a0f 100644 --- a/src/lib/gssapi/generic/rel_oid_set.c +++ b/src/lib/gssapi/generic/rel_oid_set.c @@ -1,8 +1,9 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* #ident "@(#)gss_release_oid_set.c 1.12 95/08/23 SMI" */ /* * Copyright 1996 by Sun Microsystems, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -12,7 +13,7 @@ * without specific, written prior permission. Sun Microsystems makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -34,28 +35,27 @@ #endif OM_uint32 -generic_gss_release_oid_set (minor_status, - set) - OM_uint32 * minor_status; - gss_OID_set * set; +generic_gss_release_oid_set( + OM_uint32 *minor_status, + gss_OID_set *set) { size_t i; if (minor_status) - *minor_status = 0; + *minor_status = 0; if (set == NULL) - return(GSS_S_COMPLETE); + return(GSS_S_COMPLETE); if (*set == GSS_C_NULL_OID_SET) - return(GSS_S_COMPLETE); + return(GSS_S_COMPLETE); for (i=0; i<(*set)->count; i++) - free((*set)->elements[i].elements); + free((*set)->elements[i].elements); free((*set)->elements); free(*set); *set = GSS_C_NULL_OID_SET; - + return(GSS_S_COMPLETE); } diff --git a/src/lib/gssapi/generic/util_buffer.c b/src/lib/gssapi/generic/util_buffer.c index 1ce9f89471..b707d15fbe 100644 --- a/src/lib/gssapi/generic/util_buffer.c +++ b/src/lib/gssapi/generic/util_buffer.c @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -33,12 +34,12 @@ int g_make_string_buffer(const char *str, gss_buffer_t buffer) { - buffer->length = strlen(str); + buffer->length = strlen(str); - if ((buffer->value = strdup(str)) == NULL) { - buffer->length = 0; - return(0); - } + if ((buffer->value = strdup(str)) == NULL) { + buffer->length = 0; + return(0); + } - return(1); + return(1); } diff --git a/src/lib/gssapi/generic/util_canonhost.c b/src/lib/gssapi/generic/util_canonhost.c index 829311db9d..f1bd93f2b4 100644 --- a/src/lib/gssapi/generic/util_canonhost.c +++ b/src/lib/gssapi/generic/util_canonhost.c @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -37,35 +38,34 @@ #include <string.h> char * -g_canonicalize_host(hostname) - char *hostname; +g_canonicalize_host(char *hostname) { - struct hostent *hent; - char *haddr; - char *canon, *str; + struct hostent *hent; + char *haddr; + char *canon, *str; - if ((hent = gethostbyname(hostname)) == NULL) - return(NULL); + if ((hent = gethostbyname(hostname)) == NULL) + return(NULL); - if (! (haddr = (char *) xmalloc(hent->h_length))) { + if (! (haddr = (char *) xmalloc(hent->h_length))) { return(NULL); - } + } - memcpy(haddr, hent->h_addr_list[0], hent->h_length); + memcpy(haddr, hent->h_addr_list[0], hent->h_length); - if (! (hent = gethostbyaddr(haddr, hent->h_length, hent->h_addrtype))) { + if (! (hent = gethostbyaddr(haddr, hent->h_length, hent->h_addrtype))) { return(NULL); - } + } - xfree(haddr); + xfree(haddr); - if ((canon = (char *) xmalloc(strlen(hent->h_name)+1)) == NULL) - return(NULL); + if ((canon = (char *) xmalloc(strlen(hent->h_name)+1)) == NULL) + return(NULL); - strcpy(canon, hent->h_name); + strcpy(canon, hent->h_name); - for (str = canon; *str; str++) - if (isupper(*str)) *str = tolower(*str); + for (str = canon; *str; str++) + if (isupper(*str)) *str = tolower(*str); - return(canon); + return(canon); } diff --git a/src/lib/gssapi/generic/util_errmap.c b/src/lib/gssapi/generic/util_errmap.c index 9e2f7e9b3d..2634e667b5 100644 --- a/src/lib/gssapi/generic/util_errmap.c +++ b/src/lib/gssapi/generic/util_errmap.c @@ -1,3 +1,4 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 2007, 2008 by the Massachusetts Institute of Technology. * All Rights Reserved. @@ -6,7 +7,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -20,7 +21,7 @@ * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. - * + * */ #include "gssapiP_generic.h" @@ -45,26 +46,26 @@ static inline int cmp_OM_uint32(OM_uint32 m1, OM_uint32 m2) { if (m1 < m2) - return -1; + return -1; else if (m1 > m2) - return 1; + return 1; else - return 0; + return 0; } static inline int mecherror_cmp(struct mecherror m1, struct mecherror m2) { if (m1.code < m2.code) - return -1; + return -1; if (m1.code > m2.code) - return 1; + return 1; if (m1.mech.length < m2.mech.length) - return -1; + return -1; if (m1.mech.length > m2.mech.length) - return 1; + return 1; if (m1.mech.length == 0) - return 0; + return 0; return memcmp(m1.mech.elements, m2.mech.elements, m1.mech.length); } @@ -80,10 +81,10 @@ mecherror_copy(struct mecherror *dest, struct mecherror src) *dest = src; dest->mech.elements = malloc(src.mech.length); if (dest->mech.elements == NULL) { - if (src.mech.length) - return ENOMEM; - else - return 0; + if (src.mech.length) + return ENOMEM; + else + return 0; } memcpy(dest->mech.elements, src.mech.elements, src.mech.length); return 0; @@ -95,40 +96,40 @@ mecherror_print(struct mecherror value, FILE *f) OM_uint32 minor; gss_buffer_desc str; static const struct { - const char *oidstr, *name; + const char *oidstr, *name; } mechnames[] = { - { "{ 1 2 840 113554 1 2 2 }", "krb5-new" }, - { "{ 1 3 5 1 5 2 }", "krb5-old" }, - { "{ 1 2 840 48018 1 2 2 }", "krb5-microsoft" }, - { "{ 1 3 6 1 5 5 2 }", "spnego" }, + { "{ 1 2 840 113554 1 2 2 }", "krb5-new" }, + { "{ 1 3 5 1 5 2 }", "krb5-old" }, + { "{ 1 2 840 48018 1 2 2 }", "krb5-microsoft" }, + { "{ 1 3 6 1 5 5 2 }", "spnego" }, }; unsigned int i; fprintf(f, "%lu@", (unsigned long) value.code); if (value.mech.length == 0) { - fprintf(f, "(com_err)"); - return; + fprintf(f, "(com_err)"); + return; } fprintf(f, "%p=", value.mech.elements); if (generic_gss_oid_to_str(&minor, &value.mech, &str)) { - fprintf(f, "(error in conversion)"); - return; + fprintf(f, "(error in conversion)"); + return; } /* Note: generic_gss_oid_to_str returns a null-terminated string. */ for (i = 0; i < sizeof(mechnames)/sizeof(mechnames[0]); i++) { - if (!strcmp(str.value, mechnames[i].oidstr) && mechnames[i].name != 0) { - fprintf(f, "%s", mechnames[i].name); - break; - } + if (!strcmp(str.value, mechnames[i].oidstr) && mechnames[i].name != 0) { + fprintf(f, "%s", mechnames[i].name); + break; + } } if (i == sizeof(mechnames)/sizeof(mechnames[0])) - fprintf(f, "%s", (char *) str.value); + fprintf(f, "%s", (char *) str.value); generic_gss_release_buffer(&minor, &str); } #include "errmap.h" -#include "krb5.h" /* for KRB5KRB_AP_WRONG_PRINC */ +#include "krb5.h" /* for KRB5KRB_AP_WRONG_PRINC */ static mecherrmap m; static k5_mutex_t mutex = K5_MUTEX_PARTIAL_INITIALIZER; @@ -140,11 +141,11 @@ int gssint_mecherrmap_init(void) err = mecherrmap_init(&m); if (err) - return err; + return err; err = k5_mutex_finish_init(&mutex); if (err) { - mecherrmap_destroy(&m); - return err; + mecherrmap_destroy(&m); + return err; } return 0; @@ -155,7 +156,7 @@ int gssint_mecherrmap_init(void) static int free_one(OM_uint32 i, struct mecherror value, void *p) { if (value.mech.length && value.mech.elements) - free(value.mech.elements); + free(value.mech.elements); return 0; } @@ -178,7 +179,7 @@ OM_uint32 gssint_mecherrmap_map(OM_uint32 minor, const gss_OID_desc * oid) FILE *f; f = fopen("/dev/pts/9", "w+"); if (f == NULL) - f = stderr; + f = stderr; #endif me.code = minor; @@ -186,51 +187,51 @@ OM_uint32 gssint_mecherrmap_map(OM_uint32 minor, const gss_OID_desc * oid) err = k5_mutex_lock(&mutex); if (err) { #ifdef DEBUG - if (f != stderr) fclose(f); + if (f != stderr) fclose(f); #endif - return 0; + return 0; } /* Is this status+oid already mapped? */ p = mecherrmap_findright(&m, me); if (p != NULL) { - k5_mutex_unlock(&mutex); + k5_mutex_unlock(&mutex); #ifdef DEBUG - fprintf(f, "%s: found ", __func__); - mecherror_print(me, f); - fprintf(f, " in map as %lu\n", (unsigned long) *p); - if (f != stderr) fclose(f); + fprintf(f, "%s: found ", __func__); + mecherror_print(me, f); + fprintf(f, " in map as %lu\n", (unsigned long) *p); + if (f != stderr) fclose(f); #endif - return *p; + return *p; } /* Is this status code already mapped to something else mech-specific? */ mep = mecherrmap_findleft(&m, minor); if (mep == NULL) { - /* Map it to itself plus this mech-oid. */ - new_status = minor; + /* Map it to itself plus this mech-oid. */ + new_status = minor; } else { - /* Already assigned. Pick a fake new value and map it. */ - /* There's a theoretical infinite loop risk here, if we fill - in 2**32 values. Also, returning 0 has a special - meaning. */ - do { - next_fake++; - new_status = next_fake; - if (new_status == 0) - /* ??? */; - } while (mecherrmap_findleft(&m, new_status) != NULL); + /* Already assigned. Pick a fake new value and map it. */ + /* There's a theoretical infinite loop risk here, if we fill + in 2**32 values. Also, returning 0 has a special + meaning. */ + do { + next_fake++; + new_status = next_fake; + if (new_status == 0) + /* ??? */; + } while (mecherrmap_findleft(&m, new_status) != NULL); } err = mecherror_copy(&me_copy, me); if (err) { - k5_mutex_unlock(&mutex); - return err; + k5_mutex_unlock(&mutex); + return err; } err = mecherrmap_add(&m, new_status, me_copy); k5_mutex_unlock(&mutex); if (err) { - if (me_copy.mech.length) - free(me_copy.mech.elements); + if (me_copy.mech.length) + free(me_copy.mech.elements); } #ifdef DEBUG fprintf(f, "%s: mapping ", __func__); @@ -241,9 +242,9 @@ OM_uint32 gssint_mecherrmap_map(OM_uint32 minor, const gss_OID_desc * oid) if (f != stderr) fclose(f); #endif if (err) - return 0; + return 0; else - return new_status; + return new_status; } static gss_OID_desc no_oid = { 0, 0 }; @@ -253,21 +254,21 @@ OM_uint32 gssint_mecherrmap_map_errcode(OM_uint32 errcode) } int gssint_mecherrmap_get(OM_uint32 minor, gss_OID mech_oid, - OM_uint32 *mech_minor) + OM_uint32 *mech_minor) { const struct mecherror *p; int err; if (minor == 0) { - return EINVAL; + return EINVAL; } err = k5_mutex_lock(&mutex); if (err) - return err; + return err; p = mecherrmap_findleft(&m, minor); k5_mutex_unlock(&mutex); if (!p) { - return EINVAL; + return EINVAL; } *mech_oid = p->mech; *mech_minor = p->code; diff --git a/src/lib/gssapi/generic/util_localhost.c b/src/lib/gssapi/generic/util_localhost.c index 13856e3206..2d3c27cb24 100644 --- a/src/lib/gssapi/generic/util_localhost.c +++ b/src/lib/gssapi/generic/util_localhost.c @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -34,17 +35,18 @@ #define MAXHOSTNAMELEN 64 #endif -char *g_local_host_name() +char * +g_local_host_name(void) { - char buf[MAXHOSTNAMELEN+1], *ptr; + char buf[MAXHOSTNAMELEN+1], *ptr; - if (gethostname(buf, sizeof(buf)) < 0) - return 0; + if (gethostname(buf, sizeof(buf)) < 0) + return 0; - buf[sizeof(buf)-1] = '\0'; + buf[sizeof(buf)-1] = '\0'; - if (! (ptr = xmalloc(strlen(buf) + 1))) - return 0; + if (! (ptr = xmalloc(strlen(buf) + 1))) + return 0; - return strcpy(ptr, buf); + return strcpy(ptr, buf); } diff --git a/src/lib/gssapi/generic/util_ordering.c b/src/lib/gssapi/generic/util_ordering.c index 218462bb0c..274790e4e0 100644 --- a/src/lib/gssapi/generic/util_ordering.c +++ b/src/lib/gssapi/generic/util_ordering.c @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -34,18 +35,18 @@ #define QUEUE_LENGTH 20 typedef struct _queue { - int do_replay; - int do_sequence; - int start; - int length; - gssint_uint64 firstnum; - /* Stored as deltas from firstnum. This way, the high bit won't - overflow unless we've actually gone through 2**n messages, or - gotten something *way* out of sequence. */ - gssint_uint64 elem[QUEUE_LENGTH]; - /* All ones for 64-bit sequence numbers; 32 ones for 32-bit - sequence numbers. */ - gssint_uint64 mask; + int do_replay; + int do_sequence; + int start; + int length; + gssint_uint64 firstnum; + /* Stored as deltas from firstnum. This way, the high bit won't + overflow unless we've actually gone through 2**n messages, or + gotten something *way* out of sequence. */ + gssint_uint64 elem[QUEUE_LENGTH]; + /* All ones for 64-bit sequence numbers; 32 ones for 32-bit + sequence numbers. */ + gssint_uint64 mask; } queue; /* rep invariant: @@ -59,157 +60,157 @@ typedef struct _queue { static void queue_insert(queue *q, int after, gssint_uint64 seqnum) { - /* insert. this is not the fastest way, but it's easy, and it's - optimized for insert at end, which is the common case */ - int i; + /* insert. this is not the fastest way, but it's easy, and it's + optimized for insert at end, which is the common case */ + int i; - /* common case: at end, after == q->start+q->length-1 */ + /* common case: at end, after == q->start+q->length-1 */ - /* move all the elements (after,last] up one slot */ + /* move all the elements (after,last] up one slot */ - for (i=q->start+q->length-1; i>after; i--) - QELEM(q,i+1) = QELEM(q,i); + for (i=q->start+q->length-1; i>after; i--) + QELEM(q,i+1) = QELEM(q,i); - /* fill in slot after+1 */ + /* fill in slot after+1 */ - QELEM(q,after+1) = seqnum; + QELEM(q,after+1) = seqnum; - /* Either increase the length by one, or move the starting point up - one (deleting the first element, which got bashed above), as - appropriate. */ + /* Either increase the length by one, or move the starting point up + one (deleting the first element, which got bashed above), as + appropriate. */ - if (q->length == QSIZE(q)) { - q->start++; - if (q->start == QSIZE(q)) - q->start = 0; - } else { - q->length++; - } + if (q->length == QSIZE(q)) { + q->start++; + if (q->start == QSIZE(q)) + q->start = 0; + } else { + q->length++; + } } gss_int32 g_order_init(void **vqueue, gssint_uint64 seqnum, - int do_replay, int do_sequence, int wide_nums) + int do_replay, int do_sequence, int wide_nums) { - queue *q; + queue *q; - if ((q = (queue *) malloc(sizeof(queue))) == NULL) - return(ENOMEM); + if ((q = (queue *) malloc(sizeof(queue))) == NULL) + return(ENOMEM); - /* This stops valgrind from complaining about writing uninitialized - data if the caller exports the context and writes it to a file. - We don't actually use those bytes at all, but valgrind still - complains. */ - memset(q, 0xfe, sizeof(*q)); + /* This stops valgrind from complaining about writing uninitialized + data if the caller exports the context and writes it to a file. + We don't actually use those bytes at all, but valgrind still + complains. */ + memset(q, 0xfe, sizeof(*q)); - q->do_replay = do_replay; - q->do_sequence = do_sequence; - q->mask = wide_nums ? ~(gssint_uint64)0 : 0xffffffffUL; + q->do_replay = do_replay; + q->do_sequence = do_sequence; + q->mask = wide_nums ? ~(gssint_uint64)0 : 0xffffffffUL; - q->start = 0; - q->length = 1; - q->firstnum = seqnum; - q->elem[q->start] = ((gssint_uint64)0 - 1) & q->mask; + q->start = 0; + q->length = 1; + q->firstnum = seqnum; + q->elem[q->start] = ((gssint_uint64)0 - 1) & q->mask; - *vqueue = (void *) q; - return(0); + *vqueue = (void *) q; + return(0); } gss_int32 g_order_check(void **vqueue, gssint_uint64 seqnum) { - queue *q; - int i; - gssint_uint64 expected; - - q = (queue *) (*vqueue); - - if (!q->do_replay && !q->do_sequence) - return(GSS_S_COMPLETE); - - /* All checks are done relative to the initial sequence number, to - avoid (or at least put off) the pain of wrapping. */ - seqnum -= q->firstnum; - /* If we're only doing 32-bit values, adjust for that again. - - Note that this will probably be the wrong thing to if we get - 2**32 messages sent with 32-bit sequence numbers. */ - seqnum &= q->mask; - - /* rule 1: expected sequence number */ - - expected = (QELEM(q,q->start+q->length-1)+1) & q->mask; - if (seqnum == expected) { - queue_insert(q, q->start+q->length-1, seqnum); - return(GSS_S_COMPLETE); - } - - /* rule 2: > expected sequence number */ - - if ((seqnum > expected)) { - queue_insert(q, q->start+q->length-1, seqnum); - if (q->do_replay && !q->do_sequence) - return(GSS_S_COMPLETE); - else - return(GSS_S_GAP_TOKEN); - } - - /* rule 3: seqnum < seqnum(first) */ - - if ((seqnum < QELEM(q,q->start)) && - /* Is top bit of whatever width we're using set? - - We used to check for greater than or equal to firstnum, but - (1) we've since switched to compute values relative to - firstnum, so the lowest we can have is 0, and (2) the effect - of the original scheme was highly dependent on whether - firstnum was close to either side of 0. (Consider - firstnum==0xFFFFFFFE and we miss three packets; the next - packet is *new* but would look old.) - - This check should give us 2**31 or 2**63 messages "new", and - just as many "old". That's not quite right either. */ - (seqnum & (1 + (q->mask >> 1))) - ) { - if (q->do_replay && !q->do_sequence) - return(GSS_S_OLD_TOKEN); - else - return(GSS_S_UNSEQ_TOKEN); - } - - /* rule 4+5: seqnum in [seqnum(first),seqnum(last)] */ - - else { - if (seqnum == QELEM(q,q->start+q->length-1)) - return(GSS_S_DUPLICATE_TOKEN); - - for (i=q->start; i<q->start+q->length-1; i++) { - if (seqnum == QELEM(q,i)) - return(GSS_S_DUPLICATE_TOKEN); - if ((seqnum > QELEM(q,i)) && (seqnum < QELEM(q,i+1))) { - queue_insert(q, i, seqnum); - if (q->do_replay && !q->do_sequence) - return(GSS_S_COMPLETE); - else - return(GSS_S_UNSEQ_TOKEN); - } - } - } - - /* this should never happen */ - return(GSS_S_FAILURE); + queue *q; + int i; + gssint_uint64 expected; + + q = (queue *) (*vqueue); + + if (!q->do_replay && !q->do_sequence) + return(GSS_S_COMPLETE); + + /* All checks are done relative to the initial sequence number, to + avoid (or at least put off) the pain of wrapping. */ + seqnum -= q->firstnum; + /* If we're only doing 32-bit values, adjust for that again. + + Note that this will probably be the wrong thing to if we get + 2**32 messages sent with 32-bit sequence numbers. */ + seqnum &= q->mask; + + /* rule 1: expected sequence number */ + + expected = (QELEM(q,q->start+q->length-1)+1) & q->mask; + if (seqnum == expected) { + queue_insert(q, q->start+q->length-1, seqnum); + return(GSS_S_COMPLETE); + } + + /* rule 2: > expected sequence number */ + + if ((seqnum > expected)) { + queue_insert(q, q->start+q->length-1, seqnum); + if (q->do_replay && !q->do_sequence) + return(GSS_S_COMPLETE); + else + return(GSS_S_GAP_TOKEN); + } + + /* rule 3: seqnum < seqnum(first) */ + + if ((seqnum < QELEM(q,q->start)) && + /* Is top bit of whatever width we're using set? + + We used to check for greater than or equal to firstnum, but + (1) we've since switched to compute values relative to + firstnum, so the lowest we can have is 0, and (2) the effect + of the original scheme was highly dependent on whether + firstnum was close to either side of 0. (Consider + firstnum==0xFFFFFFFE and we miss three packets; the next + packet is *new* but would look old.) + + This check should give us 2**31 or 2**63 messages "new", and + just as many "old". That's not quite right either. */ + (seqnum & (1 + (q->mask >> 1))) + ) { + if (q->do_replay && !q->do_sequence) + return(GSS_S_OLD_TOKEN); + else + return(GSS_S_UNSEQ_TOKEN); + } + + /* rule 4+5: seqnum in [seqnum(first),seqnum(last)] */ + + else { + if (seqnum == QELEM(q,q->start+q->length-1)) + return(GSS_S_DUPLICATE_TOKEN); + + for (i=q->start; i<q->start+q->length-1; i++) { + if (seqnum == QELEM(q,i)) + return(GSS_S_DUPLICATE_TOKEN); + if ((seqnum > QELEM(q,i)) && (seqnum < QELEM(q,i+1))) { + queue_insert(q, i, seqnum); + if (q->do_replay && !q->do_sequence) + return(GSS_S_COMPLETE); + else + return(GSS_S_UNSEQ_TOKEN); + } + } + } + + /* this should never happen */ + return(GSS_S_FAILURE); } void g_order_free(void **vqueue) { - queue *q; - - q = (queue *) (*vqueue); + queue *q; - free(q); + q = (queue *) (*vqueue); - *vqueue = NULL; + free(q); + + *vqueue = NULL; } /* @@ -226,11 +227,11 @@ gss_uint32 g_queue_externalize(void *vqueue, unsigned char **buf, size_t *lenremain) { if (*lenremain < sizeof(queue)) - return ENOMEM; + return ENOMEM; memcpy(*buf, vqueue, sizeof(queue)); *buf += sizeof(queue); *lenremain -= sizeof(queue); - + return 0; } @@ -240,9 +241,9 @@ g_queue_internalize(void **vqueue, unsigned char **buf, size_t *lenremain) void *q; if (*lenremain < sizeof(queue)) - return EINVAL; + return EINVAL; if ((q = malloc(sizeof(queue))) == 0) - return ENOMEM; + return ENOMEM; memcpy(q, *buf, sizeof(queue)); *buf += sizeof(queue); *lenremain -= sizeof(queue); diff --git a/src/lib/gssapi/generic/util_set.c b/src/lib/gssapi/generic/util_set.c index fea810852c..d437f1ea78 100644 --- a/src/lib/gssapi/generic/util_set.c +++ b/src/lib/gssapi/generic/util_set.c @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1995 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -27,79 +28,79 @@ #include "gssapiP_generic.h" struct _g_set_elt { - void *key; - void *value; - struct _g_set_elt *next; + void *key; + void *value; + struct _g_set_elt *next; }; int g_set_init(g_set_elt *s) { - *s = NULL; + *s = NULL; - return(0); + return(0); } #if 0 int g_set_destroy(g_set_elt *s) { - g_set next; + g_set next; - while (*s) { - next = (*s)->next; - free(*s); - *s = next; - } + while (*s) { + next = (*s)->next; + free(*s); + *s = next; + } - return(0); + return(0); } #endif int g_set_entry_add(g_set_elt *s, void *key, void *value) { - g_set_elt first; + g_set_elt first; - if ((first = (struct _g_set_elt *) malloc(sizeof(struct _g_set_elt))) == NULL) - return(ENOMEM); + if ((first = (struct _g_set_elt *) malloc(sizeof(struct _g_set_elt))) == NULL) + return(ENOMEM); - first->key = key; - first->value = value; - first->next = *s; + first->key = key; + first->value = value; + first->next = *s; - *s = first; + *s = first; - return(0); + return(0); } int g_set_entry_delete(g_set_elt *s, void *key) { - g_set_elt *p; + g_set_elt *p; - for (p=s; *p; p = &((*p)->next)) { - if ((*p)->key == key) { - g_set_elt next = (*p)->next; - free(*p); - *p = next; + for (p=s; *p; p = &((*p)->next)) { + if ((*p)->key == key) { + g_set_elt next = (*p)->next; + free(*p); + *p = next; - return(0); - } - } + return(0); + } + } - return(-1); + return(-1); } int g_set_entry_get(g_set_elt *s, void *key, void **value) { - g_set_elt p; + g_set_elt p; - for (p = *s; p; p = p->next) { - if (p->key == key) { - *value = p->value; + for (p = *s; p; p = p->next) { + if (p->key == key) { + *value = p->value; - return(0); - } - } + return(0); + } + } - *value = NULL; + *value = NULL; - return(-1); + return(-1); } diff --git a/src/lib/gssapi/generic/util_token.c b/src/lib/gssapi/generic/util_token.c index 7b8dfed223..b37d9065dd 100644 --- a/src/lib/gssapi/generic/util_token.c +++ b/src/lib/gssapi/generic/util_token.c @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -35,130 +36,126 @@ the interfaces, so the code can be fixed if the OSI namespace balloons unexpectedly. */ -/* Each token looks like this: - -0x60 tag for APPLICATION 0, SEQUENCE - (constructed, definite-length) - <length> possible multiple bytes, need to parse/generate - 0x06 tag for OBJECT IDENTIFIER - <moid_length> compile-time constant string (assume 1 byte) - <moid_bytes> compile-time constant string - <inner_bytes> the ANY containing the application token - bytes 0,1 are the token type - bytes 2,n are the token data - -Note that the token type field is a feature of RFC 1964 mechanisms and -is not used by other GSSAPI mechanisms. As such, a token type of -1 -is interpreted to mean that no token type should be expected or -generated. - -For the purposes of this abstraction, the token "header" consists of -the sequence tag and length octets, the mech OID DER encoding, and the -first two inner bytes, which indicate the token type. The token -"body" consists of everything else. - -*/ - -static unsigned int der_length_size(length) - int length; +/* + * Each token looks like this: + * 0x60 tag for APPLICATION 0, SEQUENCE + * (constructed, definite-length) + * <length> possible multiple bytes, need to parse/generate + * 0x06 tag for OBJECT IDENTIFIER + * <moid_length> compile-time constant string (assume 1 byte) + * <moid_bytes> compile-time constant string + * <inner_bytes> the ANY containing the application token + * bytes 0,1 are the token type + * bytes 2,n are the token data + * + * Note that the token type field is a feature of RFC 1964 mechanisms and + * is not used by other GSSAPI mechanisms. As such, a token type of -1 + * is interpreted to mean that no token type should be expected or + * generated. + * + * For the purposes of this abstraction, the token "header" consists of + * the sequence tag and length octets, the mech OID DER encoding, and the + * first two inner bytes, which indicate the token type. The token + * "body" consists of everything else. + */ +static unsigned int +der_length_size(int length) { - if (length < (1<<7)) - return(1); - else if (length < (1<<8)) - return(2); + if (length < (1<<7)) + return(1); + else if (length < (1<<8)) + return(2); #if INT_MAX == 0x7fff - else - return(3); + else + return(3); #else - else if (length < (1<<16)) - return(3); - else if (length < (1<<24)) - return(4); - else - return(5); + else if (length < (1<<16)) + return(3); + else if (length < (1<<24)) + return(4); + else + return(5); #endif } -static void der_write_length(buf, length) - unsigned char **buf; - int length; +static void +der_write_length(unsigned char **buf, int length) { - if (length < (1<<7)) { - *(*buf)++ = (unsigned char) length; - } else { - *(*buf)++ = (unsigned char) (der_length_size(length)+127); + if (length < (1<<7)) { + *(*buf)++ = (unsigned char) length; + } else { + *(*buf)++ = (unsigned char) (der_length_size(length)+127); #if INT_MAX > 0x7fff - if (length >= (1<<24)) - *(*buf)++ = (unsigned char) (length>>24); - if (length >= (1<<16)) - *(*buf)++ = (unsigned char) ((length>>16)&0xff); + if (length >= (1<<24)) + *(*buf)++ = (unsigned char) (length>>24); + if (length >= (1<<16)) + *(*buf)++ = (unsigned char) ((length>>16)&0xff); #endif - if (length >= (1<<8)) - *(*buf)++ = (unsigned char) ((length>>8)&0xff); - *(*buf)++ = (unsigned char) (length&0xff); - } + if (length >= (1<<8)) + *(*buf)++ = (unsigned char) ((length>>8)&0xff); + *(*buf)++ = (unsigned char) (length&0xff); + } } /* returns decoded length, or < 0 on failure. Advances buf and decrements bufsize */ -static int der_read_length(buf, bufsize) - unsigned char **buf; - int *bufsize; +static int +der_read_length(unsigned char **buf, int *bufsize) { - unsigned char sf; - int ret; - - if (*bufsize < 1) - return(-1); - sf = *(*buf)++; - (*bufsize)--; - if (sf & 0x80) { - if ((sf &= 0x7f) > ((*bufsize)-1)) - return(-1); - if (sf > sizeof(int)) - return (-1); - ret = 0; - for (; sf; sf--) { - ret = (ret<<8) + (*(*buf)++); - (*bufsize)--; - } - } else { - ret = sf; - } - - return(ret); + unsigned char sf; + int ret; + + if (*bufsize < 1) + return(-1); + sf = *(*buf)++; + (*bufsize)--; + if (sf & 0x80) { + if ((sf &= 0x7f) > ((*bufsize)-1)) + return(-1); + if (sf > sizeof(int)) + return (-1); + ret = 0; + for (; sf; sf--) { + ret = (ret<<8) + (*(*buf)++); + (*bufsize)--; + } + } else { + ret = sf; + } + + return(ret); } /* returns the length of a token, given the mech oid and the body size */ -unsigned int g_token_size(mech, body_size) - const gss_OID_desc * mech; - unsigned int body_size; +unsigned int +g_token_size(const gss_OID_desc * mech, unsigned int body_size) { - /* set body_size to sequence contents size */ - body_size += 4 + (int) mech->length; /* NEED overflow check */ - return(1 + der_length_size(body_size) + body_size); + /* set body_size to sequence contents size */ + body_size += 4 + (int) mech->length; /* NEED overflow check */ + return(1 + der_length_size(body_size) + body_size); } /* fills in a buffer with the token header. The buffer is assumed to be the right size. buf is advanced past the token header */ -void g_make_token_header(mech, body_size, buf, tok_type) - const gss_OID_desc * mech; - unsigned int body_size; - unsigned char **buf; - int tok_type; +void +g_make_token_header( + const gss_OID_desc * mech, + unsigned int body_size, + unsigned char **buf, + int tok_type) { - *(*buf)++ = 0x60; - der_write_length(buf, (tok_type == -1) ?2:4 + mech->length + body_size); - *(*buf)++ = 0x06; - *(*buf)++ = (unsigned char) mech->length; - TWRITE_STR(*buf, mech->elements, mech->length); - if (tok_type != -1) { - *(*buf)++ = (unsigned char) ((tok_type>>8)&0xff); - *(*buf)++ = (unsigned char) (tok_type&0xff); - } + *(*buf)++ = 0x60; + der_write_length(buf, (tok_type == -1) ?2:4 + mech->length + body_size); + *(*buf)++ = 0x06; + *(*buf)++ = (unsigned char) mech->length; + TWRITE_STR(*buf, mech->elements, mech->length); + if (tok_type != -1) { + *(*buf)++ = (unsigned char) ((tok_type>>8)&0xff); + *(*buf)++ = (unsigned char) (tok_type&0xff); + } } /* @@ -170,63 +167,63 @@ void g_make_token_header(mech, body_size, buf, tok_type) * *body_size are left unmodified on error. */ -gss_int32 g_verify_token_header(mech, body_size, buf_in, tok_type, toksize_in, - wrapper_required) - const gss_OID_desc * mech; - unsigned int *body_size; - unsigned char **buf_in; - int tok_type; - unsigned int toksize_in; - int wrapper_required; +gss_int32 +g_verify_token_header( + const gss_OID_desc * mech, + unsigned int *body_size, + unsigned char **buf_in, + int tok_type, + unsigned int toksize_in, + int wrapper_required) { - unsigned char *buf = *buf_in; - int seqsize; - gss_OID_desc toid; - int toksize = toksize_in; - - if ((toksize-=1) < 0) - return(G_BAD_TOK_HEADER); - if (*buf++ != 0x60) { - if (wrapper_required) - return(G_BAD_TOK_HEADER); - buf--; - toksize++; - goto skip_wrapper; - } - - if ((seqsize = der_read_length(&buf, &toksize)) < 0) - return(G_BAD_TOK_HEADER); - - if (seqsize != toksize) - return(G_BAD_TOK_HEADER); - - if ((toksize-=1) < 0) - return(G_BAD_TOK_HEADER); - if (*buf++ != 0x06) - return(G_BAD_TOK_HEADER); - - if ((toksize-=1) < 0) - return(G_BAD_TOK_HEADER); - toid.length = *buf++; - - if ((toksize-=toid.length) < 0) - return(G_BAD_TOK_HEADER); - toid.elements = buf; - buf+=toid.length; - - if (! g_OID_equal(&toid, mech)) - return G_WRONG_MECH; + unsigned char *buf = *buf_in; + int seqsize; + gss_OID_desc toid; + int toksize = toksize_in; + + if ((toksize-=1) < 0) + return(G_BAD_TOK_HEADER); + if (*buf++ != 0x60) { + if (wrapper_required) + return(G_BAD_TOK_HEADER); + buf--; + toksize++; + goto skip_wrapper; + } + + if ((seqsize = der_read_length(&buf, &toksize)) < 0) + return(G_BAD_TOK_HEADER); + + if (seqsize != toksize) + return(G_BAD_TOK_HEADER); + + if ((toksize-=1) < 0) + return(G_BAD_TOK_HEADER); + if (*buf++ != 0x06) + return(G_BAD_TOK_HEADER); + + if ((toksize-=1) < 0) + return(G_BAD_TOK_HEADER); + toid.length = *buf++; + + if ((toksize-=toid.length) < 0) + return(G_BAD_TOK_HEADER); + toid.elements = buf; + buf+=toid.length; + + if (! g_OID_equal(&toid, mech)) + return G_WRONG_MECH; skip_wrapper: - if (tok_type != -1) { - if ((toksize-=2) < 0) - return(G_BAD_TOK_HEADER); - - if ((*buf++ != ((tok_type>>8)&0xff)) || - (*buf++ != (tok_type&0xff))) - return(G_WRONG_TOKID); - } - *buf_in = buf; - *body_size = toksize; - - return 0; + if (tok_type != -1) { + if ((toksize-=2) < 0) + return(G_BAD_TOK_HEADER); + + if ((*buf++ != ((tok_type>>8)&0xff)) || + (*buf++ != (tok_type&0xff))) + return(G_WRONG_TOKID); + } + *buf_in = buf; + *body_size = toksize; + + return 0; } diff --git a/src/lib/gssapi/generic/util_validate.c b/src/lib/gssapi/generic/util_validate.c index bb9d0d2ecf..24a1bc5189 100644 --- a/src/lib/gssapi/generic/util_validate.c +++ b/src/lib/gssapi/generic/util_validate.c @@ -1,6 +1,7 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -10,7 +11,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -45,193 +46,193 @@ static const int one = 1; static const DBT dbtone = { (void *) &one, sizeof(one) }; typedef struct _vkey { - int type; - void *ptr; + int type; + void *ptr; } vkey; #endif -#define V_NAME 1 -#define V_CRED_ID 2 -#define V_CTX_ID 3 -#define V_LCTX_ID 4 +#define V_NAME 1 +#define V_CRED_ID 2 +#define V_CTX_ID 3 +#define V_LCTX_ID 4 /* All these functions return 0 on failure, and non-zero on success */ static int g_save(db, type, ptr) - g_set *db; + g_set *db; #ifdef HAVE_BSD_DB - int type; + int type; #else - void *type; + void *type; #endif - void *ptr; + void *ptr; { - int ret; + int ret; #ifdef HAVE_BSD_DB - DB **vdb; - vkey vk; - DBT key; + DB **vdb; + vkey vk; + DBT key; - ret = gssint_initialize_library(); - if (ret) - return 0; - ret = k5_mutex_lock(&db->mutex); - if (ret) - return 0; + ret = gssint_initialize_library(); + if (ret) + return 0; + ret = k5_mutex_lock(&db->mutex); + if (ret) + return 0; - vdb = (DB **) &db->data; + vdb = (DB **) &db->data; - if (!*vdb) - *vdb = dbopen(NULL, O_CREAT|O_RDWR, O_CREAT|O_RDWR, DB_HASH, NULL); + if (!*vdb) + *vdb = dbopen(NULL, O_CREAT|O_RDWR, O_CREAT|O_RDWR, DB_HASH, NULL); - vk.type = type; - vk.ptr = ptr; + vk.type = type; + vk.ptr = ptr; - key.data = &vk; - key.size = sizeof(vk); + key.data = &vk; + key.size = sizeof(vk); - ret = ((*((*vdb)->put))(*vdb, &key, &dbtone, 0) == 0); - k5_mutex_unlock(&db->mutex); - return ret; + ret = ((*((*vdb)->put))(*vdb, &key, &dbtone, 0) == 0); + k5_mutex_unlock(&db->mutex); + return ret; #else - g_set_elt *gs; - - ret = gssint_initialize_library(); - if (ret) - return 0; - ret = k5_mutex_lock(&db->mutex); - if (ret) - return 0; - - gs = (g_set_elt *) &db->data; - - if (!*gs) - if (g_set_init(gs)) { - k5_mutex_unlock(&db->mutex); - return(0); - } - - ret = (g_set_entry_add(gs, ptr, type) == 0); - k5_mutex_unlock(&db->mutex); - return ret; + g_set_elt *gs; + + ret = gssint_initialize_library(); + if (ret) + return 0; + ret = k5_mutex_lock(&db->mutex); + if (ret) + return 0; + + gs = (g_set_elt *) &db->data; + + if (!*gs) + if (g_set_init(gs)) { + k5_mutex_unlock(&db->mutex); + return(0); + } + + ret = (g_set_entry_add(gs, ptr, type) == 0); + k5_mutex_unlock(&db->mutex); + return ret; #endif } static int g_validate(db, type, ptr) - g_set *db; + g_set *db; #ifdef HAVE_BSD_DB - int type; + int type; #else - void *type; + void *type; #endif - void *ptr; + void *ptr; { - int ret; + int ret; #ifdef HAVE_BSD_DB - DB **vdb; - vkey vk; - DBT key, value; - - ret = k5_mutex_lock(&db->mutex); - if (ret) - return 0; - - vdb = (DB **) &db->data; - if (!*vdb) { - k5_mutex_unlock(&db->mutex); - return(0); - } - - vk.type = type; - vk.ptr = ptr; - - key.data = &vk; - key.size = sizeof(vk); - - if ((*((*vdb)->get))(*vdb, &key, &value, 0)) { - k5_mutex_unlock(&db->mutex); - return(0); - } - - k5_mutex_unlock(&db->mutex); - return((value.size == sizeof(one)) && - (*((int *) value.data) == one)); + DB **vdb; + vkey vk; + DBT key, value; + + ret = k5_mutex_lock(&db->mutex); + if (ret) + return 0; + + vdb = (DB **) &db->data; + if (!*vdb) { + k5_mutex_unlock(&db->mutex); + return(0); + } + + vk.type = type; + vk.ptr = ptr; + + key.data = &vk; + key.size = sizeof(vk); + + if ((*((*vdb)->get))(*vdb, &key, &value, 0)) { + k5_mutex_unlock(&db->mutex); + return(0); + } + + k5_mutex_unlock(&db->mutex); + return((value.size == sizeof(one)) && + (*((int *) value.data) == one)); #else - g_set_elt *gs; - void *value; - - ret = k5_mutex_lock(&db->mutex); - if (ret) - return 0; - - gs = (g_set_elt *) &db->data; - if (!*gs) { - k5_mutex_unlock(&db->mutex); - return(0); - } - - if (g_set_entry_get(gs, ptr, (void **) &value)) { - k5_mutex_unlock(&db->mutex); - return(0); - } - k5_mutex_unlock(&db->mutex); - return(value == type); + g_set_elt *gs; + void *value; + + ret = k5_mutex_lock(&db->mutex); + if (ret) + return 0; + + gs = (g_set_elt *) &db->data; + if (!*gs) { + k5_mutex_unlock(&db->mutex); + return(0); + } + + if (g_set_entry_get(gs, ptr, (void **) &value)) { + k5_mutex_unlock(&db->mutex); + return(0); + } + k5_mutex_unlock(&db->mutex); + return(value == type); #endif } static int g_delete(db, type, ptr) - g_set *db; + g_set *db; #ifdef HAVE_BSD_DB - int type; + int type; #else - void *type; + void *type; #endif - void *ptr; + void *ptr; { - int ret; + int ret; #ifdef HAVE_BSD_DB - DB **vdb; - vkey vk; - DBT key; + DB **vdb; + vkey vk; + DBT key; - ret = k5_mutex_lock(&db->mutex); - if (ret) - return 0; + ret = k5_mutex_lock(&db->mutex); + if (ret) + return 0; - vdb = (DB **) &db->data; - if (!*vdb) { - k5_mutex_unlock(&db->mutex); - return(0); - } + vdb = (DB **) &db->data; + if (!*vdb) { + k5_mutex_unlock(&db->mutex); + return(0); + } - vk.type = type; - vk.ptr = ptr; + vk.type = type; + vk.ptr = ptr; - key.data = &vk; - key.size = sizeof(vk); + key.data = &vk; + key.size = sizeof(vk); - ret = ((*((*vdb)->del))(*vdb, &key, 0) == 0); - k5_mutex_unlock(&db->mutex); - return ret; + ret = ((*((*vdb)->del))(*vdb, &key, 0) == 0); + k5_mutex_unlock(&db->mutex); + return ret; #else - g_set_elt *gs; - - ret = k5_mutex_lock(&db->mutex); - if (ret) - return 0; - - gs = (g_set_elt *) &db->data; - if (!*gs) { - k5_mutex_unlock(&db->mutex); - return(0); - } - - if (g_set_entry_delete(gs, ptr)) { - k5_mutex_unlock(&db->mutex); - return(0); - } - k5_mutex_unlock(&db->mutex); - return(1); + g_set_elt *gs; + + ret = k5_mutex_lock(&db->mutex); + if (ret) + return 0; + + gs = (g_set_elt *) &db->data; + if (!*gs) { + k5_mutex_unlock(&db->mutex); + return(0); + } + + if (g_set_entry_delete(gs, ptr)) { + k5_mutex_unlock(&db->mutex); + return(0); + } + k5_mutex_unlock(&db->mutex); + return(1); #endif } @@ -240,82 +241,81 @@ static int g_delete(db, type, ptr) /* save */ int g_save_name(vdb, name) - g_set *vdb; - gss_name_t name; + g_set *vdb; + gss_name_t name; { - return(g_save(vdb, V_NAME, (void *) name)); + return(g_save(vdb, V_NAME, (void *) name)); } int g_save_cred_id(vdb, cred) - g_set *vdb; - gss_cred_id_t cred; + g_set *vdb; + gss_cred_id_t cred; { - return(g_save(vdb, V_CRED_ID, (void *) cred)); + return(g_save(vdb, V_CRED_ID, (void *) cred)); } int g_save_ctx_id(vdb, ctx) - g_set *vdb; - gss_ctx_id_t ctx; + g_set *vdb; + gss_ctx_id_t ctx; { - return(g_save(vdb, V_CTX_ID, (void *) ctx)); + return(g_save(vdb, V_CTX_ID, (void *) ctx)); } int g_save_lucidctx_id(vdb, lctx) - g_set *vdb; - void *lctx; + g_set *vdb; + void *lctx; { - return(g_save(vdb, V_LCTX_ID, (void *) lctx)); + return(g_save(vdb, V_LCTX_ID, (void *) lctx)); } /* validate */ int g_validate_name(vdb, name) - g_set *vdb; - gss_name_t name; + g_set *vdb; + gss_name_t name; { - return(g_validate(vdb, V_NAME, (void *) name)); + return(g_validate(vdb, V_NAME, (void *) name)); } int g_validate_cred_id(vdb, cred) - g_set *vdb; - gss_cred_id_t cred; + g_set *vdb; + gss_cred_id_t cred; { - return(g_validate(vdb, V_CRED_ID, (void *) cred)); + return(g_validate(vdb, V_CRED_ID, (void *) cred)); } int g_validate_ctx_id(vdb, ctx) - g_set *vdb; - gss_ctx_id_t ctx; + g_set *vdb; + gss_ctx_id_t ctx; { - return(g_validate(vdb, V_CTX_ID, (void *) ctx)); + return(g_validate(vdb, V_CTX_ID, (void *) ctx)); } int g_validate_lucidctx_id(vdb, lctx) - g_set *vdb; - void *lctx; + g_set *vdb; + void *lctx; { - return(g_validate(vdb, V_LCTX_ID, (void *) lctx)); + return(g_validate(vdb, V_LCTX_ID, (void *) lctx)); } /* delete */ int g_delete_name(vdb, name) - g_set *vdb; - gss_name_t name; + g_set *vdb; + gss_name_t name; { - return(g_delete(vdb, V_NAME, (void *) name)); + return(g_delete(vdb, V_NAME, (void *) name)); } int g_delete_cred_id(vdb, cred) - g_set *vdb; - gss_cred_id_t cred; + g_set *vdb; + gss_cred_id_t cred; { - return(g_delete(vdb, V_CRED_ID, (void *) cred)); + return(g_delete(vdb, V_CRED_ID, (void *) cred)); } int g_delete_ctx_id(vdb, ctx) - g_set *vdb; - gss_ctx_id_t ctx; + g_set *vdb; + gss_ctx_id_t ctx; { - return(g_delete(vdb, V_CTX_ID, (void *) ctx)); + return(g_delete(vdb, V_CTX_ID, (void *) ctx)); } int g_delete_lucidctx_id(vdb, lctx) - g_set *vdb; - void *lctx; + g_set *vdb; + void *lctx; { - return(g_delete(vdb, V_LCTX_ID, (void *) lctx)); + return(g_delete(vdb, V_LCTX_ID, (void *) lctx)); } - diff --git a/src/lib/gssapi/generic/utl_nohash_validate.c b/src/lib/gssapi/generic/utl_nohash_validate.c index da20b71d6f..d221b3722e 100644 --- a/src/lib/gssapi/generic/utl_nohash_validate.c +++ b/src/lib/gssapi/generic/utl_nohash_validate.c @@ -1,7 +1,8 @@ +/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1990,1994 by the Massachusetts Institute of Technology. * All Rights Reserved. - * + * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating @@ -20,7 +21,7 @@ * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. - * + * */ /* @@ -41,81 +42,80 @@ /* save */ int g_save_name(vdb, name) - void **vdb; - gss_name_t *name; + void **vdb; + gss_name_t *name; { - return 1; + return 1; } int g_save_cred_id(vdb, cred) - void **vdb; - gss_cred_id_t *cred; + void **vdb; + gss_cred_id_t *cred; { - return 1; + return 1; } int g_save_ctx_id(vdb, ctx) - void **vdb; - gss_ctx_id_t *ctx; + void **vdb; + gss_ctx_id_t *ctx; { - return 1; + return 1; } int g_save_lucidctx_id(vdb, lctx) - void **vdb; - void *lctx; + void **vdb; + void *lctx; { - return 1; + return 1; } /* validate */ int g_validate_name(vdb, name) - void **vdb; - gss_name_t *name; + void **vdb; + gss_name_t *name; { - return 1; + return 1; } int g_validate_cred_id(vdb, cred) - void **vdb; - gss_cred_id_t *cred; + void **vdb; + gss_cred_id_t *cred; { - return 1; + return 1; } int g_validate_ctx_id(vdb, ctx) - void **vdb; - gss_ctx_id_t *ctx; + void **vdb; + gss_ctx_id_t *ctx; { - return 1; + return 1; } int g_validate_lucidctx_id(vdb, lctx) - void **vdb; - void *lctx; + void **vdb; + void *lctx; { - return 1; + return 1; } /* delete */ int g_delete_name(vdb, name) - void **vdb; - gss_name_t *name; + void **vdb; + gss_name_t *name; { - return 1; + return 1; } int g_delete_cred_id(vdb, cred) - void **vdb; - gss_cred_id_t *cred; + void **vdb; + gss_cred_id_t *cred; { - return 1; + return 1; } int g_delete_ctx_id(vdb, ctx) - void **vdb; - gss_ctx_id_t *ctx; + void **vdb; + gss_ctx_id_t *ctx; { - return 1; + return 1; } int g_delete_lucidctx_id(vdb, lctx) - void **vdb; - void *lctx; + void **vdb; + void *lctx; { - return 1; + return 1; } - |
