git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4830 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1998-05-01 05:18:02 +00:00
parent b990bcf7bf
commit f178df827c
2 changed files with 16 additions and 8 deletions

View File

@@ -40,6 +40,10 @@
RCSID("$Id$");
#ifndef O_BINARY
#define O_BINARY 0
#endif
typedef struct krb5_fcache{
char *filename;
int version;
@@ -86,7 +90,7 @@ erase_file(const char *filename)
off_t pos;
char *p;
fd = open(filename, O_RDWR);
fd = open(filename, O_RDWR | O_BINARY);
if(fd < 0)
if(errno == ENOENT)
return 0;
@@ -122,7 +126,7 @@ fcc_initialize(krb5_context context,
if((ret = erase_file(filename)))
return ret;
fd = open(filename, O_RDWR | O_CREAT | O_EXCL, 0600);
fd = open(filename, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
if(fd == -1)
return errno;
{
@@ -179,7 +183,7 @@ fcc_store_cred(krb5_context context,
f = FILENAME(id);
fd = open(f, O_WRONLY | O_APPEND);
fd = open(f, O_WRONLY | O_APPEND | O_BINARY);
if(fd < 0)
return errno;
{
@@ -249,7 +253,7 @@ init_fcc (krb5_context context,
int16_t tag;
krb5_storage *sp;
fd = open(fcache->filename, O_RDONLY);
fd = open(fcache->filename, O_RDONLY | O_BINARY);
if(fd < 0)
return errno;
sp = krb5_storage_from_fd(fd);

View File

@@ -40,6 +40,10 @@
RCSID("$Id$");
#ifndef O_BINARY
#define O_BINARY 0
#endif
static struct krb5_keytab_data *kt_types;
static int num_kt_types;
@@ -554,7 +558,7 @@ fkt_start_seq_get(krb5_context context,
krb5_keytab id,
krb5_kt_cursor *c)
{
return fkt_start_seq_get_int(context, id, O_RDONLY, c);
return fkt_start_seq_get_int(context, id, O_RDONLY | O_BINARY, c);
}
static krb5_error_code
@@ -626,9 +630,9 @@ fkt_add_entry(krb5_context context,
struct fkt_data *d = id->data;
off_t pos_start, pos_end;
fd = open (d->filename, O_WRONLY);
fd = open (d->filename, O_WRONLY | O_BINARY);
if (fd < 0) {
fd = open (d->filename, O_WRONLY | O_CREAT, 0600);
fd = open (d->filename, O_WRONLY | O_CREAT | O_BINARY, 0600);
if (fd < 0)
return errno;
sp = krb5_storage_from_fd(fd);
@@ -673,7 +677,7 @@ fkt_remove_entry(krb5_context context,
krb5_kt_cursor cursor;
off_t pos_start, pos_end;
fkt_start_seq_get_int(context, id, O_RDWR, &cursor);
fkt_start_seq_get_int(context, id, O_RDWR | O_BINARY, &cursor);
pos_start = cursor.offset;
while(krb5_kt_next_entry(context, id, &e, &cursor) == 0) {
if(kt_compare(context, &e, entry->principal,