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:
		| @@ -160,27 +160,43 @@ OM_uint32 gss_add_cred ( | ||||
| 		goto failure; | ||||
| 	    } | ||||
|  | ||||
| 	    name = krb5_cc_get_name(gssapi_krb5_context, cred->ccache); | ||||
| 	    if (name == NULL) { | ||||
| 		*minor_status = ENOMEM; | ||||
| 		goto failure; | ||||
| 	    } | ||||
| 	    if (strcmp(type, "MEMORY") == 0) { | ||||
| 		ret = krb5_cc_gen_new(gssapi_krb5_context, &krb5_mcc_ops, | ||||
| 				      &handle->ccache); | ||||
| 		if (ret) { | ||||
| 		    *minor_status = ret; | ||||
| 		    goto failure; | ||||
| 		} | ||||
|  | ||||
| 	    asprintf(&type_name, "%s:%s", type, name); | ||||
| 	    if (type_name == NULL) { | ||||
| 		*minor_status = ENOMEM; | ||||
| 		goto failure; | ||||
| 	    } | ||||
| 		ret = krb5_cc_copy_cache(gssapi_krb5_context, cred->ccache, | ||||
| 					 handle->ccache); | ||||
| 		if (ret) { | ||||
| 		    *minor_status = ret; | ||||
| 		    goto failure; | ||||
| 		} | ||||
|  | ||||
| 	    kret = krb5_cc_resolve(gssapi_krb5_context, type_name, | ||||
| 				   &handle->ccache); | ||||
| 	    free(type_name); | ||||
| 	    if (kret) { | ||||
| 		*minor_status = kret; | ||||
| 		goto failure; | ||||
| 	    }	     | ||||
| 	    } else { | ||||
| 		name = krb5_cc_get_name(gssapi_krb5_context, cred->ccache); | ||||
| 		if (name == NULL) { | ||||
| 		    *minor_status = ENOMEM; | ||||
| 		    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); | ||||
| 	if (ret) | ||||
| 	    goto failure; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Love Hörnquist Åstrand
					Love Hörnquist Åstrand