Replaced Kerberos5GlobalsLib calls with CCAPI v3 calls on MacOS
authorMiro Jurisic <meeroh@mit.edu>
Mon, 22 Nov 1999 22:49:33 +0000 (22:49 +0000)
committerMiro Jurisic <meeroh@mit.edu>
Mon, 22 Nov 1999 22:49:33 +0000 (22:49 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11907 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/ChangeLog
src/lib/krb5/os/ccdefname.c

index 11af1db4e5c737f0b44ccb67ef11dcb0fa316147..589ebafa33b175bc9411317343276fad6e7eaa86 100644 (file)
@@ -1,3 +1,8 @@
+1999-11-22  Miro Jurisic  <meeroh@mit.edu>
+
+       * ccdefname.c (get_from_os): Replaced Kerberos5GlobalsLib calls
+       with CCAPI v3 calls
+
 1999-11-02  Ken Raeburn  <raeburn@mit.edu>
 
        * localaddr.c (krb5_os_localaddr): Conditionalize INET6 support on
index b6eb4aea0c26360c666034b9d159e117ff6f2003..53e788859113e1c68ff8ee949e1b40250db53e3f 100644 (file)
@@ -32,7 +32,7 @@
 #include <stdio.h>
 
 #ifdef macintosh
-#include "Krb5Globals.h"
+#include "CCache.h"
 #endif
 
 #if defined(_WIN32)
@@ -190,11 +190,34 @@ static krb5_error_code get_from_os(char *name_buf, int name_size)
 
 static krb5_error_code get_from_os(char *name_buf, int name_size)
 {
-       if (name_size < 4)
-               return ENOMEM;
-       Krb5GlobalsGetDefaultCacheName (name_buf + 4, name_size - 4);
-       memcpy (name_buf, "API:", 4);
-       return 0;
+       krb5_error_code result = 0;
+       cc_context_t cc_context = NULL;
+       cc_string_t default_name = NULL;
+
+       cc_int32 ccerr = cc_initialize (&cc_context, ccapi_version_3, NULL, NULL);
+       if (ccerr == ccNoError) {
+               ccerr = cc_context_get_default_ccache_name (cc_context, &default_name);
+       }
+       
+       if (ccerr == ccNoError) {
+               if (strlen (default_name -> data) + 5 > name_size) {
+                       result = ENOMEM;
+                       goto cleanup;
+               } else {
+                       sprintf (name_buf, "API:%s", default_name -> data);
+               }
+       }
+       
+cleanup:
+       if (cc_context != NULL) {
+               cc_context_release (cc_context);
+       }
+       
+       if (default_name != NULL) {
+               cc_string_release (default_name);
+       }
+       
+       return result;
 }
 
 #else