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/libexec | |
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/libexec')
-rw-r--r-- | eBones/libexec/kpropd/Makefile | 6 | ||||
-rw-r--r-- | eBones/libexec/kpropd/kpropd.c | 32 | ||||
-rw-r--r-- | eBones/libexec/registerd/Makefile | 7 | ||||
-rw-r--r-- | eBones/libexec/registerd/registerd.c | 52 |
4 files changed, 59 insertions, 38 deletions
diff --git a/eBones/libexec/kpropd/Makefile b/eBones/libexec/kpropd/Makefile index 8cc6673..59d7914 100644 --- a/eBones/libexec/kpropd/Makefile +++ b/eBones/libexec/kpropd/Makefile @@ -2,9 +2,9 @@ # $Id: Makefile,v 1.1.1.1 1995/08/03 07:37:19 mark Exp $ PROG= kpropd -CFLAGS+=-I${.CURDIR}/../include -I${.CURDIR}/../kprop -DPADD= ${LIBKRB} ${LIBDES} -LDADD= -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes +CFLAGS+=-I${.CURDIR}/../include -I${.CURDIR}/../kprop -Wall +DPADD= ${LIBKRB} +LDADD= -L${KRBOBJDIR} -lkrb -ldes BINDIR= /usr/libexec NOMAN= noman diff --git a/eBones/libexec/kpropd/kpropd.c b/eBones/libexec/kpropd/kpropd.c index 037d913..1b232df 100644 --- a/eBones/libexec/kpropd/kpropd.c +++ b/eBones/libexec/kpropd/kpropd.c @@ -36,17 +36,23 @@ * master kerberos server in a realm. */ +#if 0 #ifndef lint static char rcsid_kpropd_c[] = "$Header: /usr/cvs/src/eBones/kpropd/kpropd.c,v 1.1.1.1 1995/08/03 07:37:19 mark Exp $"; #endif /* lint */ +#endif +#include <errno.h> +#include <unistd.h> #include <ctype.h> #include <sys/types.h> #include <sys/file.h> #include <sys/socket.h> #include <sys/stat.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> @@ -58,12 +64,15 @@ static char rcsid_kpropd_c[] = static char kprop_version[KPROP_PROT_VERSION_LEN] = KPROP_PROT_VERSION; -extern int errno; int debug = 0; int pause_int = 300; /* 5 minutes in seconds */ -unsigned long get_data_checksum(); -static void SlowDeath(); +unsigned long get_data_checksum(int fd, Key_schedule key_sched); +void recv_auth(int in, int out, int private, + struct sockaddr_in *remote, struct sockaddr_in *local, + AUTH_DAT *ad); +static void SlowDeath(void); +void recv_clear(int in, int out); /* leave room for private msg overhead */ static char buf[KPROP_BUFSIZ + 64]; @@ -74,23 +83,20 @@ usage() exit(2); } +void main(argc, argv) int argc; char **argv; { struct sockaddr_in from; struct sockaddr_in sin; - struct servent *sp; - int s, s2, fd, n, fdlock; + int s2, fd, n, fdlock; int from_len; char local_file[256]; char local_temp[256]; struct hostent *hp; char hostname[256]; - unsigned long cksum_read; - unsigned long cksum_calc; char from_str[128]; - u_long length; long kerror; AUTH_DAT auth_dat; KTEXT_ST ticket; @@ -103,7 +109,7 @@ main(argc, argv) int c; extern char *optarg; extern int optind; - int rflag; + int rflag = 0; char *srvtab = ""; char *local_db = DBM_FILE; char *kdb_util = KPROP_KDB_UTIL; @@ -329,6 +335,7 @@ main(argc, argv) } +void recv_auth(in, out, private, remote, local, ad) int in, out; int private; @@ -345,14 +352,14 @@ recv_auth(in, out, private, remote, local, ad) #ifdef NOENCRYPTION bzero((char *) session_sched, sizeof(session_sched)); #else - if (key_sched(ad->session, session_sched)) { + if (key_sched((C_Block *)ad->session, session_sched)) { syslog(LOG_ERR, "can't make key schedule"); SlowDeath(); } #endif while (1) { - n = krb_net_read(in, &length, sizeof length); + n = krb_net_read(in, (char *)&length, sizeof length); if (n == 0) break; if (n < 0) { @@ -374,7 +381,7 @@ recv_auth(in, out, private, remote, local, ad) kerror = krb_rd_priv(buf, n, session_sched, ad->session, remote, local, &msg_data); else - kerror = krb_rd_safe(buf, n, ad->session, + kerror = krb_rd_safe(buf, n, (C_Block *)ad->session, remote, local, &msg_data); if (kerror != KSUCCESS) { syslog(LOG_ERR, "%s: %s", @@ -390,6 +397,7 @@ recv_auth(in, out, private, remote, local, ad) } } +void recv_clear(in, out) int in, out; { diff --git a/eBones/libexec/registerd/Makefile b/eBones/libexec/registerd/Makefile index 5f12e59..89b6ca7 100644 --- a/eBones/libexec/registerd/Makefile +++ b/eBones/libexec/registerd/Makefile @@ -10,10 +10,11 @@ PROG= registerd SRCS= registerd.c -CFLAGS+=-DCRYPT -DKERBEROS -I${.CURDIR}/../register +CFLAGS+=-DCRYPT -DKERBEROS -I${.CURDIR}/../register \ + -I${.CURDIR}/../include -Wall .PATH: ${.CURDIR}/../../usr.bin/rlogin -DPADD= ${LIBKDB} ${LIBKRB} ${LIBDES} -LDADD= -lkdb -lkrb -ldes +DPADD= ${LIBKDB} ${LIBKRB} +LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes MAN8= registerd.8 BINDIR= /usr/libexec diff --git a/eBones/libexec/registerd/registerd.c b/eBones/libexec/registerd/registerd.c index b5c7434..12a3939 100644 --- a/eBones/libexec/registerd/registerd.c +++ b/eBones/libexec/registerd/registerd.c @@ -31,15 +31,14 @@ * SUCH DAMAGE. */ +#if 0 #ifndef lint static char copyright[] = "@(#) Copyright (c) 1990, 1993\n\ The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint static char sccsid[] = "@(#)registerd.c 8.1 (Berkeley) 6/1/93"; #endif /* not lint */ +#endif #include <sys/types.h> #include <sys/time.h> @@ -47,13 +46,16 @@ static char sccsid[] = "@(#)registerd.c 8.1 (Berkeley) 6/1/93"; #include <sys/resource.h> #include <sys/param.h> #include <sys/file.h> +#include <sys/socket.h> #include <netinet/in.h> +#include <arpa/inet.h> #include <syslog.h> -#include <stdio.h> #include <des.h> -#include <kerberosIV/krb.h> -#include <kerberosIV/krb_db.h> +#include <krb.h> +#include <krb_db.h> +#include <string.h> #include <stdio.h> +#include <unistd.h> #include "register_proto.h" #include "pathnames.h" @@ -63,6 +65,13 @@ static char sccsid[] = "@(#)registerd.c 8.1 (Berkeley) 6/1/93"; char *progname, msgbuf[BUFSIZ]; +void cleanup(void); +void die(void); +void send_packet(char *msg, int flag); +int net_get_principal(char *pname, char *iname, C_Block *keyp); +int do_append(struct sockaddr_in *sinp); + +void main(argc, argv) int argc; char **argv; @@ -74,16 +83,15 @@ main(argc, argv) int kf, retval, sval; struct sockaddr_in sin; char keyfile[MAXPATHLEN], keybuf[KBUFSIZ]; - void die(); progname = argv[0]; /* for the library routines */ openlog("registerd", LOG_PID, LOG_AUTH); - (void)signal(SIGHUP, SIG_IGN); - (void)signal(SIGINT, SIG_IGN); - (void)signal(SIGTSTP, SIG_IGN); - (void)signal(SIGPIPE, die); + signal(SIGHUP, SIG_IGN); + signal(SIGINT, SIG_IGN); + signal(SIGTSTP, SIG_IGN); + signal(SIGPIPE, (__sighandler_t *)die); if (setrlimit(RLIMIT_CORE, &rl) < 0) { syslog(LOG_ERR, "setrlimit: %m"); @@ -109,7 +117,7 @@ main(argc, argv) if ((kf = open(keyfile, O_RDONLY)) < 0) { syslog(LOG_ERR, "error opening Kerberos update keyfile (%s): %m", keyfile); - (void) sprintf(msgbuf, + sprintf(msgbuf, "couldn't open session keyfile for your host"); send_packet(msgbuf, CLEAR); exit(1); @@ -117,16 +125,16 @@ main(argc, argv) if (read(kf, keybuf, KBUFSIZ) != KBUFSIZ) { syslog(LOG_ERR, "wrong read size of Kerberos update keyfile"); - (void) sprintf(msgbuf, + sprintf(msgbuf, "couldn't read session key from your host's keyfile"); send_packet(msgbuf, CLEAR); exit(1); } - (void) sprintf(msgbuf, GOTKEY_MSG); + sprintf(msgbuf, GOTKEY_MSG); send_packet(msgbuf, CLEAR); kfile = (struct keyfile_data *) keybuf; - key_sched(kfile->kf_key, schedule); - des_set_key(kfile->kf_key, schedule); + key_sched((C_Block *)kfile->kf_key, schedule); + des_set_key((des_cblock *)kfile->kf_key, schedule); /* read the command code byte */ @@ -155,10 +163,10 @@ main(argc, argv) code = (u_char) retval; if (code != KSUCCESS) { - (void) sprintf(msgbuf, "%s", krb_err_txt[code]); + sprintf(msgbuf, "%s", krb_err_txt[code]); send_packet(msgbuf, RCRYPT); } else { - (void) sprintf(msgbuf, "Update complete."); + sprintf(msgbuf, "Update complete."); send_packet(msgbuf, RCRYPT); } cleanup(); @@ -170,6 +178,7 @@ main(argc, argv) static Principal principal_data[MAX_PRINCIPAL]; static C_Block key, master_key; static Key_schedule master_key_schedule; + int do_append(sinp) struct sockaddr_in *sinp; @@ -207,7 +216,7 @@ do_append(sinp) * convert password to key and store it */ - if (net_get_principal(input_name, input_instance, key) != 0) { + if (net_get_principal(input_name, input_instance, (C_Block *)key) != 0) { return(KFAILURE); } @@ -273,6 +282,7 @@ do_append(sinp) } +void send_packet(msg,flag) char *msg; int flag; @@ -295,6 +305,7 @@ send_packet(msg,flag) } +int net_get_principal(pname, iname, keyp) char *pname, *iname; C_Block *keyp; @@ -321,11 +332,12 @@ net_get_principal(pname, iname, keyp) return(-1); } - string_to_key(password, *keyp); + string_to_key(password, (des_cblock *)*keyp); bzero(password, 255); return(0); } +void cleanup() { bzero(master_key, sizeof(master_key)); |