/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
#include <afsconfig.h>
#include <afs/param.h>
+#include <roken.h>
-#include <sys/types.h>
-#ifdef AFS_NT40_ENV
-#include <winsock2.h>
-#else
-#include <netinet/in.h>
-#endif
-#include <string.h>
#include <ubik.h>
#include <rx/xdr.h>
#include <rx/rx.h>
#include <afs/afsutil.h>
+
#include "kauth.h"
#include "kautils.h"
#include "kaserver.h"
+#if !defined(offsetof)
+#include <stddef.h> /* for definition of offsetof() */
+#endif
+
extern Date cheaderReadTime; /* time cheader last read in */
-#define set_header_word(tt,field,value) kawrite ((tt), ((char *)&(cheader.field) - (char *)&cheader), ((cheader.field = (value)), (char *)&(cheader.field)), sizeof(afs_int32))
+#define set_header_word(tt,field,value) kawrite ((tt), (offsetof(struct kaheader, field)), ((cheader.field = (value)), (char *)&(cheader.field)), sizeof(afs_int32))
-#define inc_header_word(tt,field) kawrite ((tt), ((char *)&(cheader.field) - (char *)&cheader), ((cheader.field = (htonl(ntohl(cheader.field)+1))), (char *)&(cheader.field)), sizeof(afs_int32))
+#define inc_header_word(tt,field) kawrite ((tt), (offsetof(struct kaheader, field)), ((cheader.field = (htonl(ntohl(cheader.field)+1))), (char *)&(cheader.field)), sizeof(afs_int32))
static int index_OK(afs_int32);
returned. */
afs_int32
-FindBlock(struct ubik_trans *at, char *aname, char *ainstance, afs_int32 *toP,
+FindBlock(struct ubik_trans *at, char *aname, char *ainstance, afs_int32 *toP,
struct kaentry *tentry)
{
afs_int32 i, code;
returns zero if there were no errors. */
afs_int32
-ThreadBlock(struct ubik_trans *at, afs_int32 index,
+ThreadBlock(struct ubik_trans *at, afs_int32 index,
struct kaentry *tentry)
{
int code;
remaining count is negative. */
afs_int32
-NextBlock(struct ubik_trans *at, afs_int32 index, struct kaentry *tentry,
+NextBlock(struct ubik_trans *at, afs_int32 index, struct kaentry *tentry,
afs_int32 *remaining)
{
int code;
and pointer to the user entry. */
afs_int32
-ka_NewKey(struct ubik_trans *tt, afs_int32 tentryaddr,
+ka_NewKey(struct ubik_trans *tt, afs_int32 tentryaddr,
struct kaentry *tentry, struct ktc_encryptionKey *key)
{
struct kaOldKeys okeys; /* old keys block */
Date now = time(0);
afs_int32 newkeyver; /* new key version number */
afs_int32 newtotalkeyentries = 0, oldtotalkeyentries = 0, keyentries;
- int foundcurrentkey = 0, addednewkey = 0, modified;
+ int addednewkey = 0, modified;
+#ifdef AUTH_DBM_LOG
+ int foundcurrentkey = 0;
+#endif
es_Report("Newkey for %s.%s\n", tentry->userID.name,
tentry->userID.instance);
("Warning: Entry %s.%s contains more than one valid key: fixing\n",
tentry->userID.name, tentry->userID.instance));
}
-#endif
foundcurrentkey = 1;
+#endif
}
/* If we find an oldkey of the same version or
}
afs_int32
-ka_DelKey(struct ubik_trans *tt, afs_int32 tentryaddr,
+ka_DelKey(struct ubik_trans *tt, afs_int32 tentryaddr,
struct kaentry *tentry)
{
int code;
/* Add a key to the key cache, expanding it if necessary. */
void
-ka_Encache(char *name, char *inst, afs_int32 kvno,
+ka_Encache(char *name, char *inst, afs_int32 kvno,
struct ktc_encryptionKey *key, Date superseded)
{
int i;
return;
}
/* i == maxCachedKeys */
- keyCache =
- (struct cachedKey *)realloc(keyCache,
- (maxCachedKeys *=
- 2) * sizeof(struct cachedKey));
+ keyCache = realloc(keyCache, (maxCachedKeys *=2)
+ * sizeof(struct cachedKey));
if (keyCache == 0) {
es_Report("Can't realloc keyCache! out of memory?");
exit(123);
with tt==0, since Rx can't call Ubik. */
afs_int32
-ka_LookupKvno(struct ubik_trans *tt, char *name, char *inst, afs_int32 kvno,
+ka_LookupKvno(struct ubik_trans *tt, char *name, char *inst, afs_int32 kvno,
struct ktc_encryptionKey *key)
{
int i;
/* Look up the primary key and key version for a principal. */
afs_int32
-ka_LookupKey(struct ubik_trans *tt,
- char *name,
- char *inst,
+ka_LookupKey(struct ubik_trans *tt,
+ char *name,
+ char *inst,
afs_int32 *kvno, /* returned */
struct ktc_encryptionKey *key) /* copied out */
{