Fix warnings in rxkad
authorAndrew Deason <adeason@sinenomine.net>
Wed, 7 Oct 2009 22:33:02 +0000 (17:33 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Thu, 8 Oct 2009 15:00:13 +0000 (08:00 -0700)
Some miscellaneous warnings throughout rxkad:

rxkad/ticket5.c:
 - Explicitly cast ticket blob to unsigned char*, as some functions take
   a ticket as a char*, and some take it as an unsigned char*

 - in tkt_DecodeTicket5, make 'start' and 'end' be unsigned, since that
   is what their callers think they are

 - Ignore implicit function declaration warnings (for CRC functons)

 - Remove general warning inhibition

rxkad/ticket.c:
 - in tkt_DecodeTicket, make 'start' and 'end' be unsigned, since that
   is what their callers think they are

 - Remove general warning inhibition

rxkad/v5der.c:
 - In decode_enumerated, use der_get_unsigned instead of der_get_int,
   since we're decoding an unsigned integer.

rxkad/rxkad_server.c:
 - The last two arguments to rxkad_DeriveXORInfo are char*s, so
   explicitly cast them to be so

 - Remove general warning inhibition

rxkad/rxkad_common.c:
 - rxkad_stats_t has had a couple of spares transform into
   clientObjects/serverObjects; account for them and don't overrun the
   spares array

Reviewed-on: http://gerrit.openafs.org/600
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

README.WARNINGS
src/rxkad/Makefile.in
src/rxkad/rxkad_common.c
src/rxkad/rxkad_prototypes.h
src/rxkad/rxkad_server.c
src/rxkad/ticket.c
src/rxkad/ticket5.c
src/rxkad/v5der.c

index 106c101..ee7754b 100644 (file)
@@ -81,9 +81,7 @@ libadmin/samples/rxdebug_peers.c : format : struct clock vs unsigned int
 libadmin/test/client.c : all         : util_RPCStatsStateGet types
 ptserver/ptserver.c  : all          : ExtendedCellInfo
 rxkad/rxkad_server.c : all           : Des key nonsense
-rxkad/ticket.c       : all           : Des key nonsense
-rxkad/ticket5.c             : all           : Des key nonsense
-rxkad/v5der.c       : all (pthread) : Des key nonsense
+rxkad/ticket5.c      : implicit-func : CRC functions
 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
index 9ca071b..00f1d8c 100644 (file)
@@ -63,7 +63,7 @@ librxkad.a: ${OBJS} AFS_component_version_number.o
 rxkad_client.o: fcrypt.h private_data.h rxkad_client.c ${INCLS}
 
 rxkad_server.o: rxkad_server.c fcrypt.h private_data.h  ${INCLS}
-       $(CC) $(CFLAGS) @CFLAGS_NOERROR@ -c $<
+       $(CC) $(CFLAGS) -c $<
 
 rxkad_common.o: fcrypt.h private_data.h rxkad_common.c ${INCLS}
 
@@ -74,10 +74,10 @@ rxkad_errs.c rxkad.h: rxkad_errs.et rxkad.p.h
        ${COMPILE_ET} -p ${srcdir} rxkad_errs -h rxkad
 
 ticket.o: ticket.c lifetimes.h ${INCLS}
-       $(CC) $(CFLAGS) @CFLAGS_NOERROR@ -c $<
+       $(CC) $(CFLAGS) -c $<
 
 ticket5.o: ticket5.c v5gen.c v5der.c v5gen-rewrite.h ${INCLS}
-       $(CC) $(CFLAGS) @CFLAGS_NOERROR@ -c $<
+       $(CC) $(CFLAGS) -c $<
 
 crc.o: crc.c ${INCLS}
 
index e92dbe8..59dc9a2 100644 (file)
@@ -171,6 +171,8 @@ int rxkad_stats_agg(rxkad_stats_t * rxkad_stats) {
        rxkad_stats->des_encrypts[1] += thr_stats->des_encrypts[1];
        rxkad_stats->des_key_scheds += thr_stats->des_key_scheds;
        rxkad_stats->des_randoms += thr_stats->des_randoms;
+       rxkad_stats->clientObjects += thr_stats->clientObjects;
+       rxkad_stats->serverObjects += thr_stats->serverObjects;
        rxkad_stats->spares[0] += thr_stats->spares[0];
        rxkad_stats->spares[1] += thr_stats->spares[1];
        rxkad_stats->spares[2] += thr_stats->spares[2];
@@ -179,8 +181,6 @@ int rxkad_stats_agg(rxkad_stats_t * rxkad_stats) {
        rxkad_stats->spares[5] += thr_stats->spares[5];
        rxkad_stats->spares[6] += thr_stats->spares[6];
        rxkad_stats->spares[7] += thr_stats->spares[7];
-       rxkad_stats->spares[8] += thr_stats->spares[8];
-       rxkad_stats->spares[9] += thr_stats->spares[9];
     }
     RXKAD_GLOBAL_STATS_UNLOCK;
     return 0;
index 0fead04..3968071 100644 (file)
@@ -135,8 +135,8 @@ extern afs_int32 rxkad_SetConfiguration(struct rx_securityClass *aobj,
 extern int tkt_DecodeTicket(char *asecret, afs_int32 ticketLen,
                            struct ktc_encryptionKey *key, char *name,
                            char *inst, char *cell, struct ktc_encryptionKey *sessionKey,
-                           afs_int32 * host, afs_int32 * start,
-                           afs_int32 * end);
+                           afs_int32 * host, afs_uint32 * start,
+                           afs_uint32 * end);
 extern int tkt_MakeTicket(char *ticket, int *ticketLen,
                          struct ktc_encryptionKey *key, char *name,
                          char *inst, char *cell, afs_uint32 start,
@@ -154,8 +154,8 @@ extern int tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
                                             struct ktc_encryptionKey *),
                             char *get_key_rock, int serv_kvno, char *name,
                             char *inst, char *cell, struct ktc_encryptionKey *session_key,
-                            afs_int32 * host, afs_int32 * start,
-                            afs_int32 * end, afs_int32 disableDotCheck);
+                            afs_int32 * host, afs_uint32 * start,
+                            afs_uint32 * end, afs_int32 disableDotCheck);
 
 #if !defined(NO_DES_H_INCLUDE)
 static_inline unsigned char *
index 1e2b5ce..8955d6c 100644 (file)
@@ -406,7 +406,7 @@ rxkad_CheckResponse(struct rx_securityClass *aobj,
     rxkad_SetLevel(aconn, sconn->level);
     INC_RXKAD_STATS(responses[rxkad_LevelIndex(sconn->level)]);
     /* now compute endpoint-specific info used for computing 16 bit checksum */
-    rxkad_DeriveXORInfo(aconn, sconn->keysched, sconn->ivec, sconn->preSeq);
+    rxkad_DeriveXORInfo(aconn, &sconn->keysched, (char *)sconn->ivec, (char *)sconn->preSeq);
 
     /* otherwise things are ok */
     sconn->expirationTime = end;
index 0b6628c..10cde7b 100644 (file)
@@ -117,7 +117,7 @@ int
 tkt_DecodeTicket(char *asecret, afs_int32 ticketLen,
                 struct ktc_encryptionKey *key, char *name, char *inst,
                 char *cell, struct ktc_encryptionKey *sessionKey, afs_int32 * host,
-                afs_int32 * start, afs_int32 * end)
+                afs_uint32 * start, afs_uint32 * end)
 {
     char clear_ticket[MAXKTCTICKETLEN];
     char *ticket;
index 9b4300c..da90081 100644 (file)
@@ -61,6 +61,9 @@
 #include <afs/param.h>
 #endif
 
+#ifdef IGNORE_SOME_GCC_WARNINGS
+# pragma GCC diagnostic warning "-Wimplicit-function-declaration"
+#endif
 
 #if defined(UKERNEL)
 #include "../afs/sysincludes.h"
@@ -197,7 +200,7 @@ tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
                  int (*get_key) (void *, int, struct ktc_encryptionKey *),
                  char *get_key_rock, int serv_kvno, char *name, char *inst,
                  char *cell, struct ktc_encryptionKey *session_key, afs_int32 * host,
-                 afs_int32 * start, afs_int32 * end, afs_int32 disableCheckdot)
+                 afs_uint32 * start, afs_uint32 * end, afs_int32 disableCheckdot)
 {
     char plain[MAXKRB5TICKETLEN];
     struct ktc_encryptionKey serv_key;
@@ -218,14 +221,14 @@ tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
        return RXKADBADTICKET;  /* no ticket */
 
     if (serv_kvno == RXKAD_TKT_TYPE_KERBEROS_V5) {
-       code = decode_Ticket(ticket, ticket_len, &t5, &siz);
+       code = decode_Ticket((unsigned char *)ticket, ticket_len, &t5, &siz);
        if (code != 0)
            goto cleanup;
 
        if (t5.tkt_vno != 5)
            goto bad_ticket;
     } else {
-       code = decode_EncryptedData(ticket, ticket_len, &t5.enc_part, &siz);
+       code = decode_EncryptedData((unsigned char *)ticket, ticket_len, &t5.enc_part, &siz);
        if (code != 0)
            goto cleanup;
     }
@@ -266,7 +269,7 @@ tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
        goto bad_ticket;
 
     /* Decode ticket */
-    code = decode_EncTicketPart(plain, plainsiz, &decr_part, &siz);
+    code = decode_EncTicketPart((unsigned char *)plain, plainsiz, &decr_part, &siz);
     if (code != 0)
        goto bad_ticket;
 
index 5df724b..7b7e67b 100644 (file)
@@ -329,7 +329,7 @@ decode_enumerated(const unsigned char *p, size_t len, unsigned *num,
     p += l;
     len -= l;
     ret += l;
-    e = der_get_int(p, reallen, num, &l);
+    e = der_get_unsigned(p, reallen, num, &l);
     if (e)
        return e;
     p += l;