summaryrefslogtreecommitdiff
path: root/source3/lib/netapi
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-01-08 11:49:35 +0100
committerGünther Deschner <gd@samba.org>2008-01-08 11:59:01 +0100
commitab216a1b4ea585faa42be4908a24a475173683d2 (patch)
tree47ca22b0ed413e88b07800b3369dc1b46162c08e /source3/lib/netapi
parentc6576503c9298f1123ac4902e2b72453745d3566 (diff)
downloadsamba-ab216a1b4ea585faa42be4908a24a475173683d2.tar.gz
samba-ab216a1b4ea585faa42be4908a24a475173683d2.tar.bz2
samba-ab216a1b4ea585faa42be4908a24a475173683d2.zip
Fix crash bug when strequal is used too late in libnetapi_free.
Guenther (This used to be commit ba2b8a310e1d6f78116350e24c17ae4db08b9bed)
Diffstat (limited to 'source3/lib/netapi')
-rw-r--r--source3/lib/netapi/netapi.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c
index 61b51909c9..3516105353 100644
--- a/source3/lib/netapi/netapi.c
+++ b/source3/lib/netapi/netapi.c
@@ -103,6 +103,14 @@ NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx)
NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
{
+
+ if (ctx->krb5_cc_env) {
+ char *env = getenv(KRB5_ENV_CCNAME);
+ if (env && (strequal(ctx->krb5_cc_env, env))) {
+ unsetenv(KRB5_ENV_CCNAME);
+ }
+ }
+
gfree_names();
gfree_loadparm();
gfree_case_tables();
@@ -113,11 +121,6 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
secrets_shutdown();
regdb_close();
- if (ctx->krb5_cc_env &&
- (strequal(ctx->krb5_cc_env, getenv(KRB5_ENV_CCNAME)))) {
- unsetenv(KRB5_ENV_CCNAME);
- }
-
TALLOC_FREE(ctx);
TALLOC_FREE(frame);