From 1df855ceda7a579c822e281f27723ebe55a42654 Mon Sep 17 00:00:00 2001 From: Mark Eichin Date: Fri, 10 Jun 1994 19:02:23 +0000 Subject: [PATCH] "downgrade" to classic C, tweak headers a bit git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3715 dc483132-0cff-0310-8789-dd5450dbe970 --- .../gssapi/generic/display_com_err_status.c | 8 +- src/lib/gssapi/generic/display_major_status.c | 41 +++++---- src/lib/gssapi/generic/gssapi.h | 92 ++++++++++--------- src/lib/gssapi/generic/gssapiP_generic.h | 52 +++++------ src/lib/gssapi/generic/release_buffer.c | 6 +- src/lib/gssapi/generic/release_oid_set.c | 6 +- src/lib/gssapi/generic/util_buffer.c | 4 +- src/lib/gssapi/generic/util_canonhost.c | 8 +- src/lib/gssapi/generic/util_dup.c | 4 +- src/lib/gssapi/generic/util_oid.c | 4 +- src/lib/gssapi/generic/util_token.c | 30 ++++-- src/lib/gssapi/generic/util_val_nohash.c | 36 ++++++-- 12 files changed, 168 insertions(+), 123 deletions(-) diff --git a/src/lib/gssapi/generic/display_com_err_status.c b/src/lib/gssapi/generic/display_com_err_status.c index 0a36f91b4..08ba6d435 100644 --- a/src/lib/gssapi/generic/display_com_err_status.c +++ b/src/lib/gssapi/generic/display_com_err_status.c @@ -44,10 +44,10 @@ static const char * const no_error = "No error"; if status_type == GSS_C_MECH_CODE, return the output from error_message() */ -OM_uint32 -g_display_com_err_status(OM_uint32 *minor_status, - OM_uint32 status_value, - gss_buffer_t status_string) +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; { status_string->length = 0; status_string->value = NULL; diff --git a/src/lib/gssapi/generic/display_major_status.c b/src/lib/gssapi/generic/display_major_status.c index 0216cf116..19d8b3355 100644 --- a/src/lib/gssapi/generic/display_major_status.c +++ b/src/lib/gssapi/generic/display_major_status.c @@ -102,8 +102,10 @@ static const char * const unknown_error = "Unknown %s (field = %d)"; /**/ -int display_unknown(const char *kind, OM_uint32 value, - gss_buffer_t buffer) +int display_unknown(kind, value, buffer) + const char *kind; + OM_uint32 value; + gss_buffer_t buffer; { int len; char *str; @@ -122,10 +124,10 @@ int display_unknown(const char *kind, OM_uint32 value, /* code should be set to the calling error field */ -static OM_uint32 - display_calling(OM_uint32 *minor_status, - OM_uint32 code, - gss_buffer_t status_string) +static OM_uint32 display_calling(minor_status, code, status_string) + OM_uint32 *minor_status; + OM_uint32 code; + gss_buffer_t status_string; { const char *str; @@ -147,10 +149,10 @@ static OM_uint32 /* code should be set to the routine error field */ -static OM_uint32 - display_routine(OM_uint32 *minor_status, - OM_uint32 code, - gss_buffer_t status_string) +static OM_uint32 display_routine(minor_status, code, status_string) + OM_uint32 *minor_status; + OM_uint32 code; + gss_buffer_t status_string; { const char *str; @@ -172,10 +174,10 @@ static OM_uint32 /* code should be set to the bit offset (log_2) of a supplementary info bit */ -static OM_uint32 - display_bit(OM_uint32 *minor_status, - OM_uint32 code, - gss_buffer_t status_string) +static OM_uint32 display_bit(minor_status, code, status_string) + OM_uint32 *minor_status; + OM_uint32 code; + gss_buffer_t status_string; { const char *str; @@ -203,11 +205,12 @@ static OM_uint32 message_context > 2 : print supplementary info bit (message_context-2) */ -OM_uint32 -g_display_major_status(OM_uint32 *minor_status, - OM_uint32 status_value, - int *message_context, - gss_buffer_t status_string) +OM_uint32 g_display_major_status(minor_status, status_value, + message_context, status_string) + OM_uint32 *minor_status; + OM_uint32 status_value; + int *message_context; + gss_buffer_t status_string; { OM_uint32 ret, tmp; int bit; diff --git a/src/lib/gssapi/generic/gssapi.h b/src/lib/gssapi/generic/gssapi.h index c2a9af05f..946003116 100644 --- a/src/lib/gssapi/generic/gssapi.h +++ b/src/lib/gssapi/generic/gssapi.h @@ -23,7 +23,13 @@ #ifndef _GSSAPI_H_ #define _GSSAPI_H_ +/* for general config: */ +#include +/* for prototype-related config: */ +#include +#ifndef NO_STDLIB_H #include +#endif #include /* @@ -145,7 +151,7 @@ typedef struct gss_channel_bindings_struct { * Expiration time of 2^32-1 seconds means infinite lifetime for a * credential or security context */ -#define GSS_C_INDEFINITE 0xffffffffu +#define GSS_C_INDEFINITE 0xffffffff /* Major status codes */ @@ -230,7 +236,7 @@ typedef struct gss_channel_bindings_struct { */ OM_uint32 gss_acquire_cred - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_name_t, /* desired_name */ OM_uint32, /* time_req */ gss_OID_set, /* desired_mechs */ @@ -238,15 +244,15 @@ OM_uint32 gss_acquire_cred gss_cred_id_t*, /* output_cred_handle */ gss_OID_set*, /* actual_mechs */ OM_uint32* /* time_rec */ - ); + )); OM_uint32 gss_release_cred - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_cred_id_t* /* cred_handle */ - ); + )); OM_uint32 gss_init_sec_context - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_cred_id_t, /* claimant_cred_handle */ gss_ctx_id_t*, /* context_handle */ gss_name_t, /* target_name */ @@ -260,10 +266,10 @@ OM_uint32 gss_init_sec_context gss_buffer_t, /* output_token */ int*, /* ret_flags */ OM_uint32* /* time_rec */ - ); + )); OM_uint32 gss_accept_sec_context - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_ctx_id_t*, /* context_handle */ gss_cred_id_t, /* verifier_cred_handle */ gss_buffer_t, /* input_token_buffer */ @@ -275,122 +281,122 @@ OM_uint32 gss_accept_sec_context int*, /* ret_flags */ OM_uint32*, /* time_rec */ gss_cred_id_t* /* delegated_cred_handle */ - ); + )); OM_uint32 gss_process_context_token - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_ctx_id_t, /* context_handle */ gss_buffer_t /* token_buffer */ - ); + )); OM_uint32 gss_delete_sec_context - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_ctx_id_t*, /* context_handle */ gss_buffer_t /* output_token */ - ); + )); OM_uint32 gss_context_time - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_ctx_id_t, /* context_handle */ OM_uint32* /* time_rec */ - ); + )); OM_uint32 gss_sign - (OM_uint32*, /* minor_status */ +PROTOTYPE( (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 gss_verify - (OM_uint32*, /* minor_status */ +PROTOTYPE( (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 gss_seal - (OM_uint32*, /* minor_status */ +PROTOTYPE( (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 gss_unseal - (OM_uint32*, /* minor_status */ +PROTOTYPE( (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 gss_display_status - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ OM_uint32, /* status_value */ int, /* status_type */ const_gss_OID, /* mech_type */ int*, /* message_context */ gss_buffer_t /* status_string */ - ); + )); OM_uint32 gss_indicate_mechs - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_OID_set* /* mech_set */ - ); + )); OM_uint32 gss_compare_name - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_name_t, /* name1 */ gss_name_t, /* name2 */ int* /* name_equal */ - ); + )); OM_uint32 gss_display_name - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_name_t, /* input_name */ gss_buffer_t, /* output_name_buffer */ gss_OID* /* output_name_type */ - ); + )); OM_uint32 gss_import_name - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_buffer_t, /* input_name_buffer */ const_gss_OID, /* input_name_type */ gss_name_t* /* output_name */ - ); + )); OM_uint32 gss_release_name - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_name_t* /* input_name */ - ); + )); OM_uint32 gss_release_buffer - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_buffer_t /* buffer */ - ); + )); OM_uint32 gss_release_oid_set - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_OID_set* /* set */ - ); + )); OM_uint32 gss_inquire_cred - (OM_uint32 *, /* minor_status */ +PROTOTYPE( (OM_uint32 *, /* minor_status */ gss_cred_id_t, /* cred_handle */ gss_name_t *, /* name */ OM_uint32 *, /* lifetime */ int *, /* cred_usage */ gss_OID_set * /* mechanisms */ - ); + )); OM_uint32 gss_inquire_context - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_ctx_id_t, /* context_handle */ gss_name_t*, /* initiator_name */ gss_name_t*, /* acceptor_name */ @@ -398,7 +404,7 @@ OM_uint32 gss_inquire_context gss_OID*, /* mech_type */ int*, /* ret_flags */ int* /* locally_initiated */ - ); + )); #endif /* _GSSAPI_H_ */ diff --git a/src/lib/gssapi/generic/gssapiP_generic.h b/src/lib/gssapi/generic/gssapiP_generic.h index 7626ce411..6a640f3ce 100644 --- a/src/lib/gssapi/generic/gssapiP_generic.h +++ b/src/lib/gssapi/generic/gssapiP_generic.h @@ -81,53 +81,53 @@ /** helper functions **/ -int g_save_name(void **vdb, gss_name_t *name); -int g_save_cred_id(void **vdb, gss_cred_id_t *cred); -int g_save_ctx_id(void **vdb, gss_ctx_id_t *ctx); +int g_save_name PROTOTYPE((void **vdb, gss_name_t *name)); +int g_save_cred_id PROTOTYPE((void **vdb, gss_cred_id_t *cred)); +int g_save_ctx_id PROTOTYPE((void **vdb, gss_ctx_id_t *ctx)); -int g_validate_name(void **vdb, gss_name_t *name); -int g_validate_cred_id(void **vdb, gss_cred_id_t *cred); -int g_validate_ctx_id(void **vdb, gss_ctx_id_t *ctx); +int g_validate_name PROTOTYPE((void **vdb, gss_name_t *name)); +int g_validate_cred_id PROTOTYPE((void **vdb, gss_cred_id_t *cred)); +int g_validate_ctx_id PROTOTYPE((void **vdb, gss_ctx_id_t *ctx)); -int g_delete_name(void **vdb, gss_name_t *name); -int g_delete_cred_id(void **vdb, gss_cred_id_t *cred); -int g_delete_ctx_id(void **vdb, gss_ctx_id_t *ctx); +int g_delete_name PROTOTYPE((void **vdb, gss_name_t *name)); +int g_delete_cred_id PROTOTYPE((void **vdb, gss_cred_id_t *cred)); +int g_delete_ctx_id PROTOTYPE((void **vdb, gss_ctx_id_t *ctx)); -int g_make_string_buffer(const char *str, gss_buffer_t buffer); +int g_make_string_buffer PROTOTYPE((const char *str, gss_buffer_t buffer)); -int g_copy_OID_set(const gss_OID_set_desc * const in, gss_OID_set *out); +int g_copy_OID_set PROTOTYPE((const gss_OID_set_desc * const in, gss_OID_set *out)); -int g_token_size(const_gss_OID mech, unsigned int body_size); +int g_token_size PROTOTYPE((const_gss_OID mech, unsigned int body_size)); -void g_make_token_header(const_gss_OID mech, int body_size, - unsigned char **buf, int tok_type); +void g_make_token_header PROTOTYPE((const_gss_OID mech, int body_size, + unsigned char **buf, int tok_type)); -int g_verify_token_header(const_gss_OID mech, int *body_size, - unsigned char **buf, int tok_type, int toksize); +int g_verify_token_header PROTOTYPE((const_gss_OID mech, int *body_size, + unsigned char **buf, int tok_type, int toksize)); -OM_uint32 g_display_major_status(OM_uint32 *minor_status, +OM_uint32 g_display_major_status PROTOTYPE((OM_uint32 *minor_status, OM_uint32 status_value, int *message_context, - gss_buffer_t status_string); + gss_buffer_t status_string)); -OM_uint32 g_display_com_err_status(OM_uint32 *minor_status, +OM_uint32 g_display_com_err_status PROTOTYPE((OM_uint32 *minor_status, OM_uint32 status_value, - gss_buffer_t status_string); + gss_buffer_t status_string)); -char *g_canonicalize_host(char *hostname); +char *g_canonicalize_host PROTOTYPE((char *hostname)); -char *g_strdup(char *str); +char *g_strdup PROTOTYPE((char *str)); /** declarations of internal name mechanism functions **/ OM_uint32 generic_gss_release_buffer - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_buffer_t /* buffer */ - ); + )); OM_uint32 generic_gss_release_oid_set - (OM_uint32*, /* minor_status */ +PROTOTYPE( (OM_uint32*, /* minor_status */ gss_OID_set* /* set */ - ); + )); #endif /* _GSSAPIP_GENERIC_H_ */ diff --git a/src/lib/gssapi/generic/release_buffer.c b/src/lib/gssapi/generic/release_buffer.c index ecb8eab08..f3b5fa794 100644 --- a/src/lib/gssapi/generic/release_buffer.c +++ b/src/lib/gssapi/generic/release_buffer.c @@ -26,9 +26,9 @@ #include "gssapiP_generic.h" -OM_uint32 -generic_gss_release_buffer(OM_uint32 *minor_status, - gss_buffer_t buffer) +OM_uint32 generic_gss_release_buffer(minor_status, buffer) + OM_uint32 *minor_status; + gss_buffer_t buffer; { if ((buffer->length) && (buffer->value)) { diff --git a/src/lib/gssapi/generic/release_oid_set.c b/src/lib/gssapi/generic/release_oid_set.c index e821e6eec..7b7754530 100644 --- a/src/lib/gssapi/generic/release_oid_set.c +++ b/src/lib/gssapi/generic/release_oid_set.c @@ -26,9 +26,9 @@ * $Id$ */ -OM_uint32 -generic_gss_release_oid_set(OM_uint32 *minor_status, - gss_OID_set *set) +OM_uint32 generic_gss_release_oid_set(minor_status, set) + OM_uint32 *minor_status; + gss_OID_set *set; { *minor_status = 0; diff --git a/src/lib/gssapi/generic/util_buffer.c b/src/lib/gssapi/generic/util_buffer.c index 63c10522e..e715834d9 100644 --- a/src/lib/gssapi/generic/util_buffer.c +++ b/src/lib/gssapi/generic/util_buffer.c @@ -31,7 +31,9 @@ make sure that buffer is consistent (release'able) when this function exits, no matter what the exit value */ -int g_make_string_buffer(const char *str, gss_buffer_t buffer) +int g_make_string_buffer(str, buffer) + const char *str; + gss_buffer_t buffer; { buffer->length = strlen(str)+1; diff --git a/src/lib/gssapi/generic/util_canonhost.c b/src/lib/gssapi/generic/util_canonhost.c index 277c07836..34a7e48c5 100644 --- a/src/lib/gssapi/generic/util_canonhost.c +++ b/src/lib/gssapi/generic/util_canonhost.c @@ -26,14 +26,14 @@ /* This file could be OS specific */ +#include "gssapiP_generic.h" + #include #include #include -#include - -#include "gssapiP_generic.h" -char *g_canonicalize_host(char *hostname) +char *g_canonicalize_host(hostname) + char *hostname; { struct hostent *hent; char *haddr; diff --git a/src/lib/gssapi/generic/util_dup.c b/src/lib/gssapi/generic/util_dup.c index 4da654719..f8a86b08b 100644 --- a/src/lib/gssapi/generic/util_dup.c +++ b/src/lib/gssapi/generic/util_dup.c @@ -25,9 +25,9 @@ */ #include "gssapiP_generic.h" -#include -char *g_strdup(char *str) +char *g_strdup(str) + char *str; { char *ret; diff --git a/src/lib/gssapi/generic/util_oid.c b/src/lib/gssapi/generic/util_oid.c index 40f730a36..961a6243f 100644 --- a/src/lib/gssapi/generic/util_oid.c +++ b/src/lib/gssapi/generic/util_oid.c @@ -27,7 +27,9 @@ */ int -g_copy_OID_set(const gss_OID_set_desc * const in, gss_OID_set *out) +g_copy_OID_set(in, out) + const gss_OID_set_desc * const in; + gss_OID_set *out; { gss_OID_set copy; int i; diff --git a/src/lib/gssapi/generic/util_token.c b/src/lib/gssapi/generic/util_token.c index 3fad4b9e5..c25b9413d 100644 --- a/src/lib/gssapi/generic/util_token.c +++ b/src/lib/gssapi/generic/util_token.c @@ -51,7 +51,8 @@ first two inner bytes, which indicate the token type. The token */ -static int der_length_size(int length) +static int der_length_size(length) + int length; { if (length < (1<<7)) return(1); @@ -65,7 +66,9 @@ static int der_length_size(int length) return(5); } -static void der_write_length(unsigned char **buf, int length) +static void der_write_length(buf, length) + unsigned char **buf; + int length; { if (length < (1<<7)) { *(*buf)++ = (unsigned char) length; @@ -84,7 +87,9 @@ static void der_write_length(unsigned char **buf, int length) /* returns decoded length, or < 0 on failure. Advances buf and decrements bufsize */ -static int der_read_length(unsigned char **buf, int *bufsize) +static int der_read_length(buf, bufsize) + unsigned char **buf; + int *bufsize; { unsigned char sf; int ret; @@ -110,7 +115,9 @@ static int der_read_length(unsigned char **buf, int *bufsize) /* returns the length of a token, given the mech oid and the body size */ -int g_token_size(const_gss_OID mech, unsigned int body_size) +int g_token_size(mech, body_size) + const_gss_OID mech; + unsigned int body_size; { /* set body_size to sequence contents size */ body_size += 4 + mech->length; @@ -120,8 +127,11 @@ int g_token_size(const_gss_OID mech, unsigned int 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(const_gss_OID mech, int body_size, - unsigned char **buf, int tok_type) +void g_make_token_header(mech, body_size, buf, tok_type) + const_gss_OID mech; + int body_size; + unsigned char **buf; + int tok_type; { *(*buf)++ = 0x60; der_write_length(buf, 4 + mech->length + body_size); @@ -136,8 +146,12 @@ void g_make_token_header(const_gss_OID mech, int body_size, leaving buf advanced past the token header, and setting body_size to the number of remaining bytes */ -int g_verify_token_header(const_gss_OID mech, int *body_size, - unsigned char **buf, int tok_type, int toksize) +int g_verify_token_header(mech, body_size, buf, tok_type, toksize) + const_gss_OID mech; + int *body_size; + unsigned char **buf; + int tok_type; + int toksize; { int seqsize; gss_OID_desc toid; diff --git a/src/lib/gssapi/generic/util_val_nohash.c b/src/lib/gssapi/generic/util_val_nohash.c index 3a6ff7e45..824d4e1eb 100644 --- a/src/lib/gssapi/generic/util_val_nohash.c +++ b/src/lib/gssapi/generic/util_val_nohash.c @@ -38,45 +38,63 @@ /* save */ -int g_save_name(void **vdb, gss_name_t *name) +int g_save_name(vdb, name) + void **vdb; + gss_name_t *name; { return 1; } -int g_save_cred_id(void **vdb, gss_cred_id_t *cred) +int g_save_cred_id(vdb, cred) + void **vdb; + gss_cred_id_t *cred; { return 1; } -int g_save_ctx_id(void **vdb, gss_ctx_id_t *ctx) +int g_save_ctx_id(vdb, ctx) + void **vdb; + gss_ctx_id_t *ctx; { return 1; } /* validate */ -int g_validate_name(void **vdb, gss_name_t *name) +int g_validate_name(vdb, name) + void **vdb; + gss_name_t *name; { return 1; } -int g_validate_cred_id(void **vdb, gss_cred_id_t *cred) +int g_validate_cred_id(vdb, cred) + void **vdb; + gss_cred_id_t *cred; { return 1; } -int g_validate_ctx_id(void **vdb, gss_ctx_id_t *ctx) +int g_validate_ctx_id(vdb, ctx) + void **vdb; + gss_ctx_id_t *ctx; { return 1; } /* delete */ -int g_delete_name(void **vdb, gss_name_t *name) +int g_delete_name(vdb, name) + void **vdb; + gss_name_t *name; { return 1; } -int g_delete_cred_id(void **vdb, gss_cred_id_t *cred) +int g_delete_cred_id(vdb, cred) + void **vdb; + gss_cred_id_t *cred; { return 1; } -int g_delete_ctx_id(void **vdb, gss_ctx_id_t *ctx) +int g_delete_ctx_id(vdb, ctx) + void **vdb; + gss_ctx_id_t *ctx; { return 1; } -- 2.26.2