Updated Windows section to use filespecs instead of filenames
authorJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 23 Jul 1999 03:20:38 +0000 (03:20 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 23 Jul 1999 03:20:38 +0000 (03:20 +0000)
Add support for storing the existence of a memory profile in the krb5_context

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11588 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/init_os_ctx.c

index ee62eb96d254ff5addc9582cfc10f5f5b64e814e..668336c2b32a59aa58159a9c08a176a85121c042 100644 (file)
@@ -259,9 +259,9 @@ os_get_default_config_files(pfiles, secure)
     if (!name)
         return KRB5_CONFIG_CANTOPEN; /* should never happen */
     
-    filenames = malloc(2 * sizeof(char *));
-    filenames[0] = name;
-    filenames[1] = 0;
+    files = malloc(2 * sizeof(char *));
+    files[0] = name;
+    files[1] = 0;
 #else /* !_MSDOS && !_WIN32 */
     char* filepath = 0;
     int n_entries, i;
@@ -322,14 +322,23 @@ os_init_paths(ctx, secure)
     profile_filespec_t *files = 0;
 
     ctx->profile_secure = secure;
+    ctx->profile_in_memory = 0;
 
     retval = os_get_default_config_files(&files, secure);
 
-    if (!retval)
+    if (!retval) {
         retval = profile_init(files, &ctx->profile);
-
-    if (files)
-        free_filespecs(files);
+     
+        /* if none of the filenames can be opened use an empty profile */
+        if ( retval == ENOENT ) {
+            retval = profile_init(NULL,&ctx->profile);
+            if ( !retval )
+                ctx->profile_in_memory = 1;
+        }   
+
+        if (files)
+            free_filespecs(files);
+    }
 
     if (retval)
         ctx->profile = 0;
@@ -448,13 +457,17 @@ krb5_os_free_context(ctx)
        if (!os_ctx)
                return;
 
-       if (os_ctx->default_ccname)
+        if (os_ctx->default_ccname) {
                free(os_ctx->default_ccname);
+                os_ctx->default_ccname = 0;
+        }
 
        os_ctx->magic = 0;
        free(os_ctx);
        ctx->os_context = 0;
 
-       if (ctx->profile)
+        if (ctx->profile) {
            profile_release(ctx->profile);
+            ctx->profile = 0;
+        }
 }