don't overload the primary_principal == NULL as dead since that

doesn't always work
Based on patch from Jeffrey Hutzelman <jhutz@cmu.edu>, but tweek by me


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13417 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2004-03-03 20:49:34 +00:00
parent dff9e56989
commit bd852f759c

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997-2002 Kungliga Tekniska H<>gskolan * Copyright (c) 1997-2004 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -38,6 +38,7 @@ RCSID("$Id$");
typedef struct krb5_mcache { typedef struct krb5_mcache {
char *name; char *name;
unsigned int refcnt; unsigned int refcnt;
int dead;
krb5_principal primary_principal; krb5_principal primary_principal;
struct link { struct link {
krb5_creds cred; krb5_creds cred;
@@ -51,7 +52,7 @@ static struct krb5_mcache *mcc_head;
#define MCACHE(X) ((krb5_mcache *)(X)->data.data) #define MCACHE(X) ((krb5_mcache *)(X)->data.data)
#define MISDEAD(X) ((X)->primary_principal == NULL) #define MISDEAD(X) ((X)->dead)
#define MCC_CURSOR(C) ((struct link*)(C)) #define MCC_CURSOR(C) ((struct link*)(C))
@@ -90,6 +91,7 @@ mcc_alloc(const char *name)
return NULL; return NULL;
} }
m->dead = 0;
m->refcnt = 1; m->refcnt = 1;
m->primary_principal = NULL; m->primary_principal = NULL;
m->creds = NULL; m->creds = NULL;
@@ -153,9 +155,11 @@ mcc_initialize(krb5_context context,
krb5_ccache id, krb5_ccache id,
krb5_principal primary_principal) krb5_principal primary_principal)
{ {
krb5_mcache *m = MCACHE(id);
m->dead = 0;
return krb5_copy_principal (context, return krb5_copy_principal (context,
primary_principal, primary_principal,
&MCACHE(id)->primary_principal); &m->primary_principal);
} }
static krb5_error_code static krb5_error_code
@@ -196,8 +200,11 @@ mcc_destroy(krb5_context context,
} }
} }
HEIMDAL_MUTEX_unlock(&mcc_mutex); HEIMDAL_MUTEX_unlock(&mcc_mutex);
if (m->primary_principal != NULL) {
krb5_free_principal (context, m->primary_principal); krb5_free_principal (context, m->primary_principal);
m->primary_principal = NULL; m->primary_principal = NULL;
}
m->dead = 1;
l = m->creds; l = m->creds;
while (l != NULL) { while (l != NULL) {