From: Theodore Tso Date: Fri, 12 Mar 1999 20:33:28 +0000 (+0000) Subject: Check to make sure the context is valid and return an error if it X-Git-Tag: krb5-1.1-beta1~291 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0d3268d4bd5a4f76e38db9b7c5bceb6372f350fe;p=krb5.git Check to make sure the context is valid and return an error if it isn't. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11273 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/os/ccdefname.c b/src/lib/krb5/os/ccdefname.c index 18a7b9983..fccdbf833 100644 --- a/src/lib/krb5/os/ccdefname.c +++ b/src/lib/krb5/os/ccdefname.c @@ -84,6 +84,9 @@ static krb5_error_code get_from_os(char *name_buf, int name_size) char *prefix = krb5_cc_dfl_ops->prefix; int len; + if (get_from_registry(name_buf, name_size) == 0) + return 0; + if (!strcmp(prefix, "FILE") || !strcmp(prefix, "STDIO")) { GetWindowsDirectory (defname, sizeof(defname)-7); strcat (defname, "\\krb5cc"); @@ -129,6 +132,9 @@ krb5_cc_set_default_name(context, name) krb5_error_code retval; krb5_os_context os_ctx; + if (!context || context->magic != KV5M_CONTEXT) + return KV5M_CONTEXT; + os_ctx = context->os_context; if (!name) @@ -161,10 +167,12 @@ krb5_cc_default_name(context) { krb5_os_context os_ctx; + if (!context || context->magic != KV5M_CONTEXT) + return NULL; + os_ctx = context->os_context; if (!os_ctx->default_ccname) krb5_cc_set_default_name(context, NULL); return(os_ctx->default_ccname); } -