call krb5_set_error_string when open fails fatally
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9861 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997 - 2000 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -231,8 +231,12 @@ fcc_initialize(krb5_context context,
|
|||||||
unlink (filename);
|
unlink (filename);
|
||||||
|
|
||||||
fd = open(filename, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
|
fd = open(filename, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
|
||||||
if(fd == -1)
|
if(fd == -1) {
|
||||||
return errno;
|
ret = errno;
|
||||||
|
krb5_set_error_string(context, "open(%s): %s", filename,
|
||||||
|
strerror(ret));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
krb5_storage *sp;
|
krb5_storage *sp;
|
||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
@@ -298,8 +302,11 @@ fcc_store_cred(krb5_context context,
|
|||||||
f = FILENAME(id);
|
f = FILENAME(id);
|
||||||
|
|
||||||
fd = open(f, O_WRONLY | O_APPEND | O_BINARY);
|
fd = open(f, O_WRONLY | O_APPEND | O_BINARY);
|
||||||
if(fd < 0)
|
if(fd < 0) {
|
||||||
return errno;
|
ret = errno;
|
||||||
|
krb5_set_error_string (context, "open(%s): %s", f, strerror(ret));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
krb5_storage *sp;
|
krb5_storage *sp;
|
||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
@@ -339,8 +346,12 @@ init_fcc (krb5_context context,
|
|||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
|
|
||||||
fd = open(fcache->filename, O_RDONLY | O_BINARY);
|
fd = open(fcache->filename, O_RDONLY | O_BINARY);
|
||||||
if(fd < 0)
|
if(fd < 0) {
|
||||||
return errno;
|
ret = errno;
|
||||||
|
krb5_set_error_string(context, "open(%s): %s", fcache->filename,
|
||||||
|
strerror(ret));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
ret = krb5_ret_int8(sp, &pvno);
|
ret = krb5_ret_int8(sp, &pvno);
|
||||||
if(ret == KRB5_CC_END)
|
if(ret == KRB5_CC_END)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 1998, 1999 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -280,8 +280,12 @@ fkt_start_seq_get_int(krb5_context context,
|
|||||||
struct fkt_data *d = id->data;
|
struct fkt_data *d = id->data;
|
||||||
|
|
||||||
c->fd = open (d->filename, flags);
|
c->fd = open (d->filename, flags);
|
||||||
if (c->fd < 0)
|
if (c->fd < 0) {
|
||||||
return errno;
|
ret = errno;
|
||||||
|
krb5_set_error_string(context, "open(%s): %s", d->filename,
|
||||||
|
strerror(ret));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
c->sp = krb5_storage_from_fd(c->fd);
|
c->sp = krb5_storage_from_fd(c->fd);
|
||||||
ret = krb5_ret_int8(c->sp, &pvno);
|
ret = krb5_ret_int8(c->sp, &pvno);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
@@ -391,8 +395,12 @@ fkt_add_entry(krb5_context context,
|
|||||||
fd = open (d->filename, O_RDWR | O_BINARY);
|
fd = open (d->filename, O_RDWR | O_BINARY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fd = open (d->filename, O_RDWR | O_CREAT | O_BINARY, 0600);
|
fd = open (d->filename, O_RDWR | O_CREAT | O_BINARY, 0600);
|
||||||
if (fd < 0)
|
if (fd < 0) {
|
||||||
return errno;
|
ret = errno;
|
||||||
|
krb5_set_error_string(context, "open(%s): %s", d->filename,
|
||||||
|
strerror(ret));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
ret = krb5_store_int8(sp, 5);
|
ret = krb5_store_int8(sp, 5);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
|
Reference in New Issue
Block a user