If its a MEMORY cc, make a copy. We need to do this since now

gss_release_cred will destroy the cred. This should be really be
solved a better way.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12982 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2003-10-07 04:08:57 +00:00
parent 9b8678e016
commit 535b4f1e94
2 changed files with 68 additions and 36 deletions

View File

@@ -160,27 +160,43 @@ OM_uint32 gss_add_cred (
goto failure; goto failure;
} }
name = krb5_cc_get_name(gssapi_krb5_context, cred->ccache); if (strcmp(type, "MEMORY") == 0) {
if (name == NULL) { ret = krb5_cc_gen_new(gssapi_krb5_context, &krb5_mcc_ops,
*minor_status = ENOMEM; &handle->ccache);
goto failure; if (ret) {
} *minor_status = ret;
goto failure;
}
asprintf(&type_name, "%s:%s", type, name); ret = krb5_cc_copy_cache(gssapi_krb5_context, cred->ccache,
if (type_name == NULL) { handle->ccache);
*minor_status = ENOMEM; if (ret) {
goto failure; *minor_status = ret;
} goto failure;
}
kret = krb5_cc_resolve(gssapi_krb5_context, type_name, } else {
&handle->ccache); name = krb5_cc_get_name(gssapi_krb5_context, cred->ccache);
free(type_name); if (name == NULL) {
if (kret) { *minor_status = ENOMEM;
*minor_status = kret; goto failure;
goto failure; }
}
asprintf(&type_name, "%s:%s", type, name);
if (type_name == NULL) {
*minor_status = ENOMEM;
goto failure;
}
kret = krb5_cc_resolve(gssapi_krb5_context, type_name,
&handle->ccache);
free(type_name);
if (kret) {
*minor_status = kret;
goto failure;
}
}
} }
ret = gss_create_empty_oid_set(minor_status, &handle->mechanisms); ret = gss_create_empty_oid_set(minor_status, &handle->mechanisms);
if (ret) if (ret)
goto failure; goto failure;

View File

@@ -160,27 +160,43 @@ OM_uint32 gss_add_cred (
goto failure; goto failure;
} }
name = krb5_cc_get_name(gssapi_krb5_context, cred->ccache); if (strcmp(type, "MEMORY") == 0) {
if (name == NULL) { ret = krb5_cc_gen_new(gssapi_krb5_context, &krb5_mcc_ops,
*minor_status = ENOMEM; &handle->ccache);
goto failure; if (ret) {
} *minor_status = ret;
goto failure;
}
asprintf(&type_name, "%s:%s", type, name); ret = krb5_cc_copy_cache(gssapi_krb5_context, cred->ccache,
if (type_name == NULL) { handle->ccache);
*minor_status = ENOMEM; if (ret) {
goto failure; *minor_status = ret;
} goto failure;
}
kret = krb5_cc_resolve(gssapi_krb5_context, type_name, } else {
&handle->ccache); name = krb5_cc_get_name(gssapi_krb5_context, cred->ccache);
free(type_name); if (name == NULL) {
if (kret) { *minor_status = ENOMEM;
*minor_status = kret; goto failure;
goto failure; }
}
asprintf(&type_name, "%s:%s", type, name);
if (type_name == NULL) {
*minor_status = ENOMEM;
goto failure;
}
kret = krb5_cc_resolve(gssapi_krb5_context, type_name,
&handle->ccache);
free(type_name);
if (kret) {
*minor_status = kret;
goto failure;
}
}
} }
ret = gss_create_empty_oid_set(minor_status, &handle->mechanisms); ret = gss_create_empty_oid_set(minor_status, &handle->mechanisms);
if (ret) if (ret)
goto failure; goto failure;