diff options
author | Alexandra Ellwood <lxs@mit.edu> | 2008-09-25 20:25:40 +0000 |
---|---|---|
committer | Alexandra Ellwood <lxs@mit.edu> | 2008-09-25 20:25:40 +0000 |
commit | 2566cc858ade894e695872c346b97c53c97177ea (patch) | |
tree | 028727622fd13e4d975bb57634c7a2e1b5aed4c0 /src | |
parent | 7dd00aea5c305566d1e07ac6709fed49e9a747b5 (diff) | |
download | krb5-2566cc858ade894e695872c346b97c53c97177ea.tar.gz krb5-2566cc858ade894e695872c346b97c53c97177ea.tar.xz krb5-2566cc858ade894e695872c346b97c53c97177ea.zip |
Fixed a bug where kim_preferences_remove_favorite_identity
was removing the first identity which did not match the one
being passed in.
ticket: 6055
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20753 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r-- | src/kim/lib/kim_preferences.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/kim/lib/kim_preferences.c b/src/kim/lib/kim_preferences.c index 8ec5fd16c..46600922f 100644 --- a/src/kim/lib/kim_preferences.c +++ b/src/kim/lib/kim_preferences.c @@ -249,18 +249,18 @@ kim_error kim_favorites_add_identity (kim_favorites io_favorites, kim_count i; for (i = 0; !err && i < io_favorites->count; i++) { - kim_comparison identity_comparison = 0; + kim_comparison comparison = 0; err = kim_identity_compare (io_favorites->identities[i], in_identity, - &identity_comparison); + &comparison); if (!err) { - if (kim_comparison_is_greater_than (identity_comparison)) { + if (kim_comparison_is_greater_than (comparison)) { /* insert before the first entry that is greater than us */ break; - } else if (kim_comparison_is_equal_to (identity_comparison)) { + } else if (kim_comparison_is_equal_to (comparison)) { /* already in list */ kim_string display_string = NULL; @@ -313,7 +313,7 @@ kim_error kim_favorites_remove_identity (kim_favorites io_favorites, kim_identity in_identity) { kim_error err = KIM_NO_ERROR; - kim_boolean found = FALSE; + kim_boolean found = 0; kim_count i; if (!err && !io_favorites) { err = check_error (KIM_NULL_PARAMETER_ERR); } @@ -323,13 +323,16 @@ kim_error kim_favorites_remove_identity (kim_favorites io_favorites, for (i = 0; !err && !found && i < io_favorites->count; i++) { kim_identity identity = io_favorites->identities[i]; kim_options options = io_favorites->options[i]; + kim_comparison comparison; - err = kim_identity_compare (in_identity, identity, &found); + err = kim_identity_compare (in_identity, identity, &comparison); - if (!err && found) { + if (!err && kim_comparison_is_equal (comparison)) { kim_error terr = KIM_NO_ERROR; kim_count new_count = io_favorites->count - 1; + found = 1; + memmove (&io_favorites->identities[i], &io_favorites->identities[i + 1], (new_count - i) * sizeof (*io_favorites->identities)); |