* svr_principal.c (kadm5_modify_principal): fix modify_principal's
authorBarry Jaspan <bjaspan@mit.edu>
Mon, 21 Oct 1996 20:30:38 +0000 (20:30 +0000)
committerBarry Jaspan <bjaspan@mit.edu>
Mon, 21 Oct 1996 20:30:38 +0000 (20:30 +0000)
  handling of KADM5_TL_DATA [krb5-admin/20]

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

src/lib/kadm5/srv/ChangeLog
src/lib/kadm5/srv/svr_principal.c

index e60a083c76c792183c104afdcdc9e12e3840ef88..7369d4b70023f99c94f220bd0394c0bf77e5e3d6 100644 (file)
@@ -1,3 +1,8 @@
+Mon Oct 21 16:28:52 1996  Barry Jaspan  <bjaspan@mit.edu>
+
+       * svr_principal.c (kadm5_modify_principal): fix modify_principal's
+       handling of KADM5_TL_DATA [krb5-admin/20]
+
 Fri Oct 18 14:24:12 1996  Barry Jaspan  <bjaspan@mit.edu>
 
        * svr_misc_free.c, server_dict.c, adb_policy.c, adb_free.c:
index df9e34925426b6f276d27e2036c1cca3b24974af..7339ea1bdba1d117b1115e4a5cc0f5dc76a30a7b 100644 (file)
@@ -497,24 +497,26 @@ kadm5_modify_principal(void *server_handle,
     }
 
     if (mask & KADM5_TL_DATA) {
-        /* splice entry->tl_data onto the front of kdb.tl_data */
-        tl_data_orig = kdb.tl_data;
-        for (tl_data_tail = entry->tl_data; tl_data_tail->tl_data_next;
-             tl_data_tail = tl_data_tail->tl_data_next)
-             ;
-        tl_data_tail->tl_data_next = kdb.tl_data;
+        krb5_tl_data *tl;
+        /*
+         * Replace kdb.tl_data with what was passed in.  The
+         * KRB5_TL_KADM_DATA will be re-added (based on adb) by
+         * kdb_put_entry, below.
+         */
+        while (kdb.tl_data) {
+             tl = kdb.tl_data->tl_data_next;
+             free(kdb.tl_data->tl_data_contents);
+             free(kdb.tl_data);
+             kdb.tl_data = tl;
+        }
+        
         kdb.tl_data = entry->tl_data;
+        kdb.n_tl_data = entry->n_tl_data;
     }
 
     if ((ret = kdb_put_entry(handle, &kdb, &adb)))
        goto done;
 
-    if (mask & KADM5_TL_DATA) {
-        /* remove entry->tl_data from the front of kdb.tl_data */
-        tl_data_tail->tl_data_next = NULL;
-        kdb.tl_data = tl_data_orig;
-    }
-    
     ret = KADM5_OK;
 done:
     if (have_opol) {