(gssapi_krb5_set_error_string): don't misuse the krb5_get_error_string api
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14641 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 - 2003 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1998 - 2005 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -115,13 +115,21 @@ void
|
|||||||
gssapi_krb5_set_error_string (void)
|
gssapi_krb5_set_error_string (void)
|
||||||
{
|
{
|
||||||
struct gssapi_thr_context *ctx = gssapi_get_thread_context(1);
|
struct gssapi_thr_context *ctx = gssapi_get_thread_context(1);
|
||||||
|
char *e;
|
||||||
|
|
||||||
if (ctx == NULL)
|
if (ctx == NULL)
|
||||||
return;
|
return;
|
||||||
HEIMDAL_MUTEX_lock(&ctx->mutex);
|
HEIMDAL_MUTEX_lock(&ctx->mutex);
|
||||||
if (ctx->error_string)
|
if (ctx->error_string)
|
||||||
free(ctx->error_string);
|
free(ctx->error_string);
|
||||||
ctx->error_string = krb5_get_error_string(gssapi_krb5_context);
|
e = krb5_get_error_string(gssapi_krb5_context);
|
||||||
|
if (e == NULL)
|
||||||
|
ctx->error_string = NULL;
|
||||||
|
else {
|
||||||
|
/* ignore failures, will use status code instead */
|
||||||
|
ctx->error_string = strdup(e);
|
||||||
|
krb5_free_error_string(e);
|
||||||
|
}
|
||||||
HEIMDAL_MUTEX_unlock(&ctx->mutex);
|
HEIMDAL_MUTEX_unlock(&ctx->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 - 2003 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1998 - 2005 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -115,13 +115,21 @@ void
|
|||||||
gssapi_krb5_set_error_string (void)
|
gssapi_krb5_set_error_string (void)
|
||||||
{
|
{
|
||||||
struct gssapi_thr_context *ctx = gssapi_get_thread_context(1);
|
struct gssapi_thr_context *ctx = gssapi_get_thread_context(1);
|
||||||
|
char *e;
|
||||||
|
|
||||||
if (ctx == NULL)
|
if (ctx == NULL)
|
||||||
return;
|
return;
|
||||||
HEIMDAL_MUTEX_lock(&ctx->mutex);
|
HEIMDAL_MUTEX_lock(&ctx->mutex);
|
||||||
if (ctx->error_string)
|
if (ctx->error_string)
|
||||||
free(ctx->error_string);
|
free(ctx->error_string);
|
||||||
ctx->error_string = krb5_get_error_string(gssapi_krb5_context);
|
e = krb5_get_error_string(gssapi_krb5_context);
|
||||||
|
if (e == NULL)
|
||||||
|
ctx->error_string = NULL;
|
||||||
|
else {
|
||||||
|
/* ignore failures, will use status code instead */
|
||||||
|
ctx->error_string = strdup(e);
|
||||||
|
krb5_free_error_string(e);
|
||||||
|
}
|
||||||
HEIMDAL_MUTEX_unlock(&ctx->mutex);
|
HEIMDAL_MUTEX_unlock(&ctx->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user