(fkt_remove_entry): check return value from start_seq_get (from Wynn
Wilkes) git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11471 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -303,7 +303,7 @@ fkt_start_seq_get_int(krb5_context context,
|
||||
c->fd = open (d->filename, flags);
|
||||
if (c->fd < 0) {
|
||||
ret = errno;
|
||||
krb5_set_error_string(context, "open(%s): %s", d->filename,
|
||||
krb5_set_error_string(context, "%s: %s", d->filename,
|
||||
strerror(ret));
|
||||
return ret;
|
||||
}
|
||||
@@ -441,7 +441,7 @@ fkt_add_entry(krb5_context context,
|
||||
|
||||
fd = open (d->filename, O_RDWR | O_BINARY);
|
||||
if (fd < 0) {
|
||||
fd = open (d->filename, O_RDWR | O_CREAT | O_BINARY, 0600);
|
||||
fd = open (d->filename, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
|
||||
if (fd < 0) {
|
||||
ret = errno;
|
||||
krb5_set_error_string(context, "open(%s): %s", d->filename,
|
||||
@@ -572,8 +572,11 @@ fkt_remove_entry(krb5_context context,
|
||||
krb5_kt_cursor cursor;
|
||||
off_t pos_start, pos_end;
|
||||
int found = 0;
|
||||
krb5_error_code ret;
|
||||
|
||||
fkt_start_seq_get_int(context, id, O_RDWR | O_BINARY, &cursor);
|
||||
ret = fkt_start_seq_get_int(context, id, O_RDWR | O_BINARY, &cursor);
|
||||
if(ret != 0)
|
||||
goto out; /* return other error here? */
|
||||
while(fkt_next_entry_int(context, id, &e, &cursor,
|
||||
&pos_start, &pos_end) == 0) {
|
||||
if(krb5_kt_compare(context, &e, entry->principal,
|
||||
@@ -592,6 +595,7 @@ fkt_remove_entry(krb5_context context,
|
||||
}
|
||||
}
|
||||
krb5_kt_end_seq_get(context, id, &cursor);
|
||||
out:
|
||||
if (!found) {
|
||||
krb5_clear_error_string (context);
|
||||
return KRB5_KT_NOTFOUND;
|
||||
|
Reference in New Issue
Block a user