From 8e3533a09fb43b88d8c071bad5353576918c7842 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Thu, 6 Mar 2003 18:48:18 +0000 Subject: [PATCH] * profile.hin, prof_file.c (profile_flush_file_data): Stop copying the resource fork. We stopped writing resources to the krb5 configuration in KfM 4.5.x. In KfM 5.0 will no longer read preferences from the resource fork so we can destroy it on copy. * prof-int.h: No longer include MoreFiles. Removed framework style includes for Kerberos headers. * prof_FSp_glue.c, prof_init.c, profile.hin: Moved Mac FSSpec-based functions into a separate file so they will only be built with KfM. These functions will be exported but not in the headers because they are deprecated git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15239 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/profile/ChangeLog | 14 +++++ src/util/profile/prof_FSp_glue.c | 91 ++++++++++++++++++++++++++++++++ src/util/profile/prof_file.c | 18 ------- src/util/profile/prof_init.c | 70 ------------------------ src/util/profile/prof_int.h | 7 +-- src/util/profile/profile.hin | 11 ---- 6 files changed, 107 insertions(+), 104 deletions(-) create mode 100644 src/util/profile/prof_FSp_glue.c diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog index 23595650e..396058b7b 100644 --- a/src/util/profile/ChangeLog +++ b/src/util/profile/ChangeLog @@ -1,3 +1,17 @@ +2003-03-06 Alexandra Ellwood + * profile.hin, prof_file.c (profile_flush_file_data): Stop copying + the resource fork. We stopped writing resources to the krb5 + configuration in KfM 4.5.x. In KfM 5.0 will no longer read + preferences from the resource fork so we can destroy it on copy. + + * prof-int.h: No longer include MoreFiles. Removed framework style + includes for Kerberos headers. + + * prof_FSp_glue.c, prof_init.c, profile.hin: Moved Mac FSSpec-based + functions into a separate file so they will only be built with KfM. + These functions will be exported but not in the headers because + they are deprecated. + 2003-01-17 Ken Raeburn * prof_file.c (profile_flush_file_data) [_WIN32]: Don't call diff --git a/src/util/profile/prof_FSp_glue.c b/src/util/profile/prof_FSp_glue.c new file mode 100644 index 000000000..511c85f15 --- /dev/null +++ b/src/util/profile/prof_FSp_glue.c @@ -0,0 +1,91 @@ +/* + * prof_FSp_glue.c --- Deprecated FSSpec functions. Mac-only. + */ + +#include "prof_int.h" + +#include +#include + +long KRB5_CALLCONV FSp_profile_init (const FSSpec* files, profile_t *ret_profile); + +long KRB5_CALLCONV FSp_profile_init_path (const FSSpec* files, profile_t *ret_profile); + +errcode_t KRB5_CALLCONV +FSp_profile_init(files, ret_profile) + const FSSpec* files; + profile_t *ret_profile; +{ + unsigned int fileCount = 0; + const FSSpec *nextSpec; + profile_filespec_t *pathArray = NULL; + unsigned int i; + errcode_t retval = 0; + + for (nextSpec = files; ; nextSpec++) { + if ((nextSpec -> vRefNum == 0) && + (nextSpec -> parID == 0) && + (StrLength (nextSpec -> name) == 0)) + break; + fileCount++; + } + + pathArray = (profile_filespec_t *) malloc ((fileCount + 1) * sizeof(const_profile_filespec_t)); + if (pathArray == NULL) { + retval = ENOMEM; + } + + if (retval == 0) { + for (i = 0; i < fileCount + 1; i++) { + pathArray [i] = NULL; + } + } + + if (retval == 0) { + for (i = 0; i < fileCount; i++) { + OSStatus err = noErr; + + if (err == noErr) { + pathArray[i] = (char *) malloc (sizeof(char) * PATH_MAX); + if (pathArray[i] == NULL) { + err = memFullErr; + } + } + /* convert the FSSpec to an path */ + if (err == noErr) { + err = FSSpecToPOSIXPath (&files[i], pathArray[i], PATH_MAX); + } + + if (err == memFullErr) { + retval = ENOMEM; + break; + } else if (err != noErr) { + retval = ENOENT; + break; + } + } + } + + if (retval == 0) { + retval = profile_init ((const_profile_filespec_t *) pathArray, + ret_profile); + } + + if (pathArray != NULL) { + for (i = 0; i < fileCount; i++) { + if (pathArray [i] != 0) + free (pathArray [i]); + } + free (pathArray); + } + + return retval; +} + +errcode_t KRB5_CALLCONV +FSp_profile_init_path(files, ret_profile) + const FSSpec* files; + profile_t *ret_profile; +{ + return FSp_profile_init (files, ret_profile); +} diff --git a/src/util/profile/prof_file.c b/src/util/profile/prof_file.c index 90866b913..8a4d95d71 100644 --- a/src/util/profile/prof_file.c +++ b/src/util/profile/prof_file.c @@ -285,24 +285,6 @@ errcode_t profile_flush_file_data(data) goto errout; } -#ifdef COPY_RESOURCE_FORK - { - FSSpec from; - FSSpec to; - OSErr err = FSpLocationFromFullPOSIXPath (data -> filespec, &from); - if (err == noErr) { - err = FSpLocationFromFullPOSIXPath (new_file, &to); - } - if (err == noErr) { - err = FSpResourceForkCopy (&from, &to); - } - if (err != noErr) { - retval = ENOENT; - goto end; - } - } -#endif - unlink(old_file); if (make_hard_link(data->filespec, old_file) == 0) { /* Okay, got the hard link. Yay. Now we've got our diff --git a/src/util/profile/prof_init.c b/src/util/profile/prof_init.c index af7c6a3ec..76a4943f2 100644 --- a/src/util/profile/prof_init.c +++ b/src/util/profile/prof_init.c @@ -10,10 +10,6 @@ #endif #include -#if TARGET_OS_MAC -#include -#endif - #include "prof_int.h" /* Find a 4-byte integer type */ @@ -129,72 +125,6 @@ profile_init_path(filepath, ret_profile) return retval; } -#if TARGET_OS_MAC -KRB5_DLLIMP errcode_t KRB5_CALLCONV -FSp_profile_init(files, ret_profile) - const FSSpec* files; - profile_t *ret_profile; -{ - UInt32 fileCount = 0; - const FSSpec* nextSpec; - char** pathArray = NULL; - UInt32 i; - errcode_t retval = 0; - - for (nextSpec = files; ; nextSpec++) { - if ((nextSpec -> vRefNum == 0) && - (nextSpec -> parID == 0) && - (StrLength (nextSpec -> name) == 0)) - break; - fileCount++; - } - - pathArray = malloc ((fileCount + 1) * sizeof (char*)); - if (pathArray == NULL) { - retval = ENOMEM; - } - - if (retval == 0) { - for (i = 0; i < fileCount + 1; i++) { - pathArray [i] = NULL; - } - - for (i = 0; i < fileCount; i++) { - OSErr err = FSpGetFullPOSIXPath (&files [i], &pathArray [i]); - if (err == memFullErr) { - retval = ENOMEM; - break; - } else if (err != noErr) { - retval = ENOENT; - break; - } - } - } - - if (retval == 0) { - retval = profile_init (pathArray, ret_profile); - } - - if (pathArray != NULL) { - for (i = 0; i < fileCount; i++) { - if (pathArray [i] != 0) - free (pathArray [i]); - } - free (pathArray); - } - - return retval; -} - -KRB5_DLLIMP errcode_t KRB5_CALLCONV -FSp_profile_init_path(files, ret_profile) - const FSSpec* files; - profile_t *ret_profile; -{ - return FSp_profile_init (files, ret_profile); -} -#endif /* TARGET_OS_MAC */ - errcode_t KRB5_CALLCONV profile_flush(profile) profile_t profile; diff --git a/src/util/profile/prof_int.h b/src/util/profile/prof_int.h index 6edbb64ca..06fce8757 100644 --- a/src/util/profile/prof_int.h +++ b/src/util/profile/prof_int.h @@ -3,18 +3,15 @@ */ #include +#include #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) #include -#include -#include -#include #define USE_PTHREADS #define PROFILE_SUPPORTS_FOREIGN_NEWLINES #define SHARE_TREE_DATA -#else -#include "com_err.h" #endif +#include "com_err.h" #include "profile.h" #if defined(_WIN32) diff --git a/src/util/profile/profile.hin b/src/util/profile/profile.hin index 75ed03d50..156375c81 100644 --- a/src/util/profile/profile.hin +++ b/src/util/profile/profile.hin @@ -21,8 +21,6 @@ #pragma enumsalwaysint on #endif #pragma options align=mac68k - /* We use file paths as unique file identifiers */ - #define COPY_RESOURCE_FORK 1 #endif #ifndef KRB5_CALLCONV @@ -54,15 +52,6 @@ long KRB5_CALLCONV profile_init long KRB5_CALLCONV profile_init_path (const_profile_filespec_list_t filelist, profile_t *ret_profile); -/* On Mac Carbon, also provide FSSpec variants */ -#if TARGET_OS_MAC && defined(__FILES__) -long KRB5_CALLCONV FSp_profile_init - (const FSSpec* files, profile_t *ret_profile); - -long KRB5_CALLCONV FSp_profile_init_path - (const FSSpec* files, profile_t *ret_profile); -#endif - long KRB5_CALLCONV profile_flush (profile_t profile); -- 2.26.2