diff options
author | markm <markm@FreeBSD.org> | 1995-09-07 21:39:00 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 1995-09-07 21:39:00 +0000 |
commit | 2539acf77b018acd7416a9857a14c466e55cd7e8 (patch) | |
tree | 96ff3578d62372822240f11a1567e45b880f3910 /eBones/usr.bin | |
parent | eed9438eb23b62f78af7685dc226228e2bf5c524 (diff) | |
download | FreeBSD-src-2539acf77b018acd7416a9857a14c466e55cd7e8.zip FreeBSD-src-2539acf77b018acd7416a9857a14c466e55cd7e8.tar.gz |
Major cleanup of eBones code:
- Get all functions prototyped or at least defined before use.
- Make code compile (Mostly) clean with -Wall set
- Start to reduce the degree to which DES aka libdes is built in.
- get all functions to the same uniform standard of definition:
int
foo(a, b)
int a;
int *b;
{
:
}
- fix numerous bugs exposed by above processes.
Note - this replaces the previous work which used an unpopular function
definition style.
Diffstat (limited to 'eBones/usr.bin')
-rw-r--r-- | eBones/usr.bin/kadmin/Makefile | 6 | ||||
-rw-r--r-- | eBones/usr.bin/kadmin/kadmin.c | 36 | ||||
-rw-r--r-- | eBones/usr.bin/kdestroy/Makefile | 8 | ||||
-rw-r--r-- | eBones/usr.bin/kdestroy/kdestroy.c | 7 | ||||
-rw-r--r-- | eBones/usr.bin/kinit/Makefile | 6 | ||||
-rw-r--r-- | eBones/usr.bin/kinit/kinit.c | 10 | ||||
-rw-r--r-- | eBones/usr.bin/klist/Makefile | 6 | ||||
-rw-r--r-- | eBones/usr.bin/klist/klist.c | 25 | ||||
-rw-r--r-- | eBones/usr.bin/ksrvtgt/Makefile | 6 | ||||
-rw-r--r-- | eBones/usr.bin/ksrvtgt/ksrvtgt.c | 2 | ||||
-rw-r--r-- | eBones/usr.bin/register/Makefile | 6 | ||||
-rw-r--r-- | eBones/usr.bin/register/register.c | 34 |
12 files changed, 98 insertions, 54 deletions
diff --git a/eBones/usr.bin/kadmin/Makefile b/eBones/usr.bin/kadmin/Makefile index d7cf0a3..8eae179 100644 --- a/eBones/usr.bin/kadmin/Makefile +++ b/eBones/usr.bin/kadmin/Makefile @@ -5,10 +5,10 @@ PROG= kadmin SRCS= kadmin.c kadmin_cmds.c CLEANFILES+= kadmin_cmds.c CFLAGS+= -DPOSIX -I${.CURDIR}/../include -I${KRBOBJDIR} -CFLAGS+= -I${.CURDIR}/../libkadm -LDADD+= -L${KADMOBJDIR} -lkadm -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes +CFLAGS+= -I${.CURDIR}/../libkadm -Wall +LDADD+= -L${KADMOBJDIR} -lkadm -L${KRBOBJDIR} -lkrb -ldes LDADD+= -lss -lcom_err -NOMAN= # man page is in ../man +MAN8= kadmin.8 kadmin_cmds.c: kadmin_cmds.ct test -e kadmin_cmds.ct || ln -s ${.CURDIR}/kadmin_cmds.ct . diff --git a/eBones/usr.bin/kadmin/kadmin.c b/eBones/usr.bin/kadmin/kadmin.c index 56f03d0..fd98428 100644 --- a/eBones/usr.bin/kadmin/kadmin.c +++ b/eBones/usr.bin/kadmin/kadmin.c @@ -16,17 +16,24 @@ * NO_MULTIPLE defined. */ +#if 0 #ifndef lint static char rcsid_kadmin_c[] = "BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadmin.c,v 4.5 89/09/26 14:17:54 qjb Exp "; #endif lint +#endif +#include <unistd.h> +#include <string.h> #include <stdio.h> +#include <stdlib.h> +#include <time.h> #include <sys/param.h> #include <pwd.h> #include <ss/ss.h> -#include "krb_err.h" -#include "kadm.h" +#include <com_err.h> +#include <krb_err.h> +#include <kadm.h> #define BAD_PW 1 #define GOOD_PW 0 @@ -40,12 +47,12 @@ static char rcsid_kadmin_c[] = #define DONTSWAP 0 #define SWAP 1 -extern int kadm_init_link(); -extern char *error_message(); -extern void krb_set_tkt_string(); - -static void do_init(); -void clean_up(); +static void do_init(int argc, char *argv[]); +void clean_up(void); +int get_password(unsigned long *low, unsigned long *high, char *prompt, + int byteswap); +int get_admin_password(void); +int princ_exists(char *name, char *instance, char *realm); extern ss_request_table admin_cmds; @@ -56,6 +63,7 @@ static char krbrlm[REALM_SZ]; /* current realm being administered */ static int multiple = 0; /* Allow multiple requests per ticket */ #endif +int main(argc, argv) int argc; char *argv[]; @@ -98,7 +106,7 @@ setvals(vals, string) SET_FIELD(KADM_NAME,vals->fields); SET_FIELD(KADM_INST,vals->fields); - if (status = kname_parse(vals->name, vals->instance, realm, string)) { + if ((status = kname_parse(vals->name, vals->instance, realm, string))) { printf("kerberos error: %s\n", krb_err_txt[status]); return status; } @@ -389,12 +397,13 @@ help(argc, argv) printf("\n"); printf("This command exits this program.\n"); } else { - printf("Sorry there is no such command as %s."); - printf(" Type \"help\" for more information. \n", argv[1]); + printf("Sorry there is no such command as %s.", argv[1]); + printf(" Type \"help\" for more information. \n"); } return; } +void go_home(str,x) char *str; int x; @@ -406,7 +415,8 @@ int x; static int inited = 0; -void usage() +void +usage() { fprintf(stderr, "Usage: kadmin [-u admin_name] [-r default_realm]"); #ifndef NO_MULTIPLE @@ -605,7 +615,7 @@ int byteswap; #ifdef NOENCRYPTION bzero((char *) newkey, sizeof(newkey)); #else - des_string_to_key(new_passwd, newkey); + des_string_to_key(new_passwd, &newkey); #endif bzero(new_passwd, sizeof(new_passwd)); diff --git a/eBones/usr.bin/kdestroy/Makefile b/eBones/usr.bin/kdestroy/Makefile index 2a79774..1e4da0a 100644 --- a/eBones/usr.bin/kdestroy/Makefile +++ b/eBones/usr.bin/kdestroy/Makefile @@ -2,10 +2,10 @@ # $Id: Makefile,v 1.3 1995/07/18 16:37:42 mark Exp $ PROG= kdestroy -CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -DBSD42 -DPADD= ${LIBKRB} ${LIBDES} -LDADD= -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes +CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -DBSD42 -Wall +DPADD= ${LIBKRB} +LDADD= -L${KRBOBJDIR} -lkrb -ldes BINDIR= /usr/bin -NOMAN= noman +MAN1= kdestroy.1 .include <bsd.prog.mk> diff --git a/eBones/usr.bin/kdestroy/kdestroy.c b/eBones/usr.bin/kdestroy/kdestroy.c index c64a731..926eea5 100644 --- a/eBones/usr.bin/kdestroy/kdestroy.c +++ b/eBones/usr.bin/kdestroy/kdestroy.c @@ -13,10 +13,12 @@ * $Id: kdestroy.c,v 1.3 1995/07/18 16:37:44 mark Exp $ */ +#if 0 #ifndef lint static char rcsid[] = "$Id: kdestroy.c,v 1.3 1995/07/18 16:37:44 mark Exp $"; #endif lint +#endif #include <stdio.h> #include <krb.h> @@ -27,13 +29,16 @@ static char rcsid[] = static char *pname; -static usage() +static void +usage() { fprintf(stderr, "Usage: %s [-f] [-q]\n", pname); exit(1); } +int main(argc, argv) + int argc; char *argv[]; { int fflag=0, qflag=0, k_errno; diff --git a/eBones/usr.bin/kinit/Makefile b/eBones/usr.bin/kinit/Makefile index 24f1a95..884f37d 100644 --- a/eBones/usr.bin/kinit/Makefile +++ b/eBones/usr.bin/kinit/Makefile @@ -2,10 +2,10 @@ # $Id: Makefile,v 1.3 1995/07/18 16:37:53 mark Exp $ PROG= kinit -CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -DBSD42 +CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -DBSD42 -Wall DPADD= ${LIBKRB} ${LIBDES} -LDADD= -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes +LDADD= -L${KRBOBJDIR} -lkrb -ldes BINDIR= /usr/bin -NOMAN= noman +MAN1= kinit.1 .include <bsd.prog.mk> diff --git a/eBones/usr.bin/kinit/kinit.c b/eBones/usr.bin/kinit/kinit.c index 6cde305..3b47c7c 100644 --- a/eBones/usr.bin/kinit/kinit.c +++ b/eBones/usr.bin/kinit/kinit.c @@ -18,11 +18,15 @@ * $Id: kinit.c,v 1.4 1995/08/03 17:16:00 mark Exp $ */ +#if 0 #ifndef lint static char rcsid[] = "$Id: kinit.c,v 1.4 1995/08/03 17:16:00 mark Exp $"; #endif lint +#endif +#include <unistd.h> +#include <stdlib.h> #include <stdio.h> #include <pwd.h> #include <krb.h> @@ -49,6 +53,8 @@ static char rcsid[] = char *progname; +void usage(void); + void get_input(s, size, stream) char *s; @@ -63,7 +69,9 @@ FILE *stream; *p = '\0'; } +int main(argc, argv) + int argc; char *argv[]; { char aname[ANAME_SZ]; @@ -205,8 +213,10 @@ main(argc, argv) fprintf(stderr, "%s: %s\n", progname, krb_err_txt[k_errno]); exit(1); } + return 0; } +void usage() { fprintf(stderr, "Usage: %s [-irvl] [name]\n", progname); diff --git a/eBones/usr.bin/klist/Makefile b/eBones/usr.bin/klist/Makefile index b5ec669..c24800b 100644 --- a/eBones/usr.bin/klist/Makefile +++ b/eBones/usr.bin/klist/Makefile @@ -2,10 +2,10 @@ # $Id: Makefile,v 1.3 1995/07/18 16:37:57 mark Exp $ PROG= klist -CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include +CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall DPADD= ${LIBKRB} ${LIBDES} -LDADD= -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes +LDADD= -L${KRBOBJDIR} -lkrb -ldes BINDIR= /usr/bin -NOMAN= noman +MAN1= klist.1 .include <bsd.prog.mk> diff --git a/eBones/usr.bin/klist/klist.c b/eBones/usr.bin/klist/klist.c index 29e6453..0927dcb 100644 --- a/eBones/usr.bin/klist/klist.c +++ b/eBones/usr.bin/klist/klist.c @@ -10,25 +10,34 @@ * $Id: klist.c,v 1.3 1995/07/18 16:37:59 mark Exp $ */ +#if 0 #ifndef lint static char rcsid[] = "$Id: klist.c,v 1.3 1995/07/18 16:37:59 mark Exp $"; #endif lint +#endif +#include <unistd.h> #include <stdio.h> +#include <stdlib.h> #include <strings.h> #include <sys/file.h> #include <krb.h> #include <prot.h> +#include <time.h> + +int ok_getst(int fd, char *s, int n); +void display_srvtab(char *file); +char *short_date(long *dp); +void usage(void); +void display_tktfile(char *file, int tgt_test, int long_form); -char *tkt_string(); -char *short_date(); char *whoami; /* What was I invoked as?? */ -char *getenv(); extern char *krb_err_txt[]; /* ARGSUSED */ +int main(argc, argv) int argc; char **argv; @@ -78,7 +87,7 @@ main(argc, argv) exit(0); } - +void display_tktfile(file, tgt_test, long_form) char *file; int tgt_test, long_form; @@ -108,7 +117,7 @@ int tgt_test, long_form; */ /* Open ticket file */ - if (k_errno = tf_init(file, R_TKT_FIL)) { + if ((k_errno = tf_init(file, R_TKT_FIL))) { if (!tgt_test) fprintf(stderr, "%s: %s\n", whoami, krb_err_txt[k_errno]); exit(1); @@ -130,7 +139,7 @@ int tgt_test, long_form; } /* Open ticket file */ - if (k_errno = tf_init(file, R_TKT_FIL)) { + if ((k_errno = tf_init(file, R_TKT_FIL))) { if (!tgt_test) fprintf(stderr, "%s: %s\n", whoami, krb_err_txt[k_errno]); exit(1); @@ -199,6 +208,7 @@ short_date(dp) return (cp); } +void usage() { fprintf(stderr, @@ -206,6 +216,7 @@ usage() exit(1); } +void display_srvtab(file) char *file; { @@ -259,9 +270,11 @@ char *file; * If there is a read error, it returns -1 (like the read(2) system call) */ +int ok_getst(fd, s, n) int fd; register char *s; + int n; { register count = n; int err; diff --git a/eBones/usr.bin/ksrvtgt/Makefile b/eBones/usr.bin/ksrvtgt/Makefile index 1c6b0dc..9bf166d 100644 --- a/eBones/usr.bin/ksrvtgt/Makefile +++ b/eBones/usr.bin/ksrvtgt/Makefile @@ -2,10 +2,10 @@ # $Id: Makefile,v 1.3 1995/07/18 16:40:05 mark Exp $ PROG= ksrvtgt -CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include +CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall DPADD= ${LIBKRB} ${LIBDES} -LDADD= -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes +LDADD= -L${KRBOBJDIR} -lkrb -ldes BINDIR= /usr/bin -NOMAN= noman +MAN1= ksrvtgt.1 .include <bsd.prog.mk> diff --git a/eBones/usr.bin/ksrvtgt/ksrvtgt.c b/eBones/usr.bin/ksrvtgt/ksrvtgt.c index c51457c..0f92394 100644 --- a/eBones/usr.bin/ksrvtgt/ksrvtgt.c +++ b/eBones/usr.bin/ksrvtgt/ksrvtgt.c @@ -16,10 +16,12 @@ const char rcsid[] = #endif /* lint */ #include <stdio.h> +#include <string.h> #include <sys/param.h> #include <krb.h> #include <conf.h> +int main(argc,argv) int argc; char **argv; diff --git a/eBones/usr.bin/register/Makefile b/eBones/usr.bin/register/Makefile index 909569bb..9adfc93 100644 --- a/eBones/usr.bin/register/Makefile +++ b/eBones/usr.bin/register/Makefile @@ -3,10 +3,10 @@ PROG= register SRCS= register.c -CFLAGS+=-DCRYPT -DDEBUG -DKERBEROS -I${.CURDIR}/../include +CFLAGS+=-DCRYPT -DDEBUG -DKERBEROS -I${.CURDIR}/../include -Wall .PATH: ${.CURDIR}/../../usr.bin/rlogin -DPADD= ${LIBKRB} ${LIBDES} -LDADD= -lkrb -ldes -lcrypt +DPADD= ${LIBKRB} +LDADD= -L${KRBOBJDIR} -lkrb -ldes -lcrypt BINDIR= /usr/bin BINOWN= root BINMODE=4555 diff --git a/eBones/usr.bin/register/register.c b/eBones/usr.bin/register/register.c index 3f3cbbf..4f083a7 100644 --- a/eBones/usr.bin/register/register.c +++ b/eBones/usr.bin/register/register.c @@ -31,16 +31,17 @@ * SUCH DAMAGE. */ +#if 0 #ifndef lint static char copyright[] = "@(#) Copyright (c) 1989, 1993\n\ The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint static char sccsid[] = "@(#)register.c 8.1 (Berkeley) 6/1/93"; #endif /* not lint */ +#endif +#include <string.h> +#include <unistd.h> #include <sys/types.h> #include <sys/param.h> #include <sys/time.h> @@ -49,16 +50,23 @@ static char sccsid[] = "@(#)register.c 8.1 (Berkeley) 6/1/93"; #include <sys/file.h> #include <sys/signal.h> #include <netinet/in.h> +#include <arpa/inet.h> #include <pwd.h> #include <stdio.h> #include <netdb.h> #include <des.h> -#include <kerberosIV/krb.h> +#include <krb.h> #include "pathnames.h" #include "register_proto.h" -#define SERVICE "krbupdate" /* service to add to KDC's database */ -#define PROTOCOL "tcp" +#define SERVICE "krbupdate" /* service to add to KDC's database */ +#define PROTOCOL "tcp" + +void die(void); +void type_info(void); +void setup_key(struct sockaddr_in local); +void cleanup(void); +int get_user_info(void); char realm[REALM_SZ]; char krbhst[MAX_HSTNM]; @@ -67,10 +75,7 @@ static char pname[ANAME_SZ]; static char iname[INST_SZ]; static char password[_PASSWORD_LEN]; -/* extern char *sys_errlist; */ -void die(); -void setup_key(), type_info(), cleanup(); - +void main(argc, argv) int argc; char **argv; @@ -83,7 +88,7 @@ main(argc, argv) u_char code; static struct rlimit rl = { 0, 0 }; - signal(SIGPIPE, die); + signal(SIGPIPE, (__sighandler_t *)die); if (setrlimit(RLIMIT_CORE, &rl) < 0) { perror("rlimit"); @@ -200,7 +205,7 @@ main(argc, argv) } cleanup(); - (void)close(sock); + close(sock); } void @@ -266,7 +271,6 @@ setup_key(local) static Key_schedule schedule; int fd; char namebuf[MAXPATHLEN]; - extern int errno; (void) sprintf(namebuf, "%s%s", CLIENT_KEYFILE, @@ -285,8 +289,8 @@ setup_key(local) inet_ntoa(local.sin_addr)); exit(1); } - key_sched(kdata.kf_key, schedule); - des_set_key(kdata.kf_key, schedule); + key_sched((des_cblock *)kdata.kf_key, schedule); + des_set_key((des_cblock *)kdata.kf_key, schedule); return; } |