mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
Warning fixes - key handling
Various warning fixes related mostly to the different types used to handle keys. This should clear most of the remaining warnings in this area. The technique of inline converter helpers is extended to cover a few more cases. README.WARNINGS is adjusted to reflect the current status. Fixes: - bos: define and use an inline converter from a ktc key to a bozo key - bos.c and bos_utils.c should no longer have warnings - adjust Makefile - define a ktc key to char * converter and use it in a few places - define kas key to bozo key ptr converter and use it in a few places (afs_bosAdmin) - cast a few arguments to ka_StringToKey which expects non-const pointers Change-Id: I1c19869ac232d78209126d4eeeb11af8bcb95815 Reviewed-on: http://gerrit.openafs.org/860 Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
0188cf081f
commit
19f0da1e44
@ -46,8 +46,6 @@ afsd/afsd.c : deprecated : daemon() marked as deprecated on Darwin
|
||||
: all : call_syscall missing prototype
|
||||
auth/ktc.c : all (ukernel) : call_syscall doesn't have a prototype
|
||||
bozo/bosserver.c : deprecated : daemon() marked as deprecated on Darwin
|
||||
bozo/bos.c : all : DES key types & string consts
|
||||
bozo/bos_util.c : all : DES key types
|
||||
bucoord/ubik_db_if.c : strict-proto : Ubik_Call
|
||||
bucoord/commands.c : all : Ubik_Call
|
||||
: signed vs unsigned for dates
|
||||
@ -55,13 +53,11 @@ butc/tcmain.c : all : prototypes
|
||||
butc/tcudbprocs.c : all : ubik_Call
|
||||
kauth/admin_tools.c : all : ubik_Call nonsense
|
||||
kauth/authclient.c : strict-proto : ubik_Call nonsense
|
||||
libadmin/bos/afs_bosAdmin.c: all : DES keys, time types, and const
|
||||
libadmin/kas/afs_kasAdmin.c: all : Ubik_Call nonsense, DES keys
|
||||
libadmin/bos/afs_bosAdmin.c: all : time types, and const
|
||||
libadmin/kas/afs_kasAdmin.c: all : Ubik_Call nonsense
|
||||
libadmin/samples/rxstat_query_peer.c : all : util_RPCStatsStateGet types
|
||||
libadmin/samples/rxstat_query_process.c : all : util_RPCStatsStateGet types
|
||||
libadmin/test/client.c : all : util_RPCStatsStateGet types
|
||||
rxkad/rxkad_server.c : all : Des key nonsense - maybe fixed (no errors in pthread)
|
||||
rxkad/ticket5.c : all : CRC functions - maybe fixed (no errors in normal & pthread)
|
||||
rx/rx.c : all (pthread) : rxkad_global_stats_init not proto'd
|
||||
rx/xdr_rx.c : all (ukernel) : Prototypes don't match due to AFS_XDR_T
|
||||
not being used in the xdr header
|
||||
@ -70,7 +66,7 @@ ubik/beacon.c : all : Ubik uses signed/unsigned
|
||||
fix will require API changes.
|
||||
ubik/ubikclient.c : strict-protos : ubik_Call
|
||||
uss/uss_vol.c : all Format issues
|
||||
uss/uss_kauth.c : all : Des keys, ubik_Call
|
||||
uss/uss_kauth.c : all : ubik_Call
|
||||
viced/fsprobe.c : all : ubik_Call
|
||||
vol/salvager.c : all : consts & undefined variable from header - maybe fixed!
|
||||
volser/vol-dump.c : format : afs_sfsize_t
|
||||
|
@ -91,13 +91,13 @@ bnode.o: bnode.c ${INCLS}
|
||||
bosoprocs.o: bosoprocs.c ${INCLS}
|
||||
|
||||
bos.o: bos.c ${INCLS} AFS_component_version_number.o
|
||||
$(CC) $(CFLAGS) @CFLAGS_NOERROR@ -c $<
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
bos: bos.o $(LIBS) libbos.a
|
||||
${CC} ${CFLAGS} -o bos bos.o libbos.a $(LIBS) ${XLIBS}
|
||||
|
||||
bos_util.o: bos_util.c ${INCLS} AFS_component_version_number.o ${TOP_INCDIR}/afs/bnode.h
|
||||
$(CC) $(CFLAGS) @CFLAGS_NOERROR@ -c $<
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
bos_util: bos_util.o $(LIBS)
|
||||
${CC} ${CFLAGS} -o bos_util bos_util.o $(LIBS) ${XLIBS}
|
||||
|
@ -53,6 +53,7 @@ static int DoStat(char *aname, register struct rx_connection *aconn,
|
||||
int aint32p, int firstTime);
|
||||
|
||||
#include "bosint.h"
|
||||
#include "bosprototypes.h"
|
||||
|
||||
/* command offsets for bos salvage command */
|
||||
#define MRAFS_OFFSET 10
|
||||
@ -906,7 +907,7 @@ AddKey(register struct cmd_syndesc *as, void *arock)
|
||||
ka_StringToKey(buf, tcell, &tkey);
|
||||
}
|
||||
tconn = GetConn(as, 1);
|
||||
code = BOZO_AddKey(tconn, temp, &tkey);
|
||||
code = BOZO_AddKey(tconn, temp, ktc_to_bozoptr(&tkey));
|
||||
if (code) {
|
||||
printf("bos: failed to set key %d (%s)\n", temp, em(code));
|
||||
exit(1);
|
||||
@ -948,14 +949,14 @@ ListKeys(register struct cmd_syndesc *as, void *arock)
|
||||
tconn = GetConn(as, 1);
|
||||
everWorked = 0;
|
||||
for (i = 0;; i++) {
|
||||
code = BOZO_ListKeys(tconn, i, &kvno, &tkey, &keyInfo);
|
||||
code = BOZO_ListKeys(tconn, i, &kvno, ktc_to_bozoptr(&tkey), &keyInfo);
|
||||
if (code)
|
||||
break;
|
||||
everWorked = 1;
|
||||
/* first check if key is returned */
|
||||
if ((!ka_KeyIsZero(&tkey, sizeof(tkey))) && (as->parms[1].items)) {
|
||||
if ((!ka_KeyIsZero(ktc_to_charptr(&tkey), sizeof(tkey))) && (as->parms[1].items)) {
|
||||
printf("key %d is '", kvno);
|
||||
ka_PrintBytes(&tkey, sizeof(tkey));
|
||||
ka_PrintBytes(ktc_to_charptr(&tkey), sizeof(tkey));
|
||||
printf("'\n");
|
||||
} else {
|
||||
if (keyInfo.keyCheckSum == 0) /* shouldn't happen */
|
||||
|
@ -91,7 +91,7 @@ main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
ka_StringToKey(buf, tcell, &tkey);
|
||||
code = afsconf_AddKey(tdir, kvno, &tkey, 0);
|
||||
code = afsconf_AddKey(tdir, kvno, ktc_to_charptr(&tkey), 0);
|
||||
if (code) {
|
||||
printf("bos_util: failed to set key, code %d.\n", code);
|
||||
exit(1);
|
||||
@ -125,7 +125,7 @@ main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
des_string_to_key(buf, ktc_to_cblockptr(&tkey));
|
||||
code = afsconf_AddKey(tdir, kvno, &tkey, 0);
|
||||
code = afsconf_AddKey(tdir, kvno, ktc_to_charptr(&tkey), 0);
|
||||
if (code) {
|
||||
printf("bos_util: failed to set key, code %d.\n", code);
|
||||
exit(1);
|
||||
|
@ -10,6 +10,8 @@
|
||||
#ifndef _BOSPROTOTYPES_H_
|
||||
#define _BOSPROTOTYPES_H_
|
||||
|
||||
#include <rx/rxkad.h>
|
||||
|
||||
/* bnode.c */
|
||||
int bnode_CoreName(struct bnode *abnode, char *acoreName, char *abuffer);
|
||||
int bnode_GetString(struct bnode *abnode, char *abuffer, afs_int32 alen);
|
||||
@ -54,4 +56,9 @@ char *copystr(char *a);
|
||||
/* bosoprocs.c */
|
||||
void *bozo_ShutdownAndExit(void *arock /* really int asignal */);
|
||||
|
||||
static_inline struct bozo_key *
|
||||
ktc_to_bozoptr(struct ktc_encryptionKey *key) {
|
||||
return (struct bozo_key *)key;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1941,7 +1941,7 @@ bos_KeyCreate(const void *serverHandle, int keyVersionNumber,
|
||||
goto fail_bos_KeyCreate;
|
||||
}
|
||||
|
||||
tst = BOZO_AddKey(b_handle->server_encrypt, keyVersionNumber, key);
|
||||
tst = BOZO_AddKey(b_handle->server_encrypt, keyVersionNumber, kas_to_bozoptr(key));
|
||||
|
||||
if (tst == 0) {
|
||||
rc = 1;
|
||||
@ -2020,7 +2020,7 @@ GetKeyRPC(void *rpc_specific, int slot, int *last_item,
|
||||
|
||||
tst =
|
||||
BOZO_ListKeys(key->server, key->next++,
|
||||
&key->key[slot].keyVersionNumber, &key->key[slot].key,
|
||||
&key->key[slot].keyVersionNumber, kas_to_bozoptr(&key->key[slot].key),
|
||||
&keyInfo);
|
||||
|
||||
|
||||
|
@ -339,4 +339,9 @@ extern int ADMINAPI bos_Salvage(const void *cellHandle,
|
||||
bos_ForceBlockRead_t forceBlockRead,
|
||||
afs_status_p st);
|
||||
|
||||
static_inline struct bozo_key *
|
||||
kas_to_bozoptr(kas_encryptionKey_p key)
|
||||
{
|
||||
return (struct bozo_key *)key;
|
||||
}
|
||||
#endif /* OPENAFS_BOS_ADMIN_H */
|
||||
|
@ -1803,7 +1803,7 @@ kas_StringToKey(const char *cellName, const char *string,
|
||||
int rc = 0;
|
||||
afs_status_t tst = 0;
|
||||
|
||||
ka_StringToKey(string, cellName, (struct ktc_encryptionKey *)key);
|
||||
ka_StringToKey((char *)string, (char *)cellName, (struct ktc_encryptionKey *)key);
|
||||
rc = 1;
|
||||
|
||||
if (st != NULL) {
|
||||
|
@ -77,7 +77,7 @@ ticket.o: ticket.c lifetimes.h ${INCLS}
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
ticket5.o: ticket5.c v5gen.c v5der.c v5gen-rewrite.h ${INCLS}
|
||||
$(CC) -I${srcdir} $(CFLAGS) @CFLAGS_NOERROR@ -c $<
|
||||
$(CC) -I${srcdir} $(CFLAGS) -c $<
|
||||
|
||||
crc.o: crc.c ${INCLS}
|
||||
|
||||
|
@ -167,6 +167,11 @@ ktc_to_cblock(struct ktc_encryptionKey *key) {
|
||||
return (unsigned char *)key;
|
||||
}
|
||||
|
||||
static_inline char *
|
||||
ktc_to_charptr(struct ktc_encryptionKey *key) {
|
||||
return (char *)key;
|
||||
}
|
||||
|
||||
static_inline des_cblock *
|
||||
ktc_to_cblockptr(struct ktc_encryptionKey *key) {
|
||||
return (des_cblock *)key;
|
||||
|
@ -166,8 +166,8 @@ InitThisModule(void)
|
||||
char prompt[2 * MAXKTCNAMELEN + 20];
|
||||
char *reasonString, longPassBuff[1024], shortPassBuff[9];
|
||||
struct ktc_encryptionKey key;
|
||||
struct ktc_token token, tok;
|
||||
struct ktc_principal Name;
|
||||
struct ktc_token token;
|
||||
struct ktc_principal Name, tok;
|
||||
|
||||
/*
|
||||
* Only call this routine once.
|
||||
|
Loading…
Reference in New Issue
Block a user