O_BINARY
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4830 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -40,6 +40,10 @@
|
|||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
|
#ifndef O_BINARY
|
||||||
|
#define O_BINARY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct krb5_fcache{
|
typedef struct krb5_fcache{
|
||||||
char *filename;
|
char *filename;
|
||||||
int version;
|
int version;
|
||||||
@@ -86,7 +90,7 @@ erase_file(const char *filename)
|
|||||||
off_t pos;
|
off_t pos;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
fd = open(filename, O_RDWR);
|
fd = open(filename, O_RDWR | O_BINARY);
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
if(errno == ENOENT)
|
if(errno == ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -122,7 +126,7 @@ fcc_initialize(krb5_context context,
|
|||||||
if((ret = erase_file(filename)))
|
if((ret = erase_file(filename)))
|
||||||
return ret;
|
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)
|
if(fd == -1)
|
||||||
return errno;
|
return errno;
|
||||||
{
|
{
|
||||||
@@ -179,7 +183,7 @@ fcc_store_cred(krb5_context context,
|
|||||||
|
|
||||||
f = FILENAME(id);
|
f = FILENAME(id);
|
||||||
|
|
||||||
fd = open(f, O_WRONLY | O_APPEND);
|
fd = open(f, O_WRONLY | O_APPEND | O_BINARY);
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
return errno;
|
return errno;
|
||||||
{
|
{
|
||||||
@@ -249,7 +253,7 @@ init_fcc (krb5_context context,
|
|||||||
int16_t tag;
|
int16_t tag;
|
||||||
krb5_storage *sp;
|
krb5_storage *sp;
|
||||||
|
|
||||||
fd = open(fcache->filename, O_RDONLY);
|
fd = open(fcache->filename, O_RDONLY | O_BINARY);
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
return errno;
|
return errno;
|
||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
|
@@ -40,6 +40,10 @@
|
|||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
|
#ifndef O_BINARY
|
||||||
|
#define O_BINARY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct krb5_keytab_data *kt_types;
|
static struct krb5_keytab_data *kt_types;
|
||||||
static int num_kt_types;
|
static int num_kt_types;
|
||||||
|
|
||||||
@@ -554,7 +558,7 @@ fkt_start_seq_get(krb5_context context,
|
|||||||
krb5_keytab id,
|
krb5_keytab id,
|
||||||
krb5_kt_cursor *c)
|
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
|
static krb5_error_code
|
||||||
@@ -626,9 +630,9 @@ fkt_add_entry(krb5_context context,
|
|||||||
struct fkt_data *d = id->data;
|
struct fkt_data *d = id->data;
|
||||||
off_t pos_start, pos_end;
|
off_t pos_start, pos_end;
|
||||||
|
|
||||||
fd = open (d->filename, O_WRONLY);
|
fd = open (d->filename, O_WRONLY | O_BINARY);
|
||||||
if (fd < 0) {
|
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)
|
if (fd < 0)
|
||||||
return errno;
|
return errno;
|
||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
@@ -673,7 +677,7 @@ fkt_remove_entry(krb5_context context,
|
|||||||
krb5_kt_cursor cursor;
|
krb5_kt_cursor cursor;
|
||||||
off_t pos_start, pos_end;
|
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;
|
pos_start = cursor.offset;
|
||||||
while(krb5_kt_next_entry(context, id, &e, &cursor) == 0) {
|
while(krb5_kt_next_entry(context, id, &e, &cursor) == 0) {
|
||||||
if(kt_compare(context, &e, entry->principal,
|
if(kt_compare(context, &e, entry->principal,
|
||||||
|
Reference in New Issue
Block a user