DEVEL15-auth-cleanup-20071101
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Thu, 1 Nov 2007 16:09:32 +0000 (16:09 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 1 Nov 2007 16:09:32 +0000 (16:09 +0000)
kill warnings in auth directory

(cherry picked from commit 089a02bcbc9df2090c275e5620248f478be1e286)

src/auth/authcon.c
src/auth/cellconfig.c
src/auth/copyauth.c
src/auth/ktc.c
src/auth/setkey.c
src/auth/userok.c
src/auth/writeconfig.c

index c57abee..3e03d97 100644 (file)
@@ -23,6 +23,7 @@ RCSID
 #include "afs/stds.h"
 #include "afs/pthread_glock.h"
 #include "des/des.h"
+#include "des/des_prototypes.h"
 #include "rx/rxkad.h"
 #include "rx/rx.h"
 #include "afs/cellconfig.h"
@@ -42,7 +43,9 @@ RCSID
 #include <netdb.h>
 #endif
 #include <string.h>
+#include <stdio.h>
 #include <des.h>
+#include <des_prototypes.h>
 #include <rx/rxkad.h>
 #include <rx/rx.h>
 #include "cellconfig.h"
@@ -52,9 +55,7 @@ RCSID
 
 /* return a null security object if nothing else can be done */
 static afs_int32
-QuickAuth(astr, aindex)
-     struct rx_securityClass **astr;
-     afs_int32 *aindex;
+QuickAuth(struct rx_securityClass **astr, afs_int32 *aindex)
 {
     register struct rx_securityClass *tc;
     tc = rxnull_NewClientSecurityObject();
@@ -66,10 +67,9 @@ QuickAuth(astr, aindex)
 #if !defined(UKERNEL)
 /* Return an appropriate security class and index */
 afs_int32
-afsconf_ServerAuth(adir, astr, aindex)
-     register struct afsconf_dir *adir;
-     struct rx_securityClass **astr;
-     afs_int32 *aindex;
+afsconf_ServerAuth(register struct afsconf_dir *adir, 
+                  struct rx_securityClass **astr, 
+                  afs_int32 *aindex)
 {
     register struct rx_securityClass *tclass;
 
@@ -89,11 +89,10 @@ afsconf_ServerAuth(adir, astr, aindex)
 #endif /* !defined(UKERNEL) */
 
 static afs_int32
-GenericAuth(adir, astr, aindex, enclevel)
-     struct afsconf_dir *adir;
-     struct rx_securityClass **astr;
-     afs_int32 *aindex;
-     rxkad_level enclevel;
+GenericAuth(struct afsconf_dir *adir, 
+           struct rx_securityClass **astr, 
+           afs_int32 *aindex, 
+           rxkad_level enclevel)
 {
     char tbuffer[256];
     struct ktc_encryptionKey key, session;
@@ -160,10 +159,9 @@ afsconf_ClientAuth(struct afsconf_dir * adir, struct rx_securityClass ** astr,
  * tells rxkad to encrypt the data, too.
  */
 afs_int32
-afsconf_ClientAuthSecure(adir, astr, aindex)
-     struct afsconf_dir *adir;
-     struct rx_securityClass **astr;
-     afs_int32 *aindex;
+afsconf_ClientAuthSecure(struct afsconf_dir *adir, 
+                        struct rx_securityClass **astr, 
+                        afs_int32 *aindex)
 {
     afs_int32 rc;
 
index 5c789c5..95ed464 100644 (file)
@@ -305,7 +305,10 @@ IsClientConfigDirectory(const char *path)
 static int
 afsconf_Check(register struct afsconf_dir *adir)
 {
-    char tbuffer[256], *p;
+    char tbuffer[256];
+#ifdef AFS_NT40_ENV
+    char *p;
+#endif
     struct stat tstat;
     register afs_int32 code;
 
@@ -351,9 +354,11 @@ afsconf_Check(register struct afsconf_dir *adir)
 static int
 afsconf_Touch(register struct afsconf_dir *adir)
 {
-    char tbuffer[256], *p;
+    char tbuffer[256];
 #ifndef AFS_NT40_ENV
     struct timeval tvp[2];
+#else
+    char *p;
 #endif
 
     adir->timeRead = 0;                /* just in case */
@@ -1276,7 +1281,8 @@ afsconf_GetKeys(struct afsconf_dir *adir, struct afsconf_keys *astr)
 
 /* get latest key */
 afs_int32
-afsconf_GetLatestKey(struct afsconf_dir * adir, afs_int32 * avno, char *akey)
+afsconf_GetLatestKey(struct afsconf_dir * adir, afs_int32 * avno, 
+                    struct ktc_encryptionKey *akey)
 {
     register int i;
     int maxa;
@@ -1317,8 +1323,9 @@ afsconf_GetLatestKey(struct afsconf_dir * adir, afs_int32 * avno, char *akey)
 
 /* get a particular key */
 int
-afsconf_GetKey(struct afsconf_dir *adir, afs_int32 avno, char *akey)
+afsconf_GetKey(void *rock, int avno, struct ktc_encryptionKey *akey)
 {
+    struct afsconf_dir *adir = (struct afsconf_dir *) rock;
     register int i, maxa;
     register struct afsconf_key *tk;
     register afs_int32 code;
index e1a592d..2ced48a 100644 (file)
@@ -28,9 +28,8 @@ RCSID
 
 char whoami[256];
 
-main(argc, argv)
-     int argc;
-     char **argv;
+int
+main(int argc, char **argv)
 {
     char localName[64];
     register afs_int32 code;
index 1b6cfb3..1645702 100644 (file)
@@ -40,6 +40,7 @@ RCSID
 #include <unistd.h>
 #endif
 #include <stdio.h>
+#include <stdlib.h>
 #include <afs/stds.h>
 #include <afs/pthread_glock.h>
 #include <sys/types.h>
@@ -122,10 +123,16 @@ static struct flock fileUlock = { F_UNLCK, 0, 0, 0, 0 };
 /* the following routines aren't static anymore on behalf of the kerberos IV
  * compatibility library built in subtree krb.
  */
-int afs_tf_init(), afs_tf_get_pname(), afs_tf_get_pinst(), afs_tf_get_cred();
-int afs_tf_save_cred(), afs_tf_close(), afs_tf_create();
-int afs_tf_dest_tkt();
-static void ktc_LocalCell();
+int afs_tf_init(char *, int);
+int afs_tf_get_pname(char *);
+int afs_tf_get_pinst(char *);
+int afs_tf_get_cred(struct ktc_principal *, struct ktc_token *);
+int afs_tf_save_cred(struct ktc_principal *, struct ktc_token *, 
+                    struct ktc_principal *);
+int afs_tf_close(void);
+int afs_tf_create(char *, char *);
+int afs_tf_dest_tkt(void);
+static void ktc_LocalCell(void);
 #endif /* AFS_KERBEROS_ENV */
 
 #ifdef AFS_DUX40_ENV
@@ -245,11 +252,10 @@ static struct {
  * now. */
 
 static int
-NewSetToken(aserver, atoken, aclient, flags)
-     struct ktc_principal *aserver;
-     struct ktc_principal *aclient;
-     struct ktc_token *atoken;
-     afs_int32 flags;
+NewSetToken(struct ktc_principal *aserver, 
+           struct ktc_token *atoken, 
+           struct ktc_principal *aclient, 
+            afs_int32 flags)
 {
     TRY_KERNEL(KTC_SETTOKEN_OP, aserver, aclient, atoken,
               sizeof(struct ktc_token));
@@ -261,10 +267,8 @@ NewSetToken(aserver, atoken, aclient, flags)
 (3*sizeof(afs_int32)+MAXKTCTICKETLEN+sizeof(struct ClearToken)+MAXKTCREALMLEN)
 
 static int
-OldSetToken(aserver, atoken, aclient, flags)
-     struct ktc_principal *aserver, *aclient;
-     struct ktc_token *atoken;
-     afs_int32 flags;
+OldSetToken(struct ktc_principal *aserver, struct ktc_token *atoken, 
+           struct ktc_principal *aclient, afs_int32 flags)
 {
     struct ViceIoctl iob;
     char tbuffer[MAXPIOCTLTOKENLEN];
@@ -480,10 +484,9 @@ ktc_SetToken(struct ktc_principal *aserver,
 /* get token, given server we need and token buffer.  aclient will eventually
  * be set to our identity to the server.
  */
-ktc_GetToken(aserver, atoken, atokenLen, aclient)
-     struct ktc_principal *aserver, *aclient;
-     int atokenLen;
-     struct ktc_token *atoken;
+int
+ktc_GetToken(struct ktc_principal *aserver, struct ktc_token *atoken, 
+            int atokenLen, struct ktc_principal *aclient)
 {
     struct ViceIoctl iob;
     char tbuffer[MAXPIOCTLTOKENLEN];
@@ -495,7 +498,9 @@ ktc_GetToken(aserver, atoken, atokenLen, aclient)
     afs_int32 temp;
     int maxLen;                        /* biggest ticket we can copy */
     int tktLen;                        /* server ticket length */
+#ifdef AFS_KERBEROS_ENV
     char found = 0;
+#endif
 
     LOCK_GLOBAL_MUTEX;
 #ifndef NO_AFS_CLIENT
@@ -533,8 +538,8 @@ ktc_GetToken(aserver, atoken, atokenLen, aclient)
                    found = 1;
            } else {
                char tmpstring[MAXHOSTCHARS];
-               afs_tf_get_pname(&tmpstring);
-               afs_tf_get_pinst(&tmpstring);
+               afs_tf_get_pname(tmpstring);
+               afs_tf_get_pinst(tmpstring);
                found = 1;
            }
        }
@@ -664,8 +669,8 @@ ktc_GetToken(aserver, atoken, atokenLen, aclient)
  * NOT IMPLEMENTED YET!
  */
 #ifndef NO_AFS_CLIENT
-ktc_ForgetToken(aserver)
-     struct ktc_principal *aserver;
+int
+ktc_ForgetToken(struct ktc_principal *aserver)
 {
     int rc;
 
@@ -894,7 +899,8 @@ ktc_ForgetAllTokens(void)
 /* ktc_OldPioctl - returns a boolean true if the kernel supports only the old
  * pioctl interface for delivering AFS tickets to the cache manager. */
 
-ktc_OldPioctl()
+int
+ktc_OldPioctl(void)
 {
     int rc;
     LOCK_GLOBAL_MUTEX;
@@ -944,12 +950,13 @@ ktc_OldPioctl()
  *     c. In tf_close, be sure it gets reinitialized to a negative
  *        number. 
  */
-static fd = -1;
-static curpos;                 /* Position in tfbfr */
-static lastpos;                        /* End of tfbfr */
+static int fd = -1;
+static int curpos;                     /* Position in tfbfr */
+static int lastpos;                    /* End of tfbfr */
 static char tfbfr[BUFSIZ];     /* Buffer for ticket data */
 
-static tf_gets(), tf_read();
+static int tf_gets(char *, int);
+static int tf_read(char *, int);
 
 /*
  * This file contains routines for manipulating the ticket cache file.
@@ -1014,8 +1021,8 @@ static tf_gets(), tf_read();
  * TKT_FIL_LCK  - couldn't lock the file, even after a retry
  */
 
-afs_tf_init(tf_name, rw)
-     char *tf_name;
+int
+afs_tf_init(char *tf_name, int rw)
 {
     int wflag;
     int me;
@@ -1108,8 +1115,8 @@ afs_tf_init(tf_name, rw)
  * was longer than MAXKTCNAMELEN, TKT_FIL_FMT is returned. 
  */
 
-afs_tf_get_pname(p)
-     char *p;
+int
+afs_tf_get_pname(char *p)
 {
     if (fd < 0) {
        return TKT_FIL_INI;
@@ -1129,8 +1136,8 @@ afs_tf_get_pname(p)
  * instance may be null. 
  */
 
-afs_tf_get_pinst(inst)
-     char *inst;
+int
+afs_tf_get_pinst(char *inst)
 {
     if (fd < 0) {
        return TKT_FIL_INI;
@@ -1151,9 +1158,8 @@ afs_tf_get_pinst(inst)
  * EOF          - end of file encountered
  */
 
-afs_tf_get_cred(principal, token)
-     struct ktc_principal *principal;
-     struct ktc_token *token;
+int
+afs_tf_get_cred(struct ktc_principal *principal, struct ktc_token *token)
 {
     int k_errno;
     int kvno, lifetime;
@@ -1211,7 +1217,8 @@ afs_tf_get_cred(principal, token)
  * The return value is not defined.
  */
 
-afs_tf_close()
+int
+afs_tf_close(void)
 {
     if (!(fd < 0)) {
 #if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV)
@@ -1223,6 +1230,7 @@ afs_tf_close()
        fd = -1;                /* see declaration of fd above */
     }
     memset(tfbfr, 0, sizeof(tfbfr));
+    return 0;
 }
 
 /*
@@ -1243,11 +1251,10 @@ afs_tf_close()
  *             file is seriously ill.
  */
 
-static
-tf_gets(s, n)
-     register char *s;
+static int
+tf_gets(register char *s, int n)
 {
-    register count;
+    register int count;
 
     if (fd < 0) {
        return TKT_FIL_INI;
@@ -1279,12 +1286,10 @@ tf_gets(s, n)
  * 0           on end of file or read error
  */
 
-static
-tf_read(s, n)
-     register char *s;
-     register n;
+static int
+tf_read(register char *s, register int n)
 {
-    register count;
+    register int count;
 
     for (count = n; count > 0; --count) {
        if (curpos >= sizeof(tfbfr)) {
@@ -1299,8 +1304,6 @@ tf_read(s, n)
     return n;
 }
 
-char *tkt_string();
-
 /*
  * afs_tf_save_cred() appends an incoming ticket to the end of the ticket
  * file.  You must call afs_tf_init() before calling afs_tf_save_cred().
@@ -1312,10 +1315,10 @@ char *tkt_string();
  * called previously, and KFAILURE for anything else that went wrong.
  */
 
-afs_tf_save_cred(aserver, atoken, aclient)
-     struct ktc_principal *aserver;
-     struct ktc_principal *aclient;
-     struct ktc_token *atoken; /* Token */
+int
+afs_tf_save_cred(struct ktc_principal *aserver, 
+                struct ktc_token *atoken, 
+                struct ktc_principal *aclient)
 {
     char realm[MAXKTCREALMLEN + 1];
     char junk[MAXKTCNAMELEN];
@@ -1414,8 +1417,6 @@ afs_tf_save_cred(aserver, atoken, aclient)
  * <mit-copyright.h>.
  */
 
-char *getenv();
-
 /*
  * This routine is used to generate the name of the file that holds
  * the user's cache of server tickets and associated session keys.
@@ -1445,7 +1446,7 @@ ktc_tkt_string_uid(afs_uint32 uid)
 
     LOCK_GLOBAL_MUTEX;
     if (!*krb_ticket_string) {
-       if (env = getenv("KRBTKFILE")) {
+       if ((env = getenv("KRBTKFILE"))) {
            (void)strncpy(krb_ticket_string, env,
                          sizeof(krb_ticket_string) - 1);
            krb_ticket_string[sizeof(krb_ticket_string) - 1] = '\0';
@@ -1488,9 +1489,8 @@ ktc_set_tkt_string(char * val)
  * success, or KFAILURE if something goes wrong.
  */
 
-afs_tf_create(pname, pinst)
-     char *pname;
-     char *pinst;
+int
+afs_tf_create(char *pname, char *pinst)
 {
     int tktfile;
     int me, metoo;
@@ -1567,7 +1567,8 @@ afs_tf_create(pname, pinst)
  * failure.
  */
 
-afs_tf_dest_tkt()
+int
+afs_tf_dest_tkt(void)
 {
     char *file = ktc_tkt_string();
     int i, fd;
@@ -1607,7 +1608,7 @@ afs_tf_dest_tkt()
 }
 
 static afs_uint32
-curpag()
+curpag(void)
 {
 #if defined(AFS_AIX51_ENV)
     afs_int32 pag;
@@ -1642,8 +1643,8 @@ curpag()
 #endif
 }
 
-
-ktc_newpag()
+int
+ktc_newpag(void)
 {
     extern char **environ;
 
@@ -1662,7 +1663,7 @@ ktc_newpag()
     if (pag == -1) {
        sprintf(fname, "%s%d", prefix, getuid());
     } else {
-       sprintf(fname, "%sp%ld", prefix, pag);
+       sprintf(fname, "%sp%ld", prefix, (long int) pag);
     }
     ktc_set_tkt_string(fname);
 
@@ -1670,7 +1671,7 @@ ktc_newpag()
        numenv++;
     newenv = (char **)malloc((numenv + 2) * sizeof(char *));
 
-    for (senv = environ, denv = newenv; *senv; *senv++) {
+    for (senv = environ, denv = newenv; *senv; senv++) {
        if (strncmp(*senv, "KRBTKFILE=", 10) != 0)
            *denv++ = *senv;
     }
@@ -1681,6 +1682,7 @@ ktc_newpag()
     *++denv = 0;
     environ = newenv;
     UNLOCK_GLOBAL_MUTEX;
+    return 0;
 }
 
 /*
@@ -1688,7 +1690,7 @@ ktc_newpag()
  * find out what the local cell is.
  */
 static void
-ktc_LocalCell()
+ktc_LocalCell(void)
 {
     int code;
     struct afsconf_dir *conf;
index 2999281..86081d7 100644 (file)
@@ -28,6 +28,7 @@ RCSID
 #ifdef HAVE_NETDB_H
 #include <netdb.h>
 #endif
+#include <rx/rxkad.h>
 #include "cellconfig.h"
 #include "keys.h"
 #include <afs/afsutil.h>
@@ -37,9 +38,7 @@ static int char2hex(char c);
 static int hex2char(char c);
 
 int
-main(argc, argv)
-     int argc;
-     char **argv;
+main(int argc, char **argv)
 {
     struct afsconf_dir *tdir;
     register afs_int32 code;
index 5b4a1ed..766ffe3 100644 (file)
@@ -46,13 +46,10 @@ RCSID
 #include "keys.h"
 #include "afs/audit.h"
 
-afs_int32 afsconf_SuperUser();
-
 #if !defined(UKERNEL)
 int
-afsconf_CheckAuth(adir, acall)
-     register struct rx_call *acall;
-     register struct afsconf_dir *adir;
+afsconf_CheckAuth(register struct afsconf_dir *adir, 
+                 register struct rx_call *acall)
 {
     LOCK_GLOBAL_MUTEX;
     return ((afsconf_SuperUser(adir, acall, NULL) == 0) ? 10029 : 0);
@@ -61,8 +58,7 @@ afsconf_CheckAuth(adir, acall)
 #endif /* !defined(UKERNEL) */
 
 static int
-GetNoAuthFlag(adir)
-     struct afsconf_dir *adir;
+GetNoAuthFlag(struct afsconf_dir *adir)
 {
     if (access(AFSDIR_SERVER_NOAUTH_FILEPATH, 0) == 0) {
        osi_audit(NoAuthEvent, 0, AUD_END);     /* some random server is running noauth */
@@ -73,8 +69,7 @@ GetNoAuthFlag(adir)
 
 
 int
-afsconf_GetNoAuthFlag(adir)
-     struct afsconf_dir *adir;
+afsconf_GetNoAuthFlag(struct afsconf_dir *adir)
 {
     int rc;
 
@@ -85,9 +80,7 @@ afsconf_GetNoAuthFlag(adir)
 }
 
 void
-afsconf_SetNoAuthFlag(adir, aflag)
-     struct afsconf_dir *adir;
-     int aflag;
+afsconf_SetNoAuthFlag(struct afsconf_dir *adir, int aflag)
 {
     register afs_int32 code;
 
@@ -112,9 +105,7 @@ afsconf_SetNoAuthFlag(adir, aflag)
 
 /* deletes a user from the UserList file */
 int
-afsconf_DeleteUser(adir, auser)
-     struct afsconf_dir *adir;
-     register char *auser;
+afsconf_DeleteUser(struct afsconf_dir *adir, register char *auser)
 {
     char tbuffer[1024];
     char nbuffer[1024];
@@ -204,11 +195,8 @@ afsconf_DeleteUser(adir, auser)
 
 /* returns nth super user from the UserList file */
 int
-afsconf_GetNthUser(adir, an, abuffer, abufferLen)
-     struct afsconf_dir *adir;
-     afs_int32 an;
-     char *abuffer;
-     afs_int32 abufferLen;
+afsconf_GetNthUser(struct afsconf_dir *adir, afs_int32 an, char *abuffer, 
+                  afs_int32 abufferLen)
 {
     char tbuffer[256];
     register FILE *tf;
@@ -246,9 +234,7 @@ afsconf_GetNthUser(adir, an, abuffer, abufferLen)
 
 /* returns true iff user is in the UserList file */
 static int
-FindUser(adir, auser)
-     struct afsconf_dir *adir;
-     register char *auser;
+FindUser(struct afsconf_dir *adir, register char *auser)
 {
     char tbuffer[256];
     register bufio_p bp;
@@ -280,9 +266,7 @@ FindUser(adir, auser)
 
 /* add a user to the user list, checking for duplicates */
 int
-afsconf_AddUser(adir, aname)
-     struct afsconf_dir *adir;
-     char *aname;
+afsconf_AddUser(struct afsconf_dir *adir, char *aname)
 {
     FILE *tf;
     register afs_int32 code;
@@ -316,12 +300,8 @@ afsconf_AddUser(adir, aname)
        otherwise returns NULL. The resulting string should be immediately
        copied to other storage prior to release of mutex. */
 static char *
-CompFindUser(adir, name, sep, inst, realm)
-     struct afsconf_dir *adir;
-     char *name;
-     char *sep;
-     char *inst;
-     char *realm;
+CompFindUser(struct afsconf_dir *adir, char *name, char *sep, char *inst, 
+            char *realm)
 {
     static char fullname[MAXKTCNAMELEN + MAXKTCNAMELEN + MAXKTCREALMLEN + 3];
 
@@ -360,10 +340,7 @@ CompFindUser(adir, name, sep, inst, realm)
     if a pointer is passed.
 */
 afs_int32
-afsconf_SuperUser(adir, acall, namep)
-     struct afsconf_dir *adir;
-     struct rx_call *acall;
-     char *namep;
+afsconf_SuperUser(struct afsconf_dir *adir, struct rx_call *acall, char *namep)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -431,7 +408,7 @@ afsconf_SuperUser(adir, acall, namep)
        tmp = tcell_l;
        while (*tmp) {
            *tmp = tolower(*tmp);
-           *tmp++;
+           tmp++;
        }
 
        /* determine local cell name. It's static, so will only get
index 153bc56..dbc229d 100644 (file)
@@ -35,6 +35,7 @@ RCSID
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#include <rx/rxkad.h>
 #include "cellconfig.h"
 #include "keys.h"
 
@@ -43,8 +44,7 @@ RCSID
 */
 
 static int
-VerifyEntries(aci)
-     register struct afsconf_cell *aci;
+VerifyEntries(register struct afsconf_cell *aci)
 {
     register int i;
     register struct hostent *th;
@@ -85,10 +85,8 @@ VerifyEntries(aci)
    */
 
 int
-afsconf_SetCellInfo(adir, apath, acellInfo)
-     struct afsconf_dir *adir;
-     char *apath;
-     struct afsconf_cell *acellInfo;
+afsconf_SetCellInfo(struct afsconf_dir *adir, const char *apath, 
+                   struct afsconf_cell *acellInfo)
 {
     afs_int32 code;
 
@@ -97,11 +95,9 @@ afsconf_SetCellInfo(adir, apath, acellInfo)
 }
 
 int
-afsconf_SetExtendedCellInfo(adir, apath, acellInfo, clones)
-     struct afsconf_dir *adir;
-     char *apath;
-     struct afsconf_cell *acellInfo;
-     char clones[];
+afsconf_SetExtendedCellInfo(struct afsconf_dir *adir, 
+                           const char *apath, 
+                           struct afsconf_cell *acellInfo, char clones[])
 {
     register afs_int32 code;
     register int fd;