[31311] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Do not reload a modified profile data object

daemon@ATHENA.MIT.EDU (ghudson@mit.edu)
Sat Apr 20 20:51:02 2024

From: ghudson@mit.edu
To: cvs-krb5@mit.edu
Message-Id: <20240421005055.862B8101905@krbdev.mit.edu>
Date: Sat, 20 Apr 2024 20:50:55 -0400 (EDT)
MIME-Version: 1.0
Reply-To: krbdev@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/9b2fb80ad24006784170875709a04dc79e03b401
commit 9b2fb80ad24006784170875709a04dc79e03b401
Author: Greg Hudson <ghudson@mit.edu>
Date:   Tue Apr 16 02:14:29 2024 -0400

    Do not reload a modified profile data object
    
    The profile library normally attempts to reload a profile data tree if
    the backing file has changed.  Reloading a dirty profile object
    discards any modifications made by the caller.  If we assume that the
    modifications are destined to be flushed back out to the backing file,
    then there is no good answer--one or the other set of changes will be
    lost.  But the caller may have a different intended use for the
    modified tree (profile_flush_to_file(), profile_flush_to_buffer(),
    krb5_init_context_profile()), for which the caller's modifications may
    be critical.  Avoid discarding in-memory edits to ensure the
    correctness of these use cases.
    
    ticket: 9118

 src/util/profile/prof_file.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/util/profile/prof_file.c b/src/util/profile/prof_file.c
index b5eddc0d9..a39a5dc18 100644
--- a/src/util/profile/prof_file.c
+++ b/src/util/profile/prof_file.c
@@ -301,8 +301,13 @@ errcode_t profile_update_file_data_locked(prf_data_t data, char **ret_modspec)
     FILE *f;
     int isdir = 0;
 
+    /* Don't reload if the backing file isn't a regular file. */
     if ((data->flags & PROFILE_FILE_NO_RELOAD) && data->root != NULL)
         return 0;
+    /* Don't reload a modified data object, as the modifications may be
+     * important for this object's use. */
+    if (data->flags & PROFILE_FILE_DIRTY)
+        return 0;
 
 #ifdef HAVE_STAT
     now = time(0);
@@ -358,7 +363,6 @@ errcode_t profile_update_file_data_locked(prf_data_t data, char **ret_modspec)
     }
 
     data->upd_serial++;
-    data->flags &= ~PROFILE_FILE_DIRTY;
 
     if (isdir) {
         retval = profile_process_directory(data->filespec, &data->root);
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post