# define KRB5_CALLCONV_C
#endif
-\f/* Interface (tentative):
+/* Interface (tentative):
Mutex support:
More to be added, perhaps. */
#include <assert.h>
-\f
/* The mutex structure we use, k5_mutex_t, is defined to some
OS-specific bits. The use of multiple layers of typedefs are an
#endif
-
-\f
-
typedef k5_os_mutex k5_mutex_t;
#define K5_MUTEX_PARTIAL_INITIALIZER K5_OS_MUTEX_PARTIAL_INITIALIZER
static inline int k5_mutex_init(k5_mutex_t *m)
#define k5_assert_locked k5_mutex_assert_locked
#define k5_assert_unlocked k5_mutex_assert_unlocked
-\f
/* Thread-specific data; implemented in a support file, because we'll
need to keep track of some global data for cleanup purposes.
return 0;
}
-\f
static const char *
paddr(struct sockaddr *sa)
{
int rpc_force_close;
};
-\f
#define SET(TYPE) struct { TYPE *data; size_t n, max; }
/* Start at the top and work down -- this should allow for deletions
return 0;
}
-\f
#define USE_AF AF_INET
#define USE_TYPE SOCK_DGRAM
#define USE_PROTO 0
{
return setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(one));
}
-\f
+
static int
setnolinger(int s)
{
Issues to be addressed for src/lib/crypto: -*- text -*-
-\f
+
+
Many files here and in subdirectories pollute the namespace.
However, some applications wanting to directly use some of those
routines will expect those names to be available.
Workaround: Shared library export lists? Define and export internal
names, and provide wrapper library code or weak functions under the
polluting names?
-\f
+
+
Some routines assume "int" is big enough to describe all buffers that
may be supplied.
Issues to be addressed for src/lib/crypto/des: -*- text -*-
-\f
+
"const" could be used in more places
-\f
+
Array types are used in calling interfaces. Under ANSI C, a value of
type "arraytype *" cannot be assigned to a variable of type "const
arraytype *", so we get compilation warnings.
Issues to be addressed for src/lib/crypto/md4: -*- text -*-
-\f
+
+
Assumes int is >= 32 bits.
Issues to be addressed for src/lib/crypto/md5: -*- text -*-
-\f
+
+
Assumes int is >= 32 bits.
Issues to be addressed for src/lib/crypto/sha1: -*- text -*-
-\f
+
+
Assumes int (look for "count") is >= 32 bits.
Changing the types of internal variables is easy, but shsUpdate takes
#define log_notice_string _("Notice")
#define log_info_string _("info")
#define log_debug_string _("debug")
-\f
+
/*
* Output logging.
*
-1)
#define DEVICE_CLOSE(d) fclose(d)
-\f
/*
* klog_com_err_proc() - Handle com_err(3) messages as specified by the
* profile.
}
}
}
-\f
+
/*
* krb5_klog_init() - Initialize logging.
*
"<%10s...>");
static const char *acl_cantopen_msg = N_("%s while opening ACL file %s");
-\f
/*
* kadm5int_acl_get_line() - Get a line from the ACL file.
* Lines ending with \ are continued on the next line
else
return(acl_buf);
}
-\f
+
/*
* kadm5int_acl_parse_line() - Parse the contents of an ACL line.
*/
("X kadm5int_acl_parse_line() = %x\n", (long) acle));
return(acle);
}
-\f
+
/*
* kadm5int_acl_parse_restrictions() - Parse optional restrictions field
*
code, (*rpp) ? (*rpp)->mask : 0));
return code;
}
-\f
+
/*
* kadm5int_acl_impose_restrictions() - impose restrictions, modifying *recp, *maskp
*
("X kadm5int_acl_impose_restrictions() = 0, *maskp=0x%08x\n", *maskp));
return 0;
}
-\f
+
/*
* kadm5int_acl_free_entries() - Free all ACL entries.
*/
acl_inited = 0;
DPRINT(DEBUG_CALLS, acl_debug_level, ("X kadm5int_acl_free_entries()\n"));
}
-\f
+
/*
* kadm5int_acl_load_acl_file() - Open and parse the ACL file.
*/
("X kadm5int_acl_load_acl_file() = %d\n", retval));
return(retval);
}
-\f
+
/*
* kadm5int_acl_match_data() - See if two data entries match.
*
DPRINT(DEBUG_CALLS, acl_debug_level, ("X acl_match_entry()=%d\n",retval));
return(retval);
}
-\f
+
/*
* kadm5int_acl_find_entry() - Find a matching entry.
*/
DPRINT(DEBUG_CALLS, acl_debug_level, ("X kadm5int_acl_find_entry()=%x\n",entry));
return(entry);
}
-\f
+
/*
* kadm5int_acl_init() - Initialize ACL context.
*/
DPRINT(DEBUG_CALLS, acl_debug_level, ("X kadm5int_acl_init() = %d\n", kret));
return(kret);
}
-\f
+
/*
* kadm5int_acl_finish - Terminate ACL context.
*/
kadm5int_acl_free_entries();
DPRINT(DEBUG_CALLS, acl_debug_level, ("X kadm5int_acl_finish()\n"));
}
-\f
+
/*
* kadm5int_acl_check_krb() - Is this operation permitted for this principal?
*/
krb5_ccache_externalize, /* Externalize routine */
krb5_ccache_internalize /* Internalize routine */
};
-\f
+
/*
* krb5_ccache_size() - Determine the size required to externalize
* this krb5_ccache variant.
}
return(kret);
}
-\f
+
/*
* krb5_ccache_externalize() - Externalize the krb5_ccache.
*/
}
return(kret);
}
-\f
+
/*
* krb5_ccache_internalize() - Internalize the krb5_ccache.
*/
free(ccname);
return(kret);
}
-\f
+
/*
* Register the ccache serializer.
*/
krb5_ktf_keytab_externalize, /* Externalize routine */
krb5_ktf_keytab_internalize /* Internalize routine */
};
-\f
+
/*
* krb5_ktf_keytab_size() - Determine the size required to externalize
* this krb5_keytab variant.
}
return(kret);
}
-\f
+
/*
* krb5_ktf_keytab_externalize() - Externalize the krb5_keytab.
*/
}
return(kret);
}
-\f
+
/*
* krb5_ktf_keytab_internalize() - Internalize the krb5_ktf_keytab.
*/
return 0;
}
-\f
struct check_data {
krb5_context ctx;
krb5_principal *tgs;
krb5_free_realm_tree (ctx, cdata.tgs);
return r;
}
-\f
+
#ifdef TEST
static krb5_error_code
krb5_auth_context_externalize, /* Externalize routine */
krb5_auth_context_internalize /* Internalize routine */
};
-\f
+
/*
* krb5_auth_context_size() - Determine the size required to externalize
* the krb5_auth_context.
*sizep += required;
return(kret);
}
-\f
+
/*
* krb5_auth_context_externalize() - Externalize the krb5_auth_context.
*/
}
return(kret);
}
-\f
+
/* Internalize a keyblock and convert it to a key. */
static krb5_error_code
intern_key(krb5_context ctx, krb5_key *key, krb5_octet **bp, size_t *sp)
}
return(kret);
}
-\f
+
/*
* Register the auth_context serializer.
*/
krb5_authdata_externalize, /* Externalize routine */
krb5_authdata_internalize /* Internalize routine */
};
-\f
+
/*
* krb5_authdata_esize() - Determine the size required to externalize
* the krb5_authdata.
}
return(kret);
}
-\f
+
/*
* krb5_authdata_externalize() - Externalize the krb5_authdata.
*/
}
return(kret);
}
-\f
+
/*
* krb5_authdata_internalize() - Internalize the krb5_authdata.
*/
}
return(kret);
}
-\f
+
/*
* Register the authdata serializer.
*/
krb5_address_externalize, /* Externalize routine */
krb5_address_internalize /* Internalize routine */
};
-\f
+
/*
* krb5_address_size() - Determine the size required to externalize
* the krb5_address.
}
return(kret);
}
-\f
+
/*
* krb5_address_externalize() - Externalize the krb5_address.
*/
}
return(kret);
}
-\f
+
/*
* krb5_address_internalize() - Internalize the krb5_address.
*/
}
return(kret);
}
-\f
+
/*
* Register the address serializer.
*/
krb5_authenticator_externalize, /* Externalize routine */
krb5_authenticator_internalize /* Internalize routine */
};
-\f
+
/*
* krb5_authenticator_size() - Determine the size required to externalize
* the krb5_authenticator.
*sizep += required;
return(kret);
}
-\f
+
/*
* krb5_authenticator_externalize() - Externalize the krb5_authenticator.
*/
}
return(kret);
}
-\f
+
/*
* krb5_authenticator_internalize() - Internalize the krb5_authenticator.
*/
krb5_checksum_externalize, /* Externalize routine */
krb5_checksum_internalize /* Internalize routine */
};
-\f
+
/*
* krb5_checksum_esize() - Determine the size required to externalize
* the krb5_checksum.
}
return(kret);
}
-\f
+
/*
* krb5_checksum_externalize() - Externalize the krb5_checksum.
*/
}
return(kret);
}
-\f
+
/*
* krb5_checksum_internalize() - Internalize the krb5_checksum.
*/
}
return(kret);
}
-\f
+
/*
* Register the checksum serializer.
*/
*sizep += required;
return(kret);
}
-\f
+
/*
* krb5_context_externalize() - Externalize the krb5_context.
*/
return (0);
}
-\f
+
/*
* krb5_context_internalize() - Internalize the krb5_context.
*/
krb5_free_context(context);
return(kret);
}
-\f
+
/*
* krb5_oscontext_size() - Determine the size required to externalize
* the krb5_os_context.
*sizep += (5*sizeof(krb5_int32));
return(0);
}
-\f
+
/*
* krb5_oscontext_externalize() - Externalize the krb5_os_context.
*/
}
return(kret);
}
-\f
+
/*
* krb5_oscontext_internalize() - Internalize the krb5_os_context.
*/
}
return(kret);
}
-\f
+
/*
* Register the context serializers.
*/
krb5_keyblock_externalize, /* Externalize routine */
krb5_keyblock_internalize /* Internalize routine */
};
-\f
+
/*
* krb5_keyblock_size() - Determine the size required to externalize
* the krb5_keyblock.
}
return(kret);
}
-\f
+
/*
* krb5_keyblock_externalize() - Externalize the krb5_keyblock.
*/
}
return(kret);
}
-\f
+
/*
* krb5_keyblock_internalize() - Internalize the krb5_keyblock.
*/
}
return(kret);
}
-\f
+
/*
* Register the keyblock serializer.
*/
krb5_principal_externalize, /* Externalize routine */
krb5_principal_internalize /* Internalize routine */
};
-\f
+
/*
* krb5_principal_size() - Determine the size required to externalize
* the krb5_principal.
}
return(kret);
}
-\f
+
/*
* krb5_principal_externalize() - Externalize the krb5_principal.
*/
}
return(kret);
}
-\f
+
/*
* krb5_principal_internalize() - Internalize the krb5_principal.
*/
free(tmpname);
return kret;
}
-\f
+
/*
* Register the context serializer.
*/
*/
#include "k5-int.h"
-\f
+
/*
* krb5_find_serializer() - See if a particular type is registered.
*/
}
return(res);
}
-\f
+
/*
* krb5_register_serializer() - Register a particular serializer.
*/
*stable = *entry;
return(kret);
}
-\f
+
/*
* krb5_size_opaque() - Determine the size necessary to serialize a given
* piece of opaque data.
kret = (shandle->sizer) ? (*shandle->sizer)(kcontext, arg, sizep) : 0;
return(kret);
}
-\f
+
/*
* krb5_externalize_opaque() - Externalize a piece of opaque data.
*/
(*shandle->externalizer)(kcontext, arg, bufpp, sizep) : 0;
return(kret);
}
-\f
+
/*
* Externalize a piece of arbitrary data.
*/
}
return(kret);
}
-\f
+
/*
* krb5_internalize_opaque() - Convert external representation into a data
* structure.
(*shandle->internalizer)(kcontext, argp, bufpp, sizep) : 0;
return(kret);
}
-\f
+
/*
* krb5_ser_pack_int32() - Pack a 4-byte integer if space is available.
* Update buffer pointer and remaining space.
else
return(ENOMEM);
}
-\f
+
/*
* krb5_ser_pack_int64() - Pack an 8-byte integer if space is available.
* Update buffer pointer and remaining space.
else
return(ENOMEM);
}
-\f
+
/*
* krb5_ser_pack_bytes() - Pack a string of bytes.
*/
else
return(ENOMEM);
}
-\f
+
/*
* krb5_ser_unpack_int32() - Unpack a 4-byte integer if it's there.
*/
else
return(ENOMEM);
}
-\f
+
/*
* krb5_ser_unpack_int64() - Unpack an 8-byte integer if it's there.
*/
else
return(ENOMEM);
}
-\f
+
/*
* krb5_ser_unpack_bytes() - Unpack a byte string if it's there.
*/
else
return(EINVAL);
}
-\f
+
/* (absolute) time conversions */
#ifndef HAVE_STRFTIME
}
return((ndone) ? 0 : ENOMEM);
}
-\f
+
/* relative time (delta-t) conversions */
/* string->deltat is in deltat.y */
krb5_rcache_externalize, /* Externalize routine */
krb5_rcache_internalize /* Internalize routine */
};
-\f
+
/*
* krb5_rcache_size() - Determine the size required to externalize
* this krb5_rcache variant.
}
return(kret);
}
-\f
+
/*
* krb5_rcache_externalize() - Externalize the krb5_rcache.
*/
}
return(kret);
}
-\f
+
/*
* krb5_rcache_internalize() - Internalize the krb5_rcache.
*/
krb5_rc_close(kcontext, rcache);
return kret;
}
-\f
+
/*
* Register the rcache serializer.
*/
#endif
-\f
#ifdef CRYPTOKI_COMPAT
/* If we are in compatibility mode, switch all exposed names to the
PKCS #11 variant. There are corresponding #undefs below. */
#endif /* CRYPTOKI_COMPAT */
-\f
typedef unsigned long ck_flags_t;
#define CKR_VENDOR_DEFINED ((unsigned long) (1 << 31))
-\f
/* Compatibility layer. */
#ifdef CRYPTOKI_COMPAT
#endif /* CRYPTOKI_COMPAT */
-\f
/* System dependencies. */
#if defined(_WIN32) || defined(CRYPTOKI_FORCE_WIN32)
#pragma pack(pop, cryptoki)
Issues to be addressed for src/util/et: -*- text -*-
-\f
+
+
Non-thread-safe aspects:
error_message uses a static buffer for "unknown error code" messages;
Workaround: Use a global lock for all calls to error_message and
com_err, and when adding or removing error tables.
-\f
+
+
API divergence:
Transarc and Heimdal both have APIs that are different from this
Karl Ramm has offered to try to combine them.
Workaround:
-\f
+
+
Reference counting:
If libraries are dynamically loaded and unloaded, and the init/fini
It's not implemented as a reference count, but the effect is the same.
Fix needed: Update documentation.
-\f
+
+
64-bit support:
Values are currently computed as 32-bit values, sign-extended to
Workaround: Always use signed types of at least 32 bits for error
codes.
-\f
+
+
man page:
No documentation on add_error_table/remove_error_table interfaces,
even though they're the new, preferred interface.
-\f
}
__DATA__
-\f
+
/*
* array type, derived from template
*
upper_bound = ULONG_MAX;
return (unsigned long) upper_bound;
}
-\f
+
static inline int
<NAME>_grow(<NAME> *arr, unsigned long newcount)
{
1;
__DATA__
-\f
+
/* for use in cases where text substitutions may not work, like putting
"const" before a type that turns out to be "char *" */
typedef <LEFT> <NAME>__left_t;
1;
__DATA__
-\f
+
/*
* an enumerated collection type, generated from template
*
en->used++;
return en->used-1;
}
-\f
+
static inline <TYPE>
<NAME>_get(<NAME> *en, size_t idx)
{
1;
__DATA__
-\f
+
/*
*/
#include "k5-thread.h"
*added = 0;
return 0;
}
-\f
+
static inline int
<NAME>_get(<NAME> *en, size_t idx, <TYPE> *value)
{
#define CC_ERR_CACHE_FULL 15
#define CC_ERR_CRED_VERSION 16
-\f
/*
** types, structs, & constants
*/
cc_data ** authdata;
} cc_creds;
-\f
// begin V4 stuff
// use an enumerated type so all callers infer the same meaning
// these values are what krbv4win uses internally.
cc_int32 vers;
} infoNC;
-\f
/*
** The official (externally visible) API
*/
cc_time_t* time // < time of last change to main cache
);
-\f
/*
** Named Cache (NC) routines
** create, open, close, destroy, get_principal, get_cred_version, &
// lock types
);
-\f
/*
** Credentials routines (work within an NC)
** store, remove_cred, seq_fetch_creds