use thread specific storage to set/get the kerberos error message
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12494 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		| @@ -35,8 +35,6 @@ | ||||
|  | ||||
| RCSID("$Id$"); | ||||
|  | ||||
| static char *krb5_error_string; | ||||
|  | ||||
| static char * | ||||
| calling_error(OM_uint32 v) | ||||
| { | ||||
| @@ -116,14 +114,29 @@ supplementary_error(OM_uint32 v) | ||||
| void | ||||
| gssapi_krb5_set_error_string (void) | ||||
| { | ||||
|     krb5_error_string = krb5_get_error_string(gssapi_krb5_context); | ||||
|     struct gssapi_thr_context *ctx = gssapi_get_thread_context(1); | ||||
|  | ||||
|     if (ctx == NULL) | ||||
| 	return; | ||||
|     HEIMDAL_MUTEX_lock(&ctx->mutex); | ||||
|     if (ctx->error_string) | ||||
| 	free(ctx->error_string); | ||||
|     ctx->error_string = krb5_get_error_string(gssapi_krb5_context); | ||||
|     HEIMDAL_MUTEX_unlock(&ctx->mutex); | ||||
| } | ||||
|  | ||||
| char * | ||||
| gssapi_krb5_get_error_string (void) | ||||
| { | ||||
|     char *ret = krb5_error_string; | ||||
|     krb5_error_string = NULL; | ||||
|     struct gssapi_thr_context *ctx = gssapi_get_thread_context(0); | ||||
|     char *ret; | ||||
|  | ||||
|     if (ctx == NULL) | ||||
| 	return NULL; | ||||
|     HEIMDAL_MUTEX_lock(&ctx->mutex); | ||||
|     ret = ctx->error_string; | ||||
|     ctx->error_string = NULL; | ||||
|     HEIMDAL_MUTEX_unlock(&ctx->mutex); | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Love Hörnquist Åstrand
					Love Hörnquist Åstrand