summaryrefslogtreecommitdiffstats
path: root/src/util/profile
Commit message (Collapse)AuthorAgeFilesLines
...
* possible profile null pointer deref in threaded appKen Raeburn2005-02-234-8/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | There seems to be a problem with a null pointer popping up when profile_node_iterator reads ...->data->root to start walking through the contents. Don't have a lot of details, but I've got some patches that might tighten things up a little. * prof_tree.c (profile_node_iterator): Check that the root node pointer is not null; raise assertion failure if it is. * prof_int.h: Include k5-platform.h. (struct _prf_data_t): Reorder fields, and insert some padding. * prof_file.c (scan_shared_trees_locked): Check that the "root" field isn't null. (profile_open_file): Update the in-memory file contents after updating the refcount instead of before. (profile_update_file_data): If the root node in the file data is null, always do the update. Check that it's not null before returning a success indication. (profile_dereference_data_locked): Scan linked list of file data objects for sanity check, before and after. (profile_dereference_data_locked): Don't do it here. ticket: new status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17106 dc483132-0cff-0310-8789-dd5450dbe970
* * et/error_message.c (com_err_initialize, com_err_terminate): IfKen Raeburn2005-02-092-1/+17
| | | | | | | | | SHOW_INITFINI_FUNCS is defined, print tracing messages. * profile/prof_file.c (profile_library_initializer, profile_library_finalizer): If SHOW_INITFINI_FUNCS is defined, print tracing messages. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17094 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_file.c (profile_open_file): If mutex creation fails, free storageKen Raeburn2005-01-142-1/+4
| | | | | | | | | directly instead of calling profile_close_file. ticket: 2878 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17035 dc483132-0cff-0310-8789-dd5450dbe970
* profile code never destroys its per-file mutexesKen Raeburn2005-01-142-6/+12
| | | | | | | | | | * prof_file.c (profile_free_file_data): Destroy mutex before freeing containing structure. ticket: new target_version: 1.4 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17029 dc483132-0cff-0310-8789-dd5450dbe970
* run "make depend"Ken Raeburn2004-12-301-26/+34
| | | | | | | | In most library directories, this just affects where the line breaks are. In most other directories, it's just dropping a trailing blank line. One or two files really do have updated dependencies. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16987 dc483132-0cff-0310-8789-dd5450dbe970
* insufficient locking in profile re-reading caseKen Raeburn2004-12-152-1/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If profiles are open and iterators in use while the on-disk file is being modified (see tests/threads/prof1.c), the re-reading of the file can cause data to be freed up. The iterator code does no locking and assumes that the profile node tree won't be touched. During our Monday meeting we discussed changing the iterator code to "snapshot" the current state of the file if it were modified, so that a more consistent picture could be returned, essentially by bumping a reference count for the life of the iterator object. The reference count I was thinking of turns out to be used for a different purpose; we'd have to add another layer of indirection, another ref count, and another mutex to accomplish this. There might be a more reasonable way to go about it, but I don't want to tackle it for 1.4 when we're already shipping beta releases. This patch just adds locking to the current iterator code so that the file data can't be replaced while the iterator is being processed. The inconsistent-view issue remains. * prof_tree.c (profile_node_iterator): When the iterator has a current file, lock it, and unlock it before changing it or returning. ticket: new status: resolved target_version: 1.4 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16932 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_init.c, profile.hin: added profile_is_modified and ↵Alexandra Ellwood2004-11-043-0/+41
| | | | | | | | 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
* * prof_set.c: profile calls which set values should not fail if file is not ↵Alexandra Ellwood2004-11-042-3/+7
| | | | | | | | writable. You can now write to a different file with profile_flush_to_file() or buffer with profile_flush_to_buffer() ticket: 2750 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16858 dc483132-0cff-0310-8789-dd5450dbe970
* call stat less often on krb5.confKen Raeburn2004-10-303-0/+37
| | | | | | | | | | | | | | | | | | | | Changes suggested by lxs to reduce stat frequency to once per second. In parallel loops creating and destroying krb5 contexts on Mac OS X, this seems to improve performance by 10%, though it's hard to be sure because the times are variable. * prof_int.h (STAT_ONCE_PER_SECOND): Define. (struct _prf_data_t) [STAT_ONCE_PER_SECOND]: New field LAST_STAT. * prof_file.c (scan_shared_trees_locked, scan_shared_trees_unlocked): Redefine to do nothing for now. (profile_update_file_data) [STAT_ONCE_PER_SECOND]: If the current time is the same time as the last stat of the file, just return; otherwise, save away the current time. ticket: new status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16847 dc483132-0cff-0310-8789-dd5450dbe970
* Permit exporting profile file data into a bufferKen Raeburn2004-10-279-32/+215
| | | | | | | | | | | | | | | | | | | | | * 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
* * prof_file.c (profile_update_file_data): When resetting flags, preserve SHAREDKen Raeburn2004-10-223-25/+75
| | | | | | | | | | flag. (scan_shared_trees_locked, scan_shared_trees_unlocked): Convert to macros, so line numbers reported by assert will be useful. * prof_test1 (test2): Run new test of modifications with other existing open profile handles. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16834 dc483132-0cff-0310-8789-dd5450dbe970
* * libprofile.exports: Add profile_flush_to_fileKen Raeburn2004-10-192-0/+5
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16830 dc483132-0cff-0310-8789-dd5450dbe970
* Allow profile library caller to write the modified data to a differentKen Raeburn2004-10-188-28/+122
| | | | | | | | | | | | | | | | | | | | 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-155-73/+107
| | | | | | | | | | | | | | | | | | | | 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
* * prof_file.c (profile_library_initializer, profile_library_finalizer): ↵Alexandra Ellwood2004-10-132-0/+10
| | | | | | | | | Added macros to avoid adding error tables on platforms that don't use them (ie: OSX) ticket: 2741 version_fixed: 1.4 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16818 dc483132-0cff-0310-8789-dd5450dbe970
* Need prototypes for profile_lock_global and profile_unlock_globalAlexandra Ellwood2004-10-132-0/+8
| | | | | | ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16817 dc483132-0cff-0310-8789-dd5450dbe970
* Fix small memory leak in repeated krb5 context creation and deletion:Ken Raeburn2004-10-133-2/+8
| | | | | | | | * 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_file.c (profile_dereference_data_locked): New function.Ken Raeburn2004-09-284-2/+18
| | | | | | | | (profile_dereference_data): Call it. * prof_set.c (rw_setup): Likewise. * prof_int.h (profile_dereference_data_locked): Declare it. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16792 dc483132-0cff-0310-8789-dd5450dbe970
* * Makefile.in (check-unix-tcl-ok): Use KRB5_RUN_ENVTom Yu2004-09-263-1/+9
| | | | | | * configure.in: Use KRB5_RUN_FLAGS. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16791 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_tree.c (struct profile_node): Add new bitfield DELETED.Ken Raeburn2004-09-236-13/+109
| | | | | | | | | | | | | | | | (profile_add_node): Move variable CMP into inner block where it's used. Clear deleted flag. (profile_find_node): Skip deleted nodes. (profile_remove_node): Just set the deleted flag, don't modify the tree. * Makefile.in (profile_tcl.c): Target should be in srcdir. (profile_tcl.o): Depend on profile.h. (DO_TCL): New variable. (check-unix-tcl-, check-unix-tcl-ok): New targets. (check-unix): Depend on one of them, based on DO_TCL. * configure.in: Set and substitute DO_TCL. * prof_test1: New file. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16784 dc483132-0cff-0310-8789-dd5450dbe970
* regeneratedKen Raeburn2004-09-231-6/+8
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16783 dc483132-0cff-0310-8789-dd5450dbe970
* * profile.swg: Only include tclsh.i if building for Tcl.Ken Raeburn2004-09-232-3/+26
| | | | | | | | | (Tcl_SetResult, my_tcl_setresult): Compile hack only if building for Tcl. (%typemap SWIGTYPE *OUTPUT): Initialization is not specific to the scripting language. Add Python code. (%typemap errcode_t, errcode_t*): Add placeholders for Python support. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16782 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_file.c (profile_open_file): If an error occurs while updating from theKen Raeburn2004-08-282-0/+8
| | | | | | input file, destroy the mutex only if we're not sharing file data. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16698 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_parse.c (parse_std_line): Rewrite handling of whitespace in and afterKen Raeburn2004-08-282-6/+20
| | | | | | | | | | | | | | tag, to strip trailing whitespace (per current locale, not just ASCII space characters), and prohibit any internal space characters in tag names. (This is not the patch supplied in the bug report; that patch changed the tag handling to allow spaces in tag names, which we haven't previously allowed. On the other hand, we haven't specifically disallowed internal tabs or other whitespace, either, and this patch does so.) ticket: 2614 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16697 dc483132-0cff-0310-8789-dd5450dbe970
* * profile_tcl.c: New file, generated from profile.swg, but checked in to avoidKen Raeburn2004-08-272-0/+2084
| | | | | | requiring swig in order to generate the test program. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16692 dc483132-0cff-0310-8789-dd5450dbe970
* * profile.swg: New file.Ken Raeburn2004-08-274-4/+266
| | | | | | | | | | | * configure.in: Look for Tcl. * Makefile.in (profile_tcl, profile_tcl.c, profile_tcl.o): New targets, not built by default. (PROG_LIBPATH, PROG_RPATH, LOCALINCLUDES): Add Tcl options. (DEFINES): Define. (clean-unix): Delete profile_tcl. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16691 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_int.h (struct _prf_data_t): Add a mutex.Ken Raeburn2004-08-275-50/+142
| | | | | | | | | | | | | | * prof_file.c (profile_open_file): Initialize data mutex. (profile_update_file_data, profile_flush_file_data): Lock it while manipulating file data. (profile_lock_global, profile_unlock_global): New functions. * prof_set.c (rw_setup): Acquire global lock while checking flags and adjusting ref count. (profile_update_relation, profile_rename_section, profile_add_relation): Lock data mutex while manipulating profile data. * prof_tree.c (profile_node_iterator): Do more magic number tests. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16689 dc483132-0cff-0310-8789-dd5450dbe970
* whitespaceKen Raeburn2004-08-211-10/+10
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16677 dc483132-0cff-0310-8789-dd5450dbe970
* * Makefile.in (MLIBS): Add $(LIBS)Ken Raeburn2004-07-152-1/+3
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16599 dc483132-0cff-0310-8789-dd5450dbe970
* * libprofile.exports: Don't try to export krb5int_profile_shared_dataKen Raeburn2004-07-152-1/+5
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16598 dc483132-0cff-0310-8789-dd5450dbe970
* Delete preprocessor tests for macintosh, __MWERKS__, applec, and THINK_C, allKen Raeburn2004-06-224-18/+7
| | | | | | | part of the pre-Mac OS X support. (Except the bits in the Yarrow code, where it was part of the upstream source.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16506 dc483132-0cff-0310-8789-dd5450dbe970
* * Makefile.in (SHLIB_EXPLIBS): Add $(LIBS)Ken Raeburn2004-06-192-1/+5
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16494 dc483132-0cff-0310-8789-dd5450dbe970
* Change all uses of LIB in UNIX makefiles to LIBBASE, for better WindowsKen Raeburn2004-06-042-1/+5
| | | | | | | | | compatibility. (Windows nmake exports make variables into the environment, and LIB is treated by the Windows linker as a search path for libraries, thus breaking the linking on Windows of anything needing libraries from the search path in directories where we build libraries on UNIX.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16411 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_file.c (profile_open_file): Handle earlier (draft POSIX) specificationsKen Raeburn2004-06-042-4/+13
| | | | | | of getpwuid_r. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16408 dc483132-0cff-0310-8789-dd5450dbe970
* Closer to thread-safe..Ken Raeburn2004-06-033-1/+17
| | | | | | | | * configure.in: Check for getpwuid_r. * prof_file.c (profile_open_file) [HAVE_PWD_H && HAVE_GETPWUID_R]: Use getpwuid_r if available. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16395 dc483132-0cff-0310-8789-dd5450dbe970
* * configure.in: When generating prtest, use AC_CONFIG_FILESEzra Peisach2004-05-242-1/+7
| | | | | | | instead of K5_GEN_FILE so that a chmod may be added to make the script executable. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16354 dc483132-0cff-0310-8789-dd5450dbe970
* * Makefile.in (DEPLIBS, MLIBS, SHLIB_EXPDEPS, SHLIB_EXPLIBS): Add the new ↵Ken Raeburn2004-05-132-4/+9
| | | | | | support library git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16327 dc483132-0cff-0310-8789-dd5450dbe970
* updated dependenciesKen Raeburn2004-04-241-1/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16269 dc483132-0cff-0310-8789-dd5450dbe970
* Added support for library initialization and finalization, and verificationKen Raeburn2004-04-243-15/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | that the initializer completed successfully. Delay initialization on POSIX until the first "verification" call. Currently specific to a few platforms, but should still build on others without thread support enabled. Use it to finish creating (if necessary) and destroy mutexes, and free some other storage "permanently" allocated by libraries (currently, libkrb5 cache/keytab type registries only). Change initialization of static mutexes to a two-step operation, a static "partial" initializer and a "finish_init" routine called from a thread-safe environment like library initialization is assumed to be. POSIX will use the former, Windows will use the latter, and the debug support will check that *both* have been used. Added init/fini functions to com_err, profile, krb5, and gssapi libraries. (The profile library one may need to be removed later.) The existing ones, not thread-safe, are still around. Use weak symbol support if available to figure out if the pthread library has been linked in, and avoid calling certain routines if the C library stubs are known not to exist or work. Stub declarations for thread-specific data. Minor bugfixes, whitespace changes. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16268 dc483132-0cff-0310-8789-dd5450dbe970
* update dependenciesKen Raeburn2004-04-231-0/+8
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16261 dc483132-0cff-0310-8789-dd5450dbe970
* Add files containing the export lists used on UNIX, in each directoryKen Raeburn2004-04-222-0/+57
| | | | | | | | | | | | | | where we build a shared library, whether or not it gets installed. These should match the complete AIX export lists for a full build including krb4 support, and will eventually be used on other UNIX platforms, and cut down to just the symbols we actually want to export. We'll also have to add additional information, eventually, for versioning and such, but currently this is just a list of C symbol names. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16259 dc483132-0cff-0310-8789-dd5450dbe970
* Change profile code over to new thread macros, and enable data sharing alwaysKen Raeburn2004-03-143-26/+40
| | | | | | | | | | | | | | | * prof_int.h: Include k5-thread.h. Don't include sys/types.h and pthread.h. (SHARE_TREE_DATA): Always define. (USE_PTHREADS): Don't define. (prof_mutex_lock, prof_mutex_unlock): Deleted. (struct global_shared_profile_data): Change mutex to use k5_mutex_t instead of pthread_mutex_t. (g_shared_trees_mutex): Don't conditionalize on USE_PTHREADS. * prof_file.c (krb5int_profile_shared_data): Initialize mutex. (profile_open_file, profile_dereference_data): Use new mutex macros. Check return status when locking. Fix a potential memory leak in an error case. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16163 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_get.c (profile_parse_boolean): Declare first argument asEzra Peisach2004-03-082-1/+6
| | | | | | const char *. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16160 dc483132-0cff-0310-8789-dd5450dbe970
* ignore some more generated filesKen Raeburn2004-02-241-0/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16119 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-192-1/+6
| | | | | | not int, for prof_int32. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16105 dc483132-0cff-0310-8789-dd5450dbe970
* ProtoizeKen Raeburn2004-02-197-215/+105
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16099 dc483132-0cff-0310-8789-dd5450dbe970
* prof-int.h should include pthread.h when USE_PTHREADS is definedAlexandra Ellwood2004-01-302-0/+11
| | | | | | ticket: 2180 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15985 dc483132-0cff-0310-8789-dd5450dbe970
* * prof_get.c (profile_iterator_create): NAMES argument points to const pointers.Ken Raeburn2003-12-203-2/+8
| | | | | | * profile.hin (profile_iterator_create): Declaration updated. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15953 dc483132-0cff-0310-8789-dd5450dbe970
* move prof-int.h to be the first include file in order to obtainJeffrey Altman2003-12-1410-14/+25
| | | | | | | | | 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
* Remove leading spaces in #define and #include in public headers to support ↵Alexandra Ellwood2003-07-032-16/+18
| | | | | | | | K&R C compilers ticket: 1648 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15667 dc483132-0cff-0310-8789-dd5450dbe970