summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorBarry Jaspan <bjaspan@mit.edu>1990-01-19 16:05:31 +0000
committerBarry Jaspan <bjaspan@mit.edu>1990-01-19 16:05:31 +0000
commitd07102e67a1775af12c209f9a9b76ce7d4922bcb (patch)
tree266e0ffde984c9226863cb3ac8e2cdc31345c41b /src/lib
parent02301adeeb1b2bffd6952ffdf20f77e148d11edb (diff)
First "debugged" version -- saber accepts it
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@142 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/krb5/ccache/file/fcc.h2
-rw-r--r--src/lib/krb5/ccache/file/fcc_close.c10
-rw-r--r--src/lib/krb5/ccache/file/fcc_defnam.c2
-rw-r--r--src/lib/krb5/ccache/file/fcc_destry.c22
-rw-r--r--src/lib/krb5/ccache/file/fcc_eseq.c9
-rw-r--r--src/lib/krb5/ccache/file/fcc_gennew.c24
-rw-r--r--src/lib/krb5/ccache/file/fcc_getnam.c2
-rw-r--r--src/lib/krb5/ccache/file/fcc_gprin.c10
-rw-r--r--src/lib/krb5/ccache/file/fcc_init.c10
-rw-r--r--src/lib/krb5/ccache/file/fcc_nseq.c18
-rw-r--r--src/lib/krb5/ccache/file/fcc_read.c40
-rw-r--r--src/lib/krb5/ccache/file/fcc_reslv.c20
-rw-r--r--src/lib/krb5/ccache/file/fcc_retrv.c2
-rw-r--r--src/lib/krb5/ccache/file/fcc_sseq.c19
-rw-r--r--src/lib/krb5/ccache/file/fcc_store.c34
15 files changed, 128 insertions, 96 deletions
diff --git a/src/lib/krb5/ccache/file/fcc.h b/src/lib/krb5/ccache/file/fcc.h
index f7d91f7df..1f5cb8b1f 100644
--- a/src/lib/krb5/ccache/file/fcc.h
+++ b/src/lib/krb5/ccache/file/fcc.h
@@ -18,10 +18,12 @@
#define __KRB5_FILE_CCACHE__
#include <krb5/krb5.h>
+#include "fcc-os.h"
/* XXX Until I find out the right #define for this.. XXX */
#define KRB5_OK 0
#define KRB5_NOMEM 1
+#define KRB5_FCC_MAXLEN 100
#ifndef TKT_ROOT
#define TKT_ROOT "/tmp/tkt"
diff --git a/src/lib/krb5/ccache/file/fcc_close.c b/src/lib/krb5/ccache/file/fcc_close.c
index 35342b6fc..891f55053 100644
--- a/src/lib/krb5/ccache/file/fcc_close.c
+++ b/src/lib/krb5/ccache/file/fcc_close.c
@@ -30,7 +30,7 @@ static char fcc_resolve_c[] = "$Id$";
* system errors
* permission errors
*/
-krb5_error
+krb5_error_code
krb5_fcc_close(id)
krb5_ccache id;
{
@@ -38,15 +38,15 @@ krb5_fcc_close(id)
#ifdef OPENCLOSE
#else
- close(id->data->fd);
+ close(((krb5_fcc_data *) id->data)->fd);
#endif
- ret = unlink(id->data->filename);
+ ret = unlink(((krb5_fcc_data *) id->data)->filename);
if (ret < 0)
return errno;
- free(id->data->filename);
- free(id->data);
+ free(((krb5_fcc_data *) id->data)->filename);
+ free(((krb5_fcc_data *) id->data));
free(id);
return KRB5_OK;
diff --git a/src/lib/krb5/ccache/file/fcc_defnam.c b/src/lib/krb5/ccache/file/fcc_defnam.c
index c03fc3f5e..43a8286e2 100644
--- a/src/lib/krb5/ccache/file/fcc_defnam.c
+++ b/src/lib/krb5/ccache/file/fcc_defnam.c
@@ -41,7 +41,7 @@ static char krb5_default_name_string[KRB5_FCC_MAXLEN] = "";
char *
krb5_fcc_default_name ()
{
- char *krb5ccache;
+ char *krb5ccache, *getenv();
int len;
/* Is the environment variable defined? */
diff --git a/src/lib/krb5/ccache/file/fcc_destry.c b/src/lib/krb5/ccache/file/fcc_destry.c
index 7b8fd1c96..659f68983 100644
--- a/src/lib/krb5/ccache/file/fcc_destry.c
+++ b/src/lib/krb5/ccache/file/fcc_destry.c
@@ -12,10 +12,12 @@
#ifndef lint
static char fcc_destry_c[] = "$Id$";
-#endif lint
+#endif /* lint */
#include <krb5/copyright.h>
+#include "fcc.h"
+
/*
* Effects:
* Destroys the contents of id.
@@ -23,8 +25,7 @@ static char fcc_destry_c[] = "$Id$";
* Errors:
* system errors
*/
-krb5_error
-krb5_fcc_destroy(id)
+krb5_error_code krb5_fcc_destroy(id)
krb5_ccache id;
{
struct stat buf;
@@ -33,14 +34,15 @@ krb5_fcc_destroy(id)
int ret;
#ifdef OPENCLOSE
- id->data->fd = open(id->data->filename, O_RDWR, 0);
- if (id->data->fd < 0)
+ ((krb5_fcc_data *) id->data)->fd = open(((krb5_fcc_data *) id->data)->
+ filename, O_RDWR, 0);
+ if (((krb5_fcc_data *) id->data)->fd < 0)
return errno;
#else
- lseek(id->data->fd, 0, L_SET);
+ lseek(((krb5_fcc_data *) id->data)->fd, 0, L_SET);
#endif
- ret = fstat(id->data->fd, &buf);
+ ret = fstat(((krb5_fcc_data *) id->data)->fd, &buf);
if (ret < 0)
return errno;
@@ -49,13 +51,13 @@ krb5_fcc_destroy(id)
bzero(zeros, BUFSIZ);
for (i=0; i < size / BUFSIZ; i++)
- if (write(id->data->fd, zeros, BUFSIZ) < 0)
+ if (write(((krb5_fcc_data *) id->data)->fd, zeros, BUFSIZ) < 0)
return errno;
- if (write(id->data->fd, zeros, size % BUFSIZ) < 0)
+ if (write(((krb5_fcc_data *) id->data)->fd, zeros, size % BUFSIZ) < 0)
return errno;
#ifdef OPENCLOSE
- close(id->data->fd);
+ close(((krb5_fcc_data *) id->data)->fd);
#endif
}
diff --git a/src/lib/krb5/ccache/file/fcc_eseq.c b/src/lib/krb5/ccache/file/fcc_eseq.c
index a2af57ad1..d1cf1a596 100644
--- a/src/lib/krb5/ccache/file/fcc_eseq.c
+++ b/src/lib/krb5/ccache/file/fcc_eseq.c
@@ -12,7 +12,7 @@
#ifndef lint
static char fcc_eseq_c[] = "$Id$";
-#endif lint
+#endif /* lint */
#include <krb5/copyright.h>
#include "fcc.h"
@@ -29,17 +29,18 @@ static char fcc_eseq_c[] = "$Id$";
* Finishes sequential processing of the file credentials ccache id,
* and invalidates the cursor (it must never be used after this call).
*/
-krb5_error
+/* ARGSUSED */
+krb5_error_code
krb5_fcc_end_seq_get(id, cursor)
krb5_ccache id;
krb5_cc_cursor *cursor;
{
#ifdef OPENCLOSE
#else
- close(id->data->fd);
+ close(((krb5_fcc_data *) id->data)->fd);
#endif
- free((krb5_fcc_cursor) cursor);
+ free((krb5_fcc_cursor *) cursor);
return KRB5_OK;
}
diff --git a/src/lib/krb5/ccache/file/fcc_gennew.c b/src/lib/krb5/ccache/file/fcc_gennew.c
index 4f69282bc..8a64f57dd 100644
--- a/src/lib/krb5/ccache/file/fcc_gennew.c
+++ b/src/lib/krb5/ccache/file/fcc_gennew.c
@@ -18,6 +18,8 @@ static char fcc_resolve_c[] = "$Id$";
#include <krb5/copyright.h>
+extern krb5_cc_ops krb5_fcc_ops;
+
/*
* Effects:
* Creates a new file cred cache whose name is guaranteed to be
@@ -31,41 +33,45 @@ static char fcc_resolve_c[] = "$Id$";
* KRB5_NOMEM - there was insufficient memory to allocate the
* krb5_ccache. id is undefined.
*/
-krb5_err
+krb5_error_code
krb5_fcc_generate_new (id)
krb5_ccache id;
+
{
+ int ret;
char scratch[100]; /* XXX Is this large enough */
/* Allocate memory */
- id = (krb_ccache) malloc(sizeof(struct _krb5_ccache));
+ id = (krb5_ccache) malloc(sizeof(struct _krb5_ccache));
if (id == NULL)
return KRB5_NOMEM;
sprintf(scratch, "%sXXXXXX", TKT_ROOT);
mktemp(scratch);
- id->data = malloc(sizeof(krb5_fcc_data));
- if (id->data == NULL) {
+ ((krb5_fcc_data *) id->data) = (krb5_fcc_data *)
+ malloc(sizeof(krb5_fcc_data));
+ if (((krb5_fcc_data *) id->data) == NULL) {
free(id);
return KRB5_NOMEM;
}
- id->data->filename = malloc(strlen(scratch) + 1);
- if (id->data->filename == NULL) {
- free(id->data);
+ ((krb5_fcc_data *) id->data)->filename = (char *)
+ malloc(strlen(scratch) + 1);
+ if (((krb5_fcc_data *) id->data)->filename == NULL) {
+ free(((krb5_fcc_data *) id->data));
free(id);
return KRB5_NOMEM;
}
/* Set up the filename */
- strcpy(id->data->filename, scratch);
+ strcpy(((krb5_fcc_data *) id->data)->filename, scratch);
/* Copy the virtual operation pointers into id */
bcopy((char *) &krb5_fcc_ops, id->ops, sizeof(struct _krb5_ccache));
/* Make sure the file name is reserved */
- ret = open(id->data->filename, O_CREAT | O_EXCL, 0);
+ ret = open(((krb5_fcc_data *) id->data)->filename, O_CREAT | O_EXCL, 0);
if (ret == -1 && errno != EEXIST)
return ret;
else {
diff --git a/src/lib/krb5/ccache/file/fcc_getnam.c b/src/lib/krb5/ccache/file/fcc_getnam.c
index 6b6fa05ec..290665a01 100644
--- a/src/lib/krb5/ccache/file/fcc_getnam.c
+++ b/src/lib/krb5/ccache/file/fcc_getnam.c
@@ -29,5 +29,5 @@ char *
krb5_fcc_get_name (id)
krb5_ccache id;
{
- return (char *) id->data->filename;
+ return (char *) ((krb5_fcc_data *) id->data)->filename;
}
diff --git a/src/lib/krb5/ccache/file/fcc_gprin.c b/src/lib/krb5/ccache/file/fcc_gprin.c
index 54244b393..4f8e7d61a 100644
--- a/src/lib/krb5/ccache/file/fcc_gprin.c
+++ b/src/lib/krb5/ccache/file/fcc_gprin.c
@@ -15,6 +15,7 @@ static char fcc_gprinc_c[] = "$Id$";
#endif lint
#include <krb5/copyright.h>
+#include "fcc.h"
/*
* Modifies:
@@ -29,17 +30,18 @@ static char fcc_gprinc_c[] = "$Id$";
* system errors
* KRB5_NOMEM
*/
-krb5_error
+krb5_error_code
krb5_fcc_get_principal(id, princ)
krb5_ccache id;
krb5_principal *princ;
{
#ifdef OPENCLOSE
- id->data->fd = open(id->data->filename, O_RDONLY, 0);
- if (id->data->fd < 0)
+ ((krb5_fcc_data *) id->data)->fd = open(((krb5_fcc_data *) id->data)->
+ filename, O_RDONLY, 0);
+ if (((krb5_fcc_data *) id->data)->fd < 0)
return errno;
#else
- lseek(id->data->fd, 0, L_SET);
+ lseek(((krb5_fcc_data *) id->data)->fd, 0, L_SET);
#endif
return (krb5_fcc_read_principal(princ));
diff --git a/src/lib/krb5/ccache/file/fcc_init.c b/src/lib/krb5/ccache/file/fcc_init.c
index 61c840e8a..ba8367793 100644
--- a/src/lib/krb5/ccache/file/fcc_init.c
+++ b/src/lib/krb5/ccache/file/fcc_init.c
@@ -30,26 +30,26 @@ static char fcc_resolve_c[] = "$Id$";
* system errors
* permission errors
*/
-krb5_error
+krb5_error_code
krb5_fcc_initialize(id, princ)
krb5_ccache id;
krb5_principal princ;
{
int ret;
- ret = open(id->data->filename, O_CREAT | O_TRUNC | O_RDWR, 0);
+ ret = open(((krb5_fcc_data *) id->data)->filename, O_CREAT | O_TRUNC | O_RDWR, 0);
if (ret < 0)
return errno;
- id->data->fd = ret;
+ ((krb5_fcc_data *) id->data)->fd = ret;
- ret = fchmod(id->data->fd, S_IREAD | S_IWRITE);
+ ret = fchmod(((krb5_fcc_data *) id->data)->fd, S_IREAD | S_IWRITE);
if (ret == -1)
return ret;
krb5_fcc_write_principal(id, princ);
#ifdef OPENCLOSE
- close(id->data->fd);
+ close(((krb5_fcc_data *) id->data)->fd);
#endif
return KRB5_OK;
diff --git a/src/lib/krb5/ccache/file/fcc_nseq.c b/src/lib/krb5/ccache/file/fcc_nseq.c
index e51957016..c5bdbf0e4 100644
--- a/src/lib/krb5/ccache/file/fcc_nseq.c
+++ b/src/lib/krb5/ccache/file/fcc_nseq.c
@@ -18,6 +18,8 @@ static char fcc_nseq_c[] = "$Id$";
#include "fcc.h"
+/* XXX Deal with kret values */
+
/*
* Requires:
* cursor is a krb5_cc_cursor originally obtained from
@@ -37,26 +39,26 @@ static char fcc_nseq_c[] = "$Id$";
* Errors:
* system errors
*/
-krb5_error
+krb5_error_code
krb5_fcc_next_cred(id, creds, cursor)
krb5_ccache id;
krb5_creds *creds;
krb5_cc_cursor *cursor;
{
int ret;
- krb5_error kret;
+ krb5_error_code kret;
krb5_fcc_cursor *fcursor;
#ifdef OPENCLOSE
- ret = open(id->data->filename, O_RDONLY, 0);
+ ret = open(((krb5_fcc_data *) id->data)->filename, O_RDONLY, 0);
if (ret < 0)
return errno;
- id->data->fd = ret;
+ ((krb5_fcc_data *) id->data)->fd = ret;
#endif
fcursor = (krb5_fcc_cursor *) cursor;
- ret = lseek(id->data->fd, fcursor->pos, L_SET);
+ ret = lseek(((krb5_fcc_data *) id->data)->fd, fcursor->pos, L_SET);
if (ret < 0)
return errno;
@@ -73,11 +75,11 @@ krb5_fcc_next_cred(id, creds, cursor)
kret = krb5_fcc_read_data(&creds->ticket);
kret = krb5_fcc_read_data(&creds->second_ticket);
- fcursor->pos = tell(id->data->fd);
- cursor = (krb5_cc_cursor) fcursor;
+ fcursor->pos = tell(((krb5_fcc_data *) id->data)->fd);
+ cursor = (krb5_cc_cursor *) fcursor;
#ifdef OPENCLOSE
- close(id->data->fd);
+ close(((krb5_fcc_data *) id->data)->fd);
#endif
return KRB5_OK;
diff --git a/src/lib/krb5/ccache/file/fcc_read.c b/src/lib/krb5/ccache/file/fcc_read.c
index 70a3d31bb..86b2cfe65 100644
--- a/src/lib/krb5/ccache/file/fcc_read.c
+++ b/src/lib/krb5/ccache/file/fcc_read.c
@@ -16,15 +16,20 @@ static char fcc_read_c[] = "$Id$";
#endif lint
#include <krb5/copyright.h>
+#include "fcc.h"
+
+/* XXX Deal with kret return values */
/* XXX Doesn't deal if < sizeof(o) bytes are written XXX */
-#define krb5_fcc_read(i,b,l) (read(i->data->fd,b,l)==-1 ? errno : KRB5_OK)
+#define krb5_fcc_read(i,b,l) (read(((krb5_fcc_data *)i->data)->fd,b,l) == -1 \
+ ? errno : KRB5_OK)
/*
* FOR ALL OF THE FOLLOWING FUNCTIONS:
*
* Requires:
- * id->data->fd is open and at the right position in the file.
+ * ((krb5_fcc_data *) id->data)->fd is open and at the right position
+ * in the file.
*
* Effects:
* Allocates memory for and decodes the appropriate type from the
@@ -35,13 +40,14 @@ static char fcc_read_c[] = "$Id$";
* KRB5_NOMEM
*/
-krb5_error
+krb5_error_code
krb5_fcc_read_principal(id, princ)
krb5_ccache id;
krb5_principal princ;
{
- krb5_error kret;
+ krb5_error_code kret;
krb5_int32 length;
+ int i;
/* Read the number of components */
krb5_fcc_read_int32(id, &length);
@@ -54,17 +60,21 @@ krb5_fcc_read_principal(id, princ)
/* Read length components */
for (i=0; i < length; i++) {
kret = krb5_fcc_read_data(id, princ[i]);
+ if (kret != KRB5_OK) {
+ free(princ);
+ return kret;
+ }
}
return KRB5_OK;
}
-krb5_error
+krb5_error_code
krb5_fcc_read_keyblock(id, keyblock)
krb5_ccache id;
krb5_keyblock *keyblock;
{
- krb5_error kret;
+ krb5_error_code kret;
int ret;
keyblock = (krb5_keyblock *) malloc(sizeof(krb5_keyblock));
@@ -73,18 +83,18 @@ krb5_fcc_read_keyblock(id, keyblock)
kret = krb5_fcc_read_keytype(id, &keyblock->keytype);
kret = krb5_fcc_read_int(id, &keyblock->length);
- ret = read(id->data->fd, keyblock->contents,
+ ret = read(((krb5_fcc_data *) id->data)->fd, keyblock->contents,
(keyblock->length)*sizeof(krb5_octet));
return KRB5_OK;
}
-krb5_error
+krb5_error_code
krb5_fcc_read_data(id, data)
krb5_ccache id;
krb5_data *data;
{
- krb5_error kret;
+ krb5_error_code kret;
int ret;
data = (krb5_data *) malloc(sizeof(krb5_data));
@@ -99,14 +109,14 @@ krb5_fcc_read_data(id, data)
return KRB5_NOMEM;
}
- ret = read(id->data->fd, data->data, data->length);
+ ret = read(((krb5_fcc_data *) id->data)->fd, data->data, data->length);
if (ret == -1)
return errno;
return KRB5_OK;
}
-krb5_error
+krb5_error_code
krb5_fcc_read_int32(id, i)
krb5_ccache id;
krb5_int32 *i;
@@ -114,7 +124,7 @@ krb5_fcc_read_int32(id, i)
return krb5_fcc_read(id, i, sizeof(krb5_int32));
}
-krb5_error
+krb5_error_code
krb5_fcc_read_keytype(id, k)
krb5_ccache id;
krb5_keytype *k;
@@ -122,7 +132,7 @@ krb5_fcc_read_keytype(id, k)
return krb5_fcc_read(id, k, sizeof(krb5_keytype));
}
-krb5_error
+krb5_error_code
krb5_fcc_read_int(id, i)
krb5_ccache id;
int *i;
@@ -130,7 +140,7 @@ krb5_fcc_read_int(id, i)
return krb5_fcc_read(id, i, sizeof(int));
}
-krb5_error
+krb5_error_code
krb5_fcc_read_bool(id, b)
krb5_ccache id;
krb5_boolean *b;
@@ -138,7 +148,7 @@ krb5_fcc_read_bool(id, b)
return krb5_fcc_read(id, b, sizeof(krb5_boolean));
}
-krb5_error
+krb5_error_code
krb5_fcc_read_times(id, t)
krb5_ccache id;
krb5_ticket_times *t;
diff --git a/src/lib/krb5/ccache/file/fcc_reslv.c b/src/lib/krb5/ccache/file/fcc_reslv.c
index 3dda64055..aee9d4ded 100644
--- a/src/lib/krb5/ccache/file/fcc_reslv.c
+++ b/src/lib/krb5/ccache/file/fcc_reslv.c
@@ -18,7 +18,7 @@ static char fcc_resolve_c[] = "$Id$";
#include "fcc.h"
-extern struct krb5_cc_ops krb5_fcc_ops;
+extern krb5_cc_ops krb5_fcc_ops;
/*
* Requires:
@@ -39,7 +39,7 @@ extern struct krb5_cc_ops krb5_fcc_ops;
* krb5_ccache. id is undefined.
* permission errors
*/
-krb5_error
+krb5_error_code
krb5_fcc_resolve (id, residual)
krb5_ccache id;
char *residual;
@@ -50,15 +50,17 @@ krb5_fcc_resolve (id, residual)
if (id == NULL)
return KRB5_NOMEM;
- id->data = (char *) malloc(sizeof(krb5_fcc_data));
- if (id->data == NULL) {
+ ((krb5_fcc_data *) id->data) = (krb5_fcc_data *)
+ malloc(sizeof(krb5_fcc_data));
+ if (((krb5_fcc_data *) id->data) == NULL) {
free(id);
return KRB5_NOMEM;
}
- id->data->filename = (char *) malloc(strlen(residual) + 1);
- if (id->data->filename == NULL) {
- free(id->data);
+ ((krb5_fcc_data *) id->data)->filename = (char *)
+ malloc(strlen(residual) + 1);
+ if (((krb5_fcc_data *) id->data)->filename == NULL) {
+ free(((krb5_fcc_data *) id->data));
free(id);
return KRB5_NOMEM;
}
@@ -67,10 +69,10 @@ krb5_fcc_resolve (id, residual)
bcopy((char *) &krb5_fcc_ops, id->ops, sizeof(struct _krb5_ccache));
/* Set up the filename */
- strcpy(id->data->filename, residual);
+ strcpy(((krb5_fcc_data *) id->data)->filename, residual);
/* Make sure the file name is reserved */
- ret = open(id->data->filename, O_CREAT | O_EXCL, 0);
+ ret = open(((krb5_fcc_data *) id->data)->filename, O_CREAT | O_EXCL, 0);
if (ret == -1 && errno != EEXIST)
return ret;
else {
diff --git a/src/lib/krb5/ccache/file/fcc_retrv.c b/src/lib/krb5/ccache/file/fcc_retrv.c
index 17e9b5a6c..2668fa008 100644
--- a/src/lib/krb5/ccache/file/fcc_retrv.c
+++ b/src/lib/krb5/ccache/file/fcc_retrv.c
@@ -29,7 +29,7 @@ static char fcc_retrieve_c[] = "$Id$";
* permission errors
* KRB5_NOMEM
*/
-krb5_error
+krb5_error_code
krb5_fcc_retrieve(id, whichfields, mcreds, creds)
krb5_ccache id;
krb5_flags whichfields;
diff --git a/src/lib/krb5/ccache/file/fcc_sseq.c b/src/lib/krb5/ccache/file/fcc_sseq.c
index 33178a2a5..e0b7bda61 100644
--- a/src/lib/krb5/ccache/file/fcc_sseq.c
+++ b/src/lib/krb5/ccache/file/fcc_sseq.c
@@ -31,32 +31,35 @@ static char fcc_sseq_c[] = "$Id$";
* KRB5_NOMEM
* system errors
*/
-krb5_error
+krb5_error_code
krb5_fcc_start_seq_get(id, cursor)
krb5_ccache id;
krb5_cc_cursor *cursor;
{
krb5_fcc_cursor *fcursor;
+ int ret;
- fcursor = (krb5_cc_cursor) malloc(sizeof(krb5_fcc_cursor));
+ fcursor = (krb5_fcc_cursor *) malloc(sizeof(krb5_fcc_cursor));
if (fcursor == NULL)
return KRB5_NOMEM;
/* Make sure we start reading right after the primary principal */
#ifdef OPENCLOSE
- ret = open(id->data->filename, O_RDONLY, 0);
+ ret = open(((krb5_fcc_data *) id->data)->filename, O_RDONLY, 0);
if (ret < 0)
return errno;
- id->data->fd = ret;
+ ((krb5_fcc_data *) id->data)->fd = ret;
#else
- lseek(id->data->fd, 0, L_SET);
+ lseek(((krb5_fcc_data *) id->data)->fd, 0, L_SET);
#endif
krb5_fcc_skip_pprincipal(id);
- fcursor->pos = tell(id->data->fd);
- cursor = (krb5_cc_cursor) fcursor;
+ fcursor->pos = tell(((krb5_fcc_data *) id->data)->fd);
+ cursor = (krb5_cc_cursor *) fcursor;
#ifdef OPENCLOSE
- close(id->data->fd);
+ close(((krb5_fcc_data *) id->data)->fd);
#endif
+
+ return KRB5_OK;
}
diff --git a/src/lib/krb5/ccache/file/fcc_store.c b/src/lib/krb5/ccache/file/fcc_store.c
index 83d949117..e0240fc4d 100644
--- a/src/lib/krb5/ccache/file/fcc_store.c
+++ b/src/lib/krb5/ccache/file/fcc_store.c
@@ -19,7 +19,9 @@ static char fcc_store_c[] = "$Id$";
#include "fcc.h"
/* XXX Doesn't deal if < sizeof(o) bytes are written XXX */
-#define krb5_fcc_write(i,b,l) (write(i->data->fd,b,l)==-1 ? errno : KRB5_OK)
+#define krb5_fcc_write(i,b,l) (write(((krb5_fcc_data *)i->data)->fd,b,l) == -1\
+ ? errno : KRB5_OK)
+
#define krb5_fcc_store_int32(id,i) krb5_fcc_write(id, i, sizeof(krb5_int32))
#define krb5_fcc_store_keytype(id,k) krb5_fcc_write(id,k,sizeof(krb5_keytype))
#define krb5_fcc_store_int(id,i) krb5_fcc_write(id,i,sizeof(int))
@@ -39,21 +41,21 @@ static char fcc_store_c[] = "$Id$";
* system errors
* storage failure errors
*/
-krb5_error
+krb5_error_code
krb5_fcc_store(id, creds)
krb5_ccache id;
krb5_creds *creds;
{
#define TCHECK(ret) if (ret != KRB5_OK) goto lose;
- krb5_error ret;
+ krb5_error_code ret;
/* Make sure we are writing to the end of the file */
#ifdef OPENCLOSE
- id->data->fd = open(id->data->filename, O_APPEND, 0);
- if (id->data->fd < 0)
+ ((krb5_fcc_data *) id->data)->fd = open(((krb5_fcc_data *) id->data)->filename, O_APPEND, 0);
+ if (((krb5_fcc_data *) id->data)->fd < 0)
return errno;
#else
- ret = lseek(id->data->fd, L_XTND, 0);
+ ret = lseek(((krb5_fcc_data *) id->data)->fd, L_XTND, 0);
if (ret < 0)
return errno;
#endif
@@ -76,7 +78,7 @@ krb5_fcc_store(id, creds)
lose:
#ifdef OPENCLOSE
- close(id->data->fd);
+ close(((krb5_fcc_data *) id->data)->fd);
#endif
return ret;
@@ -87,7 +89,7 @@ lose:
* FOR ALL OF THE FOLLOWING FUNCTIONS:
*
* Requires:
- * id->data->fd is open and at the right position.
+ * ((krb5_fcc_data *) id->data)->fd is open and at the right position.
*
* Effects:
* Stores an encoded version of the second argument in the
@@ -97,12 +99,12 @@ lose:
* system errors
*/
-static krb5_error
+static krb5_error_code
krb5_fcc_store_principal(id, princ)
krb5_ccache id;
krb5_principal princ;
{
- krb5_error ret;
+ krb5_error_code ret;
krb5_principal temp;
krb5_int32 i, length = 0;
@@ -121,18 +123,18 @@ krb5_fcc_store_principal(id, princ)
return KRB5_OK;
}
-static krb5_error
+static krb5_error_code
krb5_store_keyblock(id, keyblock)
krb5_ccache id;
krb5_keyblock *keyblock;
{
- krb5_error ret;
+ krb5_error_code ret;
ret = krb5_fcc_store_keytype(id, &keyblock->keytype);
CHECK(ret);
ret = krb5_fcc_store_int(id, &keyblock->length);
CHECK(ret);
- ret = write(id->data->fd, keyblock->contents,
+ ret = write(((krb5_fcc_data *) id->data)->fd, keyblock->contents,
(keyblock->length)*sizeof(krb5_octet));
CHECK(ret);
@@ -140,16 +142,16 @@ krb5_store_keyblock(id, keyblock)
}
-static krb5_error
+static krb5_error_code
krb5_fcc_store_data(id, data)
krb5_ccache id;
krb5_data *data;
{
- krb5_error ret;
+ krb5_error_code ret;
ret = krb5_fcc_store_int32(id, data->length);
CHECK(ret);
- ret = write(id->data->fd, data->data, data->length);
+ ret = write(((krb5_fcc_data *) id->data)->fd, data->data, data->length);
if (ret == -1)
return errno;