summaryrefslogtreecommitdiffstats
path: root/eBones/usr.sbin
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>1995-09-07 21:39:00 +0000
committermarkm <markm@FreeBSD.org>1995-09-07 21:39:00 +0000
commit2539acf77b018acd7416a9857a14c466e55cd7e8 (patch)
tree96ff3578d62372822240f11a1567e45b880f3910 /eBones/usr.sbin
parenteed9438eb23b62f78af7685dc226228e2bf5c524 (diff)
downloadFreeBSD-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.sbin')
-rw-r--r--eBones/usr.sbin/ext_srvtab/Makefile8
-rw-r--r--eBones/usr.sbin/ext_srvtab/ext_srvtab.c12
-rw-r--r--eBones/usr.sbin/kadmin/Makefile6
-rw-r--r--eBones/usr.sbin/kadmin/admin_server.c31
-rw-r--r--eBones/usr.sbin/kadmin/kadm_funcs.c20
-rw-r--r--eBones/usr.sbin/kadmin/kadm_ser_wrap.c32
-rw-r--r--eBones/usr.sbin/kadmin/kadm_server.c8
-rw-r--r--eBones/usr.sbin/kadmin/kadm_server.h21
-rw-r--r--eBones/usr.sbin/kadmind/Makefile6
-rw-r--r--eBones/usr.sbin/kadmind/admin_server.c31
-rw-r--r--eBones/usr.sbin/kadmind/kadm_funcs.c20
-rw-r--r--eBones/usr.sbin/kadmind/kadm_ser_wrap.c32
-rw-r--r--eBones/usr.sbin/kadmind/kadm_server.c8
-rw-r--r--eBones/usr.sbin/kadmind/kadm_server.h21
-rw-r--r--eBones/usr.sbin/kdb_destroy/Makefile4
-rw-r--r--eBones/usr.sbin/kdb_destroy/kdb_destroy.c20
-rw-r--r--eBones/usr.sbin/kdb_edit/Makefile8
-rw-r--r--eBones/usr.sbin/kdb_edit/kdb_edit.c53
-rw-r--r--eBones/usr.sbin/kdb_edit/maketime.c2
-rw-r--r--eBones/usr.sbin/kdb_init/Makefile8
-rw-r--r--eBones/usr.sbin/kdb_init/kdb_init.c15
-rw-r--r--eBones/usr.sbin/kdb_util/Makefile8
-rw-r--r--eBones/usr.sbin/kdb_util/kdb_util.c45
-rw-r--r--eBones/usr.sbin/kerberos/Makefile6
-rw-r--r--eBones/usr.sbin/kerberos/cr_err_reply.c2
-rw-r--r--eBones/usr.sbin/kerberos/kerberos.c56
-rw-r--r--eBones/usr.sbin/kprop/Makefile6
-rw-r--r--eBones/usr.sbin/kprop/kprop.c29
-rw-r--r--eBones/usr.sbin/ksrvutil/Makefile7
-rw-r--r--eBones/usr.sbin/ksrvutil/ksrvutil.c178
-rw-r--r--eBones/usr.sbin/kstash/Makefile8
-rw-r--r--eBones/usr.sbin/kstash/kstash.c16
-rw-r--r--eBones/usr.sbin/make_keypair/Makefile6
-rw-r--r--eBones/usr.sbin/make_keypair/make_keypair.c16
34 files changed, 471 insertions, 278 deletions
diff --git a/eBones/usr.sbin/ext_srvtab/Makefile b/eBones/usr.sbin/ext_srvtab/Makefile
index b0a2a01..7fb1f29 100644
--- a/eBones/usr.sbin/ext_srvtab/Makefile
+++ b/eBones/usr.sbin/ext_srvtab/Makefile
@@ -2,9 +2,9 @@
# $Id: Makefile,v 1.3 1995/07/18 16:35:54 mark Exp $
PROG= ext_srvtab
-CFLAGS+=-DKERBEROS -I${.CURDIR}/../include
-DPADD= ${LIBKDB} ${LIBKRB} ${LIBDES}
-LDADD+= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes
-NOMAN= noman
+CFLAGS+=-DKERBEROS -I${.CURDIR}/../include -Wall
+DPADD= ${LIBKDB} ${LIBKRB}
+LDADD+= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
+MAN8= ext_srvtab.8
.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/ext_srvtab/ext_srvtab.c b/eBones/usr.sbin/ext_srvtab/ext_srvtab.c
index 6b655c7..6f25013 100644
--- a/eBones/usr.sbin/ext_srvtab/ext_srvtab.c
+++ b/eBones/usr.sbin/ext_srvtab/ext_srvtab.c
@@ -5,12 +5,15 @@
* $Id: ext_srvtab.c,v 1.3 1995/07/18 16:35:55 mark Exp $
*/
+#if 0
#ifndef lint
static char rcsid[] =
"$Id: ext_srvtab.c,v 1.3 1995/07/18 16:35:55 mark Exp $";
#endif lint
+#endif
#include <stdio.h>
+#include <string.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/time.h>
@@ -30,6 +33,11 @@ static Key_schedule master_key_schedule;
char progname[] = "ext_srvtab";
char realm[REALM_SZ];
+void FWrite(char *p, int size, int n, FILE *f);
+void StampOutSecrets(void);
+void usage(void);
+
+int
main(argc, argv)
int argc;
char *argv[];
@@ -131,12 +139,14 @@ main(argc, argv)
}
+void
Die()
{
StampOutSecrets();
exit(1);
}
+void
FWrite(p, size, n, f)
char *p;
int size;
@@ -149,6 +159,7 @@ FWrite(p, size, n, f)
}
}
+void
StampOutSecrets()
{
bzero(master_key, sizeof master_key);
@@ -156,6 +167,7 @@ StampOutSecrets()
bzero(master_key_schedule, sizeof master_key_schedule);
}
+void
usage()
{
fprintf(stderr,
diff --git a/eBones/usr.sbin/kadmin/Makefile b/eBones/usr.sbin/kadmin/Makefile
index 620ab81..f2e0357 100644
--- a/eBones/usr.sbin/kadmin/Makefile
+++ b/eBones/usr.sbin/kadmin/Makefile
@@ -3,9 +3,9 @@
PROG= kadmind
SRCS= admin_server.c kadm_funcs.c kadm_ser_wrap.c kadm_server.c
CFLAGS+=-DPOSIX -I${.CURDIR}/../include -I${KRBOBJDIR} \
- -I${.CURDIR}/../libkadm -I${KADMOBJDIR}
+ -I${.CURDIR}/../libkadm -I${KADMOBJDIR} -Wall
LDADD+= -L${KADMOBJDIR} -lkadm -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb \
- -L${DESOBJDIR} -ldes -L${ACLOBJDIR} -lacl -lcom_err
-NOMAN= # man page in ../man
+ -ldes -L${ACLOBJDIR} -lacl -lcom_err
+MAN8= kadmind.8
.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/kadmin/admin_server.c b/eBones/usr.sbin/kadmin/admin_server.c
index ce36eb6..72980d4 100644
--- a/eBones/usr.sbin/kadmin/admin_server.c
+++ b/eBones/usr.sbin/kadmin/admin_server.c
@@ -7,14 +7,14 @@
* Top-level loop of the kerberos Administration server
*/
-#ifndef lint
#if 0
+#ifndef lint
static char rcsid_admin_server_c[] =
"Id: admin_server.c,v 4.8 90/01/02 13:50:38 jtkohl Exp ";
-#endif
static const char rcsid[] =
"$Id";
#endif lint
+#endif
/*
admin_server.c
@@ -22,6 +22,8 @@ static const char rcsid[] =
*/
#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#ifndef sigmask
@@ -31,6 +33,7 @@ static const char rcsid[] =
#include <errno.h>
#include <sys/socket.h>
#include <syslog.h>
+#include <com_err.h>
#include <kadm.h>
#include <kadm_err.h>
#include <krb_db.h>
@@ -45,10 +48,19 @@ char *acldir = DEFAULT_ACL_DIR;
char krbrlm[REALM_SZ];
extern Kadm_Server server_parm;
+void cleanexit(int val);
+void process_client(int fd, struct sockaddr_in *who);
+void kill_children(void);
+static void clear_secrets(void);
+void byebye(void);
+void close_syslog(void);
+int kadm_listen(void);
+
/*
** Main does the logical thing, it sets up the database and RPC interface,
** as well as handling the creation and maintenance of the syslog file...
*/
+void
main(argc, argv) /* admin_server main routine */
int argc;
char *argv[];
@@ -79,7 +91,7 @@ char *argv[];
break;
case 'd':
/* put code to deal with alt database place */
- if (errval = kerb_db_set_name(optarg)) {
+ if ((errval = kerb_db_set_name(optarg))) {
fprintf(stderr, "opening database %s: %s",
optarg, error_message(errval));
exit(1);
@@ -134,23 +146,25 @@ char *argv[];
/* close the system log file */
+void
close_syslog()
{
log("Shutting down admin server");
}
+void
byebye() /* say goodnight gracie */
{
printf("Admin Server (kadm server) has completed operation.\n");
}
-static clear_secrets()
+static void
+clear_secrets()
{
bzero((char *)server_parm.master_key, sizeof(server_parm.master_key));
bzero((char *)server_parm.master_key_schedule,
sizeof(server_parm.master_key_schedule));
server_parm.master_key_version = 0L;
- return;
}
static exit_now = 0;
@@ -173,6 +187,7 @@ int *pidarray = (int *)0;
kadm_listen
listen on the admin servers port for a request
*/
+int
kadm_listen()
{
extern int errno;
@@ -182,7 +197,6 @@ kadm_listen()
fd_set mask, readfds;
struct sockaddr_in peer;
int addrlen;
- void process_client(), kill_children();
int pid;
sigtype do_child();
@@ -238,7 +252,7 @@ kadm_listen()
#endif /* DEBUG */
#ifndef DEBUG
/* if you want a sep daemon for each server */
- if (pid = fork()) {
+ if ((pid = fork())) {
/* parent */
if (pid < 0) {
log("fork: %s",error_message(errno));
@@ -269,6 +283,7 @@ kadm_listen()
}
}
/*NOTREACHED*/
+ return(0); /* Shut -Wall up - markm */
}
#ifdef DEBUG
@@ -432,7 +447,9 @@ do_child()
}
#ifndef DEBUG
+void
cleanexit(val)
+ int val;
{
kerb_fini();
clear_secrets();
diff --git a/eBones/usr.sbin/kadmin/kadm_funcs.c b/eBones/usr.sbin/kadmin/kadm_funcs.c
index 4ed2365..b8ddaa0 100644
--- a/eBones/usr.sbin/kadmin/kadm_funcs.c
+++ b/eBones/usr.sbin/kadmin/kadm_funcs.c
@@ -7,20 +7,23 @@
* Kerberos administration server-side database manipulation routines
*/
-#ifndef lint
#if 0
+#ifndef lint
static char rcsid_kadm_funcs_c[] =
"Id: kadm_funcs.c,v 4.3 90/03/20 01:39:51 jon Exp ";
-#endif
static const char rcsid[] =
"$Id: kadm_funcs.c,v 1.1 1995/07/18 16:37:02 mark Exp $";
#endif lint
+#endif
/*
kadm_funcs.c
the actual database manipulation code
*/
+#include <stdio.h>
+#include <string.h>
+#include <com_err.h>
#include <sys/param.h>
#include <kadm.h>
#include <kadm_err.h>
@@ -29,6 +32,7 @@ the actual database manipulation code
extern Kadm_Server server_parm;
+int
check_access(pname, pinst, prealm, acltype)
char *pname;
char *pinst;
@@ -39,17 +43,17 @@ enum acl_types acltype;
char filename[MAXPATHLEN];
extern char *acldir;
- (void) sprintf(checkname, "%s.%s@%s", pname, pinst, prealm);
+ sprintf(checkname, "%s.%s@%s", pname, pinst, prealm);
switch (acltype) {
case ADDACL:
- (void) sprintf(filename, "%s%s", acldir, ADD_ACL_FILE);
+ sprintf(filename, "%s%s", acldir, ADD_ACL_FILE);
break;
case GETACL:
- (void) sprintf(filename, "%s%s", acldir, GET_ACL_FILE);
+ sprintf(filename, "%s%s", acldir, GET_ACL_FILE);
break;
case MODACL:
- (void) sprintf(filename, "%s%s", acldir, MOD_ACL_FILE);
+ sprintf(filename, "%s%s", acldir, MOD_ACL_FILE);
break;
}
return(acl_check(filename, checkname));
@@ -66,6 +70,7 @@ char *str;
#define failadd(code) { (void) log("FAILED addding '%s.%s' (%s)", valsin->name, valsin->instance, error_message(code)); return code; }
+int
kadm_add_entry (rname, rinstance, rrealm, valsin, valsout)
char *rname; /* requestors name */
char *rinstance; /* requestors instance */
@@ -171,6 +176,7 @@ Kadm_vals *valsout;
#define failget(code) { (void) log("FAILED retrieving '%s.%s' (%s)", valsin->name, valsin->instance, error_message(code)); return code; }
+int
kadm_get_entry (rname, rinstance, rrealm, valsin, flags, valsout)
char *rname; /* requestors name */
char *rinstance; /* requestors instance */
@@ -214,6 +220,7 @@ Kadm_vals *valsout; /* what data is there */
#define failmod(code) { (void) log("FAILED modifying '%s.%s' (%s)", valsin1->name, valsin1->instance, error_message(code)); return code; }
+int
kadm_mod_entry (rname, rinstance, rrealm, valsin1, valsin2, valsout)
char *rname; /* requestors name */
char *rinstance; /* requestors instance */
@@ -313,6 +320,7 @@ Kadm_vals *valsout; /* the actual record which is returned */
#define failchange(code) { (void) log("FAILED changing key for '%s.%s@%s' (%s)", rname, rinstance, rrealm, error_message(code)); return code; }
+int
kadm_change (rname, rinstance, rrealm, newpw)
char *rname;
char *rinstance;
diff --git a/eBones/usr.sbin/kadmin/kadm_ser_wrap.c b/eBones/usr.sbin/kadmin/kadm_ser_wrap.c
index 23664d4..0fa1ace 100644
--- a/eBones/usr.sbin/kadmin/kadm_ser_wrap.c
+++ b/eBones/usr.sbin/kadmin/kadm_ser_wrap.c
@@ -7,17 +7,21 @@
* Kerberos administration server-side support functions
*/
+#if 0
#ifndef lint
static char rcsid_module_c[] =
"BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_ser_wrap.c,v 4.4 89/09/26 09:29:36 jtkohl Exp ";
#endif lint
+#endif
/*
kadm_ser_wrap.c
unwraps wrapped packets and calls the appropriate server subroutine
*/
+#include <unistd.h>
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <netdb.h>
#include <sys/socket.h>
@@ -32,6 +36,7 @@ Kadm_Server server_parm;
kadm_ser_init
set up the server_parm structure
*/
+int
kadm_ser_init(inter, realm)
int inter; /* interactive or from file */
char realm[];
@@ -40,14 +45,14 @@ char realm[];
struct hostent *hp;
char hostname[MAXHOSTNAMELEN];
- (void) init_kadm_err_tbl();
- (void) init_krb_err_tbl();
+ init_kadm_err_tbl();
+ init_krb_err_tbl();
if (gethostname(hostname, sizeof(hostname)))
return KADM_NO_HOSTNAME;
- (void) strcpy(server_parm.sname, PWSERV_NAME);
- (void) strcpy(server_parm.sinst, KRB_MASTER);
- (void) strcpy(server_parm.krbrlm, realm);
+ strcpy(server_parm.sname, PWSERV_NAME);
+ strcpy(server_parm.sinst, KRB_MASTER);
+ strcpy(server_parm.krbrlm, realm);
server_parm.admin_fd = -1;
/* setting up the addrs */
@@ -70,7 +75,8 @@ char realm[];
return KADM_SUCCESS;
}
-static void errpkt(dat, dat_len, code)
+static void
+errpkt(dat, dat_len, code)
u_char **dat;
int *dat_len;
int code;
@@ -92,6 +98,7 @@ int code;
kadm_ser_in
unwrap the data stored in dat, process, and return it.
*/
+int
kadm_ser_in(dat,dat_len)
u_char **dat;
int *dat_len;
@@ -121,8 +128,8 @@ int *dat_len;
bcopy((char *)(*dat) + in_len, (char *)authent.dat, authent.length);
authent.mbz = 0;
/* service key should be set before here */
- if (retc = krb_rd_req(&authent, server_parm.sname, server_parm.sinst,
- server_parm.recv_addr.sin_addr.s_addr, &ad, (char *)0))
+ if ((retc = krb_rd_req(&authent, server_parm.sname, server_parm.sinst,
+ server_parm.recv_addr.sin_addr.s_addr, &ad, (char *)0)))
{
errpkt(dat, dat_len,retc + krb_err_base);
return retc + krb_err_base;
@@ -134,7 +141,8 @@ int *dat_len;
#ifdef NOENCRYPTION
ncksum = 0;
#else
- ncksum = quad_cksum(in_st, (u_long *)0, (long) r_len, 0, ad.session);
+ ncksum = quad_cksum((des_cblock *)in_st, (des_cblock *)0, (long) r_len,
+ 0, (des_cblock *)ad.session);
#endif
if (ncksum!=ad.checksum) { /* yow, are we correct yet */
clr_cli_secrets();
@@ -144,11 +152,11 @@ int *dat_len;
#ifdef NOENCRYPTION
bzero(sess_sched, sizeof(sess_sched));
#else
- des_key_sched(ad.session, sess_sched);
+ des_key_sched((des_cblock *)ad.session, sess_sched);
#endif
- if (retc = (int) krb_rd_priv(in_st, r_len, sess_sched, ad.session,
+ if ((retc = (int) krb_rd_priv(in_st, r_len, sess_sched, ad.session,
&server_parm.recv_addr,
- &server_parm.admin_addr, &msg_st)) {
+ &server_parm.admin_addr, &msg_st))) {
clr_cli_secrets();
errpkt(dat, dat_len,retc + krb_err_base);
return retc + krb_err_base;
diff --git a/eBones/usr.sbin/kadmin/kadm_server.c b/eBones/usr.sbin/kadmin/kadm_server.c
index 25a58be..c6cbc6a 100644
--- a/eBones/usr.sbin/kadmin/kadm_server.c
+++ b/eBones/usr.sbin/kadmin/kadm_server.c
@@ -7,13 +7,17 @@
* Kerberos administration server-side subroutines
*/
+#if 0
#ifndef lint
static char rcsid_kadm_server_c[] =
"Header: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_server.c,v 4.2 89/09/26 09:30:23 jtkohl Exp ";
#endif lint
+#endif
+#include <string.h>
#include <kadm.h>
#include <kadm_err.h>
+#include "kadm_server.h"
/*
kadm_ser_cpw - the server side of the change_password routine
@@ -24,6 +28,7 @@ kadm_ser_cpw - the server side of the change_password routine
Replaces the password (i.e. des key) of the caller with that specified in key.
Returns no actual data from the master server, since this is called by a user
*/
+int
kadm_ser_cpw(dat, len, ad, datout, outlen)
u_char *dat;
int len;
@@ -62,6 +67,7 @@ Adds and entry containing values to the database
returns the values of the entry, so if you leave certain fields blank you will
be able to determine the default values they are set to
*/
+int
kadm_ser_add(dat,len,ad, datout, outlen)
u_char *dat;
int len;
@@ -94,6 +100,7 @@ Modifies all entries corresponding to the first values so they match the
second values.
returns the values for the changed entries
*/
+int
kadm_ser_mod(dat,len,ad, datout, outlen)
u_char *dat;
int len;
@@ -129,6 +136,7 @@ gets the fields requested by flags from all entries matching values
returns this data for each matching recipient, after a count of how many such
matches there were
*/
+int
kadm_ser_get(dat,len,ad, datout, outlen)
u_char *dat;
int len;
diff --git a/eBones/usr.sbin/kadmin/kadm_server.h b/eBones/usr.sbin/kadmin/kadm_server.h
index 2d6f8bf..1708107 100644
--- a/eBones/usr.sbin/kadmin/kadm_server.h
+++ b/eBones/usr.sbin/kadmin/kadm_server.h
@@ -23,7 +23,7 @@
*/
#include <sys/types.h>
-#include <kerberosIV/krb.h>
+#include <krb.h>
#include <des.h>
typedef struct {
@@ -48,4 +48,23 @@ typedef struct {
#define GET_ACL_FILE "/admin_acl.get"
#define MOD_ACL_FILE "/admin_acl.mod"
+int kadm_ser_in(unsigned char **dat, int *dat_len);
+int kadm_ser_init(int inter, char realm[]);
+int kadm_ser_cpw(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
+ int *outlen);
+int kadm_ser_add(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
+ int *outlen);
+int kadm_ser_mod(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
+ int *outlen);
+int kadm_ser_get(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
+ int *outlen);
+int kadm_change (char *rname, char *rinstance, char *rrealm,
+ des_cblock newpw);
+int kadm_add_entry(char *rname, char *rinstance, char *rrealm,
+ Kadm_vals *valsin, Kadm_vals *valsout);
+int kadm_mod_entry(char *rname, char *rinstance, char *rrealm,
+ Kadm_vals *valsin1, Kadm_vals *valsin2, Kadm_vals *valsout);
+int kadm_get_entry(char *rname, char *rinstance, char *rrealm,
+ Kadm_vals *valsin, u_char *flags, Kadm_vals *valsout);
+
#endif KADM_SERVER_DEFS
diff --git a/eBones/usr.sbin/kadmind/Makefile b/eBones/usr.sbin/kadmind/Makefile
index 620ab81..f2e0357 100644
--- a/eBones/usr.sbin/kadmind/Makefile
+++ b/eBones/usr.sbin/kadmind/Makefile
@@ -3,9 +3,9 @@
PROG= kadmind
SRCS= admin_server.c kadm_funcs.c kadm_ser_wrap.c kadm_server.c
CFLAGS+=-DPOSIX -I${.CURDIR}/../include -I${KRBOBJDIR} \
- -I${.CURDIR}/../libkadm -I${KADMOBJDIR}
+ -I${.CURDIR}/../libkadm -I${KADMOBJDIR} -Wall
LDADD+= -L${KADMOBJDIR} -lkadm -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb \
- -L${DESOBJDIR} -ldes -L${ACLOBJDIR} -lacl -lcom_err
-NOMAN= # man page in ../man
+ -ldes -L${ACLOBJDIR} -lacl -lcom_err
+MAN8= kadmind.8
.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/kadmind/admin_server.c b/eBones/usr.sbin/kadmind/admin_server.c
index ce36eb6..72980d4 100644
--- a/eBones/usr.sbin/kadmind/admin_server.c
+++ b/eBones/usr.sbin/kadmind/admin_server.c
@@ -7,14 +7,14 @@
* Top-level loop of the kerberos Administration server
*/
-#ifndef lint
#if 0
+#ifndef lint
static char rcsid_admin_server_c[] =
"Id: admin_server.c,v 4.8 90/01/02 13:50:38 jtkohl Exp ";
-#endif
static const char rcsid[] =
"$Id";
#endif lint
+#endif
/*
admin_server.c
@@ -22,6 +22,8 @@ static const char rcsid[] =
*/
#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#ifndef sigmask
@@ -31,6 +33,7 @@ static const char rcsid[] =
#include <errno.h>
#include <sys/socket.h>
#include <syslog.h>
+#include <com_err.h>
#include <kadm.h>
#include <kadm_err.h>
#include <krb_db.h>
@@ -45,10 +48,19 @@ char *acldir = DEFAULT_ACL_DIR;
char krbrlm[REALM_SZ];
extern Kadm_Server server_parm;
+void cleanexit(int val);
+void process_client(int fd, struct sockaddr_in *who);
+void kill_children(void);
+static void clear_secrets(void);
+void byebye(void);
+void close_syslog(void);
+int kadm_listen(void);
+
/*
** Main does the logical thing, it sets up the database and RPC interface,
** as well as handling the creation and maintenance of the syslog file...
*/
+void
main(argc, argv) /* admin_server main routine */
int argc;
char *argv[];
@@ -79,7 +91,7 @@ char *argv[];
break;
case 'd':
/* put code to deal with alt database place */
- if (errval = kerb_db_set_name(optarg)) {
+ if ((errval = kerb_db_set_name(optarg))) {
fprintf(stderr, "opening database %s: %s",
optarg, error_message(errval));
exit(1);
@@ -134,23 +146,25 @@ char *argv[];
/* close the system log file */
+void
close_syslog()
{
log("Shutting down admin server");
}
+void
byebye() /* say goodnight gracie */
{
printf("Admin Server (kadm server) has completed operation.\n");
}
-static clear_secrets()
+static void
+clear_secrets()
{
bzero((char *)server_parm.master_key, sizeof(server_parm.master_key));
bzero((char *)server_parm.master_key_schedule,
sizeof(server_parm.master_key_schedule));
server_parm.master_key_version = 0L;
- return;
}
static exit_now = 0;
@@ -173,6 +187,7 @@ int *pidarray = (int *)0;
kadm_listen
listen on the admin servers port for a request
*/
+int
kadm_listen()
{
extern int errno;
@@ -182,7 +197,6 @@ kadm_listen()
fd_set mask, readfds;
struct sockaddr_in peer;
int addrlen;
- void process_client(), kill_children();
int pid;
sigtype do_child();
@@ -238,7 +252,7 @@ kadm_listen()
#endif /* DEBUG */
#ifndef DEBUG
/* if you want a sep daemon for each server */
- if (pid = fork()) {
+ if ((pid = fork())) {
/* parent */
if (pid < 0) {
log("fork: %s",error_message(errno));
@@ -269,6 +283,7 @@ kadm_listen()
}
}
/*NOTREACHED*/
+ return(0); /* Shut -Wall up - markm */
}
#ifdef DEBUG
@@ -432,7 +447,9 @@ do_child()
}
#ifndef DEBUG
+void
cleanexit(val)
+ int val;
{
kerb_fini();
clear_secrets();
diff --git a/eBones/usr.sbin/kadmind/kadm_funcs.c b/eBones/usr.sbin/kadmind/kadm_funcs.c
index 4ed2365..b8ddaa0 100644
--- a/eBones/usr.sbin/kadmind/kadm_funcs.c
+++ b/eBones/usr.sbin/kadmind/kadm_funcs.c
@@ -7,20 +7,23 @@
* Kerberos administration server-side database manipulation routines
*/
-#ifndef lint
#if 0
+#ifndef lint
static char rcsid_kadm_funcs_c[] =
"Id: kadm_funcs.c,v 4.3 90/03/20 01:39:51 jon Exp ";
-#endif
static const char rcsid[] =
"$Id: kadm_funcs.c,v 1.1 1995/07/18 16:37:02 mark Exp $";
#endif lint
+#endif
/*
kadm_funcs.c
the actual database manipulation code
*/
+#include <stdio.h>
+#include <string.h>
+#include <com_err.h>
#include <sys/param.h>
#include <kadm.h>
#include <kadm_err.h>
@@ -29,6 +32,7 @@ the actual database manipulation code
extern Kadm_Server server_parm;
+int
check_access(pname, pinst, prealm, acltype)
char *pname;
char *pinst;
@@ -39,17 +43,17 @@ enum acl_types acltype;
char filename[MAXPATHLEN];
extern char *acldir;
- (void) sprintf(checkname, "%s.%s@%s", pname, pinst, prealm);
+ sprintf(checkname, "%s.%s@%s", pname, pinst, prealm);
switch (acltype) {
case ADDACL:
- (void) sprintf(filename, "%s%s", acldir, ADD_ACL_FILE);
+ sprintf(filename, "%s%s", acldir, ADD_ACL_FILE);
break;
case GETACL:
- (void) sprintf(filename, "%s%s", acldir, GET_ACL_FILE);
+ sprintf(filename, "%s%s", acldir, GET_ACL_FILE);
break;
case MODACL:
- (void) sprintf(filename, "%s%s", acldir, MOD_ACL_FILE);
+ sprintf(filename, "%s%s", acldir, MOD_ACL_FILE);
break;
}
return(acl_check(filename, checkname));
@@ -66,6 +70,7 @@ char *str;
#define failadd(code) { (void) log("FAILED addding '%s.%s' (%s)", valsin->name, valsin->instance, error_message(code)); return code; }
+int
kadm_add_entry (rname, rinstance, rrealm, valsin, valsout)
char *rname; /* requestors name */
char *rinstance; /* requestors instance */
@@ -171,6 +176,7 @@ Kadm_vals *valsout;
#define failget(code) { (void) log("FAILED retrieving '%s.%s' (%s)", valsin->name, valsin->instance, error_message(code)); return code; }
+int
kadm_get_entry (rname, rinstance, rrealm, valsin, flags, valsout)
char *rname; /* requestors name */
char *rinstance; /* requestors instance */
@@ -214,6 +220,7 @@ Kadm_vals *valsout; /* what data is there */
#define failmod(code) { (void) log("FAILED modifying '%s.%s' (%s)", valsin1->name, valsin1->instance, error_message(code)); return code; }
+int
kadm_mod_entry (rname, rinstance, rrealm, valsin1, valsin2, valsout)
char *rname; /* requestors name */
char *rinstance; /* requestors instance */
@@ -313,6 +320,7 @@ Kadm_vals *valsout; /* the actual record which is returned */
#define failchange(code) { (void) log("FAILED changing key for '%s.%s@%s' (%s)", rname, rinstance, rrealm, error_message(code)); return code; }
+int
kadm_change (rname, rinstance, rrealm, newpw)
char *rname;
char *rinstance;
diff --git a/eBones/usr.sbin/kadmind/kadm_ser_wrap.c b/eBones/usr.sbin/kadmind/kadm_ser_wrap.c
index 23664d4..0fa1ace 100644
--- a/eBones/usr.sbin/kadmind/kadm_ser_wrap.c
+++ b/eBones/usr.sbin/kadmind/kadm_ser_wrap.c
@@ -7,17 +7,21 @@
* Kerberos administration server-side support functions
*/
+#if 0
#ifndef lint
static char rcsid_module_c[] =
"BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_ser_wrap.c,v 4.4 89/09/26 09:29:36 jtkohl Exp ";
#endif lint
+#endif
/*
kadm_ser_wrap.c
unwraps wrapped packets and calls the appropriate server subroutine
*/
+#include <unistd.h>
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <netdb.h>
#include <sys/socket.h>
@@ -32,6 +36,7 @@ Kadm_Server server_parm;
kadm_ser_init
set up the server_parm structure
*/
+int
kadm_ser_init(inter, realm)
int inter; /* interactive or from file */
char realm[];
@@ -40,14 +45,14 @@ char realm[];
struct hostent *hp;
char hostname[MAXHOSTNAMELEN];
- (void) init_kadm_err_tbl();
- (void) init_krb_err_tbl();
+ init_kadm_err_tbl();
+ init_krb_err_tbl();
if (gethostname(hostname, sizeof(hostname)))
return KADM_NO_HOSTNAME;
- (void) strcpy(server_parm.sname, PWSERV_NAME);
- (void) strcpy(server_parm.sinst, KRB_MASTER);
- (void) strcpy(server_parm.krbrlm, realm);
+ strcpy(server_parm.sname, PWSERV_NAME);
+ strcpy(server_parm.sinst, KRB_MASTER);
+ strcpy(server_parm.krbrlm, realm);
server_parm.admin_fd = -1;
/* setting up the addrs */
@@ -70,7 +75,8 @@ char realm[];
return KADM_SUCCESS;
}
-static void errpkt(dat, dat_len, code)
+static void
+errpkt(dat, dat_len, code)
u_char **dat;
int *dat_len;
int code;
@@ -92,6 +98,7 @@ int code;
kadm_ser_in
unwrap the data stored in dat, process, and return it.
*/
+int
kadm_ser_in(dat,dat_len)
u_char **dat;
int *dat_len;
@@ -121,8 +128,8 @@ int *dat_len;
bcopy((char *)(*dat) + in_len, (char *)authent.dat, authent.length);
authent.mbz = 0;
/* service key should be set before here */
- if (retc = krb_rd_req(&authent, server_parm.sname, server_parm.sinst,
- server_parm.recv_addr.sin_addr.s_addr, &ad, (char *)0))
+ if ((retc = krb_rd_req(&authent, server_parm.sname, server_parm.sinst,
+ server_parm.recv_addr.sin_addr.s_addr, &ad, (char *)0)))
{
errpkt(dat, dat_len,retc + krb_err_base);
return retc + krb_err_base;
@@ -134,7 +141,8 @@ int *dat_len;
#ifdef NOENCRYPTION
ncksum = 0;
#else
- ncksum = quad_cksum(in_st, (u_long *)0, (long) r_len, 0, ad.session);
+ ncksum = quad_cksum((des_cblock *)in_st, (des_cblock *)0, (long) r_len,
+ 0, (des_cblock *)ad.session);
#endif
if (ncksum!=ad.checksum) { /* yow, are we correct yet */
clr_cli_secrets();
@@ -144,11 +152,11 @@ int *dat_len;
#ifdef NOENCRYPTION
bzero(sess_sched, sizeof(sess_sched));
#else
- des_key_sched(ad.session, sess_sched);
+ des_key_sched((des_cblock *)ad.session, sess_sched);
#endif
- if (retc = (int) krb_rd_priv(in_st, r_len, sess_sched, ad.session,
+ if ((retc = (int) krb_rd_priv(in_st, r_len, sess_sched, ad.session,
&server_parm.recv_addr,
- &server_parm.admin_addr, &msg_st)) {
+ &server_parm.admin_addr, &msg_st))) {
clr_cli_secrets();
errpkt(dat, dat_len,retc + krb_err_base);
return retc + krb_err_base;
diff --git a/eBones/usr.sbin/kadmind/kadm_server.c b/eBones/usr.sbin/kadmind/kadm_server.c
index 25a58be..c6cbc6a 100644
--- a/eBones/usr.sbin/kadmind/kadm_server.c
+++ b/eBones/usr.sbin/kadmind/kadm_server.c
@@ -7,13 +7,17 @@
* Kerberos administration server-side subroutines
*/
+#if 0
#ifndef lint
static char rcsid_kadm_server_c[] =
"Header: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_server.c,v 4.2 89/09/26 09:30:23 jtkohl Exp ";
#endif lint
+#endif
+#include <string.h>
#include <kadm.h>
#include <kadm_err.h>
+#include "kadm_server.h"
/*
kadm_ser_cpw - the server side of the change_password routine
@@ -24,6 +28,7 @@ kadm_ser_cpw - the server side of the change_password routine
Replaces the password (i.e. des key) of the caller with that specified in key.
Returns no actual data from the master server, since this is called by a user
*/
+int
kadm_ser_cpw(dat, len, ad, datout, outlen)
u_char *dat;
int len;
@@ -62,6 +67,7 @@ Adds and entry containing values to the database
returns the values of the entry, so if you leave certain fields blank you will
be able to determine the default values they are set to
*/
+int
kadm_ser_add(dat,len,ad, datout, outlen)
u_char *dat;
int len;
@@ -94,6 +100,7 @@ Modifies all entries corresponding to the first values so they match the
second values.
returns the values for the changed entries
*/
+int
kadm_ser_mod(dat,len,ad, datout, outlen)
u_char *dat;
int len;
@@ -129,6 +136,7 @@ gets the fields requested by flags from all entries matching values
returns this data for each matching recipient, after a count of how many such
matches there were
*/
+int
kadm_ser_get(dat,len,ad, datout, outlen)
u_char *dat;
int len;
diff --git a/eBones/usr.sbin/kadmind/kadm_server.h b/eBones/usr.sbin/kadmind/kadm_server.h
index 2d6f8bf..1708107 100644
--- a/eBones/usr.sbin/kadmind/kadm_server.h
+++ b/eBones/usr.sbin/kadmind/kadm_server.h
@@ -23,7 +23,7 @@
*/
#include <sys/types.h>
-#include <kerberosIV/krb.h>
+#include <krb.h>
#include <des.h>
typedef struct {
@@ -48,4 +48,23 @@ typedef struct {
#define GET_ACL_FILE "/admin_acl.get"
#define MOD_ACL_FILE "/admin_acl.mod"
+int kadm_ser_in(unsigned char **dat, int *dat_len);
+int kadm_ser_init(int inter, char realm[]);
+int kadm_ser_cpw(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
+ int *outlen);
+int kadm_ser_add(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
+ int *outlen);
+int kadm_ser_mod(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
+ int *outlen);
+int kadm_ser_get(u_char *dat, int len, AUTH_DAT *ad, u_char **datout,
+ int *outlen);
+int kadm_change (char *rname, char *rinstance, char *rrealm,
+ des_cblock newpw);
+int kadm_add_entry(char *rname, char *rinstance, char *rrealm,
+ Kadm_vals *valsin, Kadm_vals *valsout);
+int kadm_mod_entry(char *rname, char *rinstance, char *rrealm,
+ Kadm_vals *valsin1, Kadm_vals *valsin2, Kadm_vals *valsout);
+int kadm_get_entry(char *rname, char *rinstance, char *rrealm,
+ Kadm_vals *valsin, u_char *flags, Kadm_vals *valsout);
+
#endif KADM_SERVER_DEFS
diff --git a/eBones/usr.sbin/kdb_destroy/Makefile b/eBones/usr.sbin/kdb_destroy/Makefile
index 2e8fcb9..f22f779 100644
--- a/eBones/usr.sbin/kdb_destroy/Makefile
+++ b/eBones/usr.sbin/kdb_destroy/Makefile
@@ -2,7 +2,7 @@
# $Id: Makefile,v 1.3 1995/07/18 16:37:22 mark Exp $
PROG= kdb_destroy
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include
-NOMAN= noman
+CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall
+MAN8= kdb_destroy.8
.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/kdb_destroy/kdb_destroy.c b/eBones/usr.sbin/kdb_destroy/kdb_destroy.c
index b669de2..57e1a80 100644
--- a/eBones/usr.sbin/kdb_destroy/kdb_destroy.c
+++ b/eBones/usr.sbin/kdb_destroy/kdb_destroy.c
@@ -7,34 +7,38 @@
* $Id: kdb_destroy.c,v 1.5 1995/08/04 06:35:45 mark Exp $
*/
+#if 0
#ifndef lint
static char rcsid[] =
"$Id: kdb_destroy.c,v 1.5 1995/08/04 06:35:45 mark Exp $";
#endif lint
+#endif
+#include <unistd.h>
#include <strings.h>
#include <stdio.h>
-#include "krb.h"
-#include "krb_db.h"
+#include <krb.h>
+#include <krb_db.h>
#if defined(__FreeBSD__) || defined(__NetBSD__)
-#define DB
+#define _DBM_
#endif
-
+void
main()
{
char answer[10]; /* user input */
+#ifdef _DBM_
char dbm[256]; /* database path and name */
- char dbm1[256]; /* database path and name */
-#ifdef DB
char *file; /* database file names */
#else
+ char dbm[256]; /* database path and name */
+ char dbm1[256]; /* database path and name */
char *file1, *file2; /* database file names */
#endif
strcpy(dbm, DBM_FILE);
-#ifdef DB
+#ifdef _DBM_
file = strcat(dbm, ".db");
#else
strcpy(dbm1, DBM_FILE);
@@ -48,7 +52,7 @@ main()
fgets(answer, sizeof(answer), stdin);
if (answer[0] == 'y' || answer[0] == 'Y') {
-#ifdef DB
+#ifdef _DBM_
if (unlink(file) == 0)
#else
if (unlink(file1) == 0 && unlink(file2) == 0)
diff --git a/eBones/usr.sbin/kdb_edit/Makefile b/eBones/usr.sbin/kdb_edit/Makefile
index 792e7c5..a56efcf 100644
--- a/eBones/usr.sbin/kdb_edit/Makefile
+++ b/eBones/usr.sbin/kdb_edit/Makefile
@@ -2,11 +2,11 @@
# $Id: Makefile,v 1.3 1995/07/18 16:37:25 mark Exp $
PROG= kdb_edit
-CFLAGS+=-DKERBEROS -DDEBUG -I. -I${.CURDIR}/../include
+CFLAGS+=-DKERBEROS -DDEBUG -I. -I${.CURDIR}/../include -Wall
SRCS= kdb_edit.c maketime.c
.PATH: ${.CURDIR}/../kdb_edit
-DPADD= ${LIBKDB} ${LIBKRB} ${LIBDES}
-LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes
-NOMAN= noman
+DPADD= ${LIBKDB} ${LIBKRB}
+LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
+MAN8= kdb_edit.8
.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/kdb_edit/kdb_edit.c b/eBones/usr.sbin/kdb_edit/kdb_edit.c
index 61cf71a..82bf9a4 100644
--- a/eBones/usr.sbin/kdb_edit/kdb_edit.c
+++ b/eBones/usr.sbin/kdb_edit/kdb_edit.c
@@ -15,10 +15,12 @@
* exit returns 0 ==> success -1 ==> error
*/
+#if 0
#ifndef lint
static char rcsid[] =
"$Id: kdb_edit.c,v 1.5 1995/08/03 17:15:54 mark Exp $";
#endif lint
+#endif
#include <stdio.h>
#include <signal.h>
@@ -33,11 +35,11 @@ static char rcsid[] =
/* MKEYFILE is now defined in kdc.h */
#include <kdc.h>
-extern char *errmsg();
-extern int errno;
-extern char *strcpy();
-
-void sig_exit();
+void Usage(void);
+void cleanup(void);
+void sig_exit(int sig, int code, struct sigcontext *scp);
+void no_core_dumps(void);
+int change_principal(void);
#define zaptime(foo) bzero((char *)(foo), sizeof(*(foo)))
@@ -90,6 +92,7 @@ static char * s_gets(char * str, int len)
return(s);
}
+int
main(argc, argv)
int argc;
char *argv[];
@@ -105,7 +108,7 @@ main(argc, argv)
/* Assume a long is four bytes */
if (sizeof(long) != 4) {
- fprintf(stdout, "%s: size of long is %d.\n", sizeof(long), prog);
+ fprintf(stdout, "%s: size of long is %d.\n", prog, sizeof(long));
exit(-1);
}
/* Assume <=32 signals */
@@ -175,7 +178,7 @@ main(argc, argv)
&default_princ, 1, &more);
if (n != 1) {
fprintf(stderr,
- "%s: Kerberos error on default value lookup, %d found.\n",
+ "%s: Kerberos error on default value lookup, %ld found.\n",
progname, n);
exit(-1);
}
@@ -186,8 +189,10 @@ main(argc, argv)
}
cleanup();
+ return(0); /* make -Wall shut up - MRVM */
}
+int
change_principal()
{
static char temp[255];
@@ -269,7 +274,7 @@ change_principal()
bzero(new_key, sizeof(C_Block));
new_key[0] = 127;
#else
- string_to_key(pw_str, new_key);
+ string_to_key(pw_str, &new_key);
#endif
bzero(pw_str, sizeof pw_str); /* "RANDOM" */
} else {
@@ -290,7 +295,7 @@ change_principal()
bzero(new_key, sizeof(C_Block));
new_key[0] = 127;
#else
- string_to_key(pw_str, new_key);
+ string_to_key(pw_str, &new_key);
#endif
bzero(pw_str, sizeof pw_str); /* "NULL" */
} else {
@@ -304,7 +309,7 @@ change_principal()
bzero(new_key, sizeof(C_Block));
new_key[0] = 127;
#else
- string_to_key(pw_str,new_key);
+ string_to_key(pw_str, &new_key);
#endif
bzero(pw_str, sizeof pw_str);
}
@@ -360,7 +365,7 @@ change_principal()
fprintf(stdout, "Max ticket lifetime (*5 minutes) [ %d ] ? ",
principal_data[i].max_life);
while (s_gets(temp, sizeof(temp)-1) && *temp) {
- if (sscanf(temp, "%d", &temp_long) != 1)
+ if (sscanf(temp, "%ld", &temp_long) != 1)
goto bad_life;
if (temp_long > 255 || (temp_long < 0)) {
bad_life:
@@ -380,7 +385,7 @@ change_principal()
fprintf(stdout, "Attributes [ %d ] ? ",
principal_data[i].attributes);
while (s_gets(temp, sizeof(temp)-1) && *temp) {
- if (sscanf(temp, "%d", &temp_long) != 1)
+ if (sscanf(temp, "%ld", &temp_long) != 1)
goto bad_att;
if (temp_long > 65535 || (temp_long < 0)) {
bad_att:
@@ -425,19 +430,19 @@ change_principal()
return 1;
}
-
+void
no_core_dumps()
{
- signal(SIGQUIT, sig_exit);
- signal(SIGILL, sig_exit);
- signal(SIGTRAP, sig_exit);
- signal(SIGIOT, sig_exit);
- signal(SIGEMT, sig_exit);
- signal(SIGFPE, sig_exit);
- signal(SIGBUS, sig_exit);
- signal(SIGSEGV, sig_exit);
- signal(SIGSYS, sig_exit);
+ signal(SIGQUIT, (sig_t)sig_exit);
+ signal(SIGILL, (sig_t)sig_exit);
+ signal(SIGTRAP, (sig_t)sig_exit);
+ signal(SIGIOT, (sig_t)sig_exit);
+ signal(SIGEMT, (sig_t)sig_exit);
+ signal(SIGFPE, (sig_t)sig_exit);
+ signal(SIGBUS, (sig_t)sig_exit);
+ signal(SIGSEGV, (sig_t)sig_exit);
+ signal(SIGSYS, (sig_t)sig_exit);
}
void
@@ -452,7 +457,7 @@ sig_exit(sig, code, scp)
exit(-1);
}
-
+void
cleanup()
{
@@ -463,6 +468,8 @@ cleanup()
bzero(new_key, sizeof(new_key));
bzero(pw_str, sizeof(pw_str));
}
+
+void
Usage()
{
fprintf(stderr, "Usage: %s [-n]\n", progname);
diff --git a/eBones/usr.sbin/kdb_edit/maketime.c b/eBones/usr.sbin/kdb_edit/maketime.c
index ed485af..5e0ee00 100644
--- a/eBones/usr.sbin/kdb_edit/maketime.c
+++ b/eBones/usr.sbin/kdb_edit/maketime.c
@@ -9,10 +9,12 @@
* $Id: maketime.c,v 1.3 1995/07/18 16:37:29 mark Exp $
*/
+#if 0
#ifndef lint
static char rcsid[] =
"$Id: maketime.c,v 1.1 1994/03/21 16:23:54 piero Exp ";
#endif lint
+#endif
#include <sys/time.h>
diff --git a/eBones/usr.sbin/kdb_init/Makefile b/eBones/usr.sbin/kdb_init/Makefile
index 7738312..4d6a110 100644
--- a/eBones/usr.sbin/kdb_init/Makefile
+++ b/eBones/usr.sbin/kdb_init/Makefile
@@ -2,9 +2,9 @@
# $Id: Makefile,v 1.3 1995/07/18 16:37:34 mark Exp $
PROG= kdb_init
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include
-DPADD= ${LIBKDB} ${LIBKRB} ${LIBDES}
-LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes
-NOMAN= noman
+CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall
+DPADD= ${LIBKDB} ${LIBKRB}
+LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
+MAN8= kdb_init.8
.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/kdb_init/kdb_init.c b/eBones/usr.sbin/kdb_init/kdb_init.c
index d48ee096..de99181 100644
--- a/eBones/usr.sbin/kdb_init/kdb_init.c
+++ b/eBones/usr.sbin/kdb_init/kdb_init.c
@@ -10,10 +10,12 @@
* $Id: kdb_init.c,v 1.4 1995/07/18 16:37:35 mark Exp $
*/
+#if 0
#ifndef lint
static char rcsid[] =
"$Id: kdb_init.c,v 1.4 1995/07/18 16:37:35 mark Exp $";
#endif lint
+#endif
#include <stdio.h>
#include <sys/types.h>
@@ -32,12 +34,16 @@ enum ap_op {
RANDOM_KEY, /* choose a random key */
};
+int add_principal(char *name, char *instance, enum ap_op aap_op);
+
int debug = 0;
-char *progname, *rindex();
+char *progname;
C_Block master_key;
Key_schedule master_key_schedule;
+int
main(argc, argv)
+ int argc;
char *argv[];
{
char realm[REALM_SZ];
@@ -73,7 +79,7 @@ main(argc, argv)
fprintf(stderr, "\nEOF reading realm\n");
exit(1);
}
- if (cp = index(realm, '\n'))
+ if ((cp = index(realm, '\n')))
*cp = '\0';
if (!*realm) /* no realm given */
strcpy(realm, KRB_REALM);
@@ -112,14 +118,13 @@ main(argc, argv)
/* use a return code to indicate success or failure. check the return */
/* values of the routines called by this routine. */
+int
add_principal(name, instance, aap_op)
char *name, *instance;
enum ap_op aap_op;
{
Principal principal;
- char datestring[50];
- char pw_str[255];
- struct tm *tm, *localtime();
+ struct tm *tm;
C_Block new_key;
bzero(&principal, sizeof(principal));
diff --git a/eBones/usr.sbin/kdb_util/Makefile b/eBones/usr.sbin/kdb_util/Makefile
index bffeb51..134fd34 100644
--- a/eBones/usr.sbin/kdb_util/Makefile
+++ b/eBones/usr.sbin/kdb_util/Makefile
@@ -3,11 +3,11 @@
PROG= kdb_util
CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../kdb_edit \
- -I${.CURDIR}/../include
+ -I${.CURDIR}/../include -Wall
SRCS= kdb_util.c maketime.c
.PATH: ${.CURDIR}/../kdb_edit
-DPADD= ${LIBKDB} ${LIBKRB} ${LIBDES}
-LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes
-NOMAN= noman
+DPADD= ${LIBKDB} ${LIBKRB}
+LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
+MAN8= kdb_util.8
.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/kdb_util/kdb_util.c b/eBones/usr.sbin/kdb_util/kdb_util.c
index 140e211..5dbe509 100644
--- a/eBones/usr.sbin/kdb_util/kdb_util.c
+++ b/eBones/usr.sbin/kdb_util/kdb_util.c
@@ -15,15 +15,20 @@
* $Id: kdb_util.c,v 1.5 1995/08/03 17:15:57 mark Exp $
*/
+#if 0
#ifndef lint
static char rcsid[] =
"$Id: kdb_util.c,v 1.5 1995/08/03 17:15:57 mark Exp $";
#endif lint
+#endif
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
-#include "time.h"
+#include <time.h>
#include <strings.h>
#include <des.h>
#include <krb.h>
@@ -39,12 +44,16 @@ static des_key_schedule master_key_schedule, new_master_key_schedule;
#define zaptime(foo) bzero((char *)(foo), sizeof(*(foo)))
-extern long kdb_get_master_key(), kdb_verify_master_key();
-extern char *malloc();
-extern int errno;
-
char * progname;
+void convert_old_format_db (char *db_file, FILE *out);
+void convert_new_master_key (char *db_file, FILE *out);
+void update_ok_file (char *file_name);
+void print_time(FILE *file, unsigned long timeval);
+void load_db (char *db_file, FILE *input_file);
+int dump_db (char *db_file, FILE *output_file, void (*cv_key)());
+
+int
main(argc, argv)
int argc;
char **argv;
@@ -140,6 +149,7 @@ main(argc, argv)
exit(0);
}
+void
clear_secrets ()
{
bzero((char *)master_key, sizeof (des_cblock));
@@ -179,7 +189,7 @@ static int dump_db_1(arg, principal)
if (a->cv_key != NULL) {
(*a->cv_key) (principal);
}
- fprintf(a->output_file, "%s %s %d %d %d %d %x %x",
+ fprintf(a->output_file, "%s %s %d %d %d %d %lx %lx",
principal->name,
principal->instance,
principal->max_life,
@@ -196,6 +206,7 @@ static int dump_db_1(arg, principal)
return 0;
}
+int
dump_db (db_file, output_file, cv_key)
char *db_file;
FILE *output_file;
@@ -210,6 +221,7 @@ dump_db (db_file, output_file, cv_key)
return fflush(output_file);
}
+void
load_db (db_file, input_file)
char *db_file;
FILE *input_file;
@@ -235,7 +247,7 @@ load_db (db_file, input_file)
for (;;) { /* explicit break on eof from fscanf */
bzero((char *)&aprinc, sizeof(aprinc));
if (fscanf(input_file,
- "%s %s %d %d %d %hd %x %x %s %s %s %s\n",
+ "%s %s %d %d %d %hd %lx %lx %s %s %s %s\n",
aprinc.name,
aprinc.instance,
&temp1,
@@ -275,6 +287,7 @@ load_db (db_file, input_file)
free(temp_db_file);
}
+void
print_time(file, timeval)
FILE *file;
unsigned long timeval;
@@ -291,6 +304,7 @@ print_time(file, timeval)
}
/*ARGSUSED*/
+void
update_ok_file (file_name)
char *file_name;
{
@@ -348,6 +362,7 @@ convert_key_new_master (p)
(p->kdc_key_ver)++;
}
+void
convert_new_master_key (db_file, out)
char *db_file;
FILE *out;
@@ -355,7 +370,7 @@ convert_new_master_key (db_file, out)
printf ("\n\nEnter the CURRENT master key.");
if (kdb_get_master_key (TRUE, master_key, master_key_schedule) != 0) {
- fprintf (stderr, "%s: Couldn't get master key.\n");
+ fprintf (stderr, "get_master_key: Couldn't get master key.\n");
clear_secrets ();
exit (-1);
}
@@ -367,7 +382,7 @@ convert_new_master_key (db_file, out)
printf ("\n\nNow enter the NEW master key. Do not forget it!!");
if (kdb_get_master_key (TRUE, new_master_key, new_master_key_schedule) != 0) {
- fprintf (stderr, "%s: Couldn't get new master key.\n");
+ fprintf (stderr, "get_master_key: Couldn't get new master key.\n");
clear_secrets ();
exit (-1);
}
@@ -401,6 +416,7 @@ convert_key_old_db (p)
bzero((char *)key, sizeof (key)); /* a little paranoia ... */
}
+void
convert_old_format_db (db_file, out)
char *db_file;
FILE *out;
@@ -410,7 +426,7 @@ convert_old_format_db (db_file, out)
int n, more;
if (kdb_get_master_key (TRUE, master_key, master_key_schedule) != 0L) {
- fprintf (stderr, "%s: Couldn't get master key.\n");
+ fprintf (stderr, "verify_master_key: Couldn't get master key.\n");
clear_secrets();
exit (-1);
}
@@ -420,7 +436,7 @@ convert_old_format_db (db_file, out)
n = kerb_get_principal(KERB_M_NAME, KERB_M_INST, principal_data,
1 /* only one please */, &more);
if ((n != 1) || more) {
- fprintf(stderr, "verify_master_key: ",
+ fprintf(stderr, "verify_master_key: "
"Kerberos error on master key lookup, %d found.\n",
n);
exit (-1);
@@ -438,8 +454,9 @@ convert_old_format_db (db_file, out)
bcopy((char *)&principal_data[0].key_high,
(char *)(((long *) key_from_db) + 1), 4);
#ifndef NOENCRYPTION
- des_pcbc_encrypt(key_from_db,key_from_db,(long)sizeof(key_from_db),
- master_key_schedule,(des_cblock *)master_key_schedule,DECRYPT);
+ des_pcbc_encrypt((des_cblock *)key_from_db,(des_cblock *)key_from_db,
+ (long)sizeof(key_from_db),master_key_schedule,
+ (des_cblock *)master_key_schedule,DECRYPT);
#endif
/* the decrypted database key had better equal the master key */
n = bcmp((char *) master_key, (char *) key_from_db,
@@ -447,7 +464,7 @@ convert_old_format_db (db_file, out)
bzero((char *)key_from_db, sizeof(key_from_db));
if (n) {
- fprintf(stderr, "\n\07\07%verify_master_key: Invalid master key, ");
+ fprintf(stderr, "\n\07\07verify_master_key: Invalid master key, ");
fprintf(stderr, "does not match database.\n");
exit (-1);
}
diff --git a/eBones/usr.sbin/kerberos/Makefile b/eBones/usr.sbin/kerberos/Makefile
index bd3d89f..7db860e 100644
--- a/eBones/usr.sbin/kerberos/Makefile
+++ b/eBones/usr.sbin/kerberos/Makefile
@@ -3,9 +3,9 @@
PROG= kerberos
SRCS= kerberos.c cr_err_reply.c
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include
-DPADD= ${LIBKDB} ${LIBKRB} ${LIBDES}
-LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes
+CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall
+DPADD= ${LIBKDB} ${LIBKRB}
+LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
NOMAN= noman
.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/kerberos/cr_err_reply.c b/eBones/usr.sbin/kerberos/cr_err_reply.c
index 924a98f..89ee5f6 100644
--- a/eBones/usr.sbin/kerberos/cr_err_reply.c
+++ b/eBones/usr.sbin/kerberos/cr_err_reply.c
@@ -8,10 +8,12 @@
* $Id: cr_err_reply.c,v 1.2 1995/07/18 16:37:49 mark Exp $
*/
+#if 0
#ifndef lint
static char rcsid[] =
"$Id: cr_err_reply.c,v 1.2 1995/07/18 16:37:49 mark Exp $";
#endif /* lint */
+#endif
#include <sys/types.h>
#include <krb.h>
diff --git a/eBones/usr.sbin/kerberos/kerberos.c b/eBones/usr.sbin/kerberos/kerberos.c
index d0ce795..236bbbd 100644
--- a/eBones/usr.sbin/kerberos/kerberos.c
+++ b/eBones/usr.sbin/kerberos/kerberos.c
@@ -8,15 +8,22 @@
* $Id: kerberos.c,v 1.4 1995/07/18 16:37:51 mark Exp $
*/
+#if 0
#ifndef lint
static char rcsid[] =
"$Id: kerberos.c,v 1.4 1995/07/18 16:37:51 mark Exp $";
#endif lint
+#endif
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
#include <netdb.h>
#include <signal.h>
#include <sgtty.h>
@@ -32,7 +39,14 @@ static char rcsid[] =
#include <krb_db.h>
#include <kdc.h>
-extern int errno;
+void cr_err_reply(KTEXT pkt, char *pname, char *pinst, char *prealm,
+ u_long time_ws, u_long e, char *e_string);
+void kerb_err_reply(struct sockaddr_in *client, KTEXT pkt, long err,
+ char *string);
+void setup_disc(void);
+void kerberos(struct sockaddr_in *client, KTEXT pkt);
+int check_princ(char *p_name, char *instance, unsigned lifetime, Principal *p);
+int set_tgtkey(char *r);
struct sockaddr_in s_in = {AF_INET};
int f;
@@ -47,11 +61,8 @@ static struct timeval kerb_time;
static Principal a_name_data; /* for requesting user */
static Principal s_name_data; /* for services requested */
static C_Block session_key;
-static C_Block user_key;
-static C_Block service_key;
static u_char master_key_version;
static char k_instance[INST_SZ];
-static char log_text[128];
static char *lt;
static int more;
@@ -67,7 +78,6 @@ static u_char req_version;
static char *req_name_ptr;
static char *req_inst_ptr;
static char *req_realm_ptr;
-static u_char req_no_req;
static u_long req_time_ws;
int req_act_vno = KRB_PROT_VERSION; /* Temporary for version skew */
@@ -83,8 +93,6 @@ static long max_q_n;
static long n_auth_req;
static long n_appl_req;
static long n_packets;
-static long n_user;
-static long n_server;
static long max_age = -1;
static long pause_int = -1;
@@ -105,6 +113,7 @@ static void usage()
}
+int
main(argc, argv)
int argc;
char **argv;
@@ -117,9 +126,7 @@ main(argc, argv)
int fromlen;
static KTEXT_ST pkt_st;
KTEXT pkt = &pkt_st;
- Principal *p;
- int more, kerror;
- C_Block key;
+ int kerror;
int c;
extern char *optarg;
extern int optind;
@@ -198,9 +205,9 @@ main(argc, argv)
printf("Kerberos server starting\n");
if ((!nflag) && (max_age != -1))
- printf("\tMaximum database age: %d seconds\n", max_age);
+ printf("\tMaximum database age: %ld seconds\n", max_age);
if (pause_int != -1)
- printf("\tSleep for %d seconds on error\n", pause_int);
+ printf("\tSleep for %ld seconds on error\n", pause_int);
else
printf("\tSleep forever on error\n");
if (mflag)
@@ -235,7 +242,7 @@ main(argc, argv)
exit(1);
}
/* do all the database and cache inits */
- if (n = kerb_init()) {
+ if ((n = kerb_init())) {
if (mflag) {
printf("Kerberos db and cache init ");
printf("failed = %d ...exiting\n", n);
@@ -315,7 +322,7 @@ main(argc, argv)
}
}
-
+void
kerberos(client, pkt)
struct sockaddr_in *client;
KTEXT pkt;
@@ -336,7 +343,6 @@ kerberos(client, pkt)
static int msg_byte_order;
static int swap_bytes;
static u_char k_flags;
- char *p_name, *instance;
u_long lifetime;
int i;
C_Block key;
@@ -378,11 +384,9 @@ kerberos(client, pkt)
case AUTH_MSG_KDC_REQUEST:
{
- u_long time_ws; /* Workstation time */
u_long req_life; /* Requested liftime */
char *service; /* Service name */
char *instance; /* Service instance */
- int kerno; /* Kerberos error number */
n_auth_req++;
tk->length = 0;
k_flags = 0; /* various kerberos flags */
@@ -409,8 +413,8 @@ kerberos(client, pkt)
"Initial ticket request Host: %s User: \"%s\" \"%s\"",
inet_ntoa(client_host), req_name_ptr, req_inst_ptr, 0);
- if (i = check_princ(req_name_ptr, req_inst_ptr, 0,
- &a_name_data)) {
+ if ((i = check_princ(req_name_ptr, req_inst_ptr, 0,
+ &a_name_data))) {
kerb_err_reply(client, pkt, i, lt);
return;
}
@@ -420,8 +424,8 @@ kerberos(client, pkt)
"INITIAL request from %s.%s for %s.%s",
req_name_ptr, req_inst_ptr, service, instance, 0);
/* this does all the checking */
- if (i = check_princ(service, instance, lifetime,
- &s_name_data)) {
+ if ((i = check_princ(service, instance, lifetime,
+ &s_name_data))) {
kerb_err_reply(client, pkt, i, lt);
return;
}
@@ -566,7 +570,7 @@ kerberos(client, pkt)
#endif
krb_create_ticket(tk, k_flags, ad->pname, ad->pinst,
- ad->prealm, client_host,
+ ad->prealm, client_host.s_addr,
session_key, lifetime, kerb_time.tv_sec,
s_name_data.name, s_name_data.instance,
key);
@@ -622,6 +626,7 @@ kerberos(client, pkt)
* group that spawned us.
*/
+void
setup_disc()
{
@@ -642,7 +647,6 @@ setup_disc()
(void) close(s);
}
(void) chdir("/tmp");
- return;
}
@@ -651,6 +655,7 @@ setup_disc()
* client.
*/
+void
kerb_err_reply(client, pkt, err, string)
struct sockaddr_in *client;
KTEXT pkt;
@@ -697,6 +702,7 @@ static void check_db_age()
}
}
+int
check_princ(p_name, instance, lifetime, p)
char *p_name;
char *instance;
@@ -706,7 +712,6 @@ check_princ(p_name, instance, lifetime, p)
{
static int n;
static int more;
- long trans;
n = kerb_get_principal(p_name, instance, p, 1, &more);
klog(L_ALL_REQ,
@@ -764,6 +769,7 @@ check_princ(p_name, instance, lifetime, p)
/* Set the key for krb_rd_req so we can check tgt */
+int
set_tgtkey(r)
char *r; /* Realm for desired key */
{
@@ -801,7 +807,7 @@ hang()
pause();
} else {
char buf[256];
- sprintf(buf, "Kerberos will wait %d seconds before dying so as not to loop init", pause_int);
+ sprintf(buf, "Kerberos will wait %ld seconds before dying so as not to loop init", pause_int);
klog(L_KRB_PERR, buf);
sleep(pause_int);
klog(L_KRB_PERR, "Do svedania....\n");
diff --git a/eBones/usr.sbin/kprop/Makefile b/eBones/usr.sbin/kprop/Makefile
index fa70067..636eaa4 100644
--- a/eBones/usr.sbin/kprop/Makefile
+++ b/eBones/usr.sbin/kprop/Makefile
@@ -2,9 +2,9 @@
# $Id: Makefile,v 1.1.1.1 1995/08/03 07:36:18 mark Exp $
PROG= kprop
-CFLAGS+=-I${.CURDIR}/../include
-DPADD= ${LIBKRB} ${LIBDES}
-LDADD= -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes
+CFLAGS+=-I${.CURDIR}/../include -Wall
+DPADD= ${LIBKRB}
+LDADD= -L${KRBOBJDIR} -lkrb -ldes
BINDIR= /usr/sbin
NOMAN= noman
diff --git a/eBones/usr.sbin/kprop/kprop.c b/eBones/usr.sbin/kprop/kprop.c
index cde1cce..23bb893 100644
--- a/eBones/usr.sbin/kprop/kprop.c
+++ b/eBones/usr.sbin/kprop/kprop.c
@@ -70,11 +70,14 @@
*
*/
+#if 0
#ifndef lint
static char rcsid_kprop_c[] =
"$Id: kprop.c,v 1.1.1.1 1995/08/03 07:36:18 mark Exp $";
#endif lint
+#endif
+#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -118,6 +121,11 @@ struct slave_host {
struct slave_host *next;
};
+void Death(char *s);
+int get_slaves(struct slave_host **psl, char *file, time_t ok_mtime);
+int prop_to_slaves(struct slave_host *sl, int fd, char *fslv);
+
+int
main(argc, argv)
int argc;
char *argv[];
@@ -128,7 +136,7 @@ main(argc, argv)
struct stat stbuf, stbuf_ok;
long l_init, l_final;
char *pc;
- int l_diff, prop_to_slaves(), get_slaves();
+ int l_diff;
static struct slave_host *slave_host_list = NULL;
struct slave_host *sh;
@@ -253,6 +261,7 @@ main(argc, argv)
exit(0);
}
+void
Death(s)
char *s;
{
@@ -271,7 +280,8 @@ Death(s)
4 and 5 repeat til EOF ...
*/
-int prop_to_slaves(sl, fd, fslv)
+int
+prop_to_slaves(sl, fd, fslv)
struct slave_host *sl;
int fd;
char *fslv;
@@ -308,7 +318,7 @@ int prop_to_slaves(sl, fd, fslv)
sin.sin_port = sp->s_port;
strcpy(path, fslv);
- if (pc = rindex(path, '/')) {
+ if ((pc = rindex(path, '/'))) {
pc += 1;
} else {
pc = path;
@@ -420,7 +430,7 @@ int prop_to_slaves(sl, fd, fslv)
#ifdef NOENCRYPTION
bzero((char *)session_sched, sizeof(session_sched));
#else
- if (key_sched (cred.session, session_sched)) {
+ if (key_sched ((C_Block *)cred.session, session_sched)) {
fprintf (stderr, "%s: can't make key schedule.",
cs->name);
close (s);
@@ -461,7 +471,7 @@ int prop_to_slaves(sl, fd, fslv)
continue; /*** NEXT SLAVE ***/
}
- while (n = read(fd, buf, sizeof buf)) {
+ while ((n = read(fd, buf, sizeof buf))) {
if (n < 0) {
perror("input file read error");
exit(1);
@@ -475,7 +485,7 @@ int prop_to_slaves(sl, fd, fslv)
&my_sin, &sin);
else
length = krb_mk_safe (buf, obuf, n,
- cred.session,
+ (C_Block *)cred.session,
&my_sin, &sin);
if (length == -1) {
fprintf (stderr, "%s: %s failed.",
@@ -528,7 +538,8 @@ punt:
return (1);
}
-int get_slaves(psl, file, ok_mtime)
+int
+get_slaves(psl, file, ok_mtime)
struct slave_host **psl;
char *file;
time_t ok_mtime;
@@ -547,13 +558,13 @@ int get_slaves(psl, file, ok_mtime)
exit(-1);
}
strcpy(path, file);
- if (ppath = rindex(path, '/')) {
+ if ((ppath = rindex(path, '/'))) {
ppath += 1;
} else {
ppath = path;
}
for (th = psl; fgets(namebuf, sizeof namebuf, fin); th = &(*th)->next) {
- if (pc = index(namebuf, '\n')) {
+ if ((pc = index(namebuf, '\n'))) {
*pc = '\0';
} else {
fprintf(stderr, "Host name too long (>= %d chars) in '%s'.\n",
diff --git a/eBones/usr.sbin/ksrvutil/Makefile b/eBones/usr.sbin/ksrvutil/Makefile
index 1fcaf0c..a95d9ae 100644
--- a/eBones/usr.sbin/ksrvutil/Makefile
+++ b/eBones/usr.sbin/ksrvutil/Makefile
@@ -2,9 +2,8 @@
PROG= ksrvutil
SRCS= ksrvutil.c
-CFLAGS+= -I${.CURDIR}/../include -I${.CURDIR}/../libkadm
-LDADD+= -L${KADMOBJDIR} -lkadm -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes \
- -lcom_err
-NOMAN= #man page installed by ../man
+CFLAGS+= -I${.CURDIR}/../include -I${.CURDIR}/../libkadm -Wall
+LDADD+= -L${KADMOBJDIR} -lkadm -L${KRBOBJDIR} -lkrb -ldes -lcom_err
+MAN8= ksrvutil.8
.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/ksrvutil/ksrvutil.c b/eBones/usr.sbin/ksrvutil/ksrvutil.c
index 6d81e72..1062ea5 100644
--- a/eBones/usr.sbin/ksrvutil/ksrvutil.c
+++ b/eBones/usr.sbin/ksrvutil/ksrvutil.c
@@ -7,14 +7,14 @@
* list and update contents of srvtab files
*/
-#ifndef lint
#if 0
+#ifndef lint
static char rcsid_ksrvutil_c[] =
"BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/ksrvutil.c,v 4.1 89/09/26 09:33:49 jtkohl Exp ";
-#endif
static const char rcsid[] =
"$Id: ksrvutil.c,v 1.1 1995/07/18 16:40:11 mark Exp $";
#endif lint
+#endif
/*
* ksrvutil
@@ -29,6 +29,8 @@ static const char rcsid[] =
#define TRUE 1
#endif
+#include <unistd.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/file.h>
#include <sys/param.h>
@@ -54,11 +56,14 @@ int read_long_pw_string();
#define PRINC_HEADER " Principal\n"
#define PRINC_FORMAT "%s"
-extern int errno;
-
-extern void krb_set_tkt_string();
-void leave();
-unsigned short get_mode();
+void usage(void);
+void leave(char *str, int x);
+void get_key_from_password(des_cblock key);
+void print_name(char *name, char *inst, char *realm);
+void print_key(des_cblock key);
+unsigned short get_mode(char *filename);
+int get_svc_new_key(des_cblock new_key, char *sname, char *sinst,
+ char *srealm, char *keyfile);
void
copy_keyfile(progname, keyfile, backup_keyfile)
@@ -73,7 +78,7 @@ copy_keyfile(progname, keyfile, backup_keyfile)
int rcount; /* for copying keyfiles */
int try_again;
- (void) bzero((char *)buf, sizeof(buf));
+ bzero((char *)buf, sizeof(buf));
do {
try_again = FALSE;
@@ -125,9 +130,9 @@ safe_read_stdin(prompt, buf, size)
char *buf;
int size;
{
- (void) printf(prompt);
- (void) fflush(stdout);
- (void) bzero(buf, size);
+ printf(prompt);
+ fflush(stdout);
+ bzero(buf, size);
if (read(0, buf, size - 1) < 0) {
warn("failure reading from stdin");
leave((char *)NULL, 1);
@@ -158,7 +163,7 @@ yn(string)
{
char ynbuf[5];
- (void) printf("%s (y,n) [y] ", string);
+ printf("%s (y,n) [y] ", string);
for (;;) {
safe_read_stdin("", ynbuf, sizeof(ynbuf));
@@ -167,7 +172,7 @@ yn(string)
else if ((ynbuf[0] == 'y') || (ynbuf[0] == 'Y') || (ynbuf[0] == 0))
return(1);
else {
- (void) printf("Please enter 'y' or 'n': ");
+ printf("Please enter 'y' or 'n': ");
fflush(stdout);
}
}
@@ -191,7 +196,7 @@ append_srvtab(progname, filename, fd, sname, sinst,
safe_write(progname, filename, fd, srealm, strlen(srealm) + 1);
safe_write(progname, filename, fd, (char *)&key_vno, 1);
safe_write(progname, filename, fd, (char *)key, sizeof(des_cblock));
- (void) fsync(fd);
+ fsync(fd);
}
unsigned short
@@ -201,7 +206,7 @@ get_mode(filename)
struct stat statbuf;
unsigned short mode;
- (void) bzero((char *)&statbuf, sizeof(statbuf));
+ bzero((char *)&statbuf, sizeof(statbuf));
if (stat(filename, &statbuf) < 0)
mode = SRVTAB_MODE;
@@ -211,6 +216,7 @@ get_mode(filename)
return(mode);
}
+int
main(argc,argv)
int argc;
char *argv[];
@@ -241,27 +247,22 @@ main(argc,argv)
char databuf[BUFSIZ];
int first_printed = FALSE; /* have we printed the first item? */
- int get_svc_new_key();
- void get_key_from_password();
- void print_key();
- void print_name();
+ bzero((char *)sname, sizeof(sname));
+ bzero((char *)sinst, sizeof(sinst));
+ bzero((char *)srealm, sizeof(srealm));
- (void) bzero((char *)sname, sizeof(sname));
- (void) bzero((char *)sinst, sizeof(sinst));
- (void) bzero((char *)srealm, sizeof(srealm));
+ bzero((char *)change_tkt, sizeof(change_tkt));
+ bzero((char *)keyfile, sizeof(keyfile));
+ bzero((char *)work_keyfile, sizeof(work_keyfile));
+ bzero((char *)backup_keyfile, sizeof(backup_keyfile));
+ bzero((char *)local_realm, sizeof(local_realm));
- (void) bzero((char *)change_tkt, sizeof(change_tkt));
- (void) bzero((char *)keyfile, sizeof(keyfile));
- (void) bzero((char *)work_keyfile, sizeof(work_keyfile));
- (void) bzero((char *)backup_keyfile, sizeof(backup_keyfile));
- (void) bzero((char *)local_realm, sizeof(local_realm));
-
- (void) sprintf(change_tkt, "/tmp/tkt_ksrvutil.%d", getpid());
+ sprintf(change_tkt, "/tmp/tkt_ksrvutil.%d", getpid());
krb_set_tkt_string(change_tkt);
/* This is used only as a default for adding keys */
if (krb_get_lrealm(local_realm, 1) != KSUCCESS)
- (void) strcpy(local_realm, KRB_REALM);
+ strcpy(local_realm, KRB_REALM);
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-i") == 0)
@@ -296,7 +297,7 @@ main(argc,argv)
if (++i == argc)
usage();
else
- (void) strcpy(keyfile, argv[i]);
+ strcpy(keyfile, argv[i]);
}
else
usage();
@@ -306,14 +307,14 @@ main(argc,argv)
usage();
if (!keyfile[0])
- (void) strcpy(keyfile, KEYFILE);
+ strcpy(keyfile, KEYFILE);
- (void) strcpy(work_keyfile, keyfile);
- (void) strcpy(backup_keyfile, keyfile);
+ strcpy(work_keyfile, keyfile);
+ strcpy(backup_keyfile, keyfile);
if (change || add) {
- (void) strcat(work_keyfile, ".work");
- (void) strcat(backup_keyfile, ".old");
+ strcat(work_keyfile, ".work");
+ strcat(backup_keyfile, ".old");
copy_keyfile(argv[0], keyfile, backup_keyfile);
}
@@ -351,28 +352,28 @@ main(argc,argv)
(read(backup_keyfile_fd,(char *)old_key,sizeof(old_key)) > 0)) {
if (list) {
if (!first_printed) {
- (void) printf(VNO_HEADER);
- (void) printf(PAD);
+ printf(VNO_HEADER);
+ printf(PAD);
if (key) {
- (void) printf(KEY_HEADER);
- (void) printf(PAD);
+ printf(KEY_HEADER);
+ printf(PAD);
}
- (void) printf(PRINC_HEADER);
+ printf(PRINC_HEADER);
first_printed = 1;
}
- (void) printf(VNO_FORMAT, key_vno);
- (void) printf(PAD);
+ printf(VNO_FORMAT, key_vno);
+ printf(PAD);
if (key) {
print_key(old_key);
- (void) printf(PAD);
+ printf(PAD);
}
print_name(sname, sinst, srealm);
- (void) printf("\n");
+ printf("\n");
}
else if (change) {
- (void) printf("\nPrincipal: ");
+ printf("\nPrincipal: ");
print_name(sname, sinst, srealm);
- (void) printf("; version %d\n", key_vno);
+ printf("; version %d\n", key_vno);
if (interactive)
change_this_key = yn("Change this key?");
else if (change)
@@ -381,9 +382,9 @@ main(argc,argv)
change_this_key = 0;
if (change_this_key)
- (void) printf("Changing to version %d.\n", key_vno + 1);
+ printf("Changing to version %d.\n", key_vno + 1);
else if (change)
- (void) printf("Not changing this key.\n");
+ printf("Not changing this key.\n");
if (change_this_key) {
/*
@@ -395,31 +396,31 @@ main(argc,argv)
srealm, keyfile)) == KADM_SUCCESS)
key_vno++;
else {
- (void) bcopy(old_key, new_key, sizeof(new_key));
+ bcopy(old_key, new_key, sizeof(new_key));
com_err(argv[0], status, ": key NOT changed");
change_this_key = FALSE;
}
}
else
- (void) bcopy(old_key, new_key, sizeof(new_key));
+ bcopy(old_key, new_key, sizeof(new_key));
append_srvtab(argv[0], work_keyfile, work_keyfile_fd,
sname, sinst, srealm, key_vno, new_key);
if (key && change_this_key) {
- (void) printf("Old key: ");
+ printf("Old key: ");
print_key(old_key);
- (void) printf("; new key: ");
+ printf("; new key: ");
print_key(new_key);
- (void) printf("\n");
+ printf("\n");
}
if (change_this_key) {
if ((status = kadm_change_pw(new_key)) == KADM_SUCCESS) {
- (void) printf("Key changed.\n");
- (void) dest_tkt();
+ printf("Key changed.\n");
+ dest_tkt();
}
else {
com_err(argv[0], status,
" attempting to change password.");
- (void) dest_tkt();
+ dest_tkt();
/* XXX This knows the format of a keyfile */
if (lseek(work_keyfile_fd, -9, L_INCR) >= 0) {
key_vno--;
@@ -427,8 +428,8 @@ main(argc,argv)
work_keyfile_fd, (char *)&key_vno, 1);
safe_write(argv[0], work_keyfile, work_keyfile_fd,
(char *)old_key, sizeof(des_cblock));
- (void) fsync(work_keyfile_fd);
- (void) fprintf(stderr,"Key NOT changed.\n");
+ fsync(work_keyfile_fd);
+ fprintf(stderr,"Key NOT changed.\n");
}
else {
warn("unable to revert keyfile");
@@ -445,28 +446,28 @@ main(argc,argv)
do {
do {
safe_read_stdin("Name: ", databuf, sizeof(databuf));
- (void) strncpy(sname, databuf, sizeof(sname) - 1);
+ strncpy(sname, databuf, sizeof(sname) - 1);
safe_read_stdin("Instance: ", databuf, sizeof(databuf));
- (void) strncpy(sinst, databuf, sizeof(sinst) - 1);
+ strncpy(sinst, databuf, sizeof(sinst) - 1);
safe_read_stdin("Realm: ", databuf, sizeof(databuf));
- (void) strncpy(srealm, databuf, sizeof(srealm) - 1);
+ strncpy(srealm, databuf, sizeof(srealm) - 1);
safe_read_stdin("Version number: ", databuf, sizeof(databuf));
key_vno = atoi(databuf);
if (!srealm[0])
- (void) strcpy(srealm, local_realm);
- (void) printf("New principal: ");
+ strcpy(srealm, local_realm);
+ printf("New principal: ");
print_name(sname, sinst, srealm);
- (void) printf("; version %d\n", key_vno);
+ printf("; version %d\n", key_vno);
} while (!yn("Is this correct?"));
get_key_from_password(new_key);
if (key) {
- (void) printf("Key: ");
+ printf("Key: ");
print_key(new_key);
- (void) printf("\n");
+ printf("\n");
}
append_srvtab(argv[0], work_keyfile, work_keyfile_fd,
sname, sinst, srealm, key_vno, new_key);
- (void) printf("Key successfully added.\n");
+ printf("Key successfully added.\n");
} while (yn("Would you like to add another key?"));
}
@@ -482,9 +483,9 @@ main(argc,argv)
if (rename(work_keyfile, keyfile) < 0) {
err(1, "failure renaming %s to %s", work_keyfile, keyfile);
}
- (void) chmod(backup_keyfile, keyfile_mode);
- (void) chmod(keyfile, keyfile_mode);
- (void) printf("Old keyfile in %s.\n", backup_keyfile);
+ chmod(backup_keyfile, keyfile_mode);
+ chmod(keyfile, keyfile_mode);
+ printf("Old keyfile in %s.\n", backup_keyfile);
}
exit(0);
@@ -497,10 +498,10 @@ print_key(key)
int i;
for (i = 0; i < 4; i++)
- (void) printf("%02x", key[i]);
- (void) printf(" ");
+ printf("%02x", key[i]);
+ printf(" ");
for (i = 4; i < 8; i++)
- (void) printf("%02x", key[i]);
+ printf("%02x", key[i]);
}
void
@@ -509,7 +510,7 @@ print_name(name, inst, realm)
char *inst;
char *realm;
{
- (void) printf("%s%s%s%s%s", name, inst[0] ? "." : "", inst,
+ printf("%s%s%s%s%s", name, inst[0] ? "." : "", inst,
realm[0] ? "@" : "", realm);
}
@@ -528,10 +529,10 @@ get_svc_new_key(new_key, sname, sinst, srealm, keyfile)
((status = kadm_init_link("changepw", KRB_MASTER, srealm)) ==
KADM_SUCCESS)) {
#ifdef NOENCRYPTION
- (void) bzero((char *) new_key, sizeof(des_cblock));
+ bzero((char *) new_key, sizeof(des_cblock));
new_key[0] = (unsigned char) 1;
#else /* NOENCRYPTION */
- (void) des_random_key(new_key);
+ des_random_key(new_key);
#endif /* NOENCRYPTION */
return(KADM_SUCCESS);
}
@@ -549,22 +550,23 @@ get_key_from_password(key)
leave("Error reading password.", 1);
#ifdef NOENCRYPTION
- (void) bzero((char *) key, sizeof(des_cblock));
+ bzero((char *) key, sizeof(des_cblock));
key[0] = (unsigned char) 1;
#else /* NOENCRYPTION */
- (void) des_string_to_key(password, key);
+ des_string_to_key(password, (des_cblock *)key);
#endif /* NOENCRYPTION */
- (void) bzero((char *)password, sizeof(password));
+ bzero((char *)password, sizeof(password));
}
+void
usage()
{
- (void) fprintf(stderr, "Usage: ksrvutil [-f keyfile] [-i] [-k] ");
- (void) fprintf(stderr, "{list | change | add}\n");
- (void) fprintf(stderr, " -i causes the program to ask for ");
- (void) fprintf(stderr, "confirmation before changing keys.\n");
- (void) fprintf(stderr, " -k causes the key to printed for list or ");
- (void) fprintf(stderr, "change.\n");
+ fprintf(stderr, "Usage: ksrvutil [-f keyfile] [-i] [-k] ");
+ fprintf(stderr, "{list | change | add}\n");
+ fprintf(stderr, " -i causes the program to ask for ");
+ fprintf(stderr, "confirmation before changing keys.\n");
+ fprintf(stderr, " -k causes the key to printed for list or ");
+ fprintf(stderr, "change.\n");
exit(1);
}
@@ -574,7 +576,7 @@ char *str;
int x;
{
if (str)
- (void) fprintf(stderr, "%s\n", str);
- (void) dest_tkt();
+ fprintf(stderr, "%s\n", str);
+ dest_tkt();
exit(x);
}
diff --git a/eBones/usr.sbin/kstash/Makefile b/eBones/usr.sbin/kstash/Makefile
index b194a2c..1387f8c 100644
--- a/eBones/usr.sbin/kstash/Makefile
+++ b/eBones/usr.sbin/kstash/Makefile
@@ -2,9 +2,9 @@
# $Id: Makefile,v 1.3 1995/07/18 16:40:14 mark Exp $
PROG= kstash
-CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include
-DPADD= ${LIBKDB} ${LIBKRB} ${LIBDES}
-LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -L${DESOBJDIR} -ldes
-NOMAN= noman
+CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall
+DPADD= ${LIBKDB} ${LIBKRB}
+LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
+MAN8= kstash.8
.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/kstash/kstash.c b/eBones/usr.sbin/kstash/kstash.c
index d5a59bf..ce26a1d 100644
--- a/eBones/usr.sbin/kstash/kstash.c
+++ b/eBones/usr.sbin/kstash/kstash.c
@@ -8,12 +8,17 @@
* $Id: kstash.c,v 1.3 1995/07/18 16:40:16 mark Exp $
*/
+#if 0
#ifndef lint
static char rcsid[] =
"$Id: kstash.c,v 1.3 1995/07/18 16:40:16 mark Exp $";
#endif lint
+#endif
+#include <unistd.h>
#include <stdio.h>
+#include <string.h>
+#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -31,27 +36,23 @@ static char rcsid[] =
#include <krb_db.h>
#include <kdc.h>
-extern int errno;
-
/* change this later, but krblib_dbm needs it for now */
char *progname;
static C_Block master_key;
static Key_schedule master_key_schedule;
-static Principal s_name_data; /* for services requested */
-static unsigned char master_key_version;
int debug;
-static int more;
static int kfile;
static void clear_secrets();
+int
main(argc, argv)
int argc;
char **argv;
{
long n;
- if (n = kerb_init()) {
- fprintf(stderr, "Kerberos db and cache init failed = %d\n", n);
+ if ((n = kerb_init())) {
+ fprintf(stderr, "Kerberos db and cache init failed = %ld\n", n);
exit(1);
}
@@ -82,6 +83,7 @@ main(argc, argv)
}
(void) close(kfile);
clear_secrets();
+ return(0);
}
static void
diff --git a/eBones/usr.sbin/make_keypair/Makefile b/eBones/usr.sbin/make_keypair/Makefile
index b00048e..7d435e7 100644
--- a/eBones/usr.sbin/make_keypair/Makefile
+++ b/eBones/usr.sbin/make_keypair/Makefile
@@ -2,8 +2,8 @@
PROG= make_keypair
MAN8= make_keypair.8
-CFLAGS+=-DKERBEROS -I${.CURDIR}/../register
-DPADD= ${LIBKRB} ${LIBDES}
-LDADD= -lkdb -lkrb -ldes
+CFLAGS+=-DKERBEROS -I${.CURDIR}/../include -I${.CURDIR}/../register -Wall
+DPADD= ${LIBKRB}
+LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes
.include <bsd.prog.mk>
diff --git a/eBones/usr.sbin/make_keypair/make_keypair.c b/eBones/usr.sbin/make_keypair/make_keypair.c
index 5cc1777..deb67ac 100644
--- a/eBones/usr.sbin/make_keypair/make_keypair.c
+++ b/eBones/usr.sbin/make_keypair/make_keypair.c
@@ -31,30 +31,34 @@
* SUCH DAMAGE.
*/
+#if 0
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1988, 1993\n\
The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
static char sccsid[] = "@(#)make_keypair.c 8.1 (Berkeley) 6/1/93";
#endif /* not lint */
+#endif
#include <sys/types.h>
#include <sys/file.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <string.h>
#include <stdio.h>
#include <netdb.h>
#include <des.h>
-#include <kerberosIV/krb.h>
+#include <krb.h>
#include "pathnames.h"
#include "register_proto.h"
-void make_key(), usage();
+void usage(char *name);
+void make_key(struct in_addr addr);
char * progname;
+void
main(argc, argv)
int argc;
char **argv;
@@ -76,7 +80,7 @@ main(argc, argv)
exit(1);
}
- for (i = 0; addr = hp->h_addr_list[i]; i++) {
+ for (i = 0; (addr = hp->h_addr_list[i]); i++) {
addr = hp->h_addr_list[i];
bcopy(addr, &sin.sin_addr, hp->h_length);
OpenPOWER on IntegriCloud