(akf_add_entry): don't create the file before we need to write to it
(from Åke Sandgren) git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10838 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan
|
||||
* Copyright (c) 1997 - 2002 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -286,6 +286,13 @@ akf_add_entry(krb5_context context,
|
||||
struct akf_data *d = id->data;
|
||||
int fd, created = 0;
|
||||
krb5_error_code ret;
|
||||
int32_t len;
|
||||
krb5_storage *sp;
|
||||
|
||||
|
||||
if (entry->keyblock.keyvalue.length != 8
|
||||
|| entry->keyblock.keytype != ETYPE_DES_CBC_MD5)
|
||||
return 0;
|
||||
|
||||
fd = open (d->filename, O_RDWR | O_BINARY);
|
||||
if (fd < 0) {
|
||||
@@ -300,12 +307,6 @@ akf_add_entry(krb5_context context,
|
||||
created = 1;
|
||||
}
|
||||
|
||||
if (entry->keyblock.keyvalue.length == 8
|
||||
&& entry->keyblock.keytype == ETYPE_DES_CBC_MD5) {
|
||||
|
||||
int32_t len;
|
||||
krb5_storage *sp;
|
||||
|
||||
sp = krb5_storage_from_fd(fd);
|
||||
if(sp == NULL) {
|
||||
close(fd);
|
||||
@@ -372,7 +373,6 @@ akf_add_entry(krb5_context context,
|
||||
return ENOTTY;
|
||||
}
|
||||
krb5_storage_free(sp);
|
||||
}
|
||||
close (fd);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user