aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/ChangeLog5
-rw-r--r--src/util/et/ChangeLog6
-rw-r--r--src/util/et/et_h.awk2
-rw-r--r--src/util/et/et_h.pl2
-rw-r--r--src/util/mkrel9
-rw-r--r--src/util/profile/ChangeLog29
-rw-r--r--src/util/profile/prof_file.c22
-rw-r--r--src/util/profile/prof_init.c30
-rw-r--r--src/util/profile/prof_int.h5
-rw-r--r--src/util/profile/prof_set.c3
-rw-r--r--src/util/profile/prof_tree.c42
-rw-r--r--src/util/profile/profile.hin5
-rw-r--r--src/util/support/ChangeLog4
-rw-r--r--src/util/support/Makefile.in4
14 files changed, 156 insertions, 12 deletions
diff --git a/src/util/ChangeLog b/src/util/ChangeLog
index 990ca78..4de8fce 100644
--- a/src/util/ChangeLog
+++ b/src/util/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-31 Tom Yu <tlyu@mit.edu>
+
+ * mkrel: Rework quoting for RELTAIL check. Don't check RELTAIL if
+ doing a "-current" snapshot.
+
2004-09-24 Tom Yu <tlyu@mit.edu>
* mkrel: Rework somewhat to handle patchlevel.h being the new
diff --git a/src/util/et/ChangeLog b/src/util/et/ChangeLog
index 9349834..e9b0e23 100644
--- a/src/util/et/ChangeLog
+++ b/src/util/et/ChangeLog
@@ -1,3 +1,9 @@
+2004-11-05 Ken Raeburn <raeburn@mit.edu>
+
+ * et_h.awk: Declare initialize_*_error_table as taking no
+ arguments.
+ * et_h.pl: Regenerated.
+
2004-10-07 Tom Yu <tlyu@mit.edu>
* et_c.awk, et_h.awk: Fix off-by-one error.
diff --git a/src/util/et/et_h.awk b/src/util/et/et_h.awk
index e3d9fa4..65c6c45 100644
--- a/src/util/et/et_h.awk
+++ b/src/util/et/et_h.awk
@@ -155,7 +155,7 @@ END {
print "" > outfile
print "#if !defined(_WIN32)" > outfile
print "/* for compatibility with older versions... */" > outfile
- print "extern void initialize_" table_name "_error_table () /*@modifies internalState@*/;" > outfile
+ print "extern void initialize_" table_name "_error_table (void) /*@modifies internalState@*/;" > outfile
print "#else" > outfile
print "#define initialize_" table_name "_error_table()" > outfile
print "#endif" > outfile
diff --git a/src/util/et/et_h.pl b/src/util/et/et_h.pl
index e0965de..5ab8e8b 100644
--- a/src/util/et/et_h.pl
+++ b/src/util/et/et_h.pl
@@ -203,7 +203,7 @@ else {
&Pick('>', $outfile) &&
(print $fh 'extern void initialize_' . $table_name .
- '_error_table () /*@modifies internalState@*/;');
+ '_error_table (void) /*@modifies internalState@*/;');
&Pick('>', $outfile) &&
(print $fh '#else');
&Pick('>', $outfile) &&
diff --git a/src/util/mkrel b/src/util/mkrel
index 97a08d1..804dd5f 100644
--- a/src/util/mkrel
+++ b/src/util/mkrel
@@ -120,10 +120,11 @@ if test $newstyle = t; then
if test "$KRB5_RELTAG" != $reltag; then
echo "WARNING: patchlevel.h '$KRB5_RELTAG' != $reltag"
fi
- if test "$KRB5_MAJOR_RELEASE" != $relmajor || \
- test "$KRB5_MINOR_RELEASE" != $relminor || \
- test "$KRB5_PATCHLEVEL" != $relpatch || \
- test "$KRB5_RELTAIL" != $reltail; then
+ if test "$KRB5_MAJOR_RELEASE" != "$relmajor" || \
+ test "$KRB5_MINOR_RELEASE" != "$relminor" || \
+ test "$KRB5_PATCHLEVEL" != "$relpatch" || \
+ ( test -n "$reltail" && \
+ test "$KRB5_RELTAIL" != "$reltail" ); then
echo "WARNING: patchlevel.h $KRB5_MAJOR_RELEASE.$KRB5_MINOR_RELEASE.$KRB5_PATCHLEVEL${KRB5_RELTAIL+-$KRB5_RELTAIL} != $relmajor.$relminor.$relpatch${reltail+-$reltail}"
fi
diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog
index 1366bd4..bfe6636 100644
--- a/src/util/profile/ChangeLog
+++ b/src/util/profile/ChangeLog
@@ -1,3 +1,32 @@
+2004-12-14 Ken Raeburn <raeburn@mit.edu>
+
+ * prof_tree.c (profile_node_iterator): When the iterator has a
+ current file, lock it, and unlock it before changing it or
+ returning.
+
+2004-11-04 Alexandra Ellwood <lxs@mit.edu>
+
+ * prof_init.c, profile.hin: added profile_is_modified
+ and profile_is_writable so that callers can check to see
+ if profile_release() will fail before calling it.
+
+2004-11-04 Alexandra Ellwood <lxs@mit.edu>
+
+ * prof_set.c: profile calls which set values should not fail
+ if file is not writable. You can now write to a different
+ file with profile_flush_to_file() or buffer with
+ profile_flush_to_buffer().
+
+2004-10-30 Ken Raeburn <raeburn@mit.edu>
+
+ * 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.
+
2004-10-26 Ken Raeburn <raeburn@mit.edu>
Permit exporting profile file data into a buffer.
diff --git a/src/util/profile/prof_file.c b/src/util/profile/prof_file.c
index f47e540..0282537 100644
--- a/src/util/profile/prof_file.c
+++ b/src/util/profile/prof_file.c
@@ -66,6 +66,8 @@ void profile_library_finalizer(void)
static void profile_free_file_data(prf_data_t);
+#if 0
+
#define scan_shared_trees_locked() \
{ \
prf_data_t d; \
@@ -89,6 +91,13 @@ static void profile_free_file_data(prf_data_t);
k5_mutex_unlock(&g_shared_trees_mutex); \
}
+#else
+
+#define scan_shared_trees_locked() { ; }
+#define scan_shared_trees_unlocked() { ; }
+
+#endif
+
static int rw_access(const_profile_filespec_t filespec)
{
#ifdef HAVE_ACCESS
@@ -295,6 +304,9 @@ errcode_t profile_update_file_data(prf_data_t data)
errcode_t retval;
#ifdef HAVE_STAT
struct stat st;
+#ifdef STAT_ONCE_PER_SECOND
+ time_t now;
+#endif
#endif
FILE *f;
@@ -303,11 +315,21 @@ errcode_t profile_update_file_data(prf_data_t data)
return retval;
#ifdef HAVE_STAT
+#ifdef STAT_ONCE_PER_SECOND
+ now = time(0);
+ if (now == data->last_stat) {
+ k5_mutex_unlock(&data->lock);
+ return 0;
+ }
+#endif
if (stat(data->filespec, &st)) {
retval = errno;
k5_mutex_unlock(&data->lock);
return retval;
}
+#ifdef STAT_ONCE_PER_SECOND
+ data->last_stat = now;
+#endif
if (st.st_mtime == data->timestamp) {
k5_mutex_unlock(&data->lock);
return 0;
diff --git a/src/util/profile/prof_init.c b/src/util/profile/prof_init.c
index 02d61ee..0be2a0e 100644
--- a/src/util/profile/prof_init.c
+++ b/src/util/profile/prof_init.c
@@ -121,6 +121,36 @@ profile_init_path(const_profile_filespec_list_t filepath,
}
errcode_t KRB5_CALLCONV
+profile_is_writable(profile_t profile, int *writable)
+{
+ if (!profile || profile->magic != PROF_MAGIC_PROFILE)
+ return PROF_MAGIC_PROFILE;
+
+ if (!writable)
+ return EINVAL;
+
+ if (profile->first_file)
+ *writable = (profile->first_file->data->flags & PROFILE_FILE_RW);
+
+ return 0;
+}
+
+errcode_t KRB5_CALLCONV
+profile_is_modified(profile_t profile, int *modified)
+{
+ if (!profile || profile->magic != PROF_MAGIC_PROFILE)
+ return PROF_MAGIC_PROFILE;
+
+ if (!modified)
+ return EINVAL;
+
+ if (profile->first_file)
+ *modified = (profile->first_file->data->flags & PROFILE_FILE_DIRTY);
+
+ return 0;
+}
+
+errcode_t KRB5_CALLCONV
profile_flush(profile_t profile)
{
if (!profile || profile->magic != PROF_MAGIC_PROFILE)
diff --git a/src/util/profile/prof_int.h b/src/util/profile/prof_int.h
index d276122..b7c9096 100644
--- a/src/util/profile/prof_int.h
+++ b/src/util/profile/prof_int.h
@@ -14,6 +14,8 @@
#include "com_err.h"
#include "profile.h"
+#define STAT_ONCE_PER_SECOND
+
#if defined(_WIN32)
#define SIZEOF_INT 4
#define SIZEOF_SHORT 2
@@ -36,6 +38,9 @@ struct _prf_data_t {
k5_mutex_t lock;
char *comment;
struct profile_node *root;
+#ifdef STAT_ONCE_PER_SECOND
+ time_t last_stat;
+#endif
time_t timestamp; /* time tree was last updated from file */
int flags; /* r/w, dirty */
int upd_serial; /* incremented when data changes */
diff --git a/src/util/profile/prof_set.c b/src/util/profile/prof_set.c
index 67274c2..85f2286 100644
--- a/src/util/profile/prof_set.c
+++ b/src/util/profile/prof_set.c
@@ -33,9 +33,6 @@ static errcode_t rw_setup(profile_t profile)
file = profile->first_file;
- if (!(file->data->flags & PROFILE_FILE_RW))
- return PROF_READ_ONLY;
-
retval = profile_lock_global();
if (retval)
return retval;
diff --git a/src/util/profile/prof_tree.c b/src/util/profile/prof_tree.c
index 1d96ffb..eea34f6 100644
--- a/src/util/profile/prof_tree.c
+++ b/src/util/profile/prof_tree.c
@@ -466,17 +466,27 @@ errcode_t profile_node_iterator(void **iter_p, struct profile_node **ret_node,
* If the file has changed, then the node pointer is invalid,
* so we'll have search the file again looking for it.
*/
+ if (iter->file) {
+ retval = k5_mutex_lock(&iter->file->data->lock);
+ if (retval)
+ return retval;
+ }
if (iter->node && (iter->file->data->upd_serial != iter->file_serial)) {
iter->flags &= ~PROFILE_ITER_FINAL_SEEN;
skip_num = iter->num;
iter->node = 0;
}
- if (iter->node && iter->node->magic != PROF_MAGIC_NODE)
+ if (iter->node && iter->node->magic != PROF_MAGIC_NODE) {
+ if (iter->file)
+ k5_mutex_unlock(&iter->file->data->lock);
return PROF_MAGIC_NODE;
+ }
get_new_file:
if (iter->node == 0) {
if (iter->file == 0 ||
(iter->flags & PROFILE_ITER_FINAL_SEEN)) {
+ if (iter->file)
+ k5_mutex_unlock(&iter->file->data->lock);
profile_node_iterator_free(iter_p);
if (ret_node)
*ret_node = 0;
@@ -486,10 +496,18 @@ get_new_file:
*ret_value =0;
return 0;
}
+ k5_mutex_unlock(&iter->file->data->lock);
if ((retval = profile_update_file(iter->file))) {
if (retval == ENOENT || retval == EACCES) {
/* XXX memory leak? */
iter->file = iter->file->next;
+ if (iter->file) {
+ retval = k5_mutex_lock(&iter->file->data->lock);
+ if (retval) {
+ profile_node_iterator_free(iter_p);
+ return retval;
+ }
+ }
skip_num = 0;
retval = 0;
goto get_new_file;
@@ -498,6 +516,11 @@ get_new_file:
return retval;
}
}
+ retval = k5_mutex_lock(&iter->file->data->lock);
+ if (retval) {
+ profile_node_iterator_free(iter_p);
+ return retval;
+ }
iter->file_serial = iter->file->data->upd_serial;
/*
* Find the section to list if we are a LIST_SECTION,
@@ -518,7 +541,15 @@ get_new_file:
iter->flags |= PROFILE_ITER_FINAL_SEEN;
}
if (!section) {
+ k5_mutex_unlock(&iter->file->data->lock);
iter->file = iter->file->next;
+ if (iter->file) {
+ retval = k5_mutex_lock(&iter->file->data->lock);
+ if (retval) {
+ profile_node_iterator_free(iter_p);
+ return retval;
+ }
+ }
skip_num = 0;
goto get_new_file;
}
@@ -546,11 +577,20 @@ get_new_file:
}
iter->num++;
if (!p) {
+ k5_mutex_unlock(&iter->file->data->lock);
iter->file = iter->file->next;
+ if (iter->file) {
+ retval = k5_mutex_lock(&iter->file->data->lock);
+ if (retval) {
+ profile_node_iterator_free(iter_p);
+ return retval;
+ }
+ }
iter->node = 0;
skip_num = 0;
goto get_new_file;
}
+ k5_mutex_unlock(&iter->file->data->lock);
if ((iter->node = p->next) == NULL)
iter->file = iter->file->next;
if (ret_node)
diff --git a/src/util/profile/profile.hin b/src/util/profile/profile.hin
index ec822ca..10abe72 100644
--- a/src/util/profile/profile.hin
+++ b/src/util/profile/profile.hin
@@ -54,6 +54,11 @@ long KRB5_CALLCONV profile_flush_to_buffer
void KRB5_CALLCONV profile_free_buffer
(profile_t profile, char *buf);
+long KRB5_CALLCONV profile_is_writable
+ (profile_t profile, int *writable);
+long KRB5_CALLCONV profile_is_modified
+ (profile_t profile, int *modified);
+
void KRB5_CALLCONV profile_abandon
(profile_t profile);
diff --git a/src/util/support/ChangeLog b/src/util/support/ChangeLog
index 2ee4dd9..5db19b8 100644
--- a/src/util/support/ChangeLog
+++ b/src/util/support/ChangeLog
@@ -1,3 +1,7 @@
+2004-12-15 Jeffrey Altman <jaltman@mit.edu>
+
+ * Makefile.in: rename krb5support_32.dll to k5sprt32.dll
+
2004-10-25 Ken Raeburn <raeburn@mit.edu>
* libkrb5support.exports: Export krb5int_fac, _lock_fac,
diff --git a/src/util/support/Makefile.in b/src/util/support/Makefile.in
index 034bade..af3648a 100644
--- a/src/util/support/Makefile.in
+++ b/src/util/support/Makefile.in
@@ -5,9 +5,9 @@ BUILDTOP=$(REL)..$(S)..
RELDIR=../util/support
##DOS##BUILDTOP = ..\..
-##DOS##LIBNAME=$(OUTPRE)krb5support_32.lib
+##DOS##LIBNAME=$(OUTPRE)k5sprt32.lib
##DOS##XTRA=
-##DOS##OBJFILE=$(OUTPRE)krb5support_32.lst
+##DOS##OBJFILE=$(OUTPRE)k5sprt32.lst
SED = sed