* prof_init.c, profile.hin: added profile_is_modified and profile_is_writable so...
authorAlexandra Ellwood <lxs@mit.edu>
Thu, 4 Nov 2004 19:27:24 +0000 (19:27 +0000)
committerAlexandra Ellwood <lxs@mit.edu>
Thu, 4 Nov 2004 19:27:24 +0000 (19:27 +0000)
ticket: 2751

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16860 dc483132-0cff-0310-8789-dd5450dbe970

src/util/profile/ChangeLog
src/util/profile/prof_init.c
src/util/profile/profile.hin

index 1a28ddd96f8a784f14e3a87202f12ce21c37f6f4..1499d25a0214260d1ece683a8840b8d8c5f54d92 100644 (file)
@@ -1,3 +1,9 @@
+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 
index 02d61ee1f54b50f597da9f820f2decd62b972720..9aafb3c63a05770c7169e149bcb3da360fa306a5 100644 (file)
@@ -120,6 +120,36 @@ profile_init_path(const_profile_filespec_list_t filepath,
        return retval;
 }
 
+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)
 {
index ec822ca8b91fc47a98ad5dd33dcb0e104a1894f5..10abe725ad6069be6add957add7e481a65919545 100644 (file)
@@ -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);