diff options
author | Alexandra Ellwood <lxs@mit.edu> | 2003-03-06 18:48:18 +0000 |
---|---|---|
committer | Alexandra Ellwood <lxs@mit.edu> | 2003-03-06 18:48:18 +0000 |
commit | 8e3533a09fb43b88d8c071bad5353576918c7842 (patch) | |
tree | a6338d69cd9a0ff86258533da7652a6a1b1e7d7a | |
parent | 86251dc01f3cccbbaa60338585231a99ec1cca84 (diff) | |
download | krb5-8e3533a09fb43b88d8c071bad5353576918c7842.zip krb5-8e3533a09fb43b88d8c071bad5353576918c7842.tar.gz krb5-8e3533a09fb43b88d8c071bad5353576918c7842.tar.bz2 |
* 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
-rw-r--r-- | src/util/profile/ChangeLog | 14 | ||||
-rw-r--r-- | src/util/profile/prof_FSp_glue.c | 91 | ||||
-rw-r--r-- | src/util/profile/prof_file.c | 18 | ||||
-rw-r--r-- | src/util/profile/prof_init.c | 70 | ||||
-rw-r--r-- | src/util/profile/prof_int.h | 7 | ||||
-rw-r--r-- | src/util/profile/profile.hin | 11 |
6 files changed, 107 insertions, 104 deletions
diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog index 2359565..396058b 100644 --- a/src/util/profile/ChangeLog +++ b/src/util/profile/ChangeLog @@ -1,3 +1,17 @@ +2003-03-06 Alexandra Ellwood <lxs@mit.edu> + * 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 <raeburn@mit.edu> * 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 0000000..511c85f --- /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 <Kerberos/FSpUtils.h> +#include <limits.h> + +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 90866b9..8a4d95d 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 af7c6a3..76a4943 100644 --- a/src/util/profile/prof_init.c +++ b/src/util/profile/prof_init.c @@ -10,10 +10,6 @@ #endif #include <errno.h> -#if TARGET_OS_MAC -#include <Kerberos/FullPOSIXPath.h> -#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 6edbb64..06fce87 100644 --- a/src/util/profile/prof_int.h +++ b/src/util/profile/prof_int.h @@ -3,18 +3,15 @@ */ #include <time.h> +#include <stdio.h> #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) #include <TargetConditionals.h> -#include <Kerberos/com_err.h> -#include <Kerberos/FullPOSIXPath.h> -#include <CoreServices/CoreServices.h> #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 75ed03d..156375c 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); |