diff options
author | John Kohl <jtkohl@mit.edu> | 1990-05-08 13:42:01 +0000 |
---|---|---|
committer | John Kohl <jtkohl@mit.edu> | 1990-05-08 13:42:01 +0000 |
commit | abb37e967975432e80a832e9eebf0f91506c0d07 (patch) | |
tree | 14746c0b7c634d95c3c843c0969fec4c824cb2b6 /src/lib | |
parent | 2e3651159cd3cea86255f8a9b1eef5007772b7a1 (diff) | |
download | krb5-abb37e967975432e80a832e9eebf0f91506c0d07.tar.gz krb5-abb37e967975432e80a832e9eebf0f91506c0d07.tar.xz krb5-abb37e967975432e80a832e9eebf0f91506c0d07.zip |
need to append to not nuke the file
allocate extra space for the null end-of-list
want sizeof char, not char *
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@777 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/krb5/keytab/file/ktf_util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/krb5/keytab/file/ktf_util.c b/src/lib/krb5/keytab/file/ktf_util.c index 2207d8bc52..fec787b968 100644 --- a/src/lib/krb5/keytab/file/ktf_util.c +++ b/src/lib/krb5/keytab/file/ktf_util.c @@ -64,7 +64,7 @@ int mode; krb5_error_code kerror; if (!(KTFILEP(id) = fopen(KTFILENAME(id), - (mode == KRB5_LOCKMODE_EXCLUSIVE) ? "w" : "r"))) + (mode == KRB5_LOCKMODE_EXCLUSIVE) ? "a" : "r"))) return errno; if (kerror = krb5_lock_file(KTFILEP(id), KTFILENAME(id), mode)) { @@ -127,7 +127,7 @@ krb5_keytab_entry **entrypp; return KRB5_KT_END; if (!count || (count < 0)) return KRB5_KT_END; /* XXX */ - if (!(ret_entry->principal = (krb5_data **)calloc(count, sizeof(krb5_data *)))) + if (!(ret_entry->principal = (krb5_data **)calloc(count+1, sizeof(krb5_data *)))) return ENOMEM; for (i = 0; i < count; i++) { if (!xfread(&princ_size, sizeof(princ_size), 1, KTFILEP(id))) @@ -196,7 +196,7 @@ krb5_keytab_entry *entry; if (!xfwrite(&size, sizeof(size), 1, KTFILEP(id))) { goto abend; } - if (!xfwrite((*princp)->data, sizeof(char *), size, KTFILEP(id))) { + if (!xfwrite((*princp)->data, sizeof(char), size, KTFILEP(id))) { goto abend; } } |