summaryrefslogtreecommitdiffstats
path: root/src/util/profile
diff options
context:
space:
mode:
authorAlexandra Ellwood <lxs@mit.edu>2004-11-04 19:27:24 +0000
committerAlexandra Ellwood <lxs@mit.edu>2004-11-04 19:27:24 +0000
commit428970d0c17cd80ec166e407170fa9553e2efffa (patch)
treea144f192ea0d0017df1e5970260c698fee3bb116 /src/util/profile
parentc50f8f5cc7f64bd5c6b39ae025a762958a760640 (diff)
downloadkrb5-428970d0c17cd80ec166e407170fa9553e2efffa.tar.gz
krb5-428970d0c17cd80ec166e407170fa9553e2efffa.tar.xz
krb5-428970d0c17cd80ec166e407170fa9553e2efffa.zip
* 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
ticket: 2751 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16860 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/profile')
-rw-r--r--src/util/profile/ChangeLog6
-rw-r--r--src/util/profile/prof_init.c30
-rw-r--r--src/util/profile/profile.hin5
3 files changed, 41 insertions, 0 deletions
diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog
index 1a28ddd96..1499d25a0 100644
--- a/src/util/profile/ChangeLog
+++ b/src/util/profile/ChangeLog
@@ -1,5 +1,11 @@
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
diff --git a/src/util/profile/prof_init.c b/src/util/profile/prof_init.c
index 02d61ee1f..9aafb3c63 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/profile.hin b/src/util/profile/profile.hin
index ec822ca8b..10abe725a 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);