diff options
author | Mitchell Berger <mitchb@mit.edu> | 2001-06-21 11:09:17 +0000 |
---|---|---|
committer | Mitchell Berger <mitchb@mit.edu> | 2001-06-21 11:09:17 +0000 |
commit | 3c42ac668e07f5f61738501c0d00baf9fcdc7e04 (patch) | |
tree | 32596f9cce8c6bdb45f700f5d66ed67aa0f9f803 | |
parent | 315a85c5f2f682b399a191025c6ca217178d706a (diff) | |
download | krb5-3c42ac668e07f5f61738501c0d00baf9fcdc7e04.zip krb5-3c42ac668e07f5f61738501c0d00baf9fcdc7e04.tar.gz krb5-3c42ac668e07f5f61738501c0d00baf9fcdc7e04.tar.bz2 |
* kdb_xdr.c: Replaced function krb5_dbe_update_generation_number_general
with similar functions krb5_dbe_set_generation_number_general and
krb5_dbe_increment_generation_number_general.
git-svn-id: svn://anonsvn.mit.edu/krb5/branches/incremental-propagation-branch@13434 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/lib/kdb/ChangeLog | 6 | ||||
-rw-r--r-- | src/lib/kdb/kdb_xdr.c | 28 |
2 files changed, 26 insertions, 8 deletions
diff --git a/src/lib/kdb/ChangeLog b/src/lib/kdb/ChangeLog index 90a0a9a..8afd75b 100644 --- a/src/lib/kdb/ChangeLog +++ b/src/lib/kdb/ChangeLog @@ -1,3 +1,9 @@ +2001-06-21 Mitchell Berger <mitchb@mit.edu> + + * kdb_xdr.c: Replaced function krb5_dbe_update_generation_number_general + with similar functions krb5_dbe_set_generation_number_general and + krb5_dbe_increment_generation_number_general. + 2001-06-20 Mitchell Berger <mitchb@mit.edu> * kdb_xdr.c: Added new functions diff --git a/src/lib/kdb/kdb_xdr.c b/src/lib/kdb/kdb_xdr.c index 83141b0..a73f1e8 100644 --- a/src/lib/kdb/kdb_xdr.c +++ b/src/lib/kdb/kdb_xdr.c @@ -122,17 +122,30 @@ krb5_dbe_lookup_tl_data(context, entry, ret_tl_data) return(0); } -/* You can force the generation number to a particular value by filling in - newval. By default, if newval is zero, the generation number will simply - be incremented by 1. */ - krb5_error_code -krb5_dbe_update_generation_number_general(context, entry, newval) +krb5_dbe_set_generation_number_general(context, entry, newval) krb5_context context; krb5_db_entry * entry; krb5_int32 newval; { - krb5_error_code ret; + krb5_error_code ret; + krb5_tl_data tl_data; + krb5_octet buf[4]; /* this is the encoded size of an int32 */ + + tl_data.tl_data_type = KRB5_TL_GENERATION_NUMBER; + tl_data.tl_data_length = sizeof(newval); + krb5_kdb_encode_int32(newval, buf); + tl_data.tl_data_contents = buf; + + return(krb5_dbe_update_tl_data(context, entry, &tl_data)); +} + +krb5_error_code +krb5_dbe_increment_generation_number_general(context, entry) + krb5_context context; + krb5_db_entry * entry; +{ + krb5_error_code ret; krb5_tl_data tl_data; krb5_int32 generation_number; krb5_octet buf[4]; /* this is the encoded size of an int32 */ @@ -140,10 +153,9 @@ krb5_dbe_update_generation_number_general(context, entry, newval) if ((ret = krb5_dbe_lookup_generation_number_general(context, entry, &generation_number))) generation_number = 0; /* Didn't exist before. */ - generation_number = newval ? newval : (generation_number + 1); tl_data.tl_data_type = KRB5_TL_GENERATION_NUMBER; tl_data.tl_data_length = sizeof(generation_number); - krb5_kdb_encode_int32(generation_number, buf); + krb5_kdb_encode_int32(++generation_number, buf); tl_data.tl_data_contents = buf; return(krb5_dbe_update_tl_data(context, entry, &tl_data)); |