From c4f190ca605597fd31972192c65363117863e262 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 16 Oct 2009 23:15:52 +0100 Subject: [PATCH] More warning fixes for kauth Resolve more minor warnings from the kauth directory. *) kaux_read takes an unsigned for the number of failures *) The COUNT_REQ macro generates an unused variable (this_op) *) kas is missing some headers *) Add some more prototypes to kauth_internal.h *) Add the standard boilerplate to kauth_internal.h *) recvfrom takes a socklen_t * as its 6th argument This make kaprocs.c, kaauxdb.c, kas.c, klog.c, and ka-forwarder.c warning clean. Mark them as such. Reviewed-on: http://gerrit.openafs.org/673 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- README.WARNINGS | 6 +----- src/kauth/Makefile.in | 7 ++----- src/kauth/kaauxdb.c | 2 +- src/kauth/kaprocs.c | 7 +++---- src/kauth/kas.c | 2 ++ src/kauth/kaserver.c | 1 + src/kauth/kauth_internal.h | 26 ++++++++++++++++++++++++++ src/kauth/klog.c | 1 + src/kauth/krb_tf.c | 1 + src/kauth/krb_udp.c | 3 ++- 10 files changed, 40 insertions(+), 16 deletions(-) diff --git a/README.WARNINGS b/README.WARNINGS index c954710ea..f6c40dbf2 100644 --- a/README.WARNINGS +++ b/README.WARNINGS @@ -59,15 +59,11 @@ butc/recoverDb.c : all : pointer target issues (XXX) butc/tcudbprocs.c : all : ubik_Call butc/dump.c : all : pointer types (XXX) comerr/error_table.c : all : Autogenerated file with unused labels -kauth/kaprocs.c : all : XXX kauth/kaserver.c : all : ExtendedCellInfo -kauth/krb_udp.c : all : XXX +kauth/krb_udp.c : all : "Value computed is not used" - wierd kauth/admin_tools.c : all : ubik_Call nonsense kauth/authclient.c : strict-proto : ubik_Call nonsense : all : ubik_Call nonsense -kauth/kas.c : all : XXX -kauth/klog.c : all : XXX -kauth/ka-forwarder.c : all : XXX libadmin/bos/afs_bosAdmin.c: all : DES keys, time types, and const libadmin/kas/afs_kasAdmin.c: all : Ubik_Call nonsense, DES keys libadmin/samples/rxstat_query_peer.c : all : util_RPCStatsStateGet types diff --git a/src/kauth/Makefile.in b/src/kauth/Makefile.in index c408f47c8..79862e6b4 100644 --- a/src/kauth/Makefile.in +++ b/src/kauth/Makefile.in @@ -98,12 +98,11 @@ kadatabase.o: kadatabase.c ${INCLS} ${CC} ${CFLAGS} -c ${srcdir}/kadatabase.c kaprocs.o: kaprocs.c ${INCLS} kaport.h - ${CC} ${CFLAGS} @CFLAGS_NOERROR@ -c $< + ${CC} ${CFLAGS} -c $< authclient.o: authclient.c ${INCLS} kaauxdb.o: kaauxdb.c - $(CC) $(CFLAGS) @CFLAGS_NOERROR@ -c $< kaerrors.o: kaerrors.c @@ -162,7 +161,7 @@ token.o: token.c ${INCLS} client.o: client.c ${INCLS} AFS_component_version_number.o kas.o: kas.c ${INCLS} AFS_component_version_number.o - $(CC) $(CFLAGS) @CFLAGS_NOERROR@ -c $< + $(CC) $(CFLAGS) -c $< admin_tools.o: admin_tools.c ${INCLS} kaport.h $(CC) $(CFLAGS) @CFLAGS_NOERROR@ -c $< @@ -180,7 +179,6 @@ klog: AFS_component_version_number.o kauth.h kautils.h libkauth.a $(LIBS) \ ${CC} ${LDFLAGS} -o klog klog.o libkauth.a ${LIBS} ${XLIBS} klog.o: klog.c kauth.h kautils.h AFS_component_version_number.o - $(CC) $(CFLAGS) @CFLAGS_NOERROR@ -c $< klog.krb: kauth.h kautils.h libkauth.krb.a $(KLIBS) klog.o ${CC} ${LDFLAGS} -o klog.krb klog.o libkauth.krb.a ${KLIBS} ${XLIBS} @@ -229,7 +227,6 @@ krb_udp: krb_udp.o libkauth.a $(KLIBS) ${CC} ${LDFLAGS} -o krb_udp krb_udp.o libkauth.a $(KLIBS) ka-forwarder.o: ka-forwarder.c - $(CC) $(CFLAGS) @CFLAGS_NOERROR@ -c $< ka-forwarder: ka-forwarder.o ${CC} -o $@ ${CFLAGS} ka-forwarder.o ${LIBS} ${XLIBS} diff --git a/src/kauth/kaauxdb.c b/src/kauth/kaauxdb.c index 07eb668a1..09ba13f35 100644 --- a/src/kauth/kaauxdb.c +++ b/src/kauth/kaauxdb.c @@ -141,7 +141,7 @@ kaux_write(afs_int32 to, unsigned int nfailures, afs_uint32 lasttime) void kaux_inc(afs_int32 to, afs_uint32 locktime) { - int nfailures; + unsigned int nfailures; afs_uint32 lasttime, now; now = time(0); diff --git a/src/kauth/kaprocs.c b/src/kauth/kaprocs.c index c2deadc84..f675d054c 100644 --- a/src/kauth/kaprocs.c +++ b/src/kauth/kaprocs.c @@ -1486,7 +1486,7 @@ kamDeleteUser(struct rx_call *call, char *aname, char *ainstance) afs_int32 caller; afs_int32 to; struct kaentry tentry; - int nfailures; + unsigned int nfailures; afs_uint32 locktime; COUNT_REQ(DeleteUser); @@ -2083,8 +2083,7 @@ afs_int32 kamGetPassword(struct rx_call *call, char *name, EncryptionKey *password) { int code = KANOAUTH; - COUNT_REQ(GetPassword); - + AFS_UNUSED COUNT_REQ(GetPassword); #ifdef GETPASSWORD { afs_int32 to; @@ -2142,7 +2141,7 @@ kamGetRandomKey(struct rx_call *call, EncryptionKey *key) { int code; - COUNT_REQ(GetRandomKey); + AFS_UNUSED COUNT_REQ(GetRandomKey); if ((code = AwaitInitialization())) return code; code = des_random_key(EncryptionKey_to_cblock(key)); diff --git a/src/kauth/kas.c b/src/kauth/kas.c index 8cc7f3e2b..538d93e56 100644 --- a/src/kauth/kas.c +++ b/src/kauth/kas.c @@ -30,8 +30,10 @@ #include #include #include +#include #include "kauth.h" +#include "kauth_internal.h" #include "kautils.h" diff --git a/src/kauth/kaserver.c b/src/kauth/kaserver.c index cce632ea5..1fae422e5 100644 --- a/src/kauth/kaserver.c +++ b/src/kauth/kaserver.c @@ -45,6 +45,7 @@ #include #include #include "kauth.h" +#include "kauth_internal.h" #include "kautils.h" #include "kaserver.h" #include "kadatabase.h" diff --git a/src/kauth/kauth_internal.h b/src/kauth/kauth_internal.h index 73058f341..795efc625 100644 --- a/src/kauth/kauth_internal.h +++ b/src/kauth/kauth_internal.h @@ -1,3 +1,16 @@ +/* + * 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 + */ +#ifndef AFS_SRC_KAUTH_INTERNAL_H +#define AFS_SRC_KAUTH_INTERNAL_H + +/* admin_tools.c */ +extern afs_int32 ka_AdminInteractive(int cmd_argc, char *cmd_argv[]); /* kadatabase.c */ extern void init_kadatabase(int initFlags); @@ -7,6 +20,7 @@ extern afs_int32 ka_LookupKey(struct ubik_trans *tt, afs_int32 *kvno, struct ktc_encryptionKey *key); +struct kaentry; extern afs_int32 FindBlock(struct ubik_trans *at, char *aname, char *ainstance, afs_int32 *toP, struct kaentry *tentry); @@ -27,6 +41,16 @@ extern afs_int32 ka_NewKey(struct ubik_trans *tt, afs_int32 tentryaddr, extern int name_instance_legal(char *name, char *instance); +/* kaprocs.c */ +struct ubik_trans; +extern afs_int32 InitAuthServ(struct ubik_trans **, int, int *); + +/* krb_tf.c */ +extern afs_int32 krb_write_ticket_file(char *realm); + +/* krb_udp.c */ +extern afs_int32 init_krb_udp(void); + static_inline unsigned char * EncryptionKey_to_cblock(EncryptionKey *key) { return (unsigned char *)key; @@ -41,3 +65,5 @@ static_inline EncryptionKey * ktc_to_EncryptionKey(struct ktc_encryptionKey *key) { return (EncryptionKey *)key; } + +#endif diff --git a/src/kauth/klog.c b/src/kauth/klog.c index 2402c4e68..f227decb1 100644 --- a/src/kauth/klog.c +++ b/src/kauth/klog.c @@ -28,6 +28,7 @@ #include #include "kauth.h" #include "kautils.h" +#include "kauth_internal.h" #include "assert.h" diff --git a/src/kauth/krb_tf.c b/src/kauth/krb_tf.c index 285205c38..c8941cc25 100644 --- a/src/kauth/krb_tf.c +++ b/src/kauth/krb_tf.c @@ -63,6 +63,7 @@ #include #include "kauth.h" #include "kautils.h" +#include "kauth_internal.h" #ifndef WORDS_BIGENDIAN /* This was taken from jhutz's patch for heimdal krb4. It only diff --git a/src/kauth/krb_udp.c b/src/kauth/krb_udp.c index dad0a74ce..a8318dd20 100644 --- a/src/kauth/krb_udp.c +++ b/src/kauth/krb_udp.c @@ -43,6 +43,7 @@ #include "kauth.h" #include "kautils.h" +#include "kauth_internal.h" #include "kaserver.h" #include "prot.h" /* protocol definitions */ #include "kaport.h" @@ -791,7 +792,7 @@ SocketListener(void *unused) fd_set rfds; struct timeval tv; struct packet packet; - int fromLen; + socklen_t fromLen; afs_int32 code; printf("Starting to listen for UDP packets\n"); -- 2.39.5