]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Roughly prototype the kauth directory
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Fri, 10 Jul 2009 12:52:16 +0000 (13:52 +0100)
committerDerrick Brashear <shadow@dementia.org>
Fri, 10 Jul 2009 18:48:07 +0000 (12:48 -0600)
A first pass at prototyping and warning reduction for the kauth
directory. kauth is plagued by the des key type problems, and
no attempt to remedy this has been made. Some other complex
warnings remain - it didn't seem worth the effort to do this
in too much detail, as it's dying soon.

Reviewed-on: http://gerrit.openafs.org/23
Verified-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
22 files changed:
src/kauth/admin_tools.c
src/kauth/authclient.c
src/kauth/client.c
src/kauth/kaauxdb.c
src/kauth/kadatabase.h [new file with mode: 0644]
src/kauth/kalog.c
src/kauth/kalog.h
src/kauth/kaprocs.c
src/kauth/kaprocs.h [new file with mode: 0644]
src/kauth/kaserver.c
src/kauth/kautils.c
src/kauth/kkids.c
src/kauth/kkids.h [new file with mode: 0644]
src/kauth/klog.c
src/kauth/knfs.c
src/kauth/kpasswd.c
src/kauth/kpwvalid.c
src/kauth/krb_tf.c
src/kauth/krb_udp.c
src/kauth/read_passwd.c
src/kauth/rebuild.c
src/kauth/user.c

index 4f6c7cb66d3d5d6f6f7c0bd46b11d09c9a8e9981..9f27b3138da2b34d0863dcd06af0c7c85ef26e08 100644 (file)
 #include <afs/cmd.h>
 #include <afs/com_err.h>
 #include <afs/afsutil.h>
+#include <des.h>
+#include <des_prototypes.h>
 
 #include "kauth.h"
 #include "kautils.h"
 #include "kaport.h"
+#include "kkids.h"
 
 #define CMD_PARSER_AMBIG_FIX 1 /* allow ambiguous aliases */
 
@@ -56,7 +59,7 @@ static char myName[510];      /* almost like whoami save with path and without : */
 static int finished;
 static int zero_argc;
 static char **zero_argv;
-afs_uint32 ka_islocked();
+afs_uint32 ka_islocked(char *, char *, afs_uint32 *);
 
 afs_int32
 DefaultCell(void)
@@ -749,7 +752,7 @@ StringToKey(struct cmd_syndesc *as, void *arock)
        }
        ucstring(realm, realm, sizeof(realm));
     } else {
-       if (code = DefaultCell())
+       if ((code = DefaultCell()))
            return code;
        ucstring(realm, cell, sizeof(realm));
     }
@@ -962,7 +965,7 @@ ListTicket(struct ktc_principal *server, int verbose)
     return 0;
 }
 
-static
+static int
 GetTicket(struct cmd_syndesc *as, void *arock)
 {
     int code;
@@ -984,7 +987,7 @@ GetTicket(struct cmd_syndesc *as, void *arock)
        return KABADCMD;
     }
     if (server.cell[0] == 0) {
-       if (code = DefaultCell())
+       if ((code = DefaultCell()))
            return code;
        strcpy(server.cell, cell);
     } else {
@@ -1008,7 +1011,7 @@ GetTicket(struct cmd_syndesc *as, void *arock)
     return code;
 }
 
-static
+static int
 GetPassword(struct cmd_syndesc *as, void *arock)
 {
     int code;
@@ -1285,7 +1288,6 @@ NoAuth(struct cmd_syndesc *as, void *arock)
 static int
 MyBeforeProc(struct cmd_syndesc *as, void *arock)
 {
-    extern struct passwd *getpwuid();
     struct ktc_encryptionKey key;
     struct ktc_principal auth_server, auth_token, client;
     char realm[MAXKTCREALMLEN];
@@ -1540,7 +1542,7 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock)
 
 /* These are some helpful command that deal with the cache managers tokens. */
 
-static
+static int
 ForgetTicket(struct cmd_syndesc *as, void *arock)
 {
     afs_int32 code;
@@ -1594,7 +1596,7 @@ ForgetTicket(struct cmd_syndesc *as, void *arock)
     return 0;
 }
 
-static
+static int
 ListTickets(struct cmd_syndesc *as, void *arock)
 {
     afs_int32 code = 0;
@@ -1614,7 +1616,7 @@ ListTickets(struct cmd_syndesc *as, void *arock)
            return code;
        }
        if (server.cell[0] == 0) {
-           if (code = DefaultCell())
+           if ((code = DefaultCell()))
                return code;
            strcpy(server.cell, cell);
        } else {
@@ -1816,7 +1818,7 @@ ka_AdminInteractive(int cmd_argc, char *cmd_argv[])
 
     strcpy(whoami, "kas");
 
-    if (code = cmd_Dispatch(cmd_argc, cmd_argv)) {
+    if ((code = cmd_Dispatch(cmd_argc, cmd_argv))) {
        return code;
     }
 
index 36e3d1be05f1ffd8d89faf130f63591894582b3a..ef81d33ec6887cb68db69866c375c9d232251f8e 100644 (file)
@@ -394,21 +394,26 @@ CheckTicketAnswer(ka_BBS * oanswer, afs_int32 challenge,
        if ((field) && strcmp (field, strings)) return KABADPROTOCOL;\
        strings += len+1
 
+#define chknostr() \
+       len = strlen(strings); \
+       if (len > MAXKTCNAMELEN) return KABADPROTOCOL; \
+       strings += len+1
+
        if (caller) {
            chkstr(caller->name);
            chkstr(caller->instance);
            chkstr(caller->cell);
        } else {
-           chkstr(0);
-           chkstr(0);
-           chkstr(0);
+           chknostr();
+           chknostr();
+           chknostr();
        }
        if (server) {
            chkstr(server->name);
            chkstr(server->instance);
        } else {
-           chkstr(0);
-           chkstr(0);
+           chknostr();
+           chknostr();
        }
 
        if (oanswer->SeqLen -
@@ -563,7 +568,6 @@ ka_Authenticate(char *name, char *instance, char *cell, struct ubik_client * con
            ubik_Call(KAA_Authenticate, conn, 0, name, instance, start, end,
                      &arequest, &oanswer, 0, 0);
        if (code == RXGEN_OPCODE) {
-           extern int KAA_Authenticate_old();
            oanswer.MaxSeqLen = sizeof(answer_old);
            oanswer.SeqBody = (char *)&answer_old;
            version = 0;
@@ -680,7 +684,6 @@ ka_GetToken(char *name, char *instance, char *cell, char *cname, char *cinst, st
        ubik_Call(KAT_GetTicket, conn, 0, auth_token->kvno, auth_domain,
                  &aticket, name, instance, &atimes, &oanswer);
     if (code == RXGEN_OPCODE) {
-       extern int KAT_GetTicket_old();
        oanswer.SeqLen = 0;     /* this may be set by first call */
        oanswer.MaxSeqLen = sizeof(answer_old);
        oanswer.SeqBody = (char *)&answer_old;
index 7e641d102078e4b04a9a67b48c43e1c24661a467..b489d4661160c4bf8cfa803820caecf4a61c6ad3 100644 (file)
@@ -30,6 +30,7 @@
 #include "afs/kautils.h"
 #include "afs/pthread_glock.h"
 #include "des/des.h"
+#include <des_prototypes.h>
 
 #else /* defined(UKERNEL) */
 #include <afs/stds.h>
@@ -184,9 +185,7 @@ ka_ReadPassword(char *prompt, int verify, char *cell,
 /* This performs the backslash quoting defined by AC_ParseLoginName. */
 
 static char
-map_char(str, ip)
-     char *str;
-     int *ip;
+map_char(char *str, int *ip)
 {
     char c = str[*ip];
     if (c == '\\') {
index 4314c1680e62bf9a64bb5465fd9558f11c5ad575..07eb668a1ab2ca8702d602c589d6ddbb1198cb63 100644 (file)
@@ -25,6 +25,8 @@
 #endif
 #include <string.h>
 #include <rx/rxkad.h>
+#define UBIK_INTERNALS
+#include <ubik.h>
 #include "ubik_int.h"
 #include "kauth.h"
 #include "kaserver.h"
@@ -168,7 +170,6 @@ kaux_inc(afs_int32 to, afs_uint32 locktime)
 int
 kaux_islocked(afs_int32 to, u_int attempts, u_int locktime)
 {
-    extern int ubeacon_Debug(), ubeacon_AmSyncSite();
     unsigned int nfailures, myshare;
     afs_uint32 lasttime;
     struct ubik_debug beaconinfo;
diff --git a/src/kauth/kadatabase.h b/src/kauth/kadatabase.h
new file mode 100644 (file)
index 0000000..34c0536
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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 _KAUTH_KADATABASE_H
+#define _KAUTH_KADATABASE_H
+extern int kawrite(struct ubik_trans *, afs_int32, char *, afs_int32);
+extern int karead(struct ubik_trans *, afs_int32, char *, afs_int32);
+extern int update_admin_count(struct ubik_trans *, int);
+
+extern int ka_LookupKvno(struct ubik_trans *, char *, char *, afs_int32,
+                        struct ktc_encryptionKey *);
+
+extern afs_int32 AllocBlock(struct ubik_trans *, struct kaentry *);
+extern afs_int32 FreeBlock(struct ubik_trans *, afs_int32);
+
+extern afs_int32 FindBlock(struct ubik_trans *, char *, char *, afs_int32 *,
+                          struct kaentry *);
+extern afs_int32 ThreadBlock(struct ubik_trans *, afs_int32, struct kaentry *);
+
+extern afs_int32 UnthreadBlock(struct ubik_trans *, struct kaentry *);
+
+extern afs_int32 NextBlock(struct ubik_trans *, afs_int32, struct kaentry *,
+                          afs_int32 *);
+
+extern afs_int32 ka_DelKey(struct ubik_trans *tt, afs_int32 tentryaddr,
+                          struct kaentry *tentry);
+
+extern afs_int32 ka_LookupKvno(struct ubik_trans *tt, char *name,
+                              char *inst, afs_int32 kvno,
+                              struct ktc_encryptionKey *key);
+extern afs_int32 ka_LookupKey(struct ubik_trans *, char *, char *,
+                             afs_int32 *, struct ktc_encryptionKey *);
+
+#endif
index 335c971d0fd027b1a404606904c8ccf8e697595b..de0bd97d2a74b72a90b99ad0379b68807d7bf136 100644 (file)
@@ -40,7 +40,8 @@ extern afs_int32 verbose_track;
 
 DBM *kalog_db;
 
-kalog_Init()
+void
+kalog_Init(void)
 {
     OpenLog(AFSDIR_SERVER_KALOGDB_FILEPATH);   /* set up logging */
     SetupLogSignals();
@@ -52,9 +53,9 @@ kalog_Init()
 }
 
 /* log a ticket usage */
-kalog_log(principal, instance, sprincipal, sinstance, realm, hostaddr, type)
-     char *principal, *instance, *sprincipal, *sinstance, *realm;
-     int hostaddr, type;
+void
+kalog_log(char *principal, char *instance, char *sprincipal,
+         char *sinstance, char *realm, int hostaddr, int type)
 {
     char keybuf[512];          /* not random! 63 . 63 , 63 . 63 max key */
     datum key, data;
index ca71fb66afe30c0aaaa81e909309a387aaaead90..d42bfeb521dc0f06b38367abb820a1d891e15bf6 100644 (file)
@@ -52,3 +52,6 @@ typedef struct {
 #else
 #define KALOG(a,b,c,d,e,f,g) ka_log(a,b,c,d,e,f,g)
 #endif
+
+extern void kalog_log(char *, char *, char *, char *, char *, int, int);
+extern void kalog_Init(void);
index dae855a8e298b57c14f600d63844741faf499b68..9674673298f36d2078416c5c0ddff193c172977b 100644 (file)
 #include "kauth_internal.h"
 #include "afs/audit.h"
 
+#include "kadatabase.h"
+#include "kaprocs.h"
+
 extern struct ubik_dbase *KA_dbase;
 struct kaheader cheader;
 Date cheaderReadTime;          /* time cheader last read in */
 extern struct afsconf_dir *KA_conf;    /* for getting cell info */
 
-afs_int32 kamCreateUser(struct rx_call *call, char *aname, char *ainstance, 
-                       EncryptionKey ainitpw);
-afs_int32 ChangePassWord(struct rx_call *call, char *aname, char *ainstance, 
-                        ka_CBS *arequest, ka_BBS *oanswer);
-afs_int32 kamSetPassword(struct rx_call *call, char *aname, char *ainstance,
-                        afs_int32 akvno, EncryptionKey apassword);
-afs_int32 kamSetFields(struct rx_call *call, char *aname, char *ainstance,
-                      afs_int32 aflags, Date aexpiration, 
-                      afs_int32 alifetime, afs_int32 amaxAssociates,
-                      afs_uint32 misc_auth_bytes, afs_int32 spare2);
-afs_int32 kamDeleteUser(struct rx_call *call, char *aname, char *ainstance);
-afs_int32 kamGetEntry(struct rx_call *call, char *aname, char *ainstance,
-                     afs_int32 aversion, kaentryinfo *aentry);
-afs_int32 kamListEntry(struct rx_call *call, afs_int32 previous_index,
-                      afs_int32 *index, afs_int32 *count, kaident *name);
-afs_int32 kamGetStats(struct rx_call *call, afs_int32 version, 
-                     afs_int32 *admin_accounts, kasstats *statics,
-                     kadstats *dynamics);
-afs_int32 kamGetPassword(struct rx_call *call, char *name, 
-                        EncryptionKey *password);
-afs_int32 kamGetRandomKey(struct rx_call *call, EncryptionKey *key);
-afs_int32 kamDebug(struct rx_call *call, afs_int32 version,
-                  int checkDB, struct ka_debugInfo *info);
+
 
 char lrealm[MAXKTCREALMLEN];
 
@@ -95,15 +76,13 @@ static afs_int32 autoCPWInterval;
 static afs_int32 autoCPWUpdates;
 
 static afs_int32 set_password(struct ubik_trans *tt, char *name, 
-                             char *instance, EncryptionKey *password, 
+                             char *instance,
+                             struct ktc_encryptionKey *password,
                              afs_int32 kvno, afs_int32 caller);
-
-extern afs_int32 InitAuthServ(struct ubik_trans **tt, int lock,
-                             int *this_op);
 static afs_int32 impose_reuse_limits(EncryptionKey *password, 
                                     struct kaentry *tentry);
 static int create_user(struct ubik_trans *tt, char *name, char *instance,
-                      EncryptionKey *key, afs_int32 caller, 
+                      struct ktc_encryptionKey *key, afs_int32 caller,
                       afs_int32 flags);
 
 /* This routine is called whenever an RPC interface needs the time.  It uses
@@ -260,7 +239,7 @@ initialize_database(struct ubik_trans *tt)
    parameter passes some information about the command line arguments. */
 
 afs_int32
-init_kaprocs(char *lclpath, int initFlags)
+init_kaprocs(const char *lclpath, int initFlags)
 {
     int code;
     struct ubik_trans *tt;
@@ -571,7 +550,8 @@ special_name(char *name, char *instance)
 
 static int
 create_user(struct ubik_trans *tt, char *name, char *instance,
-           EncryptionKey *key, afs_int32 caller, afs_int32 flags)
+           struct ktc_encryptionKey *key, afs_int32 caller,
+           afs_int32 flags)
 {
     register int code;
     afs_int32 to;
@@ -822,7 +802,7 @@ impose_reuse_limits(EncryptionKey *password, struct kaentry *tentry)
 
 static afs_int32
 set_password(struct ubik_trans *tt, char *name, char *instance, 
-            EncryptionKey *password, afs_int32 kvno, afs_int32 caller)
+            struct ktc_encryptionKey *password, afs_int32 kvno, afs_int32 caller)
 {
     afs_int32 code;
     afs_int32 to;              /* offset of block */
@@ -880,7 +860,7 @@ set_password(struct ubik_trans *tt, char *name, char *instance,
 
     tentry.change_password_time = htonl(now);
 
-    if (code = kawrite(tt, to, &tentry, sizeof(tentry)))
+    if ((code = kawrite(tt, to, (char *) &tentry, sizeof(tentry))))
        return (KAIO);
     return (0);
 }
@@ -1470,7 +1450,7 @@ kamSetFields(struct rx_call *call,
 
     tentry.modification_time = htonl(now);
     tentry.modification_id = htonl(caller);
-    code = kawrite(tt, tentry_offset, &tentry, sizeof(tentry));
+    code = kawrite(tt, tentry_offset, (char *) &tentry, sizeof(tentry));
     if (code)
        goto abort;
 
diff --git a/src/kauth/kaprocs.h b/src/kauth/kaprocs.h
new file mode 100644 (file)
index 0000000..9bc6f8b
--- /dev/null
@@ -0,0 +1,23 @@
+extern afs_int32 init_kaprocs(const char *, int);
+extern afs_int32 InitAuthServ(struct ubik_trans **, int, int *);
+extern afs_int32 kamCreateUser(struct rx_call *, char *, char *,
+                              EncryptionKey);
+extern afs_int32 ChangePassWord(struct rx_call *, char *, char *, ka_CBS *,
+                               ka_BBS *);
+extern afs_int32 kamSetPassword(struct rx_call *, char *, char *, afs_int32,
+                               EncryptionKey apassword);
+extern afs_int32 kamSetFields(struct rx_call *, char *, char *, afs_int32,
+                             Date, afs_int32, afs_int32, afs_uint32,
+                             afs_int32 spare2);
+extern afs_int32 kamDeleteUser(struct rx_call *, char *, char *);
+extern afs_int32 kamGetEntry(struct rx_call *, char *, char *, afs_int32,
+                            kaentryinfo *);
+extern afs_int32 kamListEntry(struct rx_call *, afs_int32, afs_int32 *,
+                             afs_int32 *, kaident *);
+extern afs_int32 kamGetStats(struct rx_call *, afs_int32, afs_int32 *,
+                            kasstats *, kadstats *);
+extern afs_int32 kamGetPassword(struct rx_call *, char *, EncryptionKey *);
+extern afs_int32 kamGetRandomKey(struct rx_call *, EncryptionKey *);
+extern afs_int32 kamDebug(struct rx_call *, afs_int32, int,
+                         struct ka_debugInfo *);
+
index bae814678ea090ba5fe283bbf5cc113911c80b45..535387f3609acf39b79659fb75bb3d86220e243b 100644 (file)
 #include <lock.h>
 #include <afs/afsutil.h>
 #include <afs/com_err.h>
+#include <afs/audit.h>
 #include <ubik.h>
 #include <sys/stat.h>
 #include "kauth.h"
 #include "kautils.h"
 #include "kaserver.h"
-
+#include "kadatabase.h"
+#include "kaprocs.h"
 
 struct kadstats dynamic_statistics;
 struct ubik_dbase *KA_dbase;
@@ -72,8 +74,7 @@ static int debugOutput;
 
 /* check whether caller is authorized to manage RX statistics */
 int
-KA_rxstat_userok(call)
-     struct rx_call *call;
+KA_rxstat_userok(struct rx_call *call)
 {
     return afsconf_SuperUser(KA_conf, call, NULL);
 }
@@ -92,7 +93,7 @@ es_Report(char *fmt, ...)
 }
 
 static void
-initialize_dstats()
+initialize_dstats(void)
 {
     memset(&dynamic_statistics, 0, sizeof(dynamic_statistics));
     dynamic_statistics.start_time = time(0);
@@ -100,10 +101,8 @@ initialize_dstats()
 }
 
 static int
-convert_cell_to_ubik(cellinfo, myHost, serverList)
-     struct afsconf_cell *cellinfo;
-     afs_int32 *myHost;
-     afs_int32 *serverList;
+convert_cell_to_ubik(struct afsconf_cell *cellinfo, afs_int32 *myHost,
+                    afs_int32 *serverList)
 {
     int i;
     char hostname[64];
@@ -128,10 +127,7 @@ convert_cell_to_ubik(cellinfo, myHost, serverList)
 }
 
 static afs_int32
-kvno_admin_key(rock, kvno, key)
-     char *rock;
-     afs_int32 kvno;
-     struct ktc_encryptionKey *key;
+kvno_admin_key(void *rock, afs_int32 kvno, struct ktc_encryptionKey *key)
 {
     return ka_LookupKvno(0, KA_ADMIN_NAME, KA_ADMIN_INST, kvno, key);
 
@@ -147,9 +143,8 @@ kvno_admin_key(rock, kvno, key)
 
 #include "AFS_component_version_number.c"
 
-main(argc, argv)
-     int argc;
-     char *argv[];
+int
+main(int argc, char *argv[])
 {
     afs_int32 code;
     char *whoami = argv[0];
@@ -171,15 +166,11 @@ main(argc, argv)
     struct rx_securityClass *sca[1];
     struct rx_securityClass *scm[3];
 
-    extern int afsconf_ClientAuthSecure();
-    extern int afsconf_ServerAuth();
-    extern int afsconf_CheckAuth();
-
     extern int rx_stackSize;
-    extern int KAA_ExecuteRequest();
-    extern int KAT_ExecuteRequest();
-    extern int KAM_ExecuteRequest();
-    extern int RXSTATS_ExecuteRequest();
+    extern int KAA_ExecuteRequest(struct rx_call *);
+    extern int KAT_ExecuteRequest(struct rx_call *);
+    extern int KAM_ExecuteRequest(struct rx_call *);
+    extern int RXSTATS_ExecuteRequest(struct rx_call *);
 
 #ifdef AFS_AIX32_ENV
     /*
@@ -291,7 +282,7 @@ main(argc, argv)
            goto usage;
        }
     }
-    if (code = ka_CellConfig(cellservdb))
+    if ((code = ka_CellConfig(cellservdb)))
        goto abort;
     cell = ka_LocalCell();
     KA_conf = afsconf_Open(cellservdb);
@@ -323,7 +314,7 @@ main(argc, argv)
        afsconf_GetExtendedCellInfo(KA_conf, cell, AFSCONF_KAUTHSERVICE,
                                    &cellinfo, &clones);
     if (servers) {
-       if (code = ubik_ParseServerList(argc, argv, &myHost, serverList)) {
+       if ((code = ubik_ParseServerList(argc, argv, &myHost, serverList))) {
            afs_com_err(whoami, code, "Couldn't parse server list");
            exit(1);
        }
@@ -455,7 +446,7 @@ main(argc, argv)
     if (init_kaprocs(lclpath, initFlags))
        return -1;
 
-    if (code = init_krb_udp()) {
+    if ((code = init_krb_udp())) {
        ViceLog(0,
                ("Failed to initialize UDP interface; code = %d.\n", code));
        ViceLog(0, ("Running without UDP access.\n"));
index b115b24105732256d28e09a39203d2230a7e3fc2..f6f1df2f19590613d1cde85290a9cf8b844ee011 100644 (file)
@@ -27,6 +27,7 @@
 #include <rx/xdr.h>
 #include <rx/rx.h>
 #include <des.h>
+#include <des_prototypes.h>
 #include "kauth.h"
 #include "kautils.h"
 
index dc4d94352ec661930974fa6f1745deb2ebf48358..6c5f1408e7d5255a68452825e5e2ff18221101ee 100644 (file)
@@ -24,6 +24,7 @@
 #include <winsock2.h>
 #include <afs/fs_utils.h>
 #else
+#include <unistd.h>
 #include <netinet/in.h>
 #include <afs/venus.h>
 #endif
@@ -34,6 +35,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "kkids.h"
+
 #define MAXNAME 100
 #define MAXSIZE 2048
 
@@ -300,7 +303,6 @@ is_secure(char *dir)
     struct ViceIoctl blob;
     struct AclEntry *te;
     char space[2046];
-    int secure = 1;
     afs_int32 code;
     struct Acl *ta;
 
@@ -465,7 +467,7 @@ give_to_child(char *pw)
 /* quickly and painlessly
  */
 int
-terminate_child(char *pw)
+terminate_child(void)
 {
     int rc;
     rc = 0;
diff --git a/src/kauth/kkids.h b/src/kauth/kkids.h
new file mode 100644 (file)
index 0000000..5c35b24
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * 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 _KAUTH_KKIDS_H
+#define _KAUTH_KKIDS_H
+
+extern int init_child(char *);
+extern int password_bad(char *);
+extern int give_to_child(char *);
+extern int terminate_child(void);
+#endif
index de466390a6f35e8d5d7580046453b7d163cf5b05..2402c4e68a6da8ed0a374fca24b84428817cc214 100644 (file)
@@ -215,7 +215,7 @@ CommandProc(struct cmd_syndesc *as, void *arock)
            afs_com_err(rn, code, "Can't get local cell name!");
        KLOGEXIT(code);
     }
-    if (code = ka_CellToRealm(lcell, lrealm, 0))
+    if ((code = ka_CellToRealm(lcell, lrealm, 0)))
        goto nocell;
 
     strcpy(instance, "");
@@ -342,7 +342,7 @@ CommandProc(struct cmd_syndesc *as, void *arock)
 
     if (!foundExplicitCell)
        strcpy(realm, lcell);
-    if (code = ka_CellToRealm(realm, realm, &local)) {
+    if ((code = ka_CellToRealm(realm, realm, &local))) {
        if (!Silent)
            afs_com_err(rn, code, "Can't convert cell to realm");
        KLOGEXIT(code);
index 987ad4616a5c5ad1e5c71ffa4953fade88f29856..b87740c538d96ccfc83fa9fbbc7ead458de12838 100644 (file)
@@ -50,11 +50,8 @@ struct ClearToken {
 };
 
 
-static
-SetSysname(ahost, auid, sysname)
-     afs_int32 ahost;
-     afs_int32 auid;
-     char *sysname;
+static int
+SetSysname(afs_int32 ahost, afs_int32 auid, char *sysname)
 {
     afs_int32 code;
     afs_int32 pheader[6];
@@ -93,10 +90,8 @@ SetSysname(ahost, auid, sysname)
 }
 
 
-static
-GetTokens(ahost, auid)
-     afs_int32 ahost;
-     afs_int32 auid;
+static int
+GetTokens(afs_int32 ahost, afs_int32 auid)
 {
     struct ViceIoctl iob;
     afs_int32 pheader[6];
@@ -229,10 +224,8 @@ GetTokens(ahost, auid)
 }
 
 
-static
-NFSUnlog(ahost, auid)
-     afs_int32 ahost;
-     afs_int32 auid;
+static int
+NFSUnlog(afs_int32 ahost, afs_int32 auid)
 {
     afs_int32 code;
     afs_int32 pheader[6];
@@ -263,10 +256,8 @@ NFSUnlog(ahost, auid)
 }
 
 /* Copy the AFS service token into the kernel for a particular host and user */
-static
-NFSCopyToken(ahost, auid)
-     afs_int32 ahost;
-     afs_int32 auid;
+static int
+NFSCopyToken(afs_int32 ahost, afs_int32 auid)
 {
     struct ktc_principal client, server;
     struct ktc_token theTicket;
@@ -433,9 +424,8 @@ cmdproc(register struct cmd_syndesc *as, void *arock)
 
 #include "AFS_component_version_number.c"
 
-main(argc, argv)
-     int argc;
-     char **argv;
+int
+main(int argc, char **argv)
 {
     register struct cmd_syndesc *ts;
     register afs_int32 code;
index 1013e4c98fa254df89269ea937516d38aa632f83..e40fdd320e6f0e057615c1e9359baf216be09876 100644 (file)
 #include <afs/auth.h>
 #include <afs/cellconfig.h>
 #include <afs/cmd.h>
+#include <des.h>
+#include <des_prototypes.h>
 #include "kauth.h"
 #include "kautils.h"
+#include "kkids.h"
+
 #ifndef AFS_NT40_ENV
 #include <unistd.h>
 #endif
@@ -75,9 +79,6 @@ int CommandProc(struct cmd_syndesc *, void *);
 
 static int zero_argc;
 static char **zero_argv;
-extern int init_child(char *myname);
-extern int give_to_child(char *pw);
-extern int terminate_child(char *pw);
 
 #ifdef AFS_NT40_ENV
 struct passwd {
@@ -164,6 +165,7 @@ read_pass(char *passwd, int len, char *prompt, int verify)
     return code;
 }
 
+#if 0
 static int
 password_ok(char *newpw, int *insist)
 {
@@ -176,6 +178,7 @@ password_ok(char *newpw, int *insist)
     }
     return 1;                  /* lie about it */
 }
+#endif
 
 static char rn[] = "kpasswd";  /* Routine name */
 static int Pipe = 0;           /* reading from a pipe */
@@ -546,7 +549,7 @@ CommandProc(struct cmd_syndesc *as, void *arock)
        conn = 0;
     }
     rx_Finalize();
-    terminate_child(NULL);
+    terminate_child();
     exit(code);
 
   no_change:                   /* yuck, yuck, yuck */
@@ -557,6 +560,6 @@ CommandProc(struct cmd_syndesc *as, void *arock)
     memset(npasswd, 0, sizeof(npasswd));
     printf("Password for '%s' in cell '%s' unchanged.\n\n", pw->pw_name,
           cell);
-    terminate_child(NULL);
+    terminate_child();
     exit(code ? code : 1);
 }
index e310b96c521f7acbcfc0bf64203b38e1366cf416..bfd5f27f3849429eea3c0d37a5ce8a10ee987ff4 100644 (file)
@@ -21,6 +21,7 @@
 #include "AFS_component_version_number.c"
 
   /* returns 0 if the password is long enough, otherwise non-zero  */
+int
 main(int argc, char *argv[])
 {
     char oldpassword[512];
index 09c0eaef770baee7c64e8d91415ebbf29b8a89ba..285205c38c2d5891b0da6b1836b66b4681997bb9 100644 (file)
@@ -220,8 +220,7 @@ static unsigned char align_rec_3[] = {
 #endif /* AFSLITTLE_ENDIAN */
 
 afs_int32
-krb_write_ticket_file(realm)
-     char *realm;
+krb_write_ticket_file(char *realm)
 {
     char ticket_file[AFSDIR_PATH_MAX];
     int fd;
@@ -245,7 +244,7 @@ krb_write_ticket_file(realm)
     /* Use the KRBTKFILE environment variable if it exists, otherwise fall
      * back upon /tmp/tkt(uid}. 
      */
-    if (tf_name = (char *)getenv("KRBTKFILE"))
+    if ((tf_name = (char *)getenv("KRBTKFILE")))
        (void)sprintf(ticket_file, "%s", tf_name);
     else
        (void)sprintf(ticket_file, "%s/tkt%d", gettmpdir(), getuid());
index 8e5bdd556fefb868e23125e5c79d987225bb807d..c51c4857f7cf8275a2e1f3c6371c3dc44146d0aa 100644 (file)
@@ -38,6 +38,8 @@
 #include <rx/rx.h>
 #include <rx/rxkad.h>
 #include <afs/auth.h>
+#include <des.h>
+#include <des_prototypes.h>
 #include <ubik.h>
 
 #include "kauth.h"
@@ -47,6 +49,7 @@
 #include "kaport.h"
 #include "afs/audit.h"
 #include "kalog.h"
+#include "kadatabase.h"
 
 /* my kerberos error codes */
 #define KERB_ERR_BAD_MSG_TYPE  99
@@ -118,18 +121,10 @@ FiveMinuteCheckLWP(void *unused)
 
 
 static afs_int32
-create_cipher(cipher, cipherLen, sessionKey, sname, sinst, start, end, kvno,
-             ticket, ticketLen, key)
-     char *cipher;
-     int *cipherLen;
-     struct ktc_encryptionKey *sessionKey;
-     char *sname;
-     char *sinst;
-     Date start, end;
-     afs_int32 kvno;
-     char *ticket;
-     int ticketLen;
-     struct ktc_encryptionKey *key;
+create_cipher(char *cipher, int *cipherLen,
+             struct ktc_encryptionKey *sessionKey, char *sname,
+             char *sinst, Date start, Date end, afs_int32 kvno,
+             char *ticket, int ticketLen, struct ktc_encryptionKey *key)
 {
     char *answer;
     int slen;
@@ -168,7 +163,7 @@ create_cipher(cipher, cipherLen, sessionKey, sname, sinst, start, end, kvno,
        printf("\n");
     }
 
-    if (code = des_key_sched(key, schedule))
+    if ((code = des_key_sched(key, schedule)))
        printf("In KAAuthenticate: key_sched returned %d\n", code);
     des_pcbc_encrypt(cipher, cipher, len, schedule, key, ENCRYPT);
     *cipherLen = round_up_to_ebs(len);
@@ -182,14 +177,8 @@ create_cipher(cipher, cipherLen, sessionKey, sname, sinst, start, end, kvno,
 }
 
 static afs_int32
-create_reply(ans, name, inst, startTime, endTime, kvno, cipher, cipherLen)
-     struct packet *ans;
-     char *name;
-     char *inst;
-     Date startTime, endTime;
-     afs_int32 kvno;
-     char *cipher;
-     int cipherLen;
+create_reply(struct packet *ans, char *name, char *inst, Date startTime,
+            Date endTime, afs_int32 kvno, char *cipher, int cipherLen)
 {
     char *answer = ans->data;
     int slen;
@@ -223,14 +212,9 @@ create_reply(ans, name, inst, startTime, endTime, kvno, cipher, cipherLen)
 }
 
 static afs_int32
-check_auth(pkt, auth, authLen, key, name, inst, cell)
-     struct packet *pkt;
-     char *auth;
-     int authLen;
-     struct ktc_encryptionKey *key;
-     char *name;
-     char *inst;
-     char *cell;
+check_auth(struct packet *pkt, char *auth, int authLen,
+          struct ktc_encryptionKey *key, char *name, char *inst,
+          char *cell)
 {
     char *packet;
     des_key_schedule schedule;
@@ -260,15 +244,9 @@ check_auth(pkt, auth, authLen, key, name, inst, cell)
 }
 
 afs_int32
-UDP_Authenticate(ksoc, client, name, inst, startTime, endTime, sname, sinst)
-     int ksoc;
-     struct sockaddr_in *client;
-     char *name;
-     char *inst;
-     Date startTime;
-     Date endTime;
-     char *sname;
-     char *sinst;
+UDP_Authenticate(int ksoc, struct sockaddr_in *client, char *name,
+                char *inst, Date startTime, Date endTime, char *sname,
+                char *sinst)
 {
     struct ubik_trans *tt;
     afs_int32 to;              /* offset of block */
@@ -290,7 +268,7 @@ UDP_Authenticate(ksoc, client, name, inst, startTime, endTime, sname, sinst)
     COUNT_REQ(UAuthenticate);
     if (!name_instance_legal(name, inst))
        return KERB_ERR_NAME_EXP;       /* KABADNAME */
-    if (code = InitAuthServ(&tt, LOCKREAD, this_op))
+    if ((code = InitAuthServ(&tt, LOCKREAD, this_op)))
        return code;
 
     code = FindBlock(tt, name, inst, &to, &tentry);
@@ -414,15 +392,9 @@ UDP_Authenticate(ksoc, client, name, inst, startTime, endTime, sname, sinst)
 }
 
 afs_int32
-UDP_GetTicket(ksoc, pkt, kvno, authDomain, ticket, ticketLen, auth, authLen)
-     int ksoc;
-     struct packet *pkt;
-     afs_int32 kvno;
-     char *authDomain;
-     char *ticket;
-     int ticketLen;
-     char *auth;
-     int authLen;
+UDP_GetTicket(int ksoc, struct packet *pkt, afs_int32 kvno,
+             char *authDomain, char *ticket, int ticketLen, char *auth,
+             int authLen)
 {
     afs_int32 code;
     struct ktc_encryptionKey tgskey;
@@ -460,7 +432,7 @@ UDP_GetTicket(ksoc, pkt, kvno, authDomain, ticket, ticketLen, auth, authLen)
 
     COUNT_REQ(UGetTicket);
 
-    if (code = InitAuthServ(&tt, LOCKREAD, this_op))
+    if ((code = InitAuthServ(&tt, LOCKREAD, this_op)))
        goto fail;
     code =
        ka_LookupKvno(tt, KA_TGS_NAME,
@@ -621,11 +593,7 @@ UDP_GetTicket(ksoc, pkt, kvno, authDomain, ticket, ticketLen, auth, authLen)
 }
 
 static int
-err_packet(ksoc, pkt, code, reason)
-     int ksoc;
-     struct packet *pkt;
-     afs_int32 code;
-     char *reason;
+err_packet(int ksoc, struct packet *pkt, afs_int32 code, char *reason)
 {
     struct packet ans;
     char *answer = ans.data;
@@ -678,9 +646,7 @@ err_packet(ksoc, pkt, code, reason)
 }
 
 int
-process_udp_auth(ksoc, pkt)
-     int ksoc;
-     struct packet *pkt;
+process_udp_auth(int ksoc, struct packet *pkt)
 {
     char *packet = pkt->rest;
     char name[MAXKTCNAMELEN];
@@ -747,9 +713,7 @@ process_udp_auth(ksoc, pkt)
 }
 
 int
-process_udp_appl(ksoc, pkt)
-     int ksoc;
-     struct packet *pkt;
+process_udp_appl(int ksoc, struct packet *pkt)
 {
     char *packet = pkt->rest;
     afs_int32 kvno;
@@ -792,9 +756,7 @@ process_udp_appl(ksoc, pkt)
 }
 
 void
-process_udp_request(ksoc, pkt)
-     int ksoc;
-     struct packet *pkt;
+process_udp_request(int ksoc, struct packet *pkt)
 {
     char *packet = pkt->data;
     unsigned char version, auth_msg_type;
@@ -915,10 +877,11 @@ SocketListener(void *unused)
 
 #include "AFS_component_version_number.c"
 
-main()
+int
+main(int, char **)
 #else
 afs_int32
-init_krb_udp()
+init_krb_udp(void)
 #endif
 {
     struct sockaddr_in taddr;
index 8883653647dfdc603a7655b8e301189fbae5ee5b..7f52eee95b89541999ff283d4549a288d04148bd 100644 (file)
@@ -24,8 +24,7 @@
 #include <signal.h>
 #include <setjmp.h>
 #else
-char *strcpy();
-int strcmp();
+#include <string.h>
 #endif
 #if defined(AFS_AIX_ENV)
 #include <signal.h>
@@ -53,10 +52,7 @@ int read_pw_string();
 
 /*** Routines ****************************************************** */
 int
-des_read_password(k, prompt, verify)
-     C_Block *k;
-     char *prompt;
-     int verify;
+des_read_password(C_Block *k, char *prompt, int verify)
 {
     int ok;
     char key_string[BUFSIZ];
@@ -84,9 +80,7 @@ des_read_password(k, prompt, verify)
    */
 
 static int
-good_gets(s, max)
-     char *s;
-     int max;
+good_gets(char *s, int max)
 {
     int l;                     /* length of string read */
     if (!fgets(s, max, stdin)) {
@@ -112,11 +106,7 @@ good_gets(s, max)
 #endif
 
 int
-read_pw_string(s, max, prompt, verify)
-     char *s;
-     int max;
-     char *prompt;
-     int verify;
+read_pw_string(char *s, int max, char *prompt, int verify)
 {
     int ok = 0;
     int len;                   /* password length */
@@ -240,10 +230,10 @@ read_pw_string(s, max, prompt, verify)
  * this can be static since we should never have more than
  * one set saved....
  */
-static int (*old_sigfunc[NSIG]) ();
+static int (*old_sigfunc[NSIG]) (int);
 
 static
-push_signals()
+push_signals(void)
 {
     register i;
     for (i = 0; i < NSIG; i++)
@@ -251,7 +241,7 @@ push_signals()
 }
 
 static
-pop_signals()
+pop_signals(void)
 {
     register i;
     for (i = 0; i < NSIG; i++)
@@ -259,9 +249,7 @@ pop_signals()
 }
 
 static void
-sig_restore(sig, code, scp)
-     int sig, code;
-     struct sigcontext *scp;
+sig_restore(int sig, int code, struct sigcontext *scp)
 {
     longjmp(env, 1);
 }
@@ -269,7 +257,7 @@ sig_restore(sig, code, scp)
 
 #if    defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV)
 static int
-catch()
+catch(void)
 {
     ++intrupt;
 }
index 5fde2922b51deb42d0c17e3fff8c58ccdc80bdb4..987d9d4094d88dbf99af28e0c687a6858e16e9ec 100644 (file)
@@ -27,6 +27,8 @@
 #include <time.h>
 #include <ubik.h>
 #include <afs/cmd.h>
+#include <des.h>
+#include <des_prototypes.h>
 
 #include <afs/com_err.h>
 
index 1c409df2577ba18394106efda52ef8b06760327b..7245966d766680204a1f4312db7d339ca5dbb46f 100644 (file)
@@ -42,6 +42,7 @@
 #include <winsock2.h>
 #else
 #include <netinet/in.h>
+#include <unistd.h>
 #endif
 #include <string.h>
 #include <afs/cellconfig.h>
@@ -191,7 +192,7 @@ ka_UserAuthenticateGeneral(afs_int32 flags, char *name, char *instance,
 
 #if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_USR_LINUX20_ENV) && (!defined(AFS_XBSD_ENV) || defined(AFS_FBSD_ENV))
     /* handle smoothly the case where no AFS system calls exists (yet) */
-    old = (int (*)())signal(SIGSYS, SIG_IGN);
+    old = signal(SIGSYS, SIG_IGN);
 #endif
 #ifdef AFS_DECOSF_ENV
     (void)signal(SIGTRAP, SIG_IGN);