From: Ken Raeburn Date: Sun, 14 Mar 2004 06:47:13 +0000 (+0000) Subject: Make the set type separate from the set-element (linked list node) type X-Git-Tag: krb5-1.4-beta1~546 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bd213527dab6a355867a95c104352fa101a9d2e8;p=krb5.git Make the set type separate from the set-element (linked list node) type * generic/gssapiP_generic.h (g_set): New struct type. (G_SET_INIT): New macro. * generic/util_validate.c (g_save, g_validate, g_delete): Change first argument to take a g_set * rather than void **; use the address of the void pointer from the structure. (g_save_name, g_save_cred_id, g_save_ctx_id, g_validate_name, g_validate_cred_id, g_validate_ctx_id, g_delete_name, g_delete_cred_id, g_delete_ctx_id): Updated first argument type. * genericgssapiP_generic.h: Declarations updated. * krb5/gssapi_krb5.c (kg_vdb): Change type to g_set and initialize. * krb5/gssapiP_krb5.h (kg_vdb): Declaration updated. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16166 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/gssapi/generic/ChangeLog b/src/lib/gssapi/generic/ChangeLog index 48a609d0d..fb380c249 100644 --- a/src/lib/gssapi/generic/ChangeLog +++ b/src/lib/gssapi/generic/ChangeLog @@ -4,6 +4,16 @@ non-_elt versions. * util_set.c, util_validate.c: Uses updated. + * gssapiP_generic.h (g_set): New struct type. + (G_SET_INIT): New macro. + * util_validate.c (g_save, g_validate, g_delete): Change first + argument to take a g_set * rather than void **; use the address of + the void pointer from the structure. + (g_save_name, g_save_cred_id, g_save_ctx_id, g_validate_name, + g_validate_cred_id, g_validate_ctx_id, g_delete_name, + g_delete_cred_id, g_delete_ctx_id): Updated first argument type. + * gssapiP_generic.h: Declarations updated. + 2004-02-08 Ken Raeburn * util_ordering.c (g_queue_externalize, g_queue_internalize): diff --git a/src/lib/gssapi/generic/gssapiP_generic.h b/src/lib/gssapi/generic/gssapiP_generic.h index 9db3d25ad..ef2d6dd30 100644 --- a/src/lib/gssapi/generic/gssapiP_generic.h +++ b/src/lib/gssapi/generic/gssapiP_generic.h @@ -133,6 +133,11 @@ typedef UINT64_TYPE gssint_uint64; #define g_strdup gssint_g_strdup typedef struct _g_set_elt *g_set_elt; +typedef struct { + /* k5_mutex_t mutex; */ + void *data; +} g_set; +#define G_SET_INIT { /* K5_MUTEX_INITIALIZER, */ 0 } int g_set_init (g_set_elt *s); int g_set_destroy (g_set_elt *s); @@ -140,17 +145,17 @@ int g_set_entry_add (g_set_elt *s, void *key, void *value); int g_set_entry_delete (g_set_elt *s, void *key); int g_set_entry_get (g_set_elt *s, void *key, void **value); -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 (g_set *vdb, gss_name_t *name); +int g_save_cred_id (g_set *vdb, gss_cred_id_t *cred); +int g_save_ctx_id (g_set *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 (g_set *vdb, gss_name_t *name); +int g_validate_cred_id (g_set *vdb, gss_cred_id_t *cred); +int g_validate_ctx_id (g_set *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 (g_set *vdb, gss_name_t *name); +int g_delete_cred_id (g_set *vdb, gss_cred_id_t *cred); +int g_delete_ctx_id (g_set *vdb, gss_ctx_id_t *ctx); int g_make_string_buffer (const char *str, gss_buffer_t buffer); diff --git a/src/lib/gssapi/generic/util_validate.c b/src/lib/gssapi/generic/util_validate.c index da050247d..4c0c6d848 100644 --- a/src/lib/gssapi/generic/util_validate.c +++ b/src/lib/gssapi/generic/util_validate.c @@ -35,6 +35,7 @@ #endif #include #include + #ifdef HAVE_BSD_DB #include #include @@ -55,7 +56,7 @@ typedef struct _vkey { /* All these functions return 0 on failure, and non-zero on success */ static int g_save(db, type, ptr) - void **db; + g_set *db; #ifdef HAVE_BSD_DB int type; #else @@ -64,7 +65,7 @@ static int g_save(db, type, ptr) void *ptr; { #ifdef HAVE_BSD_DB - DB **vdb = (DB **) db; + DB **vdb = (DB **) &db->data; vkey vk; DBT key; @@ -79,7 +80,7 @@ static int g_save(db, type, ptr) return((*((*vdb)->put))(*vdb, &key, &dbtone, 0) == 0); #else - g_set_elt *gs = (g_set_elt *) db; + g_set_elt *gs = (g_set_elt *) &db->data; if (!*gs) if (g_set_init(gs)) @@ -90,7 +91,7 @@ static int g_save(db, type, ptr) } static int g_validate(db, type, ptr) - void **db; + g_set *db; #ifdef HAVE_BSD_DB int type; #else @@ -99,7 +100,7 @@ static int g_validate(db, type, ptr) void *ptr; { #ifdef HAVE_BSD_DB - DB **vdb = (DB **) db; + DB **vdb = (DB **) &db->data; vkey vk; DBT key, value; @@ -118,7 +119,7 @@ static int g_validate(db, type, ptr) return((value.size == sizeof(one)) && (*((int *) value.data) == one)); #else - g_set_elt *gs = (g_set_elt *) db; + g_set_elt *gs = (g_set_elt *) &db->data; void *value; if (!*gs) @@ -132,7 +133,7 @@ static int g_validate(db, type, ptr) } static int g_delete(db, type, ptr) - void **db; + g_set *db; #ifdef HAVE_BSD_DB int type; #else @@ -141,7 +142,7 @@ static int g_delete(db, type, ptr) void *ptr; { #ifdef HAVE_BSD_DB - DB **vdb = (DB **) db; + DB **vdb = (DB **) &db->data; vkey vk; DBT key; @@ -156,7 +157,7 @@ static int g_delete(db, type, ptr) return((*((*vdb)->del))(*vdb, &key, 0) == 0); #else - g_set_elt *gs = (g_set_elt *) db; + g_set_elt *gs = (g_set_elt *) &db->data; if (!*gs) return(0); @@ -173,19 +174,19 @@ static int g_delete(db, type, ptr) /* save */ int g_save_name(vdb, name) - void **vdb; + g_set *vdb; gss_name_t *name; { return(g_save(vdb, V_NAME, (void *) name)); } int g_save_cred_id(vdb, cred) - void **vdb; + g_set *vdb; gss_cred_id_t *cred; { return(g_save(vdb, V_CRED_ID, (void *) cred)); } int g_save_ctx_id(vdb, ctx) - void **vdb; + g_set *vdb; gss_ctx_id_t *ctx; { return(g_save(vdb, V_CTX_ID, (void *) ctx)); @@ -194,19 +195,19 @@ int g_save_ctx_id(vdb, ctx) /* validate */ int g_validate_name(vdb, name) - void **vdb; + g_set *vdb; gss_name_t *name; { return(g_validate(vdb, V_NAME, (void *) name)); } int g_validate_cred_id(vdb, cred) - void **vdb; + g_set *vdb; gss_cred_id_t *cred; { return(g_validate(vdb, V_CRED_ID, (void *) cred)); } int g_validate_ctx_id(vdb, ctx) - void **vdb; + g_set *vdb; gss_ctx_id_t *ctx; { return(g_validate(vdb, V_CTX_ID, (void *) ctx)); @@ -215,19 +216,19 @@ int g_validate_ctx_id(vdb, ctx) /* delete */ int g_delete_name(vdb, name) - void **vdb; + g_set *vdb; gss_name_t *name; { return(g_delete(vdb, V_NAME, (void *) name)); } int g_delete_cred_id(vdb, cred) - void **vdb; + g_set *vdb; gss_cred_id_t *cred; { return(g_delete(vdb, V_CRED_ID, (void *) cred)); } int g_delete_ctx_id(vdb, ctx) - void **vdb; + g_set *vdb; gss_ctx_id_t *ctx; { return(g_delete(vdb, V_CTX_ID, (void *) ctx)); diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog index 6e981487c..72e5c54ef 100644 --- a/src/lib/gssapi/krb5/ChangeLog +++ b/src/lib/gssapi/krb5/ChangeLog @@ -1,3 +1,8 @@ +2004-03-14 Ken Raeburn + + * gssapi_krb5.c (kg_vdb): Change type to g_set and initialize. + * gssapiP_krb5.h (kg_vdb): Declaration updated. + 2004-03-08 Ezra Peisach * gssapiP_krb5.h: Add prototype for gss_krb5int_unseal_token_v3. diff --git a/src/lib/gssapi/krb5/gssapiP_krb5.h b/src/lib/gssapi/krb5/gssapiP_krb5.h index dc1c3fa96..2fc18c03f 100644 --- a/src/lib/gssapi/krb5/gssapiP_krb5.h +++ b/src/lib/gssapi/krb5/gssapiP_krb5.h @@ -198,7 +198,7 @@ typedef struct _krb5_gss_ctx_id_rec { #endif } krb5_gss_ctx_id_rec, *krb5_gss_ctx_id_t; -extern void *kg_vdb; +extern g_set kg_vdb; /* helper macros */ diff --git a/src/lib/gssapi/krb5/gssapi_krb5.c b/src/lib/gssapi/krb5/gssapi_krb5.c index be750a749..de85a3a7b 100644 --- a/src/lib/gssapi/krb5/gssapi_krb5.c +++ b/src/lib/gssapi/krb5/gssapi_krb5.c @@ -124,7 +124,7 @@ const gss_OID_set_desc * const gss_mech_set_krb5 = oidsets+0; const gss_OID_set_desc * const gss_mech_set_krb5_old = oidsets+1; const gss_OID_set_desc * const gss_mech_set_krb5_both = oidsets+2; -void *kg_vdb = NULL; +g_set kg_vdb = G_SET_INIT; static char *kg_ccache_name = NULL; /** default credential support */