summaryrefslogtreecommitdiffstats
path: root/src/util/profile/prof_init.c
Commit message (Collapse)AuthorAgeFilesLines
* Eliminate internal fixed-width type wrappersGreg Hudson2014-02-261-14/+12
| | | | | Directly use stdint.h names for integer types in preference to the various internal names we have made up for them.
* Assume <stdint.h> and fixed-width typesGreg Hudson2014-02-261-6/+0
| | | | | | | Make unconditional use of <stdint.h> and fixed-width types such as uint32_t. k5-plugin.h doesn't use any special integer types, so remove the conditional include block there. Nothing uses INT64_FMT/UINT64_FMT, so leave those out of k5-platform.h for now.
* Assume mutex locking cannot failGreg Hudson2013-05-141-11/+4
| | | | | | | | | | | | Locking and unlocking a non-recursive mutex is a simple memory operation and should not fail on any reasonable platform with correct usage. A pthread mutex can return EDEADLK on lock or EPERM on unlock, or EINVAL if the mutex is uninitialized, but all of these conditions would reflect serious bugs in the calling code. Change the k5_mutex_lock and k5_mutex_unlock wrappers to return void and adjust all call sites. Propagate this change through k5_cc_mutex_lock and k5_cc_mutex_unlock as well.
* Style cleanup for internal error handlingGreg Hudson2012-12-191-1/+1
| | | | | | | Fix style issues in kerrs.c and errors.c. Rename error handling functions to use shorter k5_ prefix. Eliminate an inoperable krb5int_set_error() call in gic_opte_alloc and convert the other call to use krb5_set_error_message().
* Use portable path functions when loading pluginsGreg Hudson2011-08-071-8/+19
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25075 dc483132-0cff-0310-8789-dd5450dbe970
* Fix profile_abandon() management lib_handle lockGreg Hudson2011-07-211-1/+4
| | | | | | | It wasn't unlocking the mutex after decrementing the refcount and wasn't destroying the mutex before freeing the handle. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25031 dc483132-0cff-0310-8789-dd5450dbe970
* Add support for loadable profile modulesGreg Hudson2011-07-201-29/+190
| | | | | | ticket: 6929 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25025 dc483132-0cff-0310-8789-dd5450dbe970
* Add libprofile support for vtable-backed profilesGreg Hudson2011-07-201-6/+105
| | | | | | ticket: 6929 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25024 dc483132-0cff-0310-8789-dd5450dbe970
* Fail properly when profile can't be accessedGreg Hudson2010-08-231-4/+9
| | | | | | | | | | | | | | | | Make profile_init() return EACCESS or EPERM if one of those errors was encountered when failing to open any of the specified profile files. This causes krb5_init_os_context() to fail properly when krb5.conf is unreadable, instead of treating that situation like a nonexistent krb5.conf. The library will continue to soldier on if one profile file is readable and another is not. This is deliberate as of r14116, whether or not it's a good idea. ticket: 6760 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24250 dc483132-0cff-0310-8789-dd5450dbe970
* Mark and reindent util, with some exceptionsTom Yu2009-12-071-235/+236
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23455 dc483132-0cff-0310-8789-dd5450dbe970
* make mark-cstyleTom Yu2009-10-311-17/+16
| | | | | | make reindent git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23100 dc483132-0cff-0310-8789-dd5450dbe970
* Ticket: 6286Zhanna Tsitkov2008-12-051-1/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21290 dc483132-0cff-0310-8789-dd5450dbe970
* Remove unneeded LEAN_CLIENT #define'sZhanna Tsitkov2008-12-021-2/+0
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21261 dc483132-0cff-0310-8789-dd5450dbe970
* Unsigned/signed warnings cleanupEzra Peisach2008-10-281-5/+7
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20928 dc483132-0cff-0310-8789-dd5450dbe970
* lean client changesZhanna Tsitkov2008-08-201-0/+3
| | | | | | | | | All changes are under LEAN_CLIENT macro. Application server functionality is disabled. Ticket:new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20680 dc483132-0cff-0310-8789-dd5450dbe970
* Use load/store_32_be instead of open-codingKen Raeburn2008-08-021-8/+2
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20600 dc483132-0cff-0310-8789-dd5450dbe970
* Apply patch from Apple to handle missing krb5.conf for zeroconfTom Yu2008-07-101-2/+5
| | | | | | | | situations. ticket: 5632 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20509 dc483132-0cff-0310-8789-dd5450dbe970
* Profile library should not call rw_access earlier than neededAlexandra Ellwood2008-05-271-1/+1
| | | | | | | | | | Call rw_access lazily so we only call access just before we need to write to the file to avoid calling access as often. Deprecated bit in profile structures to track writability. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20341 dc483132-0cff-0310-8789-dd5450dbe970
* After malloc/realloc/calloc failures, return ENOMEM explicitly insteadKen Raeburn2008-04-301-1/+1
| | | | | | | of reading it from errno. This may make static analysis tools less confused about when we return zero vs nonzero values. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20312 dc483132-0cff-0310-8789-dd5450dbe970
* Fix krb5_get_profile to create a new profile duplicating the list ofKen Raeburn2006-06-241-0/+33
| | | | | | | | | | | | | | | | files from the one in the provided context, instead of constructing and checking the file list from scratch. Uses a new function in the profile library, not put into the public API yet. * util/profile/prof_init.c (profile_copy): New function. * util/profile/prof_int.h (profile_copy): Declare it. * lib/krb5/os/Makefile.in (LOCALINCLUDES): Look in the profile source dir. * lib/krb5/os/init_os_ctx.c (krb5_get_profile): Replace all the previous code with a call to profile_copy. ticket: 3925 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18209 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_int.h (SIZEOF_INT, SIZEOF_SHORT, SIZEOF_LONG)[_WIN32]: Don't defineKen Raeburn2006-03-311-10/+7
| | | | | | | | | * configure.in: Don't test sizes of types. * prof_init.c: Include stdint.h and inttypes.h if available. (prof_int32): Always define as int32_t. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17815 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_init.c, profile.hin: added profile_is_modified and ↵Alexandra Ellwood2004-11-041-0/+30
| | | | | | | | profile_is_writable so that callers can check to see if profile_release() will fail before calling it ticket: 2751 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16860 dc483132-0cff-0310-8789-dd5450dbe970
* Permit exporting profile file data into a bufferKen Raeburn2004-10-271-0/+12
| | | | | | | | | | | | | | | | | | | | | * prof_file.c (profile_flush_file_data_to_buffer): New function. * profi_init.c (profile_flush_to_buffer, profile_free_buffer): New functions. * prof_parse.c (output_quoted_string): Use a callback instead of stdio calls. (dump_profile): Renamed from dump_profile_to_file. Use a callback instead of stdio calls. (dump_profile_to_file_cb): New function. (profile_write_tree_file): Updated to new internal interface. (struct prof_buf): New type. (add_data_to_buffer, dump_profile_to_buffer_cb, profile_write_tree_to_buffer): New functions. * prof_int.h (profile_write_tree_to_buffer, profile_flush_file_data_to_buffer): Declare. * profile.hin (profile_flush_to_buffer, profile_free_buffer): Declare. * libprofile.exports: Export profile_flush_to_buffer and profile_free_buffer. * profile.swg (profile_flush_to_buffer): Declare. * profile_tcl.c: Regenerated. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16838 dc483132-0cff-0310-8789-dd5450dbe970
* Allow profile library caller to write the modified data to a differentKen Raeburn2004-10-181-0/+13
| | | | | | | | | | | | | | | | | | | | file than was originally read. * prof_file.c (write_data_to_file): New function, split out from profile_flush_file_data. Add argument can_create indicating whether the old file should already exist or not. (profile_flush_file_data): Call it. (profile_flush_file_data_to_file): New function. * prof_int.h (profile_flush_file_data_to_file): Declare it. (profile_flush_file_to_file): New macro. * prof_init.c (profile_flush_to_file): New function. * profile.hin (profile_flush_to_file): Declare. * profile.swg (profile_flush_to_file): Declare. * profile_tcl.c: Regenerated. * prof_test1: Use profile_flush_to_file instead of profile_flush, and reload from the new filename. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16825 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_file.c, prof_int.h, prof_set.c: Remove support for non-SHARE_TREE_DATAKen Raeburn2004-10-151-4/+2
| | | | | | | | | | | | | | | | | | | | case. * prof_int.h (struct _prf_data_t): Change filespec to a trailing char array. Add a length field for the filespec. (profile_make_prf_data): Declare. (profile_lock_global, profile_unlock_global): Prototypes need argument lists. * prof_file.c: Include stddef.h. (scan_shared_trees_locked, scan_shared_trees_unlocked): New functions. (r_access, rw_access): Now take const_profile_filespec_t arg. (profile_make_prf_data): New function. (profile_open_file): Scan trees at beginning and end. Use profile_make_prf_data to allocate and initialize storage. (profile_dereference_data, profile_free_file_data): Scan trees. (profile_ser_size, profile_ser_externalize): Filespec is never null. * prof_set.c (rw_setup): Use profile_make_prf_data to allocate and initialize storage. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16822 dc483132-0cff-0310-8789-dd5450dbe970
* Fix small memory leak in repeated krb5 context creation and deletion:Ken Raeburn2004-10-131-2/+0
| | | | | | | | * prof_init.c (profile_init): Don't add error table here. * prof_file.c (profile_library_initializer): Add it here. (profile_library_finalizer): Remove it here. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16815 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_init.c (prof_int32): If long is 4 bytes and int is not, then use long,Ken Raeburn2004-02-191-1/+1
| | | | | | not int, for prof_int32. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16105 dc483132-0cff-0310-8789-dd5450dbe970
* ProtoizeKen Raeburn2004-02-191-34/+15
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16099 dc483132-0cff-0310-8789-dd5450dbe970
* move prof-int.h to be the first include file in order to obtainJeffrey Altman2003-12-141-2/+2
| | | | | | | | | platform specific preprocessor variables used to selectively import other header files ticket: 2068 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15921 dc483132-0cff-0310-8789-dd5450dbe970
* * profile.hin, prof_file.c (profile_flush_file_data): Stop copying the ↵Alexandra Ellwood2003-03-061-70/+0
| | | | | | 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
* Merge some Mac-specific changes from meeroh's branch:Ken Raeburn2002-12-311-18/+70
| | | | | | | | | | | | | | | | | | | | | | | | * profile.hin: Don't test MACINTOSH any more. On Mac OS X, include TargetConditionals.h, set some pragmas, define COPY_RESOURCE_FORK, and error out if TARGET_RT_MAC_CFM is defined; don't set the old m68k CFM pragmas. Always use PROFILE_USES_PATHS code, don't test or define it. (FSp_profile_init, FSp_profile_init_path): Declare, on Mac OS X. * prof_int.h (NO_SYS_TYPES_H, NO_SYS_STAT_H) [macintosh]: Don't define these. * prof_file.c: Always inclued sys/types.h and sys/stat.h. (GetMacOSTempFilespec): Deleted. (profile_flush_file_data) [COPY_RESOURCE_FORK]: Copy Mac resource fork from old file to new before renaming. (rw_access, profile_update_file_data, profile_flush_file_data, profile_free_file_data): Assume PROFILE_USES_PATHS, don't test. * prof_init.c (profile_ser_size, profile_ser_externalize, profile_ser_internalize): Likewise. (FSp_profile_init, FSp_profile_init_path): Define, on MacOS X. * profile.exp: Add FSp_* functions. * prof_file.c (r_access): New function. (profile_open_file): Use it. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15073 dc483132-0cff-0310-8789-dd5450dbe970
* Checkpoint first step of merge.Ken Raeburn2002-12-071-19/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moved per-file data into a separate object from the profile handle. Dropped some old MacOS 9 code. * prof_int.h: Include Mac OS X versions of header files if appropriate. Only include prof_err.h if profile.h doesn't define ERROR_TABLE_BASE_prof. (struct _prf_data_t): Move most of contents of _prf_file_t here. Add reference count. (prf_data_t): New typedef. (struct _prf_file_t): Include an array of one _prf_data_t structure. * prof_file.c (profile_open_file): Fill in "data" field. Drop some old Mac specific code. (profile_flush_file_data): Renamed from profile_flush_file, now takes prf_data_t argument. (profile_flush_file_data): Likewise. (profile_free_file): Now calls profile_free_file_data. (profile_free_file_data): New function, with most of old profile_free_file code. * prof_init.c (profile_init_path): Removed old Mac version. (profile_ser_size, profile_ser_externalize): Get file data from new "data" field. * prof_set.c (rw_setup, profile_update_relation, profile_clear_relation, profile_rename_section, profile_add_relation): Likewise. * prof_tree.c (profile_node_iterator): Likewise. * test_profile.c (do_batchmode): Likewise. * prof_int.h (profile_flush_file): Now a macro. * prof_err.et (PROF_MAGIC_FILE_DATA): New error code value. ticket: 1237 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15037 dc483132-0cff-0310-8789-dd5450dbe970
* prof_init.c, prof_tree.c: Fixed calls to ↵Alexandra Ellwood2002-01-231-1/+1
| | | | | | profile_update_file/profile_open_file to handle the possibility that we have lost permission to read one of the configuration files in the file list (say it's in AFS). We should only fail catastrophically if we can't read all of the files in the profile git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14116 dc483132-0cff-0310-8789-dd5450dbe970
* Danilo says we can get rid of the DLLIMP stuff nowKen Raeburn2001-10-041-6/+6
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13775 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_init.c: Cleanup internal type warnings in calls to profile_initEzra Peisach2000-07-241-3/+5
| | | | | | | | | | | | * test_parse.c (main): Cast arguments to error_message. * prof_file.c (profile_open_file): Variable with argument to malloc should be unsigned. * profile.hin: Revert changes to const_profile_filespect_t and profile_filespec_t to preserve interface. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12585 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_init.c (profile_init_path): Use profile_filespec_t insteadEzra Peisach2000-06-261-2/+2
| | | | | | | | | | | of char *. (change provided by Nathan Neulinger <nneul@umr.edu>) * profile.hin: Make definition of const_profile_filespec_t to be based on profile_filespec_t. Compile time warnings cleanup. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12436 dc483132-0cff-0310-8789-dd5450dbe970
* Danilo's const_profile_filespec_t and other changes from 1.1 branchKen Raeburn1999-09-011-4/+4
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11766 dc483132-0cff-0310-8789-dd5450dbe970
* If no filespecs are provided, then return an empty profileJeffrey Altman1999-07-231-9/+13
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11590 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_int.h (profile_t): Delete typedef, since Miro changed prof_int.h toKen Raeburn1999-07-211-3/+3
| | | | | | | | include profile.h, which also has the typedef. * prof_file.c, prof_init.c: Fix typos and missed variable and type name changes from Miro's patch. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11571 dc483132-0cff-0310-8789-dd5450dbe970
* Profile library now uses MacOS native file specifiers on MacOS, and file ↵Miro Jurisic1999-07-211-13/+44
| | | | | | paths on all other OSes git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11569 dc483132-0cff-0310-8789-dd5450dbe970
* Check whether profile is valid before partying on itDanilo Almeida1999-06-231-0/+6
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11527 dc483132-0cff-0310-8789-dd5450dbe970
* Fix memory leak in profile_init_path()Danilo Almeida1999-06-171-0/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11517 dc483132-0cff-0310-8789-dd5450dbe970
* prof_init.c (profile_abandon): New function which frees the profileTheodore Tso1999-04-141-0/+13
| | | | | | | | | | handle and throwing away any changes that might have been made before they are flushed to disk. prof_file.c (profile_close_file): Move functionality of freeing the profile file to the new function profile_free_file(). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11355 dc483132-0cff-0310-8789-dd5450dbe970
* test_profile.c: Added ability to test profile set functions, and in aTheodore Tso1999-03-031-0/+13
| | | | | | | | | | | | | | | | | | | | | | batch mode. prof_init.c (profile_flush): Add new public function for flushing changes made to the profile. prof_parse.c (profile_write_tree_file): Add official internal function for flushing out a profile tree to a FILE *. configure.in, prof_file.c (rw_access): Add new function which checks to see whether we have read/write access, and emulate this for losing non-POSIX OS's. prof_file.c (profile_flush_file): Add support for writing modified profile file's. Call profile_flush_file from profile_close_file(). Also fixed minor bugs in prof_tree.c which affected renaming sections and modifying existing relations. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11237 dc483132-0cff-0310-8789-dd5450dbe970
* prof_tree.c: Add new functions profile_get_node_name,Theodore Tso1999-03-031-3/+6
| | | | | | | | | | | | | | | | | | | | | profile_get_node_value, profile_find_node, profile_remove_node, profile_set_relation_value, profile_rename_node. Rewrite profile_find_node_relation and profile_find_node_subsection in terms of profile_find_node. prof_set.c, Makefile.in: Add a new file which exports the public interfaces for setting profile entries. prof_get.c, prof_init.c, prof_int.h: Add the KRB5_DLLIMP and KRB5_CALLCONV to all of the various profile routines so they can be properly exported via a Windows DLL. prof_int.h: Add definition for the flags in the profile structure. prof_err.et: Add new error codes PROF_SET_SECTION_VALUE, PROF_EINVAL, PROF_READ_ONLY, and PROF_EXISTS. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11236 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_init.c (profile_init): Fix a problem whereby if the lastGeoffrey King1998-11-051-3/+6
| | | | | | | pathname in a list of pathnames was nonexistent, an error would be returned that they were all nonexistent. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11015 dc483132-0cff-0310-8789-dd5450dbe970
* Makefile.in: Added prof_get.c to the list of files to be compiledTheodore Tso1998-11-031-325/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | profile.hin: Added declarations for profile_free_list(), profile_get_relation_names(), and profile_get_subsection_names(). (These are new public interfaces to the profile library.) prof_int.h: Removed the profile_section_t structure, which was used only by the now-defunct prof_section.c file. Added the internal interfaces for the new public interfaces. Removed unused declarations which were never implemented(profile_get, profile_update). prof_init.c: Moved all of the profile querying functions (profile_get_values(), profile_get_value(), etc.) to prof_get.c. In the process, removed the really bletcherous (and badly implemented) profile_get_first_values(), which did nothing like what the named implied. Also added to prof_get.c new functions profile_get_subsection_names() and profile_get_relation_names(). (profile_ser_internalize): Rewrote error handling to be clearer, and removed a bug where memory was not freed correctly in an error case. (profile_init): If a list of pathnames is passed in, profile_init will now try to open all of them, now that we've defined query fallback semantics in prof_get.c prof_parse.c: Fix lint warning. prof_tree.c (profile_find_node_relation, profile_find_node_subsection): Allow the returned value or subsection field to be NULL (in case the caller isn't interested in getting the returned value or subsection, and only cares about getting the name). (profile_delete_node_relation, profile_delete_interior_node_relation): Removed these functions and replaced it with profile_remove_node(), which takes a boolean argument section_flag. (profile_find_node_name): Removed this function. (This was a Cygnus/Fusion special used by the now removed profile_find_first_values() function.) test_profile.c: Added commands to test the new profile_get_subsection_names() and profile_get_relation_names() interfaces. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11011 dc483132-0cff-0310-8789-dd5450dbe970
* Export profile_get_values() for krb4 library (win16/win32)Richard Basch1997-02-181-1/+2
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9888 dc483132-0cff-0310-8789-dd5450dbe970
* Only include stdlib.h if it's availableTheodore Tso1996-06-241-0/+2
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8547 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_init.c (profile_init_path): Add const declarationsEzra Peisach1995-10-021-2/+2
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6923 dc483132-0cff-0310-8789-dd5450dbe970