+Tue Mar 7 15:55:12 1995 Keith Vetter (keithv@fusion.com)
+
+ * ccbase.c, ccdefault.c: added window INTERFACE keyword.
+ * Makefile.in: made to work on the PC.
+
Tue Feb 28 00:35:33 1995 John Gilmore (gnu at toad.com)
* ccbase.c, ccdefault.c: Avoid <krb5/...> includes.
CFLAGS = $(CCOPTS) $(DEFS)
LDFLAGS = -g
-all:: $(OBJS)
+##DOSBUILDTOP = ..\..\..
+##DOSLIBNAME=..\krb5.lib
+##DOS!include $(BUILDTOP)\config\windows.in
-OBJS= ccbase.o \
- ccdefault.o \
- ccdefops.o
+OBJS= ccbase.$(OBJEXT) \
+ ccdefault.$(OBJEXT) \
+ ccdefops.$(OBJEXT)
SRCS= $(srcdir)/ccbase.c \
$(srcdir)/ccdefault.c \
$(srcdir)/ccdefops.c
+
+all:: $(OBJS) all-$(WHAT)
+
+all-unix::
+
+all-windows::
+ cd FILE
+ @echo Making in CCACHE\FILE
+ -$(MAKE) -$(MFLAGS) LIBCMD=$(LIBCMD)
+ cd ..
+
+clean:: clean-$(WHAT)
+
+clean-unix::
+
+clean-windows::
+ cd FILE
+ @echo Making clean in CCACHE\FILE
+ -$(MAKE) -$(MFLAGS) clean
+ cd ..
+
* If override is set, replace any existing ccache with that type tag
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_cc_register(context, ops, override)
krb5_context context;
krb5_cc_ops *ops;
* particular cache type.
*/
-krb5_error_code krb5_cc_resolve (context, name, cache)
+krb5_error_code INTERFACE
+krb5_cc_resolve (context, name, cache)
krb5_context context;
char *name;
krb5_ccache *cache;
#include "k5-int.h"
-krb5_error_code krb5_cc_default(context, ccache)
+krb5_error_code INTERFACE
+krb5_cc_default(context, ccache)
krb5_context context;
krb5_ccache *ccache;
{
+Tue Mar 7 15:58:15 1995 Keith Vetter (keithv@fusion.com)
+
+ * fcc.h: alwas pull in low-level i/o stuff for the PC.
+ * *.c, fcc-proto.h: added windows INTERFACE keyword.
+ * fcc_dest.c, fcc_init.c, fcc_maybe.c, fcc_nseq.c, fcc_read.c,
+ fcc_sseq.c, fcc_write.c: fixed up some int/long and
+ signed/unsigned problems.
+
Tue Feb 28 00:35:55 1995 John Gilmore (gnu at toad.com)
* fcc.h, fcc_gennew.c, fcc_maybe.c: Avoid <krb5/...> includes.
CFLAGS = $(CCOPTS) $(DEFS)
LDFLAGS = -g
-all:: $(OBJS)
+##DOSBUILDTOP = ..\..\..\..
+##DOSLIBNAME=..\..\krb5.lib
+##DOS!include $(BUILDTOP)\config\windows.in
-OBJS = fcc_close.o fcc_destry.o fcc_eseq.o \
- fcc_gennew.o fcc_getnam.o fcc_gprin.o fcc_init.o \
- fcc_nseq.o fcc_read.o fcc_reslv.o fcc_retrv.o \
- fcc_sseq.o fcc_store.o fcc_skip.o fcc_ops.o fcc_write.o \
- fcc_sflags.o fcc_defops.o fcc_errs.o fcc_maybe.o
+OBJS = fcc_close.$(OBJEXT) fcc_destry.$(OBJEXT) fcc_eseq.$(OBJEXT) \
+ fcc_gennew.$(OBJEXT) fcc_getnam.$(OBJEXT) fcc_gprin.$(OBJEXT) \
+ fcc_init.$(OBJEXT) fcc_nseq.$(OBJEXT) fcc_read.$(OBJEXT) \
+ fcc_reslv.$(OBJEXT) fcc_retrv.$(OBJEXT) fcc_sseq.$(OBJEXT) \
+ fcc_store.$(OBJEXT) fcc_skip.$(OBJEXT) fcc_ops.$(OBJEXT) \
+ fcc_write.$(OBJEXT) fcc_sflags.$(OBJEXT) fcc_defops.$(OBJEXT) \
+ fcc_errs.$(OBJEXT) fcc_maybe.$(OBJEXT)
SRCS = $(srcdir)/fcc_close.c $(srcdir)/fcc_destry.c $(srcdir)/fcc_eseq.c \
$(srcdir)/fcc_gennew.c $(srcdir)/fcc_getnam.c $(srcdir)/fcc_gprin.c \
$(srcdir)/fcc_write.c $(srcdir)/fcc_sflags.c $(srcdir)/fcc_defops.c \
$(srcdir)/fcc_errs.c $(srcdir)/fcc_maybe.c
+all:: $(OBJS)
#define KRB5_FCC_PROTO__
/* fcc_close.c */
-krb5_error_code krb5_fcc_close
+krb5_error_code INTERFACE krb5_fcc_close
PROTOTYPE((krb5_context, krb5_ccache id ));
/* fcc_defnam.c */
-char *krb5_fcc_default_name
+char * INTERFACE krb5_fcc_default_name
PROTOTYPE((krb5_context));
/* fcc_destry.c */
-krb5_error_code krb5_fcc_destroy
+krb5_error_code INTERFACE krb5_fcc_destroy
PROTOTYPE((krb5_context, krb5_ccache id ));
/* fcc_eseq.c */
-krb5_error_code krb5_fcc_end_seq_get
+krb5_error_code INTERFACE krb5_fcc_end_seq_get
PROTOTYPE((krb5_context, krb5_ccache id , krb5_cc_cursor *cursor ));
/* fcc_gennew.c */
-krb5_error_code krb5_fcc_generate_new
+krb5_error_code INTERFACE krb5_fcc_generate_new
PROTOTYPE((krb5_context, krb5_ccache *id ));
/* fcc_getnam.c */
-char *krb5_fcc_get_name
+char * INTERFACE krb5_fcc_get_name
PROTOTYPE((krb5_context, krb5_ccache id ));
/* fcc_gprin.c */
-krb5_error_code krb5_fcc_get_principal
+krb5_error_code INTERFACE krb5_fcc_get_principal
PROTOTYPE((krb5_context, krb5_ccache id , krb5_principal *princ ));
/* fcc_init.c */
-krb5_error_code krb5_fcc_initialize
+krb5_error_code INTERFACE krb5_fcc_initialize
PROTOTYPE((krb5_context, krb5_ccache id , krb5_principal princ ));
/* fcc_nseq.c */
-krb5_error_code krb5_fcc_next_cred
+krb5_error_code INTERFACE krb5_fcc_next_cred
PROTOTYPE((krb5_context,
krb5_ccache id ,
krb5_cc_cursor *cursor ,
krb5_creds *creds ));
/* fcc_read.c */
-krb5_error_code krb5_fcc_read_principal
+krb5_error_code INTERFACE krb5_fcc_read_principal
PROTOTYPE((krb5_context, krb5_ccache id , krb5_principal *princ ));
-krb5_error_code krb5_fcc_read_keyblock
+krb5_error_code INTERFACE krb5_fcc_read_keyblock
PROTOTYPE((krb5_context, krb5_ccache id , krb5_keyblock *keyblock ));
-krb5_error_code krb5_fcc_read_data
+krb5_error_code INTERFACE krb5_fcc_read_data
PROTOTYPE((krb5_context, krb5_ccache id , krb5_data *data ));
-krb5_error_code krb5_fcc_read_int32
+krb5_error_code INTERFACE krb5_fcc_read_int32
PROTOTYPE((krb5_context, krb5_ccache id , krb5_int32 *i ));
-krb5_error_code krb5_fcc_read_ui_2
+krb5_error_code INTERFACE krb5_fcc_read_ui_2
PROTOTYPE((krb5_context, krb5_ccache id , krb5_ui_2 *i ));
-krb5_error_code krb5_fcc_read_octet
+krb5_error_code INTERFACE krb5_fcc_read_octet
PROTOTYPE((krb5_context, krb5_ccache id , krb5_octet *i ));
-krb5_error_code krb5_fcc_read_times
+krb5_error_code INTERFACE krb5_fcc_read_times
PROTOTYPE((krb5_context, krb5_ccache id , krb5_ticket_times *t ));
-krb5_error_code krb5_fcc_read_addrs
+krb5_error_code INTERFACE krb5_fcc_read_addrs
PROTOTYPE((krb5_context, krb5_ccache, krb5_address ***));
-krb5_error_code krb5_fcc_read_addr
+krb5_error_code INTERFACE krb5_fcc_read_addr
PROTOTYPE((krb5_context, krb5_ccache, krb5_address *));
-krb5_error_code krb5_fcc_read_authdata
+krb5_error_code INTERFACE krb5_fcc_read_authdata
PROTOTYPE((krb5_context, krb5_ccache , krb5_authdata ***));
-krb5_error_code krb5_fcc_read_authdatum
+krb5_error_code INTERFACE krb5_fcc_read_authdatum
PROTOTYPE((krb5_context, krb5_ccache , krb5_authdata *));
/* fcc_reslv.c */
-krb5_error_code krb5_fcc_resolve
+krb5_error_code INTERFACE krb5_fcc_resolve
PROTOTYPE((krb5_context, krb5_ccache *id , char *residual ));
/* fcc_retrv.c */
-krb5_error_code krb5_fcc_retrieve
+krb5_error_code INTERFACE krb5_fcc_retrieve
PROTOTYPE((krb5_context,
krb5_ccache id ,
krb5_flags whichfields ,
krb5_creds *creds ));
/* fcc_sseq.c */
-krb5_error_code krb5_fcc_start_seq_get
+krb5_error_code INTERFACE krb5_fcc_start_seq_get
PROTOTYPE((krb5_context, krb5_ccache id , krb5_cc_cursor *cursor ));
/* fcc_store.c */
-krb5_error_code krb5_fcc_store
+krb5_error_code INTERFACE krb5_fcc_store
PROTOTYPE((krb5_context, krb5_ccache id , krb5_creds *creds ));
/* fcc_skip.c */
-krb5_error_code krb5_fcc_skip_principal
+krb5_error_code INTERFACE krb5_fcc_skip_principal
PROTOTYPE((krb5_context, krb5_ccache id ));
/* fcc_sflags.c */
-krb5_error_code krb5_fcc_set_flags
+krb5_error_code INTERFACE krb5_fcc_set_flags
PROTOTYPE((krb5_context, krb5_ccache id , krb5_flags flags ));
/* fcc_ops.c */
extern krb5_cc_ops krb5_cc_file_ops;
/* fcc_write.c */
-krb5_error_code krb5_fcc_write
+krb5_error_code INTERFACE krb5_fcc_write
PROTOTYPE((krb5_context, krb5_ccache id , krb5_pointer buf , int len ));
-krb5_error_code krb5_fcc_store_principal
+krb5_error_code INTERFACE krb5_fcc_store_principal
PROTOTYPE((krb5_context, krb5_ccache id , krb5_principal princ ));
-krb5_error_code krb5_fcc_store_keyblock
+krb5_error_code INTERFACE krb5_fcc_store_keyblock
PROTOTYPE((krb5_context, krb5_ccache id , krb5_keyblock *keyblock ));
-krb5_error_code krb5_fcc_store_data
+krb5_error_code INTERFACE krb5_fcc_store_data
PROTOTYPE((krb5_context, krb5_ccache id , krb5_data *data ));
-krb5_error_code krb5_fcc_store_int32
+krb5_error_code INTERFACE krb5_fcc_store_int32
PROTOTYPE((krb5_context, krb5_ccache id , krb5_int32 i ));
-krb5_error_code krb5_fcc_store_ui_2
+krb5_error_code INTERFACE krb5_fcc_store_ui_2
PROTOTYPE((krb5_context, krb5_ccache id , krb5_int32 i ));
-krb5_error_code krb5_fcc_store_octet
+krb5_error_code INTERFACE krb5_fcc_store_octet
PROTOTYPE((krb5_context, krb5_ccache id , krb5_int32 i ));
-krb5_error_code krb5_fcc_store_times
+krb5_error_code INTERFACE krb5_fcc_store_times
PROTOTYPE((krb5_context, krb5_ccache id , krb5_ticket_times *t ));
-krb5_error_code krb5_fcc_store_addrs
+krb5_error_code INTERFACE krb5_fcc_store_addrs
PROTOTYPE((krb5_context, krb5_ccache , krb5_address ** ));
-krb5_error_code krb5_fcc_store_addr
+krb5_error_code INTERFACE krb5_fcc_store_addr
PROTOTYPE((krb5_context, krb5_ccache , krb5_address * ));
-krb5_error_code krb5_fcc_store_authdata
+krb5_error_code INTERFACE krb5_fcc_store_authdata
PROTOTYPE((krb5_context, krb5_ccache , krb5_authdata **));
-krb5_error_code krb5_fcc_store_authdatum
+krb5_error_code INTERFACE krb5_fcc_store_authdatum
PROTOTYPE((krb5_context, krb5_ccache , krb5_authdata *));
/* fcc_errs.c */
-krb5_error_code krb5_fcc_interpret
+krb5_error_code INTERFACE krb5_fcc_interpret
PROTOTYPE((krb5_context, int ));
/* fcc_maybe.c */
-krb5_error_code krb5_fcc_close_file
+krb5_error_code INTERFACE krb5_fcc_close_file
PROTOTYPE((krb5_context, krb5_ccache));
-krb5_error_code krb5_fcc_open_file
+krb5_error_code INTERFACE krb5_fcc_open_file
PROTOTYPE((krb5_context, krb5_ccache, int));
#endif /* KRB5_FCC_PROTO__ */
#ifndef __KRB5_FILE_CCACHE__
#define __KRB5_FILE_CCACHE__
+#define NEED_LOWLEVEL_IO
#include "k5-int.h"
#include "fcc-proto.h"
#include <stdio.h>
#include "fcc.h"
-
+#include <malloc.h>
/*
* Modifies:
* id
* Closes the file cache, invalidates the id, and frees any resources
* associated with the cache.
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_close(context, id)
krb5_context context;
krb5_ccache id;
* returned is to static storage; the name must be copied elsewhere.
*/
-char *
+char * INTERFACE
krb5_fcc_default_name (context)
krb5_context context;
{
* This file contains the source code for krb5_fcc_destroy.
*/
-
#include <errno.h>
#include "fcc.h"
* Errors:
* system errors
*/
-krb5_error_code krb5_fcc_destroy(context, id)
+krb5_error_code INTERFACE
+krb5_fcc_destroy(context, id)
krb5_context context;
krb5_ccache id;
{
struct stat buf;
- unsigned long size;
+ unsigned long i, size;
+ unsigned int wlen;
char zeros[BUFSIZ];
- register int ret, i;
+ register int ret;
+ krb5_error_code kret;
+
if (OPENCLOSE(id)) {
ret = open(((krb5_fcc_data *) id->data)->filename, O_RDWR, 0);
if (ret < 0) {
- ret = krb5_fcc_interpret(context, errno);
+ kret = krb5_fcc_interpret(context, errno);
goto cleanup;
}
((krb5_fcc_data *) id->data)->fd = ret;
ret = unlink(((krb5_fcc_data *) id->data)->filename);
if (ret < 0) {
- ret = krb5_fcc_interpret(context, errno);
+ kret = krb5_fcc_interpret(context, errno);
if (OPENCLOSE(id)) {
(void) close(((krb5_fcc_data *)id->data)->fd);
((krb5_fcc_data *) id->data)->fd = -1;
+ kret = ret;
}
goto cleanup;
}
ret = fstat(((krb5_fcc_data *) id->data)->fd, &buf);
if (ret < 0) {
- ret = krb5_fcc_interpret(context, errno);
+ kret = krb5_fcc_interpret(context, errno);
if (OPENCLOSE(id)) {
(void) close(((krb5_fcc_data *)id->data)->fd);
((krb5_fcc_data *) id->data)->fd = -1;
memset(zeros, 0, BUFSIZ);
for (i=0; i < size / BUFSIZ; i++)
if (write(((krb5_fcc_data *) id->data)->fd, zeros, BUFSIZ) < 0) {
- ret = krb5_fcc_interpret(context, errno);
+ kret = krb5_fcc_interpret(context, errno);
if (OPENCLOSE(id)) {
(void) close(((krb5_fcc_data *)id->data)->fd);
((krb5_fcc_data *) id->data)->fd = -1;
goto cleanup;
}
- if (write(((krb5_fcc_data *) id->data)->fd, zeros, size % BUFSIZ) < 0) {
- ret = krb5_fcc_interpret(context, errno);
+ wlen = (unsigned int) (size % BUFSIZ);
+ if (write(((krb5_fcc_data *) id->data)->fd, zeros, wlen) < 0) {
+ kret = krb5_fcc_interpret(context, errno);
if (OPENCLOSE(id)) {
(void) close(((krb5_fcc_data *)id->data)->fd);
((krb5_fcc_data *) id->data)->fd = -1;
((krb5_fcc_data *) id->data)->fd = -1;
if (ret)
- ret = krb5_fcc_interpret(context, errno);
+ kret = krb5_fcc_interpret(context, errno);
cleanup:
krb5_xfree(((krb5_fcc_data *) id->data)->filename);
krb5_xfree(id->data);
krb5_xfree(id);
- return ret;
+ return kret;
}
#include "fcc.h"
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_interpret(context, errnum)
krb5_context context;
int errnum;
{
- register int retval;
+ register krb5_error_code retval;
switch (errnum) {
case ENOENT:
retval = KRB5_FCC_NOFILE;
* and invalidates the cursor (it must never be used after this call).
*/
/* ARGSUSED */
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_end_seq_get(context, id, cursor)
krb5_context context;
krb5_ccache id;
* This file contains the source code for krb5_fcc_generate_new.
*/
-
+#define NEED_SOCKETS
#include <errno.h>
-#include "k5-int.h"
#include "fcc.h"
+#include "k5-int.h"
#ifdef KRB5_USE_INET
+#ifndef _WINSOCKAPI_
#include <netinet/in.h>
+#endif
#else
#error find some way to use net-byte-order file version numbers.
#endif
* krb5_ccache. id is undefined.
* system errors (from open)
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_generate_new (context, id)
krb5_context context;
krb5_ccache *id;
* Returns:
* The name of the file cred cache id.
*/
-char *
+char * INTERFACE
krb5_fcc_get_name (context, id)
krb5_context context;
krb5_ccache id;
* system errors
* KRB5_CC_NOMEM
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_get_principal(context, id, princ)
krb5_context context;
krb5_ccache id;
* system errors
* permission errors
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_initialize(context, id, princ)
krb5_context context;
krb5_ccache id;
krb5_principal princ;
{
- int ret = KRB5_OK;
+ krb5_error_code kret;
+ int reti;
MAYBE_OPEN(context, id, FCC_OPEN_AND_ERASE);
#ifdef NOFCHMOD
- ret = chmod(((krb5_fcc_data *) id->data)->filename, S_IREAD | S_IWRITE);
+ reti = chmod(((krb5_fcc_data *) id->data)->filename, S_IREAD | S_IWRITE);
#else
- ret = fchmod(((krb5_fcc_data *) id->data)->fd, S_IREAD | S_IWRITE);
+ reti = fchmod(((krb5_fcc_data *) id->data)->fd, S_IREAD | S_IWRITE);
#endif
- if (ret == -1) {
- ret = krb5_fcc_interpret(context, errno);
- MAYBE_CLOSE(context, id, ret);
- return ret;
+ if (reti == -1) {
+ kret = krb5_fcc_interpret(context, errno);
+ MAYBE_CLOSE(context, id, kret);
+ return kret;
}
krb5_fcc_store_principal(context, id, princ);
- MAYBE_CLOSE(context, id, ret);
- return ret;
+ MAYBE_CLOSE(context, id, kret);
+ return kret;
}
* This file contains the source code for conditional open/close calls.
*/
+#define NEED_SOCKETS /* Only for ntohs, etc. */
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
int krb5_fcc_default_format = KRB5_FCC_DEFAULT_FVNO;
#ifdef KRB5_USE_INET
+#ifndef _WINSOCKAPI_
#include <netinet/in.h>
+#endif
#else
#error find some way to use net-byte-order file version numbers.
#endif
#undef EXCLUSIVE_LOCK
#undef UNLOCK_LOCK
-#endif HAVE_FLOCK
+#endif /* HAVE_FLOCK */
static krb5_error_code fcc_lock_file PROTOTYPE((krb5_fcc_data *, int, int));
static krb5_error_code
#endif
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_close_file (context, id)
krb5_context context;
krb5_ccache id;
return (ret == -1) ? krb5_fcc_interpret (context, errno) : 0;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_open_file (context, id, mode)
krb5_context context;
krb5_ccache id;
int mode;
{
krb5_fcc_data *data = (krb5_fcc_data *)id->data;
- krb5_int16 fcc_fvno;
+ krb5_ui_2 fcc_fvno;
int fd;
int open_flag;
krb5_error_code retval;
* Errors:
* system errors
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_next_cred(context, id, cursor, creds)
krb5_context context;
krb5_ccache id;
krb5_creds *creds;
{
#define TCHECK(ret) if (ret != KRB5_OK) goto lose;
- int ret;
krb5_error_code kret;
krb5_fcc_cursor *fcursor;
krb5_int32 int32;
fcursor = (krb5_fcc_cursor *) *cursor;
- ret = lseek(((krb5_fcc_data *) id->data)->fd, fcursor->pos, SEEK_SET);
- if (ret < 0) {
- ret = krb5_fcc_interpret(context, errno);
- MAYBE_CLOSE(context, id, ret);
- return ret;
+ kret = lseek(((krb5_fcc_data *) id->data)->fd, fcursor->pos, SEEK_SET);
+ if (kret < 0) {
+ kret = krb5_fcc_interpret(context, errno);
+ MAYBE_CLOSE(context, id, kret);
+ return kret;
}
kret = krb5_fcc_read_principal(context, id, &creds->client);
* KRB5_CC_END - there were not len bytes available
* system errors (read)
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_read(context, id, buf, len)
krb5_context context;
krb5_ccache id;
* KRB5_CC_NOMEM
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_read_principal(context, id, princ)
krb5_context context;
krb5_ccache id;
krb5_fcc_data *data = (krb5_fcc_data *)id->data;
krb5_error_code kret;
register krb5_principal tmpprinc;
- krb5_int32 length, type;
+ krb5_int32 length, type, msize;
int i;
if (data->version == KRB5_FCC_FVNO_1) {
if (tmpprinc == NULL)
return KRB5_CC_NOMEM;
if (length) {
- tmpprinc->data = (krb5_data *) malloc(length * sizeof(krb5_data));
- if (tmpprinc->data == 0) {
+ tmpprinc->data = 0;
+ msize = length * sizeof(krb5_data);
+ if ((msize & VALID_UINT_BITS) == msize) /* Not overflow size_t */
+ tmpprinc->data = (krb5_data *) malloc((size_t) msize);
+ if (tmpprinc->data == (krb5_data *) 0) {
free((char *)tmpprinc);
return KRB5_CC_NOMEM;
}
return kret;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_read_addrs(context, id, addrs)
krb5_context context;
krb5_ccache id;
krb5_address ***addrs;
{
krb5_error_code kret;
- krb5_int32 length;
+ krb5_int32 length, msize;
int i;
*addrs = 0;
/* Make *addrs able to hold length pointers to krb5_address structs
* Add one extra for a null-terminated list
*/
- *addrs = (krb5_address **) calloc(length+1, sizeof(krb5_address *));
+ msize = length+1;
+ if ((msize & VALID_UINT_BITS) != msize) /* Overflow size_t??? */
+ return KRB5_CC_NOMEM;
+ *addrs = (krb5_address **) calloc((size_t) msize, sizeof(krb5_address *));
if (*addrs == NULL)
return KRB5_CC_NOMEM;
return kret;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_read_keyblock(context, id, keyblock)
krb5_context context;
krb5_ccache id;
kret = krb5_fcc_read_int32(context, id, &int32);
CHECK(kret);
- keyblock->length = int32;
+ if ((int32 & VALID_INT_BITS) != int32) /* Overflow size_t??? */
+ return KRB5_CC_NOMEM;
+ keyblock->length = (int) int32;
if ( keyblock->length == 0 )
return KRB5_OK;
keyblock->contents = (unsigned char *) malloc(keyblock->length*
return kret;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_read_data(context, id, data)
krb5_context context;
krb5_ccache id;
krb5_data *data;
{
krb5_error_code kret;
+ krb5_int32 len;
data->magic = KV5M_DATA;
data->data = 0;
- kret = krb5_fcc_read_int32(context, id, &data->length);
+ kret = krb5_fcc_read_int32(context, id, &len);
CHECK(kret);
+ if ((len & VALID_INT_BITS) != len)
+ return KRB5_CC_NOMEM;
+ data->length = (int) len;
if (data->length == 0) {
data->data = 0;
return kret;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_read_addr(context, id, addr)
krb5_context context;
krb5_ccache id;
kret = krb5_fcc_read_int32(context, id, &int32);
CHECK(kret);
- addr->length = int32;
+ if ((int32 & VALID_INT_BITS) != int32) /* Overflow int??? */
+ return KRB5_CC_NOMEM;
+ addr->length = (int) int32;
if (addr->length == 0)
return KRB5_OK;
return kret;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_read_int32(context, id, i)
krb5_context context;
krb5_ccache id;
}
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_read_ui_2(context, id, i)
krb5_context context;
krb5_ccache id;
}
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_read_octet(context, id, i)
krb5_context context;
krb5_ccache id;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_read_times(context, id, t)
krb5_context context;
krb5_ccache id;
return retval;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_read_authdata(context, id, a)
krb5_context context;
krb5_ccache id;
krb5_authdata ***a;
{
krb5_error_code kret;
- krb5_int32 length;
+ krb5_int32 length, msize;
int i;
*a = 0;
/* Make *a able to hold length pointers to krb5_authdata structs
* Add one extra for a null-terminated list
*/
- *a = (krb5_authdata **) calloc(length+1, sizeof(krb5_authdata *));
+ msize = length+1;
+ if ((msize & VALID_UINT_BITS) != msize) /* Overflow size_t??? */
+ return KRB5_CC_NOMEM;
+ *a = (krb5_authdata **) calloc((size_t) msize, sizeof(krb5_authdata *));
if (*a == NULL)
return KRB5_CC_NOMEM;
return kret;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_read_authdatum(context, id, a)
krb5_context context;
krb5_ccache id;
krb5_error_code kret;
krb5_int32 int32;
krb5_ui_2 ui2;
- int ret;
a->magic = KV5M_AUTHDATA;
a->contents = NULL;
a->ad_type = (krb5_authdatatype)ui2;
kret = krb5_fcc_read_int32(context, id, &int32);
CHECK(kret);
- a->length = int32;
+ if ((int32 & VALID_INT_BITS) != int32) /* Overflow int??? */
+ return KRB5_CC_NOMEM;
+ a->length = (int) int32;
if (a->length == 0 )
return KRB5_OK;
* krb5_ccache. id is undefined.
* permission errors
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_resolve (context, id, residual)
krb5_context context;
krb5_ccache *id;
* permission errors
* KRB5_CC_NOMEM
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_retrieve(context, id, whichfields, mcreds, creds)
krb5_context context;
krb5_ccache id;
* Effects:
* Sets the operational flags of id to flags.
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_set_flags(context, id, flags)
krb5_context context;
krb5_ccache id;
#include "fcc.h"
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_skip_principal(context, id)
krb5_context context;
krb5_ccache id;
* KRB5_CC_NOMEM
* system errors
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_start_seq_get(context, id, cursor)
krb5_context context;
krb5_ccache id;
krb5_cc_cursor *cursor;
{
krb5_fcc_cursor *fcursor;
- int ret = KRB5_OK;
+ krb5_error_code kret = KRB5_OK;
fcursor = (krb5_fcc_cursor *) malloc(sizeof(krb5_fcc_cursor));
if (fcursor == NULL)
return KRB5_CC_NOMEM;
if (OPENCLOSE(id)) {
- ret = krb5_fcc_open_file(context, id, FCC_OPEN_RDONLY);
- if (ret) {
+ kret = krb5_fcc_open_file(context, id, FCC_OPEN_RDONLY);
+ if (kret) {
krb5_xfree(fcursor);
- return ret;
+ return kret;
}
}
else
fcursor->pos = lseek(((krb5_fcc_data *) id->data)->fd, 0, SEEK_CUR);
*cursor = (krb5_cc_cursor) fcursor;
- MAYBE_CLOSE(context, id, ret);
- return ret;
+ MAYBE_CLOSE(context, id, kret);
+ return kret;
}
* system errors
* storage failure errors
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_store(context, id, creds)
krb5_context context;
krb5_ccache id;
* Errors:
* system errors
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_write(context, id, buf, len)
krb5_context context;
krb5_ccache id;
* system errors
*/
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_store_principal(context, id, princ)
krb5_context context;
krb5_ccache id;
return KRB5_OK;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_store_addrs(context, id, addrs)
krb5_context context;
krb5_ccache id;
return KRB5_OK;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_store_keyblock(context, id, keyblock)
krb5_context context;
krb5_ccache id;
return krb5_fcc_write(context, id, (char *) keyblock->contents, keyblock->length);
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_store_addr(context, id, addr)
krb5_context context;
krb5_ccache id;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_store_data(context, id, data)
krb5_context context;
krb5_ccache id;
return krb5_fcc_write(context, id, data->data, data->length);
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_store_int32(context, id, i)
krb5_context context;
krb5_ccache id;
(data->version == KRB5_FCC_FVNO_2))
return krb5_fcc_write(context, id, (char *) &i, sizeof(krb5_int32));
else {
- buf[3] = i & 0xFF;
+ buf[3] = (unsigned char) (i & 0xFF);
i >>= 8;
- buf[2] = i & 0xFF;
+ buf[2] = (unsigned char) (i & 0xFF);
i >>= 8;
- buf[1] = i & 0xFF;
+ buf[1] = (unsigned char) (i & 0xFF);
i >>= 8;
- buf[0] = i & 0xFF;
+ buf[0] = (unsigned char) (i & 0xFF);
return krb5_fcc_write(context, id, buf, 4);
}
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_store_ui_2(context, id, i)
krb5_context context;
krb5_ccache id;
if ((data->version == KRB5_FCC_FVNO_1) ||
(data->version == KRB5_FCC_FVNO_2)) {
- ibuf = i;
+ ibuf = (krb5_ui_2) i;
return krb5_fcc_write(context, id, (char *) &ibuf, sizeof(krb5_ui_2));
} else {
- buf[1] = i & 0xFF;
+ buf[1] = (unsigned char) (i & 0xFF);
i >>= 8;
- buf[0] = i & 0xFF;
+ buf[0] = (unsigned char) (i & 0xFF);
return krb5_fcc_write(context, id, buf, 2);
}
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_store_octet(context, id, i)
krb5_context context;
krb5_ccache id;
{
krb5_octet ibuf;
- ibuf = i;
+ ibuf = (krb5_octet) i;
return krb5_fcc_write(context, id, (char *) &ibuf, 1);
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_store_times(context, id, t)
krb5_context context;
krb5_ccache id;
}
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_store_authdata(context, id, a)
krb5_context context;
krb5_ccache id;
return KRB5_OK;
}
-krb5_error_code
+krb5_error_code INTERFACE
krb5_fcc_store_authdatum (context, id, a)
krb5_context context;
krb5_ccache id;