]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Warning fixes - key handling
authorMarc Dionne <marc.c.dionne@gmail.com>
Thu, 19 Nov 2009 23:29:08 +0000 (18:29 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Sun, 29 Nov 2009 19:52:24 +0000 (11:52 -0800)
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>
README.WARNINGS
src/bozo/Makefile.in
src/bozo/bos.c
src/bozo/bos_util.c
src/bozo/bosprototypes.h
src/libadmin/bos/afs_bosAdmin.c
src/libadmin/bos/afs_bosAdmin.h
src/libadmin/kas/afs_kasAdmin.c
src/rxkad/Makefile.in
src/rxkad/rxkad_prototypes.h
src/uss/uss_kauth.c

index 39c39b1174075798fb465166d8c95255725a3449..923d89cec4b9a4299253f3acfc799f3a8dc1c6f2 100644 (file)
@@ -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
index 286389b30af1faf53772b1e8e9aab524f5f4d008..14bb2794d9989aba18c86e70660b3688a2839619 100644 (file)
@@ -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}
index e7e7f3397a3549db3f4285b9dcb2de7a819a049a..fd79e4ff9dcf347c787b821df5d5adffa4aaa7f6 100644 (file)
@@ -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 */
index 5cfb674ea5785e6571470929f477edbd7bd4583e..e11dfb98957121e9882c6f0b4e30cdfa45d64060 100644 (file)
@@ -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);
index 5314c0cc8b0c1e29142138be2f21d759c05be807..360bb7792cdfd98cb2593410f2c3329f578de3d0 100644 (file)
@@ -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
index 44be450cbe68a4cd0ff9453899ac8a44b7df7160..d80ed32b58d6e1e1f2727f83301fa3b9728c2c26 100644 (file)
@@ -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);
 
 
index ddfb63c5c887c9d334fb933016e51f0428368813..79d9bba063e1f319e7a60e784826061f6005ffce 100644 (file)
@@ -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 */
index 72d1be6a72e97273f15b4dca221afac21d0c95fa..7c87bebd7047d2c96e3a8038689a818cc341950f 100644 (file)
@@ -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) {
index f3962a8b2a317f01db203ba54c590048da42d9db..dc4207257124479755921fac54b39b3267b2756b 100644 (file)
@@ -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}
 
index 430b821724be664b3396de576ad43d925b1e915b..505a65e8fe822725ea84fc6e39e9f84ad483281b 100644 (file)
@@ -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;
index 509585f14c9f84c83dc56a207c5260228627bc53..95c7c04eff39486f46e54888932d9f53c26e2440 100644 (file)
@@ -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.