summaryrefslogtreecommitdiffstats
path: root/eBones
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
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')
-rw-r--r--eBones/Makefile8
-rw-r--r--eBones/acl/Makefile4
-rw-r--r--eBones/acl/acl_files.c83
-rw-r--r--eBones/des/Makefile2
-rw-r--r--eBones/ext_srvtab/Makefile8
-rw-r--r--eBones/ext_srvtab/ext_srvtab.c12
-rw-r--r--eBones/include/des.h176
-rw-r--r--eBones/include/kparse.h8
-rw-r--r--eBones/include/krb.h173
-rw-r--r--eBones/include/krb_db.h2
-rw-r--r--eBones/kadmin/Makefile6
-rw-r--r--eBones/kadmin/kadmin.c36
-rw-r--r--eBones/kadmind/Makefile6
-rw-r--r--eBones/kadmind/admin_server.c31
-rw-r--r--eBones/kadmind/kadm_funcs.c20
-rw-r--r--eBones/kadmind/kadm_ser_wrap.c32
-rw-r--r--eBones/kadmind/kadm_server.c8
-rw-r--r--eBones/kadmind/kadm_server.h21
-rw-r--r--eBones/kdb/krb_cache.c39
-rw-r--r--eBones/kdb/krb_dbm.c169
-rw-r--r--eBones/kdb/krb_kdb_utils.c59
-rw-r--r--eBones/kdb/krb_lib.c22
-rw-r--r--eBones/kdb/print_princ.c5
-rw-r--r--eBones/kdb_destroy/Makefile4
-rw-r--r--eBones/kdb_destroy/kdb_destroy.c20
-rw-r--r--eBones/kdb_edit/Makefile8
-rw-r--r--eBones/kdb_edit/kdb_edit.c53
-rw-r--r--eBones/kdb_edit/maketime.c2
-rw-r--r--eBones/kdb_init/Makefile8
-rw-r--r--eBones/kdb_init/kdb_init.c15
-rw-r--r--eBones/kdb_util/Makefile8
-rw-r--r--eBones/kdb_util/kdb_util.c45
-rw-r--r--eBones/kdestroy/Makefile8
-rw-r--r--eBones/kdestroy/kdestroy.c7
-rw-r--r--eBones/kerberos/Makefile6
-rw-r--r--eBones/kerberos/cr_err_reply.c2
-rw-r--r--eBones/kerberos/kerberos.c56
-rw-r--r--eBones/kinit/Makefile6
-rw-r--r--eBones/kinit/kinit.c10
-rw-r--r--eBones/klist/Makefile6
-rw-r--r--eBones/klist/klist.c25
-rw-r--r--eBones/kprop/Makefile6
-rw-r--r--eBones/kprop/kprop.c29
-rw-r--r--eBones/kpropd/Makefile6
-rw-r--r--eBones/kpropd/kpropd.c32
-rw-r--r--eBones/krb/Makefile22
-rw-r--r--eBones/krb/add_ticket.c1
-rw-r--r--eBones/krb/create_auth_reply.c1
-rw-r--r--eBones/krb/create_ciph.c22
-rw-r--r--eBones/krb/create_ticket.c23
-rw-r--r--eBones/krb/decomp_ticket.c26
-rw-r--r--eBones/krb/des_rw.c29
-rw-r--r--eBones/krb/dest_tkt.c6
-rw-r--r--eBones/krb/extract_ticket.c11
-rw-r--r--eBones/krb/fgetst.c8
-rw-r--r--eBones/krb/get_ad_tkt.c15
-rw-r--r--eBones/krb/get_admhst.c6
-rw-r--r--eBones/krb/get_cred.c7
-rw-r--r--eBones/krb/get_in_tkt.c65
-rw-r--r--eBones/krb/get_krbhst.c6
-rw-r--r--eBones/krb/get_krbrlm.c7
-rw-r--r--eBones/krb/get_phost.c7
-rw-r--r--eBones/krb/get_pw_tkt.c7
-rw-r--r--eBones/krb/get_request.c7
-rw-r--r--eBones/krb/get_svc_in_tkt.c6
-rw-r--r--eBones/krb/get_tf_fullname.c8
-rw-r--r--eBones/krb/get_tf_realm.c5
-rw-r--r--eBones/krb/getrealm.c4
-rw-r--r--eBones/krb/getst.c6
-rw-r--r--eBones/krb/in_tkt.c9
-rw-r--r--eBones/krb/k_gethostname.c5
-rw-r--r--eBones/krb/klog.c12
-rw-r--r--eBones/krb/kname_parse.c16
-rw-r--r--eBones/krb/kntoln.c5
-rw-r--r--eBones/krb/kparse.c75
-rw-r--r--eBones/krb/krb_get_in_tkt.c31
-rw-r--r--eBones/krb/krbglue.c12
-rw-r--r--eBones/krb/kuserok.c5
-rw-r--r--eBones/krb/log.c23
-rw-r--r--eBones/krb/mk_priv.c22
-rw-r--r--eBones/krb/mk_req.c20
-rw-r--r--eBones/krb/mk_safe.c15
-rw-r--r--eBones/krb/month_sname.c3
-rw-r--r--eBones/krb/netread.c8
-rw-r--r--eBones/krb/netwrite.c8
-rw-r--r--eBones/krb/pkt_clen.c8
-rw-r--r--eBones/krb/rd_err.c9
-rw-r--r--eBones/krb/rd_priv.c20
-rw-r--r--eBones/krb/rd_req.c29
-rw-r--r--eBones/krb/rd_safe.c16
-rw-r--r--eBones/krb/read_service_key.c12
-rw-r--r--eBones/krb/recvauth.c24
-rw-r--r--eBones/krb/save_credentials.c13
-rw-r--r--eBones/krb/send_to_kdc.c323
-rw-r--r--eBones/krb/sendauth.c30
-rw-r--r--eBones/krb/stime.c3
-rw-r--r--eBones/krb/tf_shm.c13
-rw-r--r--eBones/krb/tf_util.c115
-rw-r--r--eBones/krb/tkt_string.c6
-rw-r--r--eBones/krb/util.c6
-rw-r--r--eBones/ksrvtgt/Makefile6
-rw-r--r--eBones/ksrvtgt/ksrvtgt.c2
-rw-r--r--eBones/ksrvutil/Makefile7
-rw-r--r--eBones/ksrvutil/ksrvutil.c178
-rw-r--r--eBones/kstash/Makefile8
-rw-r--r--eBones/kstash/kstash.c16
-rw-r--r--eBones/lib/libacl/Makefile4
-rw-r--r--eBones/lib/libacl/acl_files.c83
-rw-r--r--eBones/lib/libkadm/Makefile3
-rw-r--r--eBones/lib/libkadm/kadm.h16
-rw-r--r--eBones/lib/libkadm/kadm_cli_wrap.c74
-rw-r--r--eBones/lib/libkadm/kadm_stream.c80
-rw-r--r--eBones/lib/libkadm/kadm_supp.c26
-rw-r--r--eBones/lib/libkdb/krb_cache.c39
-rw-r--r--eBones/lib/libkdb/krb_dbm.c169
-rw-r--r--eBones/lib/libkdb/krb_kdb_utils.c59
-rw-r--r--eBones/lib/libkdb/krb_lib.c22
-rw-r--r--eBones/lib/libkdb/print_princ.c5
-rw-r--r--eBones/lib/libkrb/Makefile22
-rw-r--r--eBones/lib/libkrb/add_ticket.c1
-rw-r--r--eBones/lib/libkrb/create_auth_reply.c1
-rw-r--r--eBones/lib/libkrb/create_ciph.c22
-rw-r--r--eBones/lib/libkrb/create_ticket.c23
-rw-r--r--eBones/lib/libkrb/decomp_ticket.c26
-rw-r--r--eBones/lib/libkrb/des_rw.c29
-rw-r--r--eBones/lib/libkrb/dest_tkt.c6
-rw-r--r--eBones/lib/libkrb/extract_ticket.c11
-rw-r--r--eBones/lib/libkrb/fgetst.c8
-rw-r--r--eBones/lib/libkrb/get_ad_tkt.c15
-rw-r--r--eBones/lib/libkrb/get_admhst.c6
-rw-r--r--eBones/lib/libkrb/get_cred.c7
-rw-r--r--eBones/lib/libkrb/get_in_tkt.c65
-rw-r--r--eBones/lib/libkrb/get_krbhst.c6
-rw-r--r--eBones/lib/libkrb/get_krbrlm.c7
-rw-r--r--eBones/lib/libkrb/get_phost.c7
-rw-r--r--eBones/lib/libkrb/get_pw_tkt.c7
-rw-r--r--eBones/lib/libkrb/get_request.c7
-rw-r--r--eBones/lib/libkrb/get_svc_in_tkt.c6
-rw-r--r--eBones/lib/libkrb/get_tf_fullname.c8
-rw-r--r--eBones/lib/libkrb/get_tf_realm.c5
-rw-r--r--eBones/lib/libkrb/getrealm.c4
-rw-r--r--eBones/lib/libkrb/getst.c6
-rw-r--r--eBones/lib/libkrb/in_tkt.c9
-rw-r--r--eBones/lib/libkrb/k_gethostname.c5
-rw-r--r--eBones/lib/libkrb/klog.c12
-rw-r--r--eBones/lib/libkrb/kname_parse.c16
-rw-r--r--eBones/lib/libkrb/kntoln.c5
-rw-r--r--eBones/lib/libkrb/kparse.c75
-rw-r--r--eBones/lib/libkrb/krb_get_in_tkt.c31
-rw-r--r--eBones/lib/libkrb/krbglue.c12
-rw-r--r--eBones/lib/libkrb/kuserok.c5
-rw-r--r--eBones/lib/libkrb/log.c23
-rw-r--r--eBones/lib/libkrb/mk_priv.c22
-rw-r--r--eBones/lib/libkrb/mk_req.c20
-rw-r--r--eBones/lib/libkrb/mk_safe.c15
-rw-r--r--eBones/lib/libkrb/month_sname.c3
-rw-r--r--eBones/lib/libkrb/netread.c8
-rw-r--r--eBones/lib/libkrb/netwrite.c8
-rw-r--r--eBones/lib/libkrb/pkt_clen.c8
-rw-r--r--eBones/lib/libkrb/rd_err.c9
-rw-r--r--eBones/lib/libkrb/rd_priv.c20
-rw-r--r--eBones/lib/libkrb/rd_req.c29
-rw-r--r--eBones/lib/libkrb/rd_safe.c16
-rw-r--r--eBones/lib/libkrb/read_service_key.c12
-rw-r--r--eBones/lib/libkrb/recvauth.c24
-rw-r--r--eBones/lib/libkrb/save_credentials.c13
-rw-r--r--eBones/lib/libkrb/send_to_kdc.c323
-rw-r--r--eBones/lib/libkrb/sendauth.c30
-rw-r--r--eBones/lib/libkrb/stime.c3
-rw-r--r--eBones/lib/libkrb/tf_shm.c13
-rw-r--r--eBones/lib/libkrb/tf_util.c115
-rw-r--r--eBones/lib/libkrb/tkt_string.c6
-rw-r--r--eBones/lib/libkrb/util.c6
-rw-r--r--eBones/libexec/kpropd/Makefile6
-rw-r--r--eBones/libexec/kpropd/kpropd.c32
-rw-r--r--eBones/libexec/registerd/Makefile7
-rw-r--r--eBones/libexec/registerd/registerd.c52
-rw-r--r--eBones/libkadm/Makefile3
-rw-r--r--eBones/libkadm/kadm.h16
-rw-r--r--eBones/libkadm/kadm_cli_wrap.c74
-rw-r--r--eBones/libkadm/kadm_stream.c80
-rw-r--r--eBones/libkadm/kadm_supp.c26
-rw-r--r--eBones/make_keypair/Makefile6
-rw-r--r--eBones/make_keypair/make_keypair.c16
-rw-r--r--eBones/man/Makefile16
-rw-r--r--eBones/register/Makefile6
-rw-r--r--eBones/register/register.c34
-rw-r--r--eBones/registerd/Makefile7
-rw-r--r--eBones/registerd/registerd.c52
-rw-r--r--eBones/usr.bin/kadmin/Makefile6
-rw-r--r--eBones/usr.bin/kadmin/kadmin.c36
-rw-r--r--eBones/usr.bin/kdestroy/Makefile8
-rw-r--r--eBones/usr.bin/kdestroy/kdestroy.c7
-rw-r--r--eBones/usr.bin/kinit/Makefile6
-rw-r--r--eBones/usr.bin/kinit/kinit.c10
-rw-r--r--eBones/usr.bin/klist/Makefile6
-rw-r--r--eBones/usr.bin/klist/klist.c25
-rw-r--r--eBones/usr.bin/ksrvtgt/Makefile6
-rw-r--r--eBones/usr.bin/ksrvtgt/ksrvtgt.c2
-rw-r--r--eBones/usr.bin/register/Makefile6
-rw-r--r--eBones/usr.bin/register/register.c34
-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
235 files changed, 3820 insertions, 2005 deletions
diff --git a/eBones/Makefile b/eBones/Makefile
index 2d95034..28f92b6 100644
--- a/eBones/Makefile
+++ b/eBones/Makefile
@@ -1,13 +1,13 @@
# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
-# $Id: Makefile,v 1.14 1995/08/25 22:49:26 markm Exp $
+# $Id: Makefile,v 1.14 1995/07/18 16:34:20 mark Exp $
-SUBDIR= include acl kdb krb libkadm
+SUBDIR= include des acl kdb krb libkadm
SUBDIR+= ext_srvtab kdb_destroy kdb_edit \
kdb_init kdb_util kdestroy kerberos kinit klist ksrvtgt \
- kstash kadmin kadmind ksrvutil man
+ kstash kadmin kadmind ksrvutil man register registerd make_keypair
-# register registerd make_keypair
+CFLAGS+= -Wall
SDIR= ${.CURDIR}/..
diff --git a/eBones/acl/Makefile b/eBones/acl/Makefile
index 0ac5183..c015eaa 100644
--- a/eBones/acl/Makefile
+++ b/eBones/acl/Makefile
@@ -6,5 +6,9 @@ SHLIB_MAJOR= 2
SHLIB_MINOR= 0
CFLAGS+=-DDEBUG -DKERBEROS -I${.CURDIR}/../include -Wall
SRCS= acl_files.c
+MAN3= acl_check.3
+MLINKS= acl_check.3 acl_canonicalize_principal.3 \
+ acl_check.3 acl_exact_match.3 acl_check.3 acl_add.3 \
+ acl_check.3 acl_delete.3 acl_check.3 acl_initialize.3
.include <bsd.lib.mk>
diff --git a/eBones/acl/acl_files.c b/eBones/acl/acl_files.c
index 1f488f3..a3e1f68 100644
--- a/eBones/acl/acl_files.c
+++ b/eBones/acl/acl_files.c
@@ -19,16 +19,16 @@ static char rcsid[] =
/*** Routines for manipulating access control list files ***/
-#include <stdio.h>
+#include <unistd.h>
#include <stdlib.h>
+#include <stdio.h>
#include <strings.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/errno.h>
#include <ctype.h>
-#include <unistd.h>
-#include <krb.h>
+#include "krb.h"
__BEGIN_DECLS
static int acl_abort __P((char *, FILE *));
@@ -57,16 +57,15 @@ __END_DECLS
#define COR(a,b) ((a!=NULL)?(a):(b))
-extern int errno;
-
-/* extern time_t time(); */
-
/* Canonicalize a principal name */
/* If instance is missing, it becomes "" */
/* If realm is missing, it becomes the local realm */
/* Canonicalized form is put in canon, which must be big enough to hold
MAX_PRINCIPAL_SIZE characters */
-void acl_canonicalize_principal(char *principal, char *canon)
+void
+acl_canonicalize_principal(principal, canon)
+char *principal;
+char *canon;
{
char *dot, *atsign, *end;
int len;
@@ -127,7 +126,9 @@ void acl_canonicalize_principal(char *principal, char *canon)
/* Return new FILE pointer */
/* or NULL if file cannot be modified */
/* REQUIRES WRITE PERMISSION TO CONTAINING DIRECTORY */
-static FILE *acl_lock_file(char *acl_file)
+static FILE *
+acl_lock_file(acl_file)
+char *acl_file;
{
struct stat s;
char new[LINESIZE];
@@ -174,7 +175,10 @@ static FILE *acl_lock_file(char *acl_file)
/* Returns > 0 if lock was broken */
/* Returns < 0 if some other error occurs */
/* Closes f */
-static int acl_commit(char *acl_file, FILE *f)
+static int
+acl_commit(acl_file, f)
+char *acl_file;
+FILE *f;
{
char new[LINESIZE];
int ret;
@@ -198,7 +202,10 @@ static int acl_commit(char *acl_file, FILE *f)
* Returns 0 if successful, < 0 otherwise
* Closes f
*/
-static int acl_abort(char *acl_file, FILE *f)
+static int
+acl_abort(acl_file, f)
+char *acl_file;
+FILE *f;
{
char new[LINESIZE];
int ret;
@@ -220,7 +227,10 @@ static int acl_abort(char *acl_file, FILE *f)
/* Creates the file with permissions perm if it does not exist */
/* Erases it if it does */
/* Returns return value of acl_commit */
-int acl_initialize(char *acl_file, int perm)
+int
+acl_initialize(acl_file, perm)
+char *acl_file;
+int perm;
{
FILE *new;
int fd;
@@ -241,7 +251,9 @@ int acl_initialize(char *acl_file, int perm)
/* Eliminate all whitespace character in buf */
/* Modifies its argument */
-static void nuke_whitespace(char *buf)
+static void
+nuke_whitespace(buf)
+char *buf;
{
register char *pin, *pout;
@@ -259,7 +271,8 @@ struct hashtbl {
};
/* Make an empty hash table of size s */
-static struct hashtbl *make_hash(size)
+static struct hashtbl *
+make_hash(size)
int size;
{
struct hashtbl *h;
@@ -273,7 +286,9 @@ int size;
}
/* Destroy a hash table */
-static void destroy_hash(struct hashtbl *h)
+static void
+destroy_hash(h)
+struct hashtbl *h;
{
int i;
@@ -285,7 +300,9 @@ static void destroy_hash(struct hashtbl *h)
}
/* Compute hash value for a string */
-static unsigned hashval(char *s)
+static unsigned
+hashval(s)
+register char *s;
{
register unsigned hv;
@@ -296,7 +313,10 @@ static unsigned hashval(char *s)
}
/* Add an element to a hash table */
-static void add_hash(struct hashtbl *h, char *el)
+static void
+add_hash(h, el)
+struct hashtbl *h;
+char *el;
{
unsigned hv;
char *s;
@@ -327,7 +347,10 @@ static void add_hash(struct hashtbl *h, char *el)
}
/* Returns nonzero if el is in h */
-static int check_hash(struct hashtbl *h, char *el)
+static int
+check_hash(h, el)
+struct hashtbl *h;
+char *el;
{
unsigned hv;
@@ -354,7 +377,9 @@ static int acl_cache_next = 0;
/* Returns < 0 if unsuccessful in loading acl */
/* Returns index into acl_cache otherwise */
/* Note that if acl is already loaded, this is just a lookup */
-static int acl_load(char *name)
+static int
+acl_load(name)
+char *name;
{
int i;
FILE *f;
@@ -421,7 +446,10 @@ static int acl_load(char *name)
/* Returns nonzero if it can be determined that acl contains principal */
/* Principal is not canonicalized, and no wildcarding is done */
-int acl_exact_match(char *acl, char *principal)
+int
+acl_exact_match(acl, principal)
+char *acl;
+char *principal;
{
int idx;
@@ -432,7 +460,10 @@ int acl_exact_match(char *acl, char *principal)
/* Returns nonzero if it can be determined that acl contains principal */
/* Recognizes wildcards in acl of the form
name.*@realm, *.*@realm, and *.*@* */
-int acl_check(char *acl, char *principal)
+int
+acl_check(acl, principal)
+char *acl;
+char *principal;
{
char buf[MAX_PRINCIPAL_SIZE];
char canon[MAX_PRINCIPAL_SIZE];
@@ -458,7 +489,10 @@ int acl_check(char *acl, char *principal)
/* Adds principal to acl */
/* Wildcards are interpreted literally */
-int acl_add(char *acl, char *principal)
+int
+acl_add(acl, principal)
+char *acl;
+char *principal;
{
int idx;
int i;
@@ -490,7 +524,10 @@ int acl_add(char *acl, char *principal)
/* Removes principal from acl */
/* Wildcards are interpreted literally */
-int acl_delete(char *acl, char *principal)
+int
+acl_delete(acl, principal)
+char *acl;
+char *principal;
{
int idx;
int i;
diff --git a/eBones/des/Makefile b/eBones/des/Makefile
index 8d5c210..0dc3484 100644
--- a/eBones/des/Makefile
+++ b/eBones/des/Makefile
@@ -1,5 +1,5 @@
# @(#)Makefile 5.4 (Berkeley) 5/7/91
-# $Id: Makefile,v 1.1.1.1 1994/09/30 14:49:50 csgr Exp $
+# $Id: Makefile,v 1.5 1995/07/18 16:34:59 mark Exp $
LIB= des
SRCS= cbc_cksm.c cbc_enc.c ecb_enc.c enc_read.c enc_writ.c pcbc_enc.c \
diff --git a/eBones/ext_srvtab/Makefile b/eBones/ext_srvtab/Makefile
index b0a2a01..7fb1f29 100644
--- a/eBones/ext_srvtab/Makefile
+++ b/eBones/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/ext_srvtab/ext_srvtab.c b/eBones/ext_srvtab/ext_srvtab.c
index 6b655c7..6f25013 100644
--- a/eBones/ext_srvtab/ext_srvtab.c
+++ b/eBones/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/include/des.h b/eBones/include/des.h
index af20141..e55b4ae 100644
--- a/eBones/include/des.h
+++ b/eBones/include/des.h
@@ -1,27 +1,38 @@
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <Copyright.MIT>.
- *
- * Include file for the Data Encryption Standard library.
- *
- * from: des.h,v 4.11 89/01/17 16:24:57 rfrench Exp $
- * $Id: des.h,v 1.3 1995/07/18 16:36:25 mark Exp $
+/* des.h */
+/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au).
+ * All rights reserved.
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * See the COPYRIGHT file in the libdes distribution for more details.
*/
-/* only do the whole thing once */
-#ifndef DES_DEFS
-#define DES_DEFS
+#ifndef HEADER_DES_H
+#define HEADER_DES_H
-typedef unsigned char des_cblock[8]; /* crypto-block size */
-/* Key schedule */
-typedef struct des_ks_struct { des_cblock _; } des_key_schedule[16];
+#include <stdio.h>
+
+typedef unsigned char des_cblock[8];
+typedef struct des_ks_struct
+ {
+ union {
+ des_cblock _;
+ /* make sure things are correct size on machines with
+ * 8 byte longs */
+ unsigned long pad[2];
+ } ks;
+#undef _
+#define _ ks._
+ } des_key_schedule[16];
#define DES_KEY_SZ (sizeof(des_cblock))
+#define DES_SCHEDULE_SZ (sizeof(des_key_schedule))
+
#define DES_ENCRYPT 1
#define DES_DECRYPT 0
-#ifndef NCOMPAT
+#define DES_CBC_MODE 0
+#define DES_PCBC_MODE 1
+
#define C_Block des_cblock
#define Key_schedule des_key_schedule
#define ENCRYPT DES_ENCRYPT
@@ -31,14 +42,139 @@ typedef struct des_ks_struct { des_cblock _; } des_key_schedule[16];
#define read_pw_string des_read_pw_string
#define random_key des_random_key
#define pcbc_encrypt des_pcbc_encrypt
+#define set_key des_set_key
#define key_sched des_key_sched
+#define ecb_encrypt des_ecb_encrypt
#define cbc_encrypt des_cbc_encrypt
+#define ncbc_encrypt des_ncbc_encrypt
#define cbc_cksum des_cbc_cksum
-#define C_Block_print des_cblock_print
#define quad_cksum des_quad_cksum
-typedef struct des_ks_struct bit_64;
+
+/* For compatibility with the MIT lib - eay 20/05/92 */
+typedef des_key_schedule bit_64;
+
+extern int des_check_key; /* defaults to false */
+extern int des_rw_mode; /* defaults to DES_PCBC_MODE */
+
+/* The next line is used to disable full ANSI prototypes, if your
+ * compiler has problems with the prototypes, make sure this line always
+ * evaluates to true :-) */
+#if defined(MSDOS) && defined(__STDC__)
+#undef PROTO
+#define PROTO
#endif
-#define des_cblock_print(x) des_cblock_print_file(x, stdout)
+/* markm - dirty hack */
+#define PROTO
-#endif DES_DEFS
+#ifdef PROTO
+int des_2ecb_encrypt(des_cblock *input,des_cblock *output,
+ des_key_schedule ks1,des_key_schedule ks2,int enc);
+int des_3ecb_encrypt(des_cblock *input,des_cblock *output,
+ des_key_schedule ks1,des_key_schedule ks2,
+ des_key_schedule ks3, int enc);
+unsigned long des_cbc_cksum(des_cblock *input,des_cblock *output,
+ long length,des_key_schedule schedule,des_cblock *ivec);
+int des_cbc_encrypt(des_cblock *input,des_cblock *output,long length,
+ des_key_schedule schedule,des_cblock *ivec,int enc);
+int des_ncbc_encrypt(des_cblock *input,des_cblock *output,long length,
+ des_key_schedule schedule,des_cblock *ivec,int enc);
+int des_3cbc_encrypt(des_cblock *input,des_cblock *output,long length,
+ des_key_schedule sk1,des_key_schedule sk2,
+ des_cblock *ivec1,des_cblock *ivec2,int enc);
+int des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits,
+ long length,des_key_schedule schedule,des_cblock *ivec,int enc);
+int des_ecb_encrypt(des_cblock *input,des_cblock *output,
+ des_key_schedule ks,int enc);
+int des_encrypt(unsigned long *input,unsigned long *output,
+ des_key_schedule ks, int enc);
+int des_encrypt2(unsigned long *input,unsigned long *output,
+ des_key_schedule ks, int enc);
+int des_ede3_cbc_encrypt(des_cblock *input, des_cblock *output,
+ long length, des_key_schedule ks1, des_key_schedule ks2,
+ des_key_schedule ks3, des_cblock *ivec, int enc);
+int des_ede2_cbc_encrypt(des_cblock *input, des_cblock *output,
+ long length, des_key_schedule ks1, des_key_schedule ks2,
+ des_cblock *ivec, int enc);
+int des_enc_read(int fd,char *buf,int len,des_key_schedule sched,
+ des_cblock *iv);
+int des_enc_write(int fd,char *buf,int len,des_key_schedule sched,
+ des_cblock *iv);
+#if 0
+#ifdef PERL5
+char *des_crypt(const char *buf,const char *salt);
+#else
+/* some stupid compilers complain because I have declared char instead
+ * of const char */
+#ifdef HEADER_DES_LOCL_H
+char *crypt(const char *buf,const char *salt);
+#else
+char *crypt();
+#endif /* HEADER_DES_LOCL_H */
+#endif /* PERL5 */
+#endif /* 0 */
+
+int des_ofb_encrypt(unsigned char *in,unsigned char *out,
+ int numbits,long length,des_key_schedule schedule,des_cblock *ivec);
+int des_pcbc_encrypt(des_cblock *input,des_cblock *output,long length,
+ des_key_schedule schedule,des_cblock *ivec,int enc);
+unsigned long des_quad_cksum(des_cblock *input,des_cblock *output,
+ long length,int out_count,des_cblock *seed);
+void des_random_seed(des_cblock key);
+int des_random_key(des_cblock ret);
+int des_read_password(des_cblock *key,char *prompt,int verify);
+int des_read_2passwords(des_cblock *key1,des_cblock *key2,
+ char *prompt,int verify);
+int des_read_pw_string(char *buf,int length,char *prompt,int verify);
+void des_set_odd_parity(des_cblock *key);
+int des_is_weak_key(des_cblock *key);
+int des_set_key(des_cblock *key,des_key_schedule schedule);
+int des_key_sched(des_cblock *key,des_key_schedule schedule);
+int des_string_to_key(char *str,des_cblock *key);
+int des_string_to_2keys(char *str,des_cblock *key1,des_cblock *key2);
+int des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
+ des_key_schedule schedule, des_cblock *ivec, int *num, int enc);
+int des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
+ des_key_schedule schedule, des_cblock *ivec, int *num);
+void des_cblock_print_file(des_cblock *cb, FILE *fp);
+
+#else
+
+int des_2ecb_encrypt();
+int des_3ecb_encrypt();
+unsigned long des_cbc_cksum();
+int des_cbc_encrypt();
+int des_ncbc_encrypt();
+int des_3cbc_encrypt();
+int des_cfb_encrypt();
+int des_ecb_encrypt();
+int des_encrypt();
+int des_encrypt2();
+int des_ede3_cbc_encrypt();
+int des_ede2_cbc_encrypt();
+int des_enc_read();
+int des_enc_write();
+#ifdef PERL5
+char *des_crypt();
+#else
+char *crypt();
+#endif
+int des_ofb_encrypt();
+int des_pcbc_encrypt();
+unsigned long des_quad_cksum();
+void des_random_seed();
+int des_random_key();
+int des_read_password();
+int des_read_2passwords();
+int des_read_pw_string();
+void des_set_odd_parity();
+int des_is_weak_key();
+int des_set_key();
+int des_key_sched();
+int des_string_to_key();
+int des_string_to_2keys();
+int des_cfb64_encrypt();
+int des_ofb64_encrypt();
+void des_cblock_print_file();
+#endif
+#endif
diff --git a/eBones/include/kparse.h b/eBones/include/kparse.h
index 26bc523..58d45a7 100644
--- a/eBones/include/kparse.h
+++ b/eBones/include/kparse.h
@@ -81,7 +81,11 @@ extern char ErrorMsg[]; /*
* fGetParameterSet
*/
-extern char *strsave(); /* defined in this module */
-extern char *strutol(); /* defined in this module */
+extern char *strsave(char *p); /* defined in this module */
+extern char *strutol(char *p); /* defined in this module */
+
+int fGetParameterSet(FILE *fp, parmtable parm[], int parmcount);
+int fGetKeywordValue(FILE *fp, char *keyword, int klen, char *value, int vlen);
+int fGetToken(FILE *fp, char *dest, int maxlen);
#endif /* KPARSE_DEFS */
diff --git a/eBones/include/krb.h b/eBones/include/krb.h
index 134e0e9..70c2a80 100644
--- a/eBones/include/krb.h
+++ b/eBones/include/krb.h
@@ -6,7 +6,7 @@
* Include file for the Kerberos library.
*
* from: krb.h,v 4.26 89/08/08 17:55:25 jtkohl Exp $
- * $Id: krb.h,v 1.3 1995/08/25 22:50:15 markm Exp $
+ * $Id: krb.h,v 1.6 1995/08/25 21:25:10 mark Exp $
*/
/* Only one time, please */
@@ -375,71 +375,128 @@ char *tkt_string();
#define KOPT_DO_OLDSTYLE 0x00000008 /* use the old-style protocol */
#endif ATHENA_COMPAT
-void acl_canonicalize_principal(char *principal, char *buf);
-int acl_check(char *acl, char *principal);
-int acl_exact_match(char *acl, char *principal);
-int acl_add(char *acl, char *principal);
-int acl_delete(char *acl, char *principal);
-int acl_initialize(char *acl_file, int mode);
+/* libacl */
+void acl_canonicalize_principal __P((char *principal, char *buf));
+int acl_check __P((char *acl, char *principal));
+int acl_exact_match __P((char *acl, char *principal));
+int acl_add __P((char *acl, char *principal));
+int acl_delete __P((char *acl, char *principal));
+int acl_initialize __P((char *acl_file, int mode));
-int krb_mk_req(KTEXT authent, char *service, char *instance, char *realm,
+/* libkrb - krb.3 */
+int krb_mk_req __P((KTEXT authent, char *service, char *instance, char *realm,
long checksum);
-int krb_rd_req (KTEXT authent, char *service, char *instance, long from_addr,
- AUTH_DAT *ad, char *fn);
-int krb_kntoln(AUTH_DAT *ad, char *lname);
-int krb_set_key(char *key, int cvt);
-int krb_get_cred(char *service, char *instance, char *realm, CREDENTIALS *c);
-long krb_mk_priv(u_char *in, u_char *out, u_long in_length,
+int krb_rd_req __P((KTEXT authent, char *service, char *instance,
+ long from_addr, AUTH_DAT *ad, char *fn));
+int krb_kntoln __P((AUTH_DAT *ad, char *lname));
+int krb_set_key __P((char *key, int cvt));
+int krb_get_cred __P((char *service, char *instance, char *realm,
+ CREDENTIALS *c));
+long krb_mk_priv __P((u_char *in, u_char *out, u_long in_length,
des_key_schedule schedule, des_cblock key, struct sockaddr_in *sender,
- struct sockaddr_in *receiver);
-long krb_rd_priv(u_char *in, u_long in_length, Key_schedule schedule,
+ struct sockaddr_in *receiver));
+long krb_rd_priv __P((u_char *in, u_long in_length, Key_schedule schedule,
des_cblock key, struct sockaddr_in *sender, struct sockaddr_in *receiver,
- MSG_DAT *msg_data);
-long krb_mk_safe(u_char *in, u_char *out, u_long in_length, des_cblock key,
- struct sockaddr_in *sender, struct sockaddr_in *receiver);
-long krb_rd_safe(u_char *in, u_long length, des_cblock key,
+ MSG_DAT *msg_data));
+long krb_mk_safe __P((u_char *in, u_char *out, u_long in_length,
+ des_cblock *key, struct sockaddr_in *sender, struct sockaddr_in *receiver));
+long krb_rd_safe __P((u_char *in, u_long length, des_cblock *key,
struct sockaddr_in *sender, struct sockaddr_in *receiver,
- MSG_DAT *msg_data);
-long krb_mk_err(u_char *out, long code, char *string);
-int krb_rd_err(u_char *in, u_long in_length, long *code, MSG_DAT *m_data);
-
-int krb_get_lrealm(char *r, int n);
-char *krb_get_phost(char *alias);
-int krb_get_krbhst(char *h, char *r, int n);
-int krb_get_admhst(char *h, char *r, int n);
-int krb_net_write(int fd, char *buf, int len);
-int krb_net_read(int fd, char *buf, int len);
-int krb_get_tf_realm(char *ticket_file, char *realm);
-int krb_get_in_tkt(char *user, char *instance, char *realm, char *service,
+ MSG_DAT *msg_data));
+long krb_mk_err __P((u_char *out, long code, char *string));
+int krb_rd_err __P((u_char *in, u_long in_length, long *code, MSG_DAT *m_data));
+
+/* libkrb - krb_sendauth.3 */
+int krb_sendauth __P((long options, int fd, KTEXT ticket, char *service,
+ char *inst, char *realm, u_long checksum, MSG_DAT *msg_data,
+ CREDENTIALS *cred, Key_schedule schedule, struct sockaddr_in *laddr,
+ struct sockaddr_in *faddr, char *version));
+int krb_recvauth __P((long options, int fd, KTEXT ticket, char *service,
+ char *instance, struct sockaddr_in *faddr, struct sockaddr_in *laddr,
+ AUTH_DAT *kdata, char *filename, Key_schedule schedule, char *version));
+int krb_net_write __P((int fd, char *buf, int len));
+int krb_net_read __P((int fd, char *buf, int len));
+
+/* libkrb - krb_realmofhost.3 */
+char *krb_realmofhost __P((char *host));
+char *krb_get_phost __P((char *alias));
+int krb_get_krbhst __P((char *h, char *r, int n));
+int krb_get_admhst __P((char *h, char *r, int n));
+int krb_get_lrealm __P((char *r, int n));
+
+/* libkrb - krb_set_tkt_string.3 */
+void krb_set_tkt_string(char *val);
+
+/* libkrb - kuserok.3 */
+int kuserok __P((AUTH_DAT *authdata, char *localuser));
+
+/* libkrb - tf_util.3 */
+int tf_init __P((char *tf_name, int rw));
+int tf_get_pname __P((char *p));
+int tf_get_pinst __P((char *inst));
+int tf_get_cred __P((CREDENTIALS *c));
+void tf_close __P((void));
+
+/* Internal routines */
+int des_read __P((int fd, char *buf, int len));
+int des_write __P((int fd, char *buf, int len));
+int krb_get_tf_realm __P((char *ticket_file, char *realm));
+int krb_get_in_tkt __P((char *user, char *instance, char *realm, char *service,
char *sinstance, int life, int (*key_proc)(), int (*decrypt_proc)(),
- char *arg);
-int krb_get_pw_in_tkt(char *user, char *instance, char *realm, char *service,
- char *sinstance, int life, char *password);
-int krb_get_tf_fullname(char *ticket_file, char *name, char *instance,
- char *realm);
-int save_credentials(char *service, char *instance, char *realm,
- des_cblock session, int lifetime, int kvno, KTEXT ticket, long issue_date);
-int read_service_key(char *service, char *instance, char *realm, int kvno,
- char *file, char *key);
-int get_ad_tkt(char *service, char *sinstance, char *realm, int lifetime);
-int send_to_kdc(KTEXT pkt, KTEXT rpkt, char *realm);
-int decomp_ticket(KTEXT tkt, unsigned char *flags, char *pname,
+ char *arg));
+int krb_get_pw_in_tkt __P((char *user, char *instance, char *realm,
+ char *service, char *sinstance, int life, char *password));
+int krb_get_svc_in_tkt __P((char *user, char *instance, char *realm,
+ char *service, char *sinstance, int life, char *srvtab));
+int krb_get_tf_fullname __P((char *ticket_file, char *name, char *instance,
+ char *realm));
+int save_credentials __P((char *service, char *instance, char *realm,
+ des_cblock session, int lifetime, int kvno, KTEXT ticket, long issue_date));
+int read_service_key __P((char *service, char *instance, char *realm, int kvno,
+ char *file, char *key));
+int get_ad_tkt __P((char *service, char *sinstance, char *realm, int lifetime));
+int send_to_kdc __P((KTEXT pkt, KTEXT rpkt, char *realm));
+int krb_create_ticket __P((KTEXT tkt, unsigned char flags, char *pname,
+ char *pinstance, char *prealm, long paddress, char *session, short life,
+ long time_sec, char *sname, char *sinstance, C_Block key));
+int decomp_ticket __P((KTEXT tkt, unsigned char *flags, char *pname,
char *pinstance, char *prealm, unsigned long *paddress, des_cblock session,
int *life, unsigned long *time_sec, char *sname, char *sinstance,
- des_cblock key, des_key_schedule key_s);
-int kname_parse(char *np, char *ip, char *rp, char *fullname);
-int tf_init(char *tf_name, int rw);
-int tf_save_cred(char *service, char *instance, char *realm,
- des_cblock session, int lifetime, int kvno, KTEXT ticket, long issue_date);
-int tf_get_pname(char *p);
-int tf_get_pinst(char *inst);
-int tf_get_cred(CREDENTIALS *c);
-void tf_close(void);
-int getst(int fd, char *s, int n);
-int pkt_clen(KTEXT pkt);
-int in_tkt(char *pname, char *pinst);
-char *month_sname(int n);
-void log(); /* Actually VARARGS - markm */
+ des_cblock key, des_key_schedule key_s));
+int create_ciph __P((KTEXT c, C_Block session, char *service, char *instance,
+ char *realm, unsigned long life, int kvno, KTEXT tkt,
+ unsigned long kdc_time, C_Block key));
+int kname_parse __P((char *np, char *ip, char *rp, char *fullname));
+int tf_save_cred __P((char *service, char *instance, char *realm,
+ des_cblock session, int lifetime, int kvno, KTEXT ticket, long issue_date));
+int getst(int fd, char *s, int n));
+int pkt_clen __P((KTEXT pkt));
+int in_tkt __P((char *pname, char *pinst));
+int dest_tkt __P((void));
+char *month_sname __P((int n));
+void log __P(()); /* Actually VARARGS - markm */
+void kset_logfile __P((char *filename));
+void set_logfile __P((char *filename));
+int k_isinst __P((char *s));
+int k_isrealm __P((char *s));
+int k_isname __P((char *s));
+int k_gethostname __P((char *name, int namelen));
+int kerb_init __P((void));
+void kerb_fini __P((void));
+int kerb_db_set_name __P((char *name));
+int kerb_db_set_lockmode __P((int mode));
+int kerb_db_create __P((char *db_name));
+int kerb_db_iterate __P((int (*func)(), char *arg));
+int kerb_db_rename __P((char *from, char *to));
+long kerb_get_db_age __P((void));
+char * stime __P((long *t));
+
+long kdb_get_master_key __P((int prompt, C_Block master_key,
+ Key_schedule master_key_sched));
+long kdb_verify_master_key __P((C_Block master_key,
+ Key_schedule master_key_sched, FILE *out));
+void kdb_encrypt_key __P((C_Block in, C_Block out, C_Block master_key,
+ Key_schedule master_key_sched, int e_d_flag));
extern int krb_ap_req_debug;
extern int krb_debug;
diff --git a/eBones/include/krb_db.h b/eBones/include/krb_db.h
index f7e6d57..d6d125a 100644
--- a/eBones/include/krb_db.h
+++ b/eBones/include/krb_db.h
@@ -11,7 +11,7 @@
* They MUST correspond to those defined in *.rel
*
* from: krb_db.h,v 4.9 89/01/24 17:55:39 jon Exp $
- * $Id: krb_db.h,v 1.3 1995/07/18 16:36:38 mark Exp $
+ * $Id: krb_db.h,v 1.4 1995/08/25 21:25:12 mark Exp $
*/
#ifndef KRB_DB_DEFS
diff --git a/eBones/kadmin/Makefile b/eBones/kadmin/Makefile
index d7cf0a3..8eae179 100644
--- a/eBones/kadmin/Makefile
+++ b/eBones/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/kadmin/kadmin.c b/eBones/kadmin/kadmin.c
index 56f03d0..fd98428 100644
--- a/eBones/kadmin/kadmin.c
+++ b/eBones/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/kadmind/Makefile b/eBones/kadmind/Makefile
index 620ab81..f2e0357 100644
--- a/eBones/kadmind/Makefile
+++ b/eBones/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/kadmind/admin_server.c b/eBones/kadmind/admin_server.c
index ce36eb6..72980d4 100644
--- a/eBones/kadmind/admin_server.c
+++ b/eBones/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/kadmind/kadm_funcs.c b/eBones/kadmind/kadm_funcs.c
index 4ed2365..b8ddaa0 100644
--- a/eBones/kadmind/kadm_funcs.c
+++ b/eBones/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/kadmind/kadm_ser_wrap.c b/eBones/kadmind/kadm_ser_wrap.c
index 23664d4..0fa1ace 100644
--- a/eBones/kadmind/kadm_ser_wrap.c
+++ b/eBones/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/kadmind/kadm_server.c b/eBones/kadmind/kadm_server.c
index 25a58be..c6cbc6a 100644
--- a/eBones/kadmind/kadm_server.c
+++ b/eBones/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/kadmind/kadm_server.h b/eBones/kadmind/kadm_server.h
index 2d6f8bf..1708107 100644
--- a/eBones/kadmind/kadm_server.h
+++ b/eBones/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/kdb/krb_cache.c b/eBones/kdb/krb_cache.c
index 0dafb140..1c7c9ce 100644
--- a/eBones/kdb/krb_cache.c
+++ b/eBones/kdb/krb_cache.c
@@ -49,21 +49,21 @@ kerb_cache_init()
*/
int
-kerb_cache_get_principal(char *serv, char *inst, Principal *principal,
- unsigned int max)
+kerb_cache_get_principal(serv, inst, principal, max)
+ char *serv; /* could have wild card */
+ char *inst; /* could have wild card */
+ Principal *principal;
+ unsigned int max; /* max number of name structs to return */
+
{
int found = 0;
if (!init)
kerb_cache_init();
#ifdef DEBUG
- if (kerb_debug & 2)
+ if (kerb_debug & 2) {
fprintf(stderr, "cache_get_principal for %s %s max = %d\n",
serv, inst, max);
-#endif DEBUG
-
-#ifdef DEBUG
- if (kerb_debug & 2) {
if (found) {
fprintf(stderr, "cache get %s %s found %s %s\n",
serv, inst, principal->name, principal->instance);
@@ -82,7 +82,11 @@ kerb_cache_get_principal(char *serv, char *inst, Principal *principal,
*/
int
-kerb_cache_put_principal(Principal *principal, unsigned int max)
+kerb_cache_put_principal(principal, max)
+ Principal *principal;
+ unsigned int max; /* max number of principal structs to
+ * insert */
+
{
u_long i;
int count = 0;
@@ -115,7 +119,12 @@ kerb_cache_put_principal(Principal *principal, unsigned int max)
*/
int
-kerb_cache_get_dba(char *serv, char *inst, Dba *dba, unsigned int max)
+kerb_cache_get_dba(serv, inst, dba, max)
+ char *serv; /* could have wild card */
+ char *inst; /* could have wild card */
+ Dba *dba;
+ unsigned int max; /* max number of name structs to return */
+
{
int found = 0;
@@ -123,13 +132,9 @@ kerb_cache_get_dba(char *serv, char *inst, Dba *dba, unsigned int max)
kerb_cache_init();
#ifdef DEBUG
- if (kerb_debug & 2)
+ if (kerb_debug & 2) {
fprintf(stderr, "cache_get_dba for %s %s max = %d\n",
serv, inst, max);
-#endif
-
-#ifdef DEBUG
- if (kerb_debug & 2) {
if (found) {
fprintf(stderr, "cache get %s %s found %s %s\n",
serv, inst, dba->name, dba->instance);
@@ -146,7 +151,10 @@ kerb_cache_get_dba(char *serv, char *inst, Dba *dba, unsigned int max)
*/
int
-kerb_cache_put_dba(Dba *dba, unsigned int max)
+kerb_cache_put_dba(dba, max)
+ Dba *dba;
+ unsigned int max; /* max number of dba structs to insert */
+
{
u_long i;
int count = 0;
@@ -170,3 +178,4 @@ kerb_cache_put_dba(Dba *dba, unsigned int max)
}
return count;
}
+
diff --git a/eBones/kdb/krb_dbm.c b/eBones/kdb/krb_dbm.c
index 68f428b..760bd6f 100644
--- a/eBones/kdb/krb_dbm.c
+++ b/eBones/kdb/krb_dbm.c
@@ -6,7 +6,7 @@
* from: krb_dbm.c,v 4.9 89/04/18 16:15:13 wesommer Exp $
* $Id: krb_dbm.c,v 1.4 1995/08/03 17:15:42 mark Exp $
*/
-
+
#if 0
#ifndef lint
static char rcsid[] =
@@ -15,16 +15,16 @@ static char rcsid[] =
#endif
#if defined(__FreeBSD__) || defined(__NetBSD__)
-#define NDBM_
+#define _NDBM_
#endif
#if defined(__FreeBSD__) || defined(__NetBSD__)
-#define DBM_
+#define _DBM_
#endif
+#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/uio.h>
@@ -35,17 +35,17 @@ static char rcsid[] =
#include <strings.h>
#include <des.h>
#include <sys/file.h>
-#ifdef NDBM_
+#ifdef _NDBM_
#include <ndbm.h>
-#else /*NDBM_*/
+#else /*_NDBM_*/
#include <dbm.h>
-#endif /*NDBM_*/
+#endif /*_NDBM_*/
/* before krb_db.h */
#include <krb.h>
#include <krb_db.h>
#ifdef dbm_pagfno
-#define DBM_
+#define DB
#endif
#define KERB_DB_MAX_RETRY 5
@@ -56,14 +56,18 @@ extern long kerb_debug;
extern char *progname;
#endif
-static init = 0;
+static init = 0;
static char default_db_name[] = DBM_FILE;
static char *current_db_name = default_db_name;
-static void encode_princ_key(), decode_princ_key();
-static void encode_princ_contents(), decode_princ_contents();
-static void kerb_dbl_fini();
-static int kerb_dbl_lock();
-static void kerb_dbl_unlock();
+static void encode_princ_key(datum *key, char *name, char *instance);
+static void decode_princ_key(datum *key, char *name, char *instance);
+static void encode_princ_contents(datum *contents, Principal *principal);
+static void decode_princ_contents(datum *contents, Principal *principal);
+static void kerb_dbl_fini(void);
+static int kerb_dbl_lock(int mode);
+static void kerb_dbl_unlock(void);
+static long kerb_start_update(char *db_name);
+static long kerb_end_update(char *db_name, long age);
static struct timeval timestamp;/* current time of request */
static int non_blocking = 0;
@@ -128,7 +132,7 @@ static int non_blocking = 0;
* Instead, all routines call "dbm_next" instead.
*/
-#ifndef NDBM_
+#ifndef _NDBM_
typedef char DBM;
#define dbm_open(file, flags, mode) ((dbminit(file) == 0)?"":((char *)0))
@@ -145,7 +149,9 @@ typedef char DBM;
* Utility routine: generate name of database file.
*/
-static char *gen_dbsuffix(char *db_name, char *sfx)
+static char *gen_dbsuffix(db_name, sfx)
+ char *db_name;
+ char *sfx;
{
char *dbsuffix;
@@ -162,7 +168,8 @@ static char *gen_dbsuffix(char *db_name, char *sfx)
* initialization for data base routines.
*/
-int kerb_db_init()
+int
+kerb_db_init()
{
init = 1;
return (0);
@@ -173,7 +180,8 @@ int kerb_db_init()
* a kerb_db_init
*/
-void kerb_db_fini()
+void
+kerb_db_fini()
{
}
@@ -184,7 +192,9 @@ void kerb_db_fini()
* If the alternate database doesn't exist, nothing is changed.
*/
-int kerb_db_set_name(char *name)
+int
+kerb_db_set_name(name)
+ char *name;
{
DBM *db;
@@ -203,7 +213,8 @@ int kerb_db_set_name(char *name)
* Return the last modification time of the database.
*/
-long kerb_get_db_age()
+long
+kerb_get_db_age()
{
struct stat st;
char *okname;
@@ -228,7 +239,9 @@ long kerb_get_db_age()
* the server (for example, during slave updates).
*/
-static long kerb_start_update(char *db_name)
+static long
+kerb_start_update(db_name)
+ char *db_name;
{
char *okname = gen_dbsuffix(db_name, ".ok");
long age = kerb_get_db_age();
@@ -241,7 +254,10 @@ static long kerb_start_update(char *db_name)
return age;
}
-static long kerb_end_update(char *db_name, long age)
+static long
+kerb_end_update(db_name, age)
+ char *db_name;
+ long age;
{
int fd;
int retval = 0;
@@ -276,12 +292,15 @@ static long kerb_end_update(char *db_name, long age)
return retval;
}
-static long kerb_start_read()
+static long
+kerb_start_read()
{
return kerb_get_db_age();
}
-static long kerb_end_read(u_long age)
+static long
+kerb_end_read(age)
+ u_long age;
{
if (kerb_get_db_age() != age || age == -1) {
return -1;
@@ -293,12 +312,14 @@ static long kerb_end_read(u_long age)
* Create the database, assuming it's not there.
*/
-int kerb_db_create(char *db_name)
+int
+kerb_db_create(db_name)
+ char *db_name;
{
char *okname = gen_dbsuffix(db_name, ".ok");
int fd;
register int ret = 0;
-#ifdef NDBM_
+#ifdef _NDBM_
DBM *db;
db = dbm_open(db_name, O_RDWR|O_CREAT|O_EXCL, 0600);
@@ -341,10 +362,12 @@ int kerb_db_create(char *db_name)
* necessarily know to complete the transaction the rename, but...
*/
-int kerb_db_rename(char *from, char *to)
+int
+kerb_db_rename(from, to)
+ char *from;
+ char *to;
{
- int ok = 0;
-#ifdef DBM_
+#ifdef _DBM_
char *fromdb = gen_dbsuffix (from, ".db");
char *todb = gen_dbsuffix (to, ".db");
#else
@@ -355,8 +378,9 @@ int kerb_db_rename(char *from, char *to)
#endif
char *fromok = gen_dbsuffix(from, ".ok");
long trans = kerb_start_update(to);
+ int ok = 0;
-#ifdef DBM_
+#ifdef _DBM_
if (rename (fromdb, todb) == 0) {
#else
if ((rename (fromdir, todir) == 0)
@@ -367,7 +391,7 @@ int kerb_db_rename(char *from, char *to)
}
free (fromok);
-#ifdef DBM_
+#ifdef _DBM_
free (fromdb);
free (todb);
#else
@@ -385,15 +409,16 @@ int kerb_db_rename(char *from, char *to)
/*
* look up a principal in the data base returns number of principals
* found , and whether there were more than requested.
- char *name could have wild card
- char *inst could have wild card
- Principal *principal
- unsigned int max max number of name structs to return
- int *more where there more than 'max' tuples?
*/
-int kerb_db_get_principal(char *name, char *inst, Principal *principal,
- unsigned int max, int *more)
+int
+kerb_db_get_principal(name, inst, principal, max, more)
+ char *name; /* could have wild card */
+ char *inst; /* could have wild card */
+ Principal *principal;
+ unsigned int max; /* max number of name structs to return */
+ int *more; /* where there more than 'max' tuples? */
+
{
int found = 0, code;
extern int errorproc();
@@ -491,7 +516,12 @@ int kerb_db_get_principal(char *name, char *inst, Principal *principal,
* successfully updated.
*/
-int kerb_db_put_principal(Principal *principal, unsigned int max)
+int
+kerb_db_put_principal(principal, max)
+ Principal *principal;
+ unsigned int max; /* number of principal structs to
+ * update */
+
{
int found = 0, code;
u_long i;
@@ -536,7 +566,9 @@ int kerb_db_put_principal(Principal *principal, unsigned int max)
}
static void
-encode_princ_key(datum *key, char *name, char *instance)
+encode_princ_key(key, name, instance)
+ datum *key;
+ char *name, *instance;
{
static char keystring[ANAME_SZ + INST_SZ];
@@ -548,7 +580,9 @@ encode_princ_key(datum *key, char *name, char *instance)
}
static void
-decode_princ_key(datum *key, char *name, char *instance)
+decode_princ_key(key, name, instance)
+ datum *key;
+ char *name, *instance;
{
strncpy(name, key->dptr, ANAME_SZ);
strncpy(instance, key->dptr + ANAME_SZ, INST_SZ);
@@ -557,19 +591,25 @@ decode_princ_key(datum *key, char *name, char *instance)
}
static void
-encode_princ_contents(datum *contents, Principal *principal)
+encode_princ_contents(contents, principal)
+ datum *contents;
+ Principal *principal;
{
contents->dsize = sizeof(*principal);
contents->dptr = (char *) principal;
}
static void
-decode_princ_contents(datum *contents, Principal *principal)
+decode_princ_contents(contents, principal)
+ datum *contents;
+ Principal *principal;
{
bcopy(contents->dptr, (char *) principal, sizeof(*principal));
}
-void kerb_db_get_stat(DB_stat *s)
+void
+kerb_db_get_stat(s)
+ DB_stat *s;
{
gettimeofday(&timestamp, NULL);
@@ -587,11 +627,15 @@ void kerb_db_get_stat(DB_stat *s)
/* update local copy too */
}
-void kerb_db_put_stat(DB_stat *s)
+void
+kerb_db_put_stat(s)
+ DB_stat *s;
{
}
-void delta_stat(DB_stat *a, DB_stat *b, DB_stat *c)
+void
+delta_stat(a, b, c)
+ DB_stat *a, *b, *c;
{
/* c = a - b then b = a for the next time */
@@ -614,14 +658,23 @@ void delta_stat(DB_stat *a, DB_stat *b, DB_stat *c)
* whether there were more than requested.
*/
-int kerb_db_get_dba(char *dba_name, char *dba_inst, Dba *dba, unsigned int max,
- int *more)
+int
+kerb_db_get_dba(dba_name, dba_inst, dba, max, more)
+ char *dba_name; /* could have wild card */
+ char *dba_inst; /* could have wild card */
+ Dba *dba;
+ unsigned int max; /* max number of name structs to return */
+ int *more; /* where there more than 'max' tuples? */
+
{
*more = 0;
return (0);
}
-int kerb_db_iterate (int (*func)(), char *arg)
+int
+kerb_db_iterate (func, arg)
+ int (*func)();
+ char *arg; /* void *, really */
{
datum key, contents;
Principal *principal;
@@ -650,7 +703,8 @@ static int dblfd = -1;
static int mylock = 0;
static int inited = 0;
-static int kerb_dbl_init()
+static void
+kerb_dbl_init()
{
if (!inited) {
char *filename = gen_dbsuffix (current_db_name, ".ok");
@@ -663,10 +717,10 @@ static int kerb_dbl_init()
free(filename);
inited++;
}
- return (0);
}
-static void kerb_dbl_fini()
+static void
+kerb_dbl_fini()
{
close(dblfd);
dblfd = -1;
@@ -674,7 +728,9 @@ static void kerb_dbl_fini()
mylock = 0;
}
-static int kerb_dbl_lock(int mode)
+static int
+kerb_dbl_lock(mode)
+ int mode;
{
int flock_mode;
@@ -706,7 +762,8 @@ static int kerb_dbl_lock(int mode)
return 0;
}
-static void kerb_dbl_unlock()
+static void
+kerb_dbl_unlock()
{
if (!mylock) { /* lock already unlocked */
fprintf(stderr, "Kerberos database lock not locked when unlocking.\n");
@@ -722,7 +779,9 @@ static void kerb_dbl_unlock()
mylock = 0;
}
-int kerb_db_set_lockmode(int mode)
+int
+kerb_db_set_lockmode(mode)
+ int mode;
{
int old = non_blocking;
non_blocking = mode;
diff --git a/eBones/kdb/krb_kdb_utils.c b/eBones/kdb/krb_kdb_utils.c
index 275cc39..0256348 100644
--- a/eBones/kdb/krb_kdb_utils.c
+++ b/eBones/kdb/krb_kdb_utils.c
@@ -20,17 +20,20 @@ static char rcsid[] =
#endif lint
#endif
+#include <des.h>
+#include <krb.h>
+#include <krb_db.h>
+#include <kdc.h>
#include <stdio.h>
-#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/file.h>
-#include <krb.h>
-#include <krb_db.h>
-#include <kdc.h>
-long kdb_get_master_key(int prompt, C_Block master_key,
- Key_schedule master_key_sched)
+long
+kdb_get_master_key(prompt, master_key, master_key_sched)
+ int prompt;
+ C_Block master_key;
+ Key_schedule master_key_sched;
{
int kfile;
@@ -39,7 +42,7 @@ long kdb_get_master_key(int prompt, C_Block master_key,
placebo_read_password(master_key,
"\nEnter Kerberos master key: ", 0);
#else
- des_read_password((C_Block *)master_key,
+ des_read_password((des_cblock *)master_key,
"\nEnter Kerberos master key: ", 0);
#endif
printf ("\n");
@@ -57,33 +60,21 @@ long kdb_get_master_key(int prompt, C_Block master_key,
}
#ifndef NOENCRYPTION
- key_sched((C_Block *)master_key,master_key_sched);
+ key_sched((des_cblock *)master_key,master_key_sched);
#endif
return (0);
}
-/* The old algorithm used the key schedule as the initial vector which
- was byte order depedent ... */
-
-void kdb_encrypt_key (C_Block in, C_Block out, C_Block master_key,
- Key_schedule master_key_sched, int e_d_flag)
-{
-
-#ifdef NOENCRYPTION
- bcopy(in, out, sizeof(C_Block));
-#else
- pcbc_encrypt((C_Block *)in,(C_Block *)out,(long)sizeof(C_Block),
- master_key_sched,(C_Block *)master_key, e_d_flag);
-#endif
-}
-
/* The caller is reasponsible for cleaning up the master key and sched,
even if we can't verify the master key */
/* Returns master key version if successful, otherwise -1 */
-long kdb_verify_master_key (C_Block master_key, Key_schedule master_key_sched,
- FILE *out)
+long
+kdb_verify_master_key (master_key, master_key_sched, out)
+ C_Block master_key;
+ Key_schedule master_key_sched;
+ FILE *out; /* setting this to non-null be do output */
{
C_Block key_from_db;
Principal principal_data[1];
@@ -137,3 +128,21 @@ long kdb_verify_master_key (C_Block master_key, Key_schedule master_key_sched,
return (master_key_version);
}
+
+/* The old algorithm used the key schedule as the initial vector which
+ was byte order depedent ... */
+
+void
+kdb_encrypt_key (in, out, master_key, master_key_sched, e_d_flag)
+ C_Block in, out, master_key;
+ Key_schedule master_key_sched;
+ int e_d_flag;
+{
+
+#ifdef NOENCRYPTION
+ bcopy(in, out, sizeof(C_Block));
+#else
+ pcbc_encrypt((des_cblock*)in,(des_cblock*)out,(long)sizeof(C_Block),
+ master_key_sched,(des_cblock*)master_key,e_d_flag);
+#endif
+}
diff --git a/eBones/kdb/krb_lib.c b/eBones/kdb/krb_lib.c
index 5610dbb..2cf4fb8 100644
--- a/eBones/kdb/krb_lib.c
+++ b/eBones/kdb/krb_lib.c
@@ -78,8 +78,13 @@ kerb_fini()
*/
int
-kerb_get_principal(char *name, char *inst, Principal *principal,
- unsigned int max, int *more)
+kerb_get_principal(name, inst, principal, max, more)
+ char *name; /* could have wild card */
+ char *inst; /* could have wild card */
+ Principal *principal;
+ unsigned int max; /* max number of name structs to return */
+ int *more; /* more tuples than room for */
+
{
int found = 0;
#ifdef CACHE
@@ -131,7 +136,10 @@ kerb_get_principal(char *name, char *inst, Principal *principal,
}
/* principals */
-int kerb_put_principal(Principal *principal, unsigned int n)
+int
+kerb_put_principal(principal, n)
+ Principal *principal;
+ unsigned int n; /* number of principal structs to write */
{
long time();
struct tm *tp, *localtime();
@@ -176,7 +184,13 @@ int kerb_put_principal(Principal *principal, unsigned int n)
}
int
-kerb_get_dba(char *name, char *inst, Dba *dba, unsigned int max, int *more)
+kerb_get_dba(name, inst, dba, max, more)
+ char *name; /* could have wild card */
+ char *inst; /* could have wild card */
+ Dba *dba;
+ unsigned int max; /* max number of name structs to return */
+ int *more; /* more tuples than room for */
+
{
int found = 0;
#ifdef CACHE
diff --git a/eBones/kdb/print_princ.c b/eBones/kdb/print_princ.c
index b1d1ca9..64e9106 100644
--- a/eBones/kdb/print_princ.c
+++ b/eBones/kdb/print_princ.c
@@ -15,6 +15,7 @@ static char rcsid[] =
#endif
#include <stdio.h>
+#include <time.h>
#include <sys/types.h>
#include <sys/time.h>
#include <strings.h>
@@ -26,7 +27,9 @@ extern int debug;
long kerb_debug;
static struct tm *time_p;
-void krb_print_principal(Principal *a_n)
+void
+krb_print_principal(a_n)
+ Principal *a_n;
{
/* run-time database does not contain string versions */
time_p = localtime(&(a_n->exp_date));
diff --git a/eBones/kdb_destroy/Makefile b/eBones/kdb_destroy/Makefile
index 2e8fcb9..f22f779 100644
--- a/eBones/kdb_destroy/Makefile
+++ b/eBones/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/kdb_destroy/kdb_destroy.c b/eBones/kdb_destroy/kdb_destroy.c
index b669de2..57e1a80 100644
--- a/eBones/kdb_destroy/kdb_destroy.c
+++ b/eBones/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/kdb_edit/Makefile b/eBones/kdb_edit/Makefile
index 792e7c5..a56efcf 100644
--- a/eBones/kdb_edit/Makefile
+++ b/eBones/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/kdb_edit/kdb_edit.c b/eBones/kdb_edit/kdb_edit.c
index 61cf71a..82bf9a4 100644
--- a/eBones/kdb_edit/kdb_edit.c
+++ b/eBones/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/kdb_edit/maketime.c b/eBones/kdb_edit/maketime.c
index ed485af..5e0ee00 100644
--- a/eBones/kdb_edit/maketime.c
+++ b/eBones/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/kdb_init/Makefile b/eBones/kdb_init/Makefile
index 7738312..4d6a110 100644
--- a/eBones/kdb_init/Makefile
+++ b/eBones/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/kdb_init/kdb_init.c b/eBones/kdb_init/kdb_init.c
index d48ee096..de99181 100644
--- a/eBones/kdb_init/kdb_init.c
+++ b/eBones/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/kdb_util/Makefile b/eBones/kdb_util/Makefile
index bffeb51..134fd34 100644
--- a/eBones/kdb_util/Makefile
+++ b/eBones/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/kdb_util/kdb_util.c b/eBones/kdb_util/kdb_util.c
index 140e211..5dbe509 100644
--- a/eBones/kdb_util/kdb_util.c
+++ b/eBones/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/kdestroy/Makefile b/eBones/kdestroy/Makefile
index 2a79774..1e4da0a 100644
--- a/eBones/kdestroy/Makefile
+++ b/eBones/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/kdestroy/kdestroy.c b/eBones/kdestroy/kdestroy.c
index c64a731..926eea5 100644
--- a/eBones/kdestroy/kdestroy.c
+++ b/eBones/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/kerberos/Makefile b/eBones/kerberos/Makefile
index bd3d89f..7db860e 100644
--- a/eBones/kerberos/Makefile
+++ b/eBones/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/kerberos/cr_err_reply.c b/eBones/kerberos/cr_err_reply.c
index 924a98f..89ee5f6 100644
--- a/eBones/kerberos/cr_err_reply.c
+++ b/eBones/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/kerberos/kerberos.c b/eBones/kerberos/kerberos.c
index d0ce795..236bbbd 100644
--- a/eBones/kerberos/kerberos.c
+++ b/eBones/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/kinit/Makefile b/eBones/kinit/Makefile
index 24f1a95..884f37d 100644
--- a/eBones/kinit/Makefile
+++ b/eBones/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/kinit/kinit.c b/eBones/kinit/kinit.c
index 6cde305..3b47c7c 100644
--- a/eBones/kinit/kinit.c
+++ b/eBones/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/klist/Makefile b/eBones/klist/Makefile
index b5ec669..c24800b 100644
--- a/eBones/klist/Makefile
+++ b/eBones/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/klist/klist.c b/eBones/klist/klist.c
index 29e6453..0927dcb 100644
--- a/eBones/klist/klist.c
+++ b/eBones/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/kprop/Makefile b/eBones/kprop/Makefile
index fa70067..636eaa4 100644
--- a/eBones/kprop/Makefile
+++ b/eBones/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/kprop/kprop.c b/eBones/kprop/kprop.c
index cde1cce..23bb893 100644
--- a/eBones/kprop/kprop.c
+++ b/eBones/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/kpropd/Makefile b/eBones/kpropd/Makefile
index 8cc6673..59d7914 100644
--- a/eBones/kpropd/Makefile
+++ b/eBones/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/kpropd/kpropd.c b/eBones/kpropd/kpropd.c
index 037d913..1b232df 100644
--- a/eBones/kpropd/kpropd.c
+++ b/eBones/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/krb/Makefile b/eBones/krb/Makefile
index 10ef4ba..b09b96b 100644
--- a/eBones/krb/Makefile
+++ b/eBones/krb/Makefile
@@ -31,4 +31,26 @@ beforeinstall:
install -c -o ${BINOWN} -g ${BINGRP} -m 444 krb_err.h \
${DESTDIR}/usr/include/kerberosIV
+MAN3= krb.3 krb_realmofhost.3 krb_sendauth.3 krb_set_tkt_string.3 \
+ kuserok.3 tf_util.3
+
+MLINKS= krb.3 krb_mk_req.3 krb.3 krb_rd_req.3 krb.3 krb_kntoln.3 \
+ krb.3 krb_set_key.3 krb.3 krb_get_cred.3 krb.3 krb_mk_priv.3 \
+ krb.3 krb_rd_priv.3 krb.3 krb_mk_safe.3 krb.3 krb_rd_safe.3 \
+ krb.3 krb_mk_err.3 krb.3 krb_rd_err.3 krb.3 krb_ck_repl.3
+
+MLINKS+=krb_realmofhost.3 krb_get_phost.3 krb_realmofhost.3 krb_get_krbhst.3 \
+ krb_realmofhost.3 krb_get_admhst.3 krb_realmofhost.3 krb_get_lrealm.3
+
+MLINKS+=krb_realmofhost.3 realm.3
+
+MLINKS+=krb_sendauth.3 krb_recvauth.3 krb_sendauth.3 krb_net_write.3 \
+ krb_sendauth.3 krb_net_read.3
+
+MLINKS+=krb_sendauth.3 ksend.3
+
+MLINKS+=tf_util.3 tf_init.3 tf_util.3 tf_get_pname.3 \
+ tf_util.3 tf_get_pinst.3 tf_util.3 tf_get_cred.3 \
+ tf_util.3 tf_close.3
+
.include <bsd.lib.mk>
diff --git a/eBones/krb/add_ticket.c b/eBones/krb/add_ticket.c
index bec7cd8..14ef47c 100644
--- a/eBones/krb/add_ticket.c
+++ b/eBones/krb/add_ticket.c
@@ -46,6 +46,7 @@ static char rcsid[] =
/* XXX they aren't all used; to avoid incompatible changes we will
* fool lint for the moment */
/*ARGSUSED */
+int
add_ticket(cipher,n,session,lifetime,sname,instance,realm,kvno,ticket)
KTEXT cipher; /* Ciphertext info for ticket */
char *sname; /* Service name */
diff --git a/eBones/krb/create_auth_reply.c b/eBones/krb/create_auth_reply.c
index ea3afd6..e304b17 100644
--- a/eBones/krb/create_auth_reply.c
+++ b/eBones/krb/create_auth_reply.c
@@ -15,7 +15,6 @@ static char *rcsid =
#endif /* lint */
#endif
-#include <stdio.h>
#include <krb.h>
#include <prot.h>
#include <strings.h>
diff --git a/eBones/krb/create_ciph.c b/eBones/krb/create_ciph.c
index a383604..7fb93e3 100644
--- a/eBones/krb/create_ciph.c
+++ b/eBones/krb/create_ciph.c
@@ -56,9 +56,19 @@ static char *rcsid =
*
*/
-int create_ciph(KTEXT c, des_cblock session, char *service, char *instance,
- char *realm, unsigned long life, int kvno, KTEXT tkt,
- unsigned long kdc_time, des_cblock key)
+int
+create_ciph(c, session, service, instance, realm, life, kvno, tkt,
+ kdc_time, key)
+ KTEXT c; /* Text block to hold ciphertext */
+ C_Block session; /* Session key to send to user */
+ char *service; /* Service name on ticket */
+ char *instance; /* Instance name on ticket */
+ char *realm; /* Realm of this KDC */
+ unsigned long life; /* Lifetime of the ticket */
+ int kvno; /* Key version number for service */
+ KTEXT tkt; /* The ticket for the service */
+ unsigned long kdc_time; /* KDC time */
+ C_Block key; /* Key to encrypt ciphertext with */
{
char *ptr;
Key_schedule key_s;
@@ -93,9 +103,9 @@ int create_ciph(KTEXT c, des_cblock session, char *service, char *instance,
c->length = (((ptr - (char *) c->dat) + 7) / 8) * 8;
#ifndef NOENCRYPTION
- key_sched((des_cblock *)key,key_s);
- pcbc_encrypt((des_cblock *)c->dat,(des_cblock *)c->dat,(long) c->length,
- key_s,(des_cblock *)key,ENCRYPT);
+ key_sched((C_Block *)key,key_s);
+ pcbc_encrypt((C_Block *)c->dat,(C_Block *)c->dat,(long) c->length,key_s,
+ (C_Block *)key,ENCRYPT);
#endif /* NOENCRYPTION */
return(KSUCCESS);
diff --git a/eBones/krb/create_ticket.c b/eBones/krb/create_ticket.c
index 264d1ac..e1d6974 100644
--- a/eBones/krb/create_ticket.c
+++ b/eBones/krb/create_ticket.c
@@ -70,9 +70,20 @@ static char rcsid[] =
*
*/
-int krb_create_ticket(KTEXT tkt, unsigned char flags, char *pname,
- char *pinstance, char *prealm, long paddress, char *session, short life,
- long time_sec, char *sname, char *sinstance, des_cblock key)
+int krb_create_ticket(tkt, flags, pname, pinstance, prealm, paddress,
+ session, life, time_sec, sname, sinstance, key)
+ KTEXT tkt; /* Gets filled in by the ticket */
+ unsigned char flags; /* Various Kerberos flags */
+ char *pname; /* Principal's name */
+ char *pinstance; /* Principal's instance */
+ char *prealm; /* Principal's authentication domain */
+ long paddress; /* Net address of requesting entity */
+ char *session; /* Session key inserted in ticket */
+ short life; /* Lifetime of the ticket */
+ long time_sec; /* Issue time and date */
+ char *sname; /* Service Name */
+ char *sinstance; /* Instance Name */
+ C_Block key; /* Service's secret key */
{
Key_schedule key_s;
register char *data; /* running index into ticket */
@@ -113,9 +124,9 @@ int krb_create_ticket(KTEXT tkt, unsigned char flags, char *pname,
}
#ifndef NOENCRYPTION
- key_sched((des_cblock *)key,key_s);
- pcbc_encrypt((des_cblock *)tkt->dat,(des_cblock *)tkt->dat,
- (long)tkt->length,key_s,(des_cblock *)key,ENCRYPT);
+ key_sched((C_Block *)key,key_s);
+ pcbc_encrypt((C_Block *)tkt->dat,(C_Block *)tkt->dat,(long)tkt->length,
+ key_s,(C_Block *)key,ENCRYPT);
#endif
return 0;
}
diff --git a/eBones/krb/decomp_ticket.c b/eBones/krb/decomp_ticket.c
index ab46450..04316ad 100644
--- a/eBones/krb/decomp_ticket.c
+++ b/eBones/krb/decomp_ticket.c
@@ -46,18 +46,32 @@ static char *rcsid =
* See create_ticket.c for the format of the ticket packet.
*/
-int decomp_ticket(KTEXT tkt, unsigned char *flags, char *pname,
- char *pinstance, char *prealm, unsigned long *paddress, des_cblock session,
- int *life, unsigned long *time_sec, char *sname, char *sinstance,
- des_cblock key, des_key_schedule key_s)
+int
+decomp_ticket(tkt, flags, pname, pinstance, prealm, paddress, session,
+ life, time_sec, sname, sinstance, key, key_s)
+ KTEXT tkt; /* The ticket to be decoded */
+ unsigned char *flags; /* Kerberos ticket flags */
+ char *pname; /* Authentication name */
+ char *pinstance; /* Principal's instance */
+ char *prealm; /* Principal's authentication domain */
+ unsigned long *paddress; /* Net address of entity
+ * requesting ticket */
+ C_Block session; /* Session key inserted in ticket */
+ int *life; /* Lifetime of the ticket */
+ unsigned long *time_sec; /* Issue time and date */
+ char *sname; /* Service name */
+ char *sinstance; /* Service instance */
+ C_Block key; /* Service's secret key
+ * (to decrypt the ticket) */
+ Key_schedule key_s; /* The precomputed key schedule */
{
static int tkt_swap_bytes;
unsigned char *uptr;
char *ptr = (char *)tkt->dat;
#ifndef NOENCRYPTION
- pcbc_encrypt((des_cblock *)tkt->dat,(des_cblock *)tkt->dat,
- (long)tkt->length,key_s,(des_cblock *)key,DECRYPT);
+ pcbc_encrypt((C_Block *)tkt->dat,(C_Block *)tkt->dat,(long)tkt->length,
+ key_s,(C_Block *)key,DECRYPT);
#endif /* ! NOENCRYPTION */
*flags = *ptr; /* get flags byte */
diff --git a/eBones/krb/des_rw.c b/eBones/krb/des_rw.c
index 774e62b..5b339ee 100644
--- a/eBones/krb/des_rw.c
+++ b/eBones/krb/des_rw.c
@@ -1,4 +1,4 @@
-/* -
+/*
* Copyright (c) 1994 Geoffrey M. Rehmet, Rhodes University
* All rights reserved.
*
@@ -100,10 +100,10 @@
#include <sys/param.h>
#include <sys/types.h>
-#include <krb.h>
#include <des.h>
+#include <krb.h>
-static bit_64 des_key;
+static des_cblock des_key;
static des_key_schedule key_schedule;
/*
@@ -120,10 +120,15 @@ static u_char *buff_ptr = buffer;
* inkey is the initial vector for the DES encryption, while insched is
* the DES key, in unwrapped form.
*/
-void des_set_key(bit_64 *inkey, u_char *insched)
+
+int
+des_set_key(inkey, insched)
+ des_cblock *inkey;
+ des_key_schedule insched;
{
- bcopy(inkey, &des_key, sizeof(bit_64));
+ bcopy(inkey, des_key, sizeof(des_cblock));
bcopy(insched, &key_schedule, sizeof(des_key_schedule));
+ return 0;
}
/*
@@ -136,7 +141,11 @@ void des_clear_key()
bzero(&key_schedule, sizeof(des_key_schedule));
}
-int des_read(int fd, char *buf, int len)
+int
+des_read(fd, buf, len)
+ int fd;
+ register char * buf;
+ int len;
{
int msg_length; /* length of actual message data */
int pad_length; /* length of padded message */
@@ -161,7 +170,7 @@ int des_read(int fd, char *buf, int len)
}
}
- nread = krb_net_read(fd,(char *)&msg_length, sizeof(msg_length));
+ nread = krb_net_read(fd, (char *)&msg_length, sizeof(msg_length));
if(nread != (int)(sizeof(msg_length)))
return(0);
@@ -200,7 +209,11 @@ int des_read(int fd, char *buf, int len)
* Write a message onto a file descriptor (generally a socket), using
* DES to encrypt the message.
*/
-int des_write(int fd, char *buf, int len)
+int
+des_write(fd, buf, len)
+ int fd;
+ char * buf;
+ int len;
{
static int seeded = 0;
char garbage[8];
diff --git a/eBones/krb/dest_tkt.c b/eBones/krb/dest_tkt.c
index 6e6082e..df04be0 100644
--- a/eBones/krb/dest_tkt.c
+++ b/eBones/krb/dest_tkt.c
@@ -15,10 +15,9 @@ static char *rcsid =
#endif /* lint */
#endif
+#include <unistd.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <krb.h>
#include <sys/file.h>
#include <sys/types.h>
@@ -37,7 +36,8 @@ static char *rcsid =
* The ticket file (TKT_FILE) is defined in "krb.h".
*/
-int dest_tkt()
+int
+dest_tkt()
{
char *file = TKT_FILE;
int i,fd;
diff --git a/eBones/krb/extract_ticket.c b/eBones/krb/extract_ticket.c
index 97e8432..8ad3097 100644
--- a/eBones/krb/extract_ticket.c
+++ b/eBones/krb/extract_ticket.c
@@ -27,8 +27,15 @@ static char *rcsid =
* session, liftime and kvno.
*/
-void extract_ticket(KTEXT cipher, int n, char *session, int *lifetime,
- int *kvno, char *realm, KTEXT ticket)
+void
+extract_ticket(cipher,n,session,lifetime,kvno,realm,ticket)
+ KTEXT cipher; /* The ciphertext */
+ int n; /* Which ticket */
+ char *session; /* The session key for this tkt */
+ int *lifetime; /* The life of this ticket */
+ int *kvno; /* The kvno for the service */
+ char *realm; /* Realm in which tkt issued */
+ KTEXT ticket; /* The ticket itself */
{
char *ptr;
int i;
diff --git a/eBones/krb/fgetst.c b/eBones/krb/fgetst.c
index 4c6a364..796caca 100644
--- a/eBones/krb/fgetst.c
+++ b/eBones/krb/fgetst.c
@@ -25,9 +25,13 @@ static char rcsid[] =
* returns the number of characters read, including the null terminator.
*/
-int fgetst(FILE *f, char *s, int n)
+int
+fgetst(f, s, n)
+ FILE *f;
+ register char *s;
+ int n;
{
- register count = n;
+ register int count = n;
int ch; /* NOT char; otherwise you don't see EOF */
while ((ch = getc(f)) != EOF && ch && --count) {
diff --git a/eBones/krb/get_ad_tkt.c b/eBones/krb/get_ad_tkt.c
index ad76a4f..f96644a 100644
--- a/eBones/krb/get_ad_tkt.c
+++ b/eBones/krb/get_ad_tkt.c
@@ -27,6 +27,8 @@ static char rcsid[] =
#include <sys/time.h>
#include <sys/types.h>
+extern int krb_debug;
+
struct timeval tt_local = { 0, 0 };
int swap_bytes;
@@ -65,7 +67,12 @@ unsigned long rep_err_code;
* extraction macros like pkt_version(), pkt_msg_type(), etc.
*/
-int get_ad_tkt(char *service, char *sinstance, char *realm, int lifetime)
+int
+get_ad_tkt(service,sinstance,realm,lifetime)
+ char *service;
+ char *sinstance;
+ char *realm;
+ int lifetime;
{
static KTEXT_ST pkt_st;
KTEXT pkt = & pkt_st; /* Packet to KDC */
@@ -177,9 +184,9 @@ int get_ad_tkt(char *service, char *sinstance, char *realm, int lifetime)
bcopy((char *) pkt_cipher(rpkt),(char *) (cip->dat),cip->length);
#ifndef NOENCRYPTION
- key_sched((des_cblock *)cr.session,key_s);
- pcbc_encrypt((des_cblock *)cip->dat,(des_cblock *)cip->dat,
- (long)cip->length,key_s,(des_cblock *)cr.session,DECRYPT);
+ key_sched((C_Block *)cr.session,key_s);
+ pcbc_encrypt((C_Block *)cip->dat,(C_Block *)cip->dat,(long)cip->length,
+ key_s,(C_Block *)cr.session,DECRYPT);
#endif
/* Get rid of all traces of key */
bzero((char *) cr.session, sizeof(key));
diff --git a/eBones/krb/get_admhst.c b/eBones/krb/get_admhst.c
index b33b828..a01a40f 100644
--- a/eBones/krb/get_admhst.c
+++ b/eBones/krb/get_admhst.c
@@ -39,7 +39,11 @@ static char *rcsid =
* provided by a nameserver.
*/
-int krb_get_admhst(char *h, char *r, int n)
+int
+krb_get_admhst(h, r, n)
+ char *h;
+ char *r;
+ int n;
{
FILE *cnffile;
char tr[REALM_SZ];
diff --git a/eBones/krb/get_cred.c b/eBones/krb/get_cred.c
index 14e1cc1..6023386 100644
--- a/eBones/krb/get_cred.c
+++ b/eBones/krb/get_cred.c
@@ -27,7 +27,12 @@ static char *rcsid =
* On failure it returns a Kerberos error code.
*/
-int krb_get_cred(char *service, char *instance, char *realm, CREDENTIALS *c)
+int
+krb_get_cred(service,instance,realm,c)
+ char *service; /* Service name */
+ char *instance; /* Instance */
+ char *realm; /* Auth domain */
+ CREDENTIALS *c; /* Credentials struct */
{
int tf_status; /* return value of tf function calls */
diff --git a/eBones/krb/get_in_tkt.c b/eBones/krb/get_in_tkt.c
index 79758f6..b95f073 100644
--- a/eBones/krb/get_in_tkt.c
+++ b/eBones/krb/get_in_tkt.c
@@ -16,10 +16,10 @@ static char rcsid[] =
#include <krb.h>
#include <prot.h>
-#include <des.h>
-#include "conf.h"
-#include <stdio.h>
+#ifndef NULL
+#define NULL 0
+#endif
/*
* This file contains two routines: passwd_to_key() converts
@@ -44,17 +44,18 @@ static char rcsid[] =
*/
/*ARGSUSED */
-static int passwd_to_key(char *user, char *instance, char *realm,
- char *passwd, des_cblock key)
+static int passwd_to_key(user,instance,realm,passwd,key)
+ char *user, *instance, *realm, *passwd;
+ C_Block *key;
{
#ifdef NOENCRYPTION
if (!passwd)
placebo_read_password(key, "Password: ", 0);
#else
if (passwd)
- string_to_key(passwd,(des_cblock *)key);
+ string_to_key(passwd,key);
else
- des_read_password((des_cblock *)key,"Password: ",0);
+ des_read_password(key,"Password: ",0);
#endif
return (0);
}
@@ -76,8 +77,11 @@ static int passwd_to_key(char *user, char *instance, char *realm,
* The result of the call to krb_get_in_tkt() is returned.
*/
-int krb_get_pw_in_tkt(char *user, char *instance, char *realm, char *service,
- char *sinstance, int life, char *password)
+int
+krb_get_pw_in_tkt(user,instance,realm,service,sinstance,life,password)
+ char *user, *instance, *realm, *service, *sinstance;
+ int life;
+ char *password;
{
return(krb_get_in_tkt(user,instance,realm,service,sinstance,life,
passwd_to_key, NULL, password));
@@ -99,16 +103,36 @@ int krb_get_pw_in_tkt(char *user, char *instance, char *realm, char *service,
* echoing.
*/
-#if 0
-#ifndef lint
-static char rcsid_read_password_c[] =
-"Bones$Header: /usr/cvs/src/eBones/krb/get_in_tkt.c,v 1.3 1995/07/18 16:38:30 mark Exp $";
-#endif lint
+#include <des.h>
+#include "conf.h"
+
+#include <stdio.h>
+#ifdef BSDUNIX
+#include <strings.h>
+#include <sys/ioctl.h>
+#include <signal.h>
+#include <setjmp.h>
+#else
+/* char *strcpy();
+int strcmp(); */
#endif
+#ifdef BSDUNIX
+static jmp_buf env;
+#endif
+
+#ifdef BSDUNIX
+static void sig_restore();
+static push_signals(), pop_signals();
+int placebo_read_pw_string();
+#endif
/*** Routines ****************************************************** */
-int placebo_read_password(des_cblock *k, char *prompt, int verify)
+int
+placebo_read_password(k,prompt,verify)
+ des_cblock *k;
+ char *prompt;
+ int verify;
{
int ok;
char key_string[BUFSIZ];
@@ -135,7 +159,8 @@ lose:
* Returns 0 on success, non-zero on failure.
*/
-int placebo_read_pw_string(char *s, int max, char *prompt, int verify)
+int
+placebo_read_pw_string(s,max,prompt,verify)
char *s;
int max;
char *prompt;
@@ -237,21 +262,23 @@ static void (*old_sigfunc[NSIG])();
static int (*old_sigfunc[NSIG])();
#endif POSIX
-static void push_signals()
+static push_signals()
{
register i;
for (i = 0; i < NSIG; i++)
old_sigfunc[i] = signal(i,sig_restore);
}
-static void pop_signals()
+static pop_signals()
{
register i;
for (i = 0; i < NSIG; i++)
signal(i,old_sigfunc[i]);
}
-static void sig_restore(int sig, int code, struct sigcontext *scp)
+static void sig_restore(sig,code,scp)
+ int sig,code;
+ struct sigcontext *scp;
{
longjmp(env,1);
}
diff --git a/eBones/krb/get_krbhst.c b/eBones/krb/get_krbhst.c
index ab3abbd..cfc6e1c 100644
--- a/eBones/krb/get_krbhst.c
+++ b/eBones/krb/get_krbhst.c
@@ -50,7 +50,11 @@ static char *rcsid =
* nameserver.
*/
-int krb_get_krbhst(char *h, char *r, int n)
+int
+krb_get_krbhst(h,r,n)
+ char *h;
+ char *r;
+ int n;
{
FILE *cnffile;
char tr[REALM_SZ];
diff --git a/eBones/krb/get_krbrlm.c b/eBones/krb/get_krbrlm.c
index 150a916..a4803e5 100644
--- a/eBones/krb/get_krbrlm.c
+++ b/eBones/krb/get_krbrlm.c
@@ -34,9 +34,12 @@ static char *rcsid =
* krb_get_krbhst().
*/
-int krb_get_lrealm(char *r, int n)
+int
+krb_get_lrealm(r,n)
+ char *r;
+ int n;
{
- FILE *cnffile;
+ FILE *cnffile, *fopen();
if (n > 1)
return(KFAILURE); /* Temporary restriction */
diff --git a/eBones/krb/get_phost.c b/eBones/krb/get_phost.c
index 4b0f495..cd83b2d 100644
--- a/eBones/krb/get_phost.c
+++ b/eBones/krb/get_phost.c
@@ -15,10 +15,10 @@ static char rcsid[] =
#endif
#include <stdio.h>
-#include <string.h>
#include <ctype.h>
#include <netdb.h>
-#include <krb.h>
+
+char *index();
/*
* This routine takes an alias for a host name and returns the first
@@ -37,7 +37,8 @@ static char rcsid[] =
* to the original "alias" argument is returned.
*/
-char *krb_get_phost(char *alias)
+char * krb_get_phost(alias)
+ char *alias;
{
struct hostent *h;
char *phost = alias;
diff --git a/eBones/krb/get_pw_tkt.c b/eBones/krb/get_pw_tkt.c
index 1b016a8..48b6126 100644
--- a/eBones/krb/get_pw_tkt.c
+++ b/eBones/krb/get_pw_tkt.c
@@ -48,7 +48,12 @@ static char *rcsid =
* the password-changing server will be in the user's ticket file.
*/
-int get_pw_tkt(char *user, char *instance, char *realm, char *cpw)
+int
+get_pw_tkt(user,instance,realm,cpw)
+ char *user;
+ char *instance;
+ char *realm;
+ char *cpw;
{
int kerror;
diff --git a/eBones/krb/get_request.c b/eBones/krb/get_request.c
index dec742b..c4982bf3 100644
--- a/eBones/krb/get_request.c
+++ b/eBones/krb/get_request.c
@@ -28,7 +28,12 @@ static char *rcsid =
* if there are less than n requests in the packet.
*/
-int get_request(KTEXT pkt, int n, char **s_name, char **instance)
+int
+get_request(pkt, n, s_name, instance)
+ KTEXT pkt; /* The packet itself */
+ int n; /* Which request do we want */
+ char **s_name; /* Service name to be filled in */
+ char **instance; /* Instance name to be filled in */
{
/* Go to the beginning of the request list */
char *ptr = (char *) pkt_a_realm(pkt) + 6 +
diff --git a/eBones/krb/get_svc_in_tkt.c b/eBones/krb/get_svc_in_tkt.c
index cd90f9e..f5680db 100644
--- a/eBones/krb/get_svc_in_tkt.c
+++ b/eBones/krb/get_svc_in_tkt.c
@@ -44,7 +44,8 @@ static char rcsid[] =
* The service key is placed in "key".
*/
-static int srvtab_to_key(user, instance, realm, srvtab, key)
+static int
+srvtab_to_key(user, instance, realm, srvtab, key)
char *user, *instance, *realm, *srvtab;
C_Block key;
{
@@ -65,7 +66,8 @@ static int srvtab_to_key(user, instance, realm, srvtab, key)
* It returns the return value of the krb_get_in_tkt() call.
*/
-int krb_get_svc_in_tkt(user, instance, realm, service, sinstance, life, srvtab)
+int
+krb_get_svc_in_tkt(user, instance, realm, service, sinstance, life, srvtab)
char *user, *instance, *realm, *service, *sinstance;
int life;
char *srvtab;
diff --git a/eBones/krb/get_tf_fullname.c b/eBones/krb/get_tf_fullname.c
index 45226db..8d76399 100644
--- a/eBones/krb/get_tf_fullname.c
+++ b/eBones/krb/get_tf_fullname.c
@@ -32,8 +32,12 @@ static char rcsid[] =
* krb_get_in_tkt().
*/
-int krb_get_tf_fullname(char *ticket_file, char *name, char *instance,
- char *realm)
+int
+krb_get_tf_fullname(ticket_file, name, instance, realm)
+ char *ticket_file;
+ char *name;
+ char *instance;
+ char *realm;
{
int tf_status;
CREDENTIALS c;
diff --git a/eBones/krb/get_tf_realm.c b/eBones/krb/get_tf_realm.c
index 704c687..8d75a9d 100644
--- a/eBones/krb/get_tf_realm.c
+++ b/eBones/krb/get_tf_realm.c
@@ -28,7 +28,10 @@ static char rcsid[] =
*
*/
-int krb_get_tf_realm(char *ticket_file, char *realm)
+int
+krb_get_tf_realm(ticket_file, realm)
+ char *ticket_file;
+ char *realm;
{
return(krb_get_tf_fullname(ticket_file, 0, 0, realm));
}
diff --git a/eBones/krb/getrealm.c b/eBones/krb/getrealm.c
index 37686c4..dcd4d28 100644
--- a/eBones/krb/getrealm.c
+++ b/eBones/krb/getrealm.c
@@ -47,7 +47,9 @@ static char rcsid[] =
static char ret_realm[REALM_SZ+1];
-char *krb_realmofhost(char *host)
+char *
+krb_realmofhost(host)
+char *host;
{
char *domain;
FILE *trans_file;
diff --git a/eBones/krb/getst.c b/eBones/krb/getst.c
index 549ec50..e50e4bb 100644
--- a/eBones/krb/getst.c
+++ b/eBones/krb/getst.c
@@ -26,7 +26,11 @@ static char rcsid[] =
* the null terminator.
*/
-int getst(int fd, char *s, int n)
+int
+getst(fd, s, n)
+ int fd;
+ register char *s;
+ int n;
{
register count = n;
while (read(fd, s, 1) > 0 && --count)
diff --git a/eBones/krb/in_tkt.c b/eBones/krb/in_tkt.c
index 12fbb39..1f6ee8a 100644
--- a/eBones/krb/in_tkt.c
+++ b/eBones/krb/in_tkt.c
@@ -16,8 +16,8 @@ static char rcsid[] =
#endif
#include <unistd.h>
-#include <stdio.h>
#include <string.h>
+#include <stdio.h>
#include <krb.h>
#include <sys/file.h>
#include <sys/fcntl.h>
@@ -27,6 +27,8 @@ static char rcsid[] =
#include <sys/param.h>
#endif
+extern int krb_debug;
+
/*
* in_tkt() is used to initialize the ticket store. It creates the
* file to contain the tickets and writes the given user's name "pname"
@@ -34,7 +36,10 @@ static char rcsid[] =
* success, or KFAILURE if something goes wrong.
*/
-int in_tkt(char *pname, char *pinst)
+int
+in_tkt(pname,pinst)
+ char *pname;
+ char *pinst;
{
int tktfile;
uid_t me, metoo;
diff --git a/eBones/krb/k_gethostname.c b/eBones/krb/k_gethostname.c
index 093ee5d..cfb4f92 100644
--- a/eBones/krb/k_gethostname.c
+++ b/eBones/krb/k_gethostname.c
@@ -41,7 +41,10 @@ extern get_custom();
* not work.
*/
-int k_gethostname(char *name, int namelen)
+int
+k_gethostname(name, namelen)
+ char *name;
+ int namelen;
{
#ifdef BSD42
return gethostname(name, namelen);
diff --git a/eBones/krb/klog.c b/eBones/krb/klog.c
index 97d52c7..7fdc774 100644
--- a/eBones/krb/klog.c
+++ b/eBones/krb/klog.c
@@ -50,11 +50,13 @@ static char logtxt[1000];
* text string "logtxt".
*/
-char *klog(int type, char *format, int a1, int a2, int a3, int a4, int a5,
- int a6, int a7, int a8, int a9, int a0)
+char * klog(type,format,a1,a2,a3,a4,a5,a6,a7,a8,a9,a0)
+ int type;
+ char *format;
+ int a1,a2,a3,a4,a5,a6,a7,a8,a9,a0;
{
FILE *logfile;
- long time(),now;
+ long now;
struct tm *tm;
static int logtype_array[NLOGTYPE] = {0,0};
static int array_initialized;
@@ -99,7 +101,9 @@ char *klog(int type, char *format, int a1, int a2, int a3, int a4, int a5,
* the logfile defaults to KRBLOG, defined in "krb.h".
*/
-void kset_logfile(char *filename)
+void
+kset_logfile(filename)
+ char *filename;
{
log_name = filename;
is_open = 0;
diff --git a/eBones/krb/kname_parse.c b/eBones/krb/kname_parse.c
index c69b5cc..da7ec93 100644
--- a/eBones/krb/kname_parse.c
+++ b/eBones/krb/kname_parse.c
@@ -54,7 +54,9 @@ extern char *krb_err_txt[];
* KNAME_FMT is returned.
*/
-int kname_parse(char *np, char *ip, char *rp, char *fullname)
+int
+kname_parse(np, ip, rp, fullname)
+ char *np, *ip, *rp, *fullname;
{
static char buf[FULL_SZ];
char *rnext, *wnext; /* next char to read, write */
@@ -137,7 +139,9 @@ int kname_parse(char *np, char *ip, char *rp, char *fullname)
* Kerberos name; returns 0 if it's not.
*/
-int k_isname(char *s)
+int
+k_isname(s)
+ char *s;
{
register char c;
int backslash = 0;
@@ -172,7 +176,9 @@ int k_isname(char *s)
* Kerberos instance; returns 0 if it's not.
*/
-int k_isinst(char *s)
+int
+k_isinst(s)
+ char *s;
{
register char c;
int backslash = 0;
@@ -204,7 +210,9 @@ int k_isinst(char *s)
* Kerberos realm; returns 0 if it's not.
*/
-int k_isrealm(char *s)
+int
+k_isrealm(s)
+ char *s;
{
register char c;
int backslash = 0;
diff --git a/eBones/krb/kntoln.c b/eBones/krb/kntoln.c
index ddb1ba2..388704c 100644
--- a/eBones/krb/kntoln.c
+++ b/eBones/krb/kntoln.c
@@ -44,7 +44,10 @@ static char *rcsid =
* KSUCCESS if all goes well, otherwise KFAILURE.
*/
-int krb_kntoln(AUTH_DAT *ad, char *lname)
+int
+krb_kntoln(ad,lname)
+ AUTH_DAT *ad;
+ char *lname;
{
static char lrealm[REALM_SZ] = "";
diff --git a/eBones/krb/kparse.c b/eBones/krb/kparse.c
index edb471c..5b25ac7 100644
--- a/eBones/krb/kparse.c
+++ b/eBones/krb/kparse.c
@@ -40,8 +40,8 @@ static char rcsid[] =
#endif lint
#endif
-#include <stdio.h>
#include <stdlib.h>
+#include <stdio.h>
#include <ctype.h>
#include <kparse.h>
@@ -53,18 +53,20 @@ static char rcsid[] =
#define MAXKEY 80
#define MAXVALUE 80
-int fGetKeywordValue(FILE *fp, char *keyword, int klen, char *value, int vlen);
-int fGetToken(FILE *fp, char *dest, int maxlen);
+int fUngetChar(int ch, FILE *fp);
int fGetChar(FILE *fp);
-int fUngetChar(int ch, FILE*fp);
-int fGetLiteral(FILE *fp);;
+int fGetLiteral(FILE *fp);
int LineNbr=1; /* current line nbr in parameter file */
char ErrorMsg[80]; /* meaningful only when KV_SYNTAX, PS_SYNTAX,
* or PS_BAD_KEYWORD is returned by
* fGetKeywordValue or fGetParameterSet */
-int fGetParameterSet(FILE *fp, parmtable parm[], int parmcount )
+int
+fGetParameterSet( fp,parm,parmcount )
+ FILE *fp;
+ parmtable parm[];
+ int parmcount;
{
int rc,i;
char keyword[MAXKEY];
@@ -127,7 +129,12 @@ int fGetParameterSet(FILE *fp, parmtable parm[], int parmcount )
* different. Like strcmp, ParmCompare returns 0 for a match found, -1
* otherwise
*/
-int ParmCompare(parmtable parm[], int parmcount, char *keyword, char *value )
+int
+ParmCompare( parm, parmcount, keyword, value )
+ parmtable parm[];
+ int parmcount;
+ char *keyword;
+ char *value;
{
int i;
@@ -143,7 +150,10 @@ int ParmCompare(parmtable parm[], int parmcount, char *keyword, char *value )
return(-1);
}
-void FreeParameterSet(parmtable parm[], int parmcount)
+void
+FreeParameterSet(parm,parmcount)
+ parmtable parm[];
+ int parmcount;
{
int i;
@@ -155,7 +165,13 @@ void FreeParameterSet(parmtable parm[], int parmcount)
}
}
-int fGetKeywordValue(FILE *fp, char *keyword, int klen, char *value, int vlen)
+int
+fGetKeywordValue( fp, keyword, klen, value, vlen )
+ FILE *fp;
+ char *keyword;
+ int klen;
+ char *value;
+ int vlen;
{
int rc;
int gotit;
@@ -311,7 +327,7 @@ int fGetKeywordValue(FILE *fp, char *keyword, int klen, char *value, int vlen)
} while ( !gotit );
/*NOTREACHED*/
- return 0; /* I know, I know. - markm */
+ return(0); /*just to shut up -Wall MRVM*/
}
/*
@@ -343,7 +359,11 @@ int fGetKeywordValue(FILE *fp, char *keyword, int klen, char *value, int vlen)
* classification for end of file is
* always zero.
*/
-int fGetToken(FILE *fp, char *dest, int maxlen)
+int
+fGetToken(fp, dest, maxlen)
+ FILE *fp;
+ char *dest;
+ int maxlen;
{
int ch='\0';
int len=0;
@@ -436,7 +456,9 @@ int fGetToken(FILE *fp, char *dest, int maxlen)
* special case certain values (\n, \f, \r, \b) or return a literal
* otherwise (useful for \", for example).
*/
-int fGetLiteral(FILE *fp)
+int
+fGetLiteral(fp)
+ FILE *fp;
{
int ch;
int n=0;
@@ -511,7 +533,10 @@ int fGetLiteral(FILE *fp)
* exactly the same as ungetc(3) except that the line number of the
* input file is maintained.
*/
-int fUngetChar(int ch, FILE*fp)
+int
+fUngetChar(ch,fp)
+ int ch;
+ FILE *fp;
{
if (ch=='\n') LineNbr--;
return(ungetc(ch,fp));
@@ -522,7 +547,9 @@ int fUngetChar(int ch, FILE*fp)
* exactly the same as fgetc(3) except that the line number of the
* input file is maintained.
*/
-int fGetChar(FILE *fp)
+int
+fGetChar(fp)
+ FILE *fp;
{
int ch = fgetc(fp);
if (ch=='\n') LineNbr++;
@@ -548,7 +575,9 @@ int fGetChar(FILE *fp)
* Return Value: pointer to copied string
*
*/
-char *strsave(char *p)
+char *
+strsave(p)
+ char *p;
{
return(strcpy(malloc(strlen(p)+1),p));
}
@@ -559,7 +588,9 @@ char *strsave(char *p)
* the pointer to the beginning of the string is returned.
*/
-char *strutol(char *start)
+char *
+strutol( start )
+ char *start;
{
char *q;
for (q=start; *q; q++)
@@ -574,7 +605,9 @@ char *strutol(char *start)
char *pgm = "gettoken";
-main(int argc, char **argv)
+main(argc,argv)
+ int argc;
+ char **argv;
{
char *p;
int type;
@@ -627,7 +660,9 @@ main(int argc, char **argv)
#ifdef KVTEST
-main(int argc, char **argv)
+main(argc,argv)
+ int argc;
+ char **argv;
{
int rc,ch;
FILE *fp;
@@ -684,7 +719,9 @@ parmtable kparm[] = {
{ "instance", "", (char *)NULL }
};
-main(int argc, char **argv)
+main(argc,argv)
+ int argc;
+ char **argv;
{
int rc,i,ch;
FILE *fp;
diff --git a/eBones/krb/krb_get_in_tkt.c b/eBones/krb/krb_get_in_tkt.c
index e17b60e..b6ff308 100644
--- a/eBones/krb/krb_get_in_tkt.c
+++ b/eBones/krb/krb_get_in_tkt.c
@@ -35,8 +35,14 @@ int swap_bytes;
* using the key returned by key_proc.
*/
-static int decrypt_tkt(char *user, char *instance, char *realm, char *arg,
- int (*key_proc)(), KTEXT *cipp)
+static int
+decrypt_tkt(user, instance, realm, arg, key_proc, cipp)
+ char *user;
+ char *instance;
+ char *realm;
+ char *arg;
+ int (*key_proc)();
+ KTEXT *cipp;
{
KTEXT cip = *cipp;
C_Block key; /* Key for decrypting cipher */
@@ -56,9 +62,9 @@ static int decrypt_tkt(char *user, char *instance, char *realm, char *arg,
}
#ifndef NOENCRYPTION
- key_sched((des_cblock *)key,key_s);
- pcbc_encrypt((des_cblock *)cip->dat,(des_cblock *)cip->dat,
- (long) cip->length,key_s,(des_cblock *)key,DES_DECRYPT);
+ key_sched(&key,key_s);
+ pcbc_encrypt((C_Block *)cip->dat,(C_Block *)cip->dat,
+ (long) cip->length,key_s,(C_Block *)key,DES_DECRYPT);
#endif /* !NOENCRYPTION */
/* Get rid of all traces of key */
bzero((char *)key,sizeof(key));
@@ -108,9 +114,18 @@ static int decrypt_tkt(char *user, char *instance, char *realm, char *arg,
* string sinstance service's instance
*/
-int krb_get_in_tkt(char *user, char *instance, char *realm, char *service,
- char *sinstance, int life, int (*key_proc)(), int (*decrypt_proc)(),
- char *arg)
+int
+krb_get_in_tkt(user, instance, realm, service, sinstance, life,
+ key_proc, decrypt_proc, arg)
+ char *user;
+ char *instance;
+ char *realm;
+ char *service;
+ char *sinstance;
+ int life;
+ int (*key_proc)();
+ int (*decrypt_proc)();
+ char *arg;
{
KTEXT_ST pkt_st;
KTEXT pkt = &pkt_st; /* Packet to KDC */
diff --git a/eBones/krb/krbglue.c b/eBones/krb/krbglue.c
index de5b7e2..f82cf70 100644
--- a/eBones/krb/krbglue.c
+++ b/eBones/krb/krbglue.c
@@ -22,10 +22,11 @@ $Id: krbglue.c,v 1.3 1995/07/18 16:39:05 mark Exp $";
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
-#include "des.h"
+#include <des.h>
#include "krb.h"
/* These definitions should be in krb.h, no? */
+/*
#if defined(__HIGHC__)
#undef __STDC__
#endif
@@ -59,7 +60,7 @@ extern char *krb_get_phost (char *);
extern int krb_get_krbhst (char *, char *, int);
#ifdef DEBUG
extern KTEXT krb_create_death_packet (char *);
-#endif /* DEBUG */
+#endif
#else
extern int krb_mk_req ();
extern int krb_rd_req ();
@@ -81,8 +82,11 @@ extern char *krb_get_phost ();
extern int krb_get_krbhst ();
#ifdef DEBUG
extern KTEXT krb_create_death_packet ();
-#endif /* DEBUG */
-#endif /* STDC */
+#endif
+#endif
+*/
+
+
int mk_ap_req(authent, service, instance, realm, checksum)
KTEXT authent;
char *service, *instance, *realm;
diff --git a/eBones/krb/kuserok.c b/eBones/krb/kuserok.c
index 15a25e8..8e5d18a 100644
--- a/eBones/krb/kuserok.c
+++ b/eBones/krb/kuserok.c
@@ -86,7 +86,10 @@ parmtable kparm[] = {
#define KPARMS kparm,PARMCOUNT(kparm)
#endif ATHENA_COMPAT
-int kuserok(AUTH_DAT *kdata, char *luser)
+int
+kuserok(kdata, luser)
+ AUTH_DAT *kdata;
+ char *luser;
{
struct stat sbuf;
struct passwd *pwd;
diff --git a/eBones/krb/log.c b/eBones/krb/log.c
index aea6ab9..e33477f 100644
--- a/eBones/krb/log.c
+++ b/eBones/krb/log.c
@@ -44,12 +44,18 @@ static is_open;
* The return value is undefined.
*/
+__BEGIN_DECLS
+char *month_sname __P((int));
+__END_DECLS
+
+
/*VARARGS1 */
-void log(char *format,int a1,int a2,int a3,int a4,int a5,int a6,int a7,
- int a8,int a9,int a0)
+void log(format,a1,a2,a3,a4,a5,a6,a7,a8,a9,a0)
+ char *format;
+ int a1,a2,a3,a4,a5,a6,a7,a8,a9,a0;
{
- FILE *logfile;
- long now;
+ FILE *logfile, *fopen();
+ long time(),now;
struct tm *tm;
if ((logfile = fopen(log_name,"a")) == NULL)
@@ -73,7 +79,9 @@ void log(char *format,int a1,int a2,int a3,int a4,int a5,int a6,int a7,
* the logfile defaults to KRBLOG, defined in "krb.h".
*/
-void set_logfile(char *filename)
+void
+set_logfile(filename)
+ char *filename;
{
log_name = filename;
is_open = 0;
@@ -86,7 +94,10 @@ void set_logfile(char *filename)
* on success.
*/
-int new_log(long t, char *string)
+int
+new_log(t,string)
+ long t;
+ char *string;
{
static FILE *logfile;
diff --git a/eBones/krb/mk_priv.c b/eBones/krb/mk_priv.c
index bc377de..d45d734 100644
--- a/eBones/krb/mk_priv.c
+++ b/eBones/krb/mk_priv.c
@@ -40,8 +40,13 @@ static char rcsid[] =
#include <prot.h>
#include "lsb_addr_comp.h"
+extern char *errmsg();
+extern int errno;
+extern int krb_debug;
+
/* static storage */
+
static u_long c_length;
static struct timeval msg_time;
static u_char msg_time_5ms;
@@ -90,9 +95,16 @@ static long msg_time_sec;
* 0<=n<=7 bytes pad to 8 byte multiple zeroes
*/
-long krb_mk_priv(u_char *in, u_char *out, u_long length,
- des_key_schedule schedule, des_cblock key, struct sockaddr_in *sender,
- struct sockaddr_in *receiver)
+long krb_mk_priv(in,out,length,schedule,key,sender,receiver)
+ u_char *in; /* application data */
+ u_char *out; /* put msg here, leave room for
+ * header! breaks if in and out
+ * (header stuff) overlap */
+ u_long length; /* of in data */
+ Key_schedule schedule; /* precomputed key schedule */
+ C_Block key; /* encryption key for seed and ivec */
+ struct sockaddr_in *sender; /* sender address */
+ struct sockaddr_in *receiver; /* receiver address */
{
register u_char *p,*q;
static u_char *c_length_ptr;
@@ -187,8 +199,8 @@ long krb_mk_priv(u_char *in, u_char *out, u_long length,
bcopy((char *) &c_length,(char *)c_length_ptr,sizeof(c_length));
#ifndef NOENCRYPTION
- pcbc_encrypt((des_cblock *)q,(des_cblock *)q,(long)(p-q),schedule,
- (des_cblock *)key,ENCRYPT);
+ pcbc_encrypt((C_Block *)q,(C_Block *)q,(long)(p-q),schedule,(C_Block *)key,
+ ENCRYPT);
#endif /* NOENCRYPTION */
return (q - out + c_length); /* resulting size */
diff --git a/eBones/krb/mk_req.c b/eBones/krb/mk_req.c
index 971e6a2..a27c1c0 100644
--- a/eBones/krb/mk_req.c
+++ b/eBones/krb/mk_req.c
@@ -21,6 +21,7 @@ static char *rcsid =
#include <sys/time.h>
#include <strings.h>
+extern int krb_ap_req_debug;
static struct timeval tv_local = { 0, 0 };
static int lifetime = DEFAULT_TKT_LIFE;
@@ -68,8 +69,13 @@ static int lifetime = DEFAULT_TKT_LIFE;
* all rounded up to multiple of 8.
*/
-int krb_mk_req(KTEXT authent, char *service, char *instance, char *realm,
- long checksum)
+int
+krb_mk_req(authent,service,instance,realm,checksum)
+ register KTEXT authent; /* Place to build the authenticator */
+ char *service; /* Name of the service */
+ char *instance; /* Service instance */
+ char *realm; /* Authentication domain of service */
+ long checksum; /* Checksum of data (optional) */
{
static KTEXT_ST req_st; /* Temp storage for req id */
register KTEXT req_id = &req_st;
@@ -151,9 +157,9 @@ int krb_mk_req(KTEXT authent, char *service, char *instance, char *realm,
req_id->length = ((req_id->length+7)/8)*8;
#ifndef NOENCRYPTION
- key_sched((des_cblock *)cr.session,key_s);
- pcbc_encrypt((des_cblock *)req_id->dat,(des_cblock *)req_id->dat,
- (long)req_id->length,key_s,(des_cblock *)cr.session,ENCRYPT);
+ key_sched((C_Block *)cr.session,key_s);
+ pcbc_encrypt((C_Block *)req_id->dat,(C_Block *)req_id->dat,
+ (long)req_id->length,key_s,(C_Block *)cr.session,ENCRYPT);
bzero((char *) key_s, sizeof(key_s));
#endif /* NOENCRYPTION */
@@ -181,7 +187,9 @@ int krb_mk_req(KTEXT authent, char *service, char *instance, char *realm,
* It returns the previous value of the default lifetime.
*/
-int krb_set_lifetime(int newval)
+int
+krb_set_lifetime(newval)
+int newval;
{
int olife = lifetime;
diff --git a/eBones/krb/mk_safe.c b/eBones/krb/mk_safe.c
index f4aab32..e5490bc 100644
--- a/eBones/krb/mk_safe.c
+++ b/eBones/krb/mk_safe.c
@@ -83,8 +83,17 @@ static long msg_time_sec;
* above using "key"
*/
-long krb_mk_safe(u_char *in, u_char *out, u_long length, des_cblock key,
- struct sockaddr_in *sender, struct sockaddr_in *receiver)
+long krb_mk_safe(in,out,length,key,sender,receiver)
+ u_char *in; /* application data */
+ u_char *out; /*
+ * put msg here, leave room for header!
+ * breaks if in and out (header stuff)
+ * overlap
+ */
+ u_long length; /* of in data */
+ C_Block *key; /* encryption key for seed and ivec */
+ struct sockaddr_in *sender; /* sender address */
+ struct sockaddr_in *receiver; /* receiver address */
{
register u_char *p,*q;
@@ -148,7 +157,7 @@ long krb_mk_safe(u_char *in, u_char *out, u_long length, des_cblock key,
cksum = 0;
bzero(big_cksum, sizeof(big_cksum));
#else
- cksum=quad_cksum((des_cblock *)q,big_cksum,p-q,2,(des_cblock *)key);
+ cksum=quad_cksum((C_Block *)q,big_cksum,p-q,2,key);
#endif
if (krb_debug)
printf("\ncksum = %lu",cksum);
diff --git a/eBones/krb/month_sname.c b/eBones/krb/month_sname.c
index 3443e41..f4ef339 100644
--- a/eBones/krb/month_sname.c
+++ b/eBones/krb/month_sname.c
@@ -22,7 +22,8 @@ static char *rcsid =
* month. Returns 0 if the argument is out of range.
*/
-char *month_sname(int n)
+char *month_sname(n)
+ int n;
{
static char *name[] = {
"Jan","Feb","Mar","Apr","May","Jun",
diff --git a/eBones/krb/netread.c b/eBones/krb/netread.c
index c773bc8..628004e 100644
--- a/eBones/krb/netread.c
+++ b/eBones/krb/netread.c
@@ -14,9 +14,7 @@ static char rcsid[] =
#endif lint
#endif
-#include <stdio.h>
#include <unistd.h>
-#include <krb.h>
/*
* krb_net_read() reads from the file descriptor "fd" to the buffer
@@ -28,7 +26,11 @@ static char rcsid[] =
* XXX must not use non-blocking I/O
*/
-int krb_net_read(int fd, char *buf, int len)
+int
+krb_net_read(fd, buf, len)
+int fd;
+register char *buf;
+register int len;
{
int cc, len2 = 0;
diff --git a/eBones/krb/netwrite.c b/eBones/krb/netwrite.c
index 7af91ff..f85f7ba 100644
--- a/eBones/krb/netwrite.c
+++ b/eBones/krb/netwrite.c
@@ -14,9 +14,7 @@ static char rcsid[] =
#endif lint
#endif
-#include <stdio.h>
#include <unistd.h>
-#include <krb.h>
/*
* krb_net_write() writes "len" bytes from "buf" to the file
@@ -27,7 +25,11 @@ static char rcsid[] =
* XXX must not use non-blocking I/O
*/
-int krb_net_write(int fd, char *buf, int len)
+int
+krb_net_write(fd, buf, len)
+int fd;
+register char *buf;
+int len;
{
int cc;
register int wrlen = len;
diff --git a/eBones/krb/pkt_clen.c b/eBones/krb/pkt_clen.c
index 17d46c2..f8dacae 100644
--- a/eBones/krb/pkt_clen.c
+++ b/eBones/krb/pkt_clen.c
@@ -15,10 +15,12 @@ static char *rcsid =
#endif /* lint */
#endif
+#include <string.h>
+
#include <krb.h>
#include <prot.h>
-#include <string.h>
+extern int krb_debug;
extern int swap_bytes;
/*
@@ -29,7 +31,9 @@ extern int swap_bytes;
* ciphertext length out of the packet.
*/
-int pkt_clen(KTEXT pkt)
+int
+pkt_clen(pkt)
+ KTEXT pkt;
{
static unsigned short temp,temp2;
int clen = 0;
diff --git a/eBones/krb/rd_err.c b/eBones/krb/rd_err.c
index 8c5b8a2..e46dc66 100644
--- a/eBones/krb/rd_err.c
+++ b/eBones/krb/rd_err.c
@@ -24,8 +24,8 @@ static char rcsid[] =
#endif
/* system include files */
-#include <stdio.h>
#include <string.h>
+#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <netinet/in.h>
@@ -50,7 +50,12 @@ static char rcsid[] =
* The AUTH_MSG_APPL_ERR message format can be found in mk_err.c
*/
-int krb_rd_err(u_char *in, u_long in_length, long *code, MSG_DAT *m_data)
+int
+krb_rd_err(in,in_length,code,m_data)
+ u_char *in; /* pointer to the msg received */
+ u_long in_length; /* of in msg */
+ long *code; /* received error code */
+ MSG_DAT *m_data;
{
register u_char *p;
int swap_bytes = 0;
diff --git a/eBones/krb/rd_priv.c b/eBones/krb/rd_priv.c
index 457352e..0c21a1d 100644
--- a/eBones/krb/rd_priv.c
+++ b/eBones/krb/rd_priv.c
@@ -26,8 +26,8 @@ static char rcsid[]=
#endif
/* system include files */
-#include <stdio.h>
#include <string.h>
+#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <netinet/in.h>
@@ -39,6 +39,8 @@ static char rcsid[]=
#include <prot.h>
#include "lsb_addr_comp.h"
+extern int krb_debug;
+
/* static storage */
static u_long c_length;
@@ -68,9 +70,15 @@ int private_msg_ver = KRB_PROT_VERSION;
* information, MSG_DAT, is defined in "krb.h".
*/
-long krb_rd_priv(u_char *in, u_long in_length, des_key_schedule schedule,
- des_cblock key, struct sockaddr_in *sender, struct sockaddr_in *receiver,
- MSG_DAT *m_data)
+long
+krb_rd_priv(in,in_length,schedule,key,sender,receiver,m_data)
+ u_char *in; /* pointer to the msg received */
+ u_long in_length; /* length of "in" msg */
+ Key_schedule schedule; /* precomputed key schedule */
+ C_Block key; /* encryption key for seed and ivec */
+ struct sockaddr_in *sender;
+ struct sockaddr_in *receiver;
+ MSG_DAT *m_data; /*various input/output data from msg */
{
register u_char *p,*q;
static u_long src_addr; /* Can't send structs since no
@@ -103,8 +111,8 @@ long krb_rd_priv(u_char *in, u_long in_length, des_key_schedule schedule,
q = p; /* mark start of encrypted stuff */
#ifndef NOENCRYPTION
- pcbc_encrypt((des_cblock *)q,(des_cblock *)q,(long)c_length,schedule,
- (des_cblock *)key,DECRYPT);
+ pcbc_encrypt((C_Block *)q,(C_Block *)q,(long)c_length,schedule,
+ (C_Block *)key,DECRYPT);
#endif
/* safely get application data length */
diff --git a/eBones/krb/rd_req.c b/eBones/krb/rd_req.c
index b77ec48..60ee948 100644
--- a/eBones/krb/rd_req.c
+++ b/eBones/krb/rd_req.c
@@ -15,13 +15,14 @@ static char *rcsid =
#endif /* lint */
#endif
-#include <stdio.h>
#include <des.h>
#include <krb.h>
#include <prot.h>
#include <sys/time.h>
#include <strings.h>
+extern int krb_ap_req_debug;
+
static struct timeval t_local = { 0, 0 };
/*
@@ -65,17 +66,20 @@ static char st_inst[INST_SZ]; /* server's instance */
* krb_rd_req().
*/
-int krb_set_key(char *key, int cvt)
+int
+krb_set_key(key,cvt)
+ char *key;
+ int cvt;
{
#ifdef NOENCRYPTION
bzero(ky, sizeof(ky));
return KSUCCESS;
#else
if (cvt)
- string_to_key(key,(des_cblock *)ky);
+ string_to_key(key,(C_Block *)ky);
else
bcopy(key,(char *)ky,8);
- return(des_key_sched((des_cblock *)ky,serv_key));
+ return(des_key_sched((C_Block *)ky,serv_key));
#endif
}
@@ -121,8 +125,14 @@ int krb_set_key(char *key, int cvt)
* Mutual authentication is not implemented.
*/
-int krb_rd_req (KTEXT authent, char *service, char *instance, long from_addr,
- AUTH_DAT *ad, char *fn)
+int
+krb_rd_req(authent,service,instance,from_addr,ad,fn)
+ register KTEXT authent; /* The received message */
+ char *service; /* Service name */
+ char *instance; /* Service instance */
+ long from_addr; /* Net address of originating host */
+ AUTH_DAT *ad; /* Structure to be filled in */
+ char *fn; /* Filename to get keys from */
{
static KTEXT_ST ticket; /* Temp storage for ticket */
static KTEXT tkt = &ticket;
@@ -241,10 +251,9 @@ int krb_rd_req (KTEXT authent, char *service, char *instance, long from_addr,
bcopy(ptr + tkt->length, (char *)(req_id->dat),req_id->length);
#ifndef NOENCRYPTION
- key_sched((des_cblock *)ad->session,seskey_sched);
- pcbc_encrypt((des_cblock *)req_id->dat,(des_cblock *)req_id->dat,
- (long)req_id->length,seskey_sched,(des_cblock *)ad->session,
- DES_DECRYPT);
+ key_sched((C_Block *)ad->session,seskey_sched);
+ pcbc_encrypt((C_Block *)req_id->dat,(C_Block *)req_id->dat,
+ (long)req_id->length,seskey_sched,(C_Block *)ad->session,DES_DECRYPT);
#endif /* NOENCRYPTION */
#define check_ptr() if ((ptr - (char *) req_id->dat) > req_id->length) return(RD_AP_MODIFIED);
diff --git a/eBones/krb/rd_safe.c b/eBones/krb/rd_safe.c
index 48d43c5..4d3e8d6 100644
--- a/eBones/krb/rd_safe.c
+++ b/eBones/krb/rd_safe.c
@@ -37,6 +37,10 @@ static char rcsid[] =
#include <prot.h>
#include "lsb_addr_comp.h"
+extern char *errmsg();
+extern int errno;
+extern int krb_debug;
+
/* static storage */
static C_Block calc_cksum[2];
@@ -62,9 +66,13 @@ static u_long delta_t;
* information, MSG_DAT, is defined in "krb.h".
*/
-long krb_rd_safe(u_char *in, u_long in_length, des_cblock key,
- struct sockaddr_in *sender, struct sockaddr_in *receiver,
- MSG_DAT *m_data)
+long krb_rd_safe(in,in_length,key,sender,receiver,m_data)
+ u_char *in; /* pointer to the msg received */
+ u_long in_length; /* length of "in" msg */
+ C_Block *key; /* encryption key for seed and ivec */
+ struct sockaddr_in *sender; /* sender's address */
+ struct sockaddr_in *receiver; /* receiver's address -- me */
+ MSG_DAT *m_data; /* where to put message information */
{
register u_char *p,*q;
static u_long src_addr; /* Can't send structs since no
@@ -162,7 +170,7 @@ krb_rd_safe protocol err sizeof(u_long) != sizeof(struct in_addr)");
#ifdef NOENCRYPTION
bzero(calc_cksum, sizeof(calc_cksum));
#else
- quad_cksum((des_cblock *)q,calc_cksum,p-q,2,(des_cblock *)key);
+ quad_cksum((C_Block *)q,calc_cksum,p-q,2,key);
#endif
if (krb_debug)
diff --git a/eBones/krb/read_service_key.c b/eBones/krb/read_service_key.c
index aa577fd..6064292 100644
--- a/eBones/krb/read_service_key.c
+++ b/eBones/krb/read_service_key.c
@@ -17,8 +17,8 @@ static char *rcsid =
#include <krb.h>
#include <stdio.h>
-#include <strings.h>
#include <unistd.h>
+#include <strings.h>
/*
* The private keys for servers on a given host are stored in a
@@ -54,8 +54,14 @@ static char *rcsid =
/*ARGSUSED */
-int read_service_key(char *service, char *instance, char *realm, int kvno,
- char *file, char *key)
+int
+read_service_key(service,instance,realm,kvno,file,key)
+ char *service; /* Service Name */
+ char *instance; /* Instance name or "*" */
+ char *realm; /* Realm */
+ int kvno; /* Key version number */
+ char *file; /* Filename */
+ char *key; /* Pointer to key to be filled in */
{
char serv[SNAME_SZ];
char inst[INST_SZ];
diff --git a/eBones/krb/recvauth.c b/eBones/krb/recvauth.c
index 8e9a6bb..45d68ee 100644
--- a/eBones/krb/recvauth.c
+++ b/eBones/krb/recvauth.c
@@ -14,6 +14,7 @@ static char rcsid[] =
#endif lint
#endif
+#include <krb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <syslog.h>
@@ -22,7 +23,6 @@ static char rcsid[] =
#include <stdlib.h>
#include <unistd.h>
#include <strings.h>
-#include <krb.h>
#define KRB_SENDAUTH_VERS "AUTHV0.1" /* MUST be KRB_SENDAUTH_VLEN
@@ -34,6 +34,8 @@ static char rcsid[] =
* be sure to support old versions of krb_sendauth!
*/
+extern int errno;
+
/*
* krb_recvauth() reads (and optionally responds to) a message sent
* using krb_sendauth(). The "options" argument is a bit-field of
@@ -120,14 +122,24 @@ static char rcsid[] =
#endif /* max */
int
-krb_recvauth(long options, int fd, KTEXT ticket, char *service, char *instance,
- struct sockaddr_in *faddr, struct sockaddr_in *laddr, AUTH_DAT *kdata,
- char *filename, des_key_schedule schedule, char *version)
+krb_recvauth(options, fd, ticket, service, instance, faddr, laddr, kdata,
+ filename, schedule, version)
+long options; /* bit-pattern of options */
+int fd; /* file descr. to read from */
+KTEXT ticket; /* storage for client's ticket */
+char *service; /* service expected */
+char *instance; /* inst expected (may be filled in) */
+struct sockaddr_in *faddr; /* address of foreign host on fd */
+struct sockaddr_in *laddr; /* local address */
+AUTH_DAT *kdata; /* kerberos data (returned) */
+char *filename; /* name of file with service keys */
+Key_schedule schedule; /* key schedule (return) */
+char *version; /* version string (filled in) */
{
int i, cc, old_vers = 0;
char krb_vers[KRB_SENDAUTH_VLEN + 1]; /* + 1 for the null terminator */
- char *cp = NULL;
+ char *cp;
int rem;
long tkt_len, priv_len;
u_long cksum;
@@ -242,7 +254,7 @@ krb_recvauth(long options, int fd, KTEXT ticket, char *service, char *instance,
cksum = kdata->checksum + 1;
cksum = htonl(cksum);
#ifndef NOENCRYPTION
- key_sched((des_cblock *)kdata->session,schedule);
+ key_sched((C_Block *)kdata->session,schedule);
#endif
priv_len = krb_mk_priv((unsigned char *)&cksum,
tmp_buf,
diff --git a/eBones/krb/save_credentials.c b/eBones/krb/save_credentials.c
index bec225f..268bb77 100644
--- a/eBones/krb/save_credentials.c
+++ b/eBones/krb/save_credentials.c
@@ -30,8 +30,17 @@ static char *rcsid =
* by the tf_init() or tf_save_cred() routines.
*/
-int save_credentials(char *service, char *instance, char *realm,
- des_cblock session, int lifetime, int kvno, KTEXT ticket, long issue_date)
+int
+save_credentials(service, instance, realm, session, lifetime, kvno,
+ ticket, issue_date)
+ char *service; /* Service name */
+ char *instance; /* Instance */
+ char *realm; /* Auth domain */
+ C_Block session; /* Session key */
+ int lifetime; /* Lifetime */
+ int kvno; /* Key version number */
+ KTEXT ticket; /* The ticket itself */
+ long issue_date; /* The issue time */
{
int tf_status; /* return values of the tf_util calls */
diff --git a/eBones/krb/send_to_kdc.c b/eBones/krb/send_to_kdc.c
index 96b3cb5..a2a329a 100644
--- a/eBones/krb/send_to_kdc.c
+++ b/eBones/krb/send_to_kdc.c
@@ -4,7 +4,7 @@
* <Copyright.MIT>.
*
* from: send_to_kdc.c,v 4.20 90/01/02 13:40:37 jtkohl Exp $
- * $Id: send_to_kdc.c,v 1.5 1995/08/25 22:52:05 markm Exp $
+ * $Id: send_to_kdc.c,v 1.3 1995/07/18 16:39:42 mark Exp $
*/
#if 0
@@ -17,9 +17,9 @@ static char rcsid_send_to_kdc_c[] =
#include <krb.h>
#include <prot.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -34,6 +34,11 @@ static char rcsid_send_to_kdc_c[] =
#define S_AD_SZ sizeof(struct sockaddr_in)
+extern int errno;
+extern int krb_debug;
+
+extern char *malloc(), *calloc(), *realloc();
+
int krb_udp_port = 0;
/* CLIENT_KRB_TIMEOUT indicates the time to wait before
@@ -41,6 +46,7 @@ int krb_udp_port = 0;
*/
static struct timeval timeout = { CLIENT_KRB_TIMEOUT, 0};
static char *prog = "send_to_kdc";
+static send_recv();
/*
* This file contains two routines, send_to_kdc() and send_recv().
@@ -48,106 +54,6 @@ static char *prog = "send_to_kdc";
*/
/*
- * try to send out and receive message.
- * return 1 on success, 0 on failure
- */
-
-static int send_recv(KTEXT pkt, KTEXT rpkt, int f, struct sockaddr_in *_to,
- struct hostent *addrs)
-{
- fd_set readfds;
- register struct hostent *hp;
- struct sockaddr_in from;
- int sin_size;
- int numsent;
- int addr_count;
-
- if (krb_debug) {
- if (_to->sin_family == AF_INET)
- printf("Sending message to %s...",
- inet_ntoa(_to->sin_addr));
- else
- printf("Sending message...");
- (void) fflush(stdout);
- }
- if ((numsent = sendto(f,(char *)(pkt->dat), pkt->length, 0,
- (struct sockaddr *)_to,
- S_AD_SZ)) != pkt->length) {
- if (krb_debug)
- printf("sent only %d/%d\n",numsent, pkt->length);
- return 0;
- }
- if (krb_debug) {
- printf("Sent\nWaiting for reply...");
- (void) fflush(stdout);
- }
- FD_ZERO(&readfds);
- FD_SET(f, &readfds);
- errno = 0;
- /* select - either recv is ready, or timeout */
- /* see if timeout or error or wrong descriptor */
- if (select(f + 1, &readfds, (fd_set *)0, (fd_set *)0, &timeout) < 1
- || !FD_ISSET(f, &readfds)) {
- if (krb_debug) {
- fprintf(stderr, "select failed: readfds=%lx",
- (unsigned long)&readfds);
- perror("");
- }
- return 0;
- }
- sin_size = sizeof(from);
- if (recvfrom(f, (char *)(rpkt->dat), sizeof(rpkt->dat), 0,
- (struct sockaddr *)&from, &sin_size)
- < 0) {
- if (krb_debug)
- perror("recvfrom");
- return 0;
- }
- if (krb_debug) {
- printf("received packet from %s\n", inet_ntoa(from.sin_addr));
- fflush(stdout);
- }
-/* At least Sun OS version 3.2 (or worse) and Ultrix version 2.2
- (or worse) only return one address ... */
-#if (defined(ULTRIX022) || (defined(SunOS) && SunOS < 40))
- for (hp = addrs; hp->h_name != (char *)NULL; hp++) {
- if (!bcmp(hp->h_addr, (char *)&from.sin_addr.s_addr,
- hp->h_length)) {
- if (krb_debug) {
- printf("Received it\n");
- (void) fflush(stdout);
- }
- return 1;
- }
- if (krb_debug)
- fprintf(stderr, "packet not from %s\n",
- inet_ntoa(*(struct in_addr *)hp->h_addr));
- }
- }
-#else /* !(ULTRIX022 || (SunOS < 40)) */
- for (hp = addrs; hp->h_name != (char *)NULL; hp++) {
- for (addr_count = 0; hp->h_addr_list[addr_count]; addr_count++) {
- if (!bcmp(hp->h_addr_list[addr_count],
- (char *)&from.sin_addr.s_addr, hp->h_length)) {
- if (krb_debug) {
- printf("Received it\n");
- (void) fflush(stdout);
- }
- return 1;
- }
- if (krb_debug)
- fprintf(stderr, "packet not from %s\n",
- inet_ntoa(*(struct in_addr *)hp->h_addr_list[addr_count]));
- }
- }
-#endif /* !(ULTRIX022 || (SunOS < 40)) */
- if (krb_debug)
- fprintf(stderr, "%s: received packet from wrong host! (%s)\n",
- "send_to_kdc(send_rcv)", inet_ntoa(from.sin_addr));
- return 0;
-}
-
-/*
* send_to_kdc() sends a message to the Kerberos authentication
* server(s) in the given realm and returns the reply message.
* The "pkt" argument points to the message to be sent to Kerberos;
@@ -174,16 +80,20 @@ static int send_recv(KTEXT pkt, KTEXT rpkt, int f, struct sockaddr_in *_to,
* after several retries
*/
-int send_to_kdc(KTEXT pkt, KTEXT rpkt, char *realm)
+int
+send_to_kdc(pkt,rpkt,realm)
+ KTEXT pkt;
+ KTEXT rpkt;
+ char *realm;
{
int i, f;
int no_host; /* was a kerberos host found? */
int retry;
int n_hosts;
int retval;
- int addr_count;
struct sockaddr_in to;
struct hostent *host, *hostlist;
+ char *cp;
char krbhst[MAX_HSTNM];
char lrealm[REALM_SZ];
@@ -242,70 +152,35 @@ int send_to_kdc(KTEXT pkt, KTEXT rpkt, char *realm)
continue;
no_host = 0; /* found at least one */
n_hosts++;
- /*
- * Preserve host network addresses to check against later
- */
+ /* preserve host network address to check later
+ * (would be better to preserve *all* addresses,
+ * take care of that later)
+ */
hostlist = (struct hostent *)
realloc((char *)hostlist,
(unsigned)
sizeof(struct hostent)*(n_hosts+1));
- if (!hostlist) {
- fprintf(stderr, "Could not grow hostlist\n");
- return /*errno */SKDC_CANT;
- }
- bcopy((char *)host, (char *)&hostlist[n_hosts-1],
- sizeof(struct hostent));
- host = &hostlist[n_hosts-1];
+ if (!hostlist)
+ return /*errno */SKDC_CANT;
+ bcopy((char *)host, (char *)&hostlist[n_hosts-1],
+ sizeof(struct hostent));
+ host = &hostlist[n_hosts-1];
+ cp = malloc((unsigned)host->h_length);
+ if (!cp) {
+ retval = /*errno */SKDC_CANT;
+ goto rtn;
+ }
+ bcopy((char *)host->h_addr, cp, host->h_length);
/* At least Sun OS version 3.2 (or worse) and Ultrix version 2.2
- (or worse) only return one address ... */
-#if (defined(ULTRIX022) || (defined(SunOS) && SunOS < 40))
- {
- char *cp = malloc((unsigned)host->h_length);
- if (!cp) {
- retval = /*errno */SKDC_CANT;
- goto rtn;
- }
- bcopy((char *)host->h_addr, cp, host->h_length);
- host->h_addr = cp;
- }
-#else /* !(ULTRIX022 || (SunOS < 40)) */
- /*
- * Make a copy of the entire h_addr_list.
- */
- {
- char *addr;
- char **old_addr_list;
- addr_count = 0;
- old_addr_list = host->h_addr_list;
- while(old_addr_list[addr_count++])
- ;
- host->h_addr_list = (char **)malloc(addr_count+1 * sizeof(char *));
- if (host->h_addr_list == NULL) {
- fprintf(stderr, "Could not allocate host->h_addr_list\n");
- retval = SKDC_CANT;
- goto rtn;
- }
- if (krb_debug) {
- printf("h_length = %d\n", host->h_length);
- printf("Number of addresses = %d\n", addr_count);
- }
- for (addr_count = 0; old_addr_list[addr_count]; addr_count++) {
- if (krb_debug)
- printf ("addr[%d] = %s\n", addr_count,
- inet_ntoa(*(struct in_addr *)old_addr_list[addr_count]));
- addr = (char *)malloc(host->h_length);
- if (addr == NULL) {
- fprintf(stderr, "Could not allocate address\n");
- retval = SKDC_CANT;
- goto rtn;
- }
- bcopy(old_addr_list[addr_count], addr, host->h_length);
- host->h_addr_list[addr_count] = addr;
- }
- host->h_addr_list[addr_count] = NULL;
- }
-#endif /* !(ULTRIX022 || (SunOS < 40)) */
-
+ (or worse) only return one name ... */
+#if !(defined(ULTRIX022) || (defined(SunOS) && SunOS < 40))
+ host->h_addr_list = (char **)malloc(sizeof(char *));
+ if (!host->h_addr_list) {
+ retval = /*errno */SKDC_CANT;
+ goto rtn;
+ }
+#endif /* ULTRIX022 || SunOS */
+ host->h_addr = cp;
bzero((char *)&hostlist[n_hosts],
sizeof(struct hostent));
to.sin_family = host->h_addrtype;
@@ -323,36 +198,22 @@ int send_to_kdc(KTEXT pkt, KTEXT rpkt, char *realm)
}
if (no_host) {
if (krb_debug)
- fprintf(stderr, "%s: can't find any Kerberos host.\n", prog);
+ fprintf(stderr, "%s: can't find any Kerberos host.\n",
+ prog);
retval = SKDC_CANT;
goto rtn;
}
- /*
- * retry each host in sequence. Some addresses may be unreachable
- * from where we are, so loop through them as well.
- */
+ /* retry each host in sequence */
for (retry = 0; retry < CLIENT_KRB_RETRY; ++retry) {
for (host = hostlist; host->h_name != (char *)NULL; host++) {
-#if (defined(ULTRIX022) || (defined(SunOS) && SunOS < 40))
- to.sin_family = host->h_addrtype;
- bcopy(host->h_addr_list[addr_count], (char *)&to.sin_addr,
- host->h_length);
- if (send_recv(pkt, rpkt, f, &to, hostlist)) {
- retval = KSUCCESS;
- goto rtn;
- }
-#else /* !(ULTRIX022 || (SunOS < 40)) */
- for (addr_count = 0; host->h_addr_list[addr_count]; addr_count++) {
- to.sin_family = host->h_addrtype;
- bcopy(host->h_addr_list[addr_count], (char *)&to.sin_addr,
- host->h_length);
- if (send_recv(pkt, rpkt, f, &to, hostlist)) {
- retval = KSUCCESS;
- goto rtn;
- }
- }
-#endif /* !(ULTRIX022 || (SunOS < 40)) */
- }
+ to.sin_family = host->h_addrtype;
+ bcopy(host->h_addr, (char *)&to.sin_addr,
+ host->h_length);
+ if (send_recv(pkt, rpkt, f, &to, hostlist)) {
+ retval = KSUCCESS;
+ goto rtn;
+ }
+ }
}
retval = SKDC_RETRY;
rtn:
@@ -375,3 +236,87 @@ rtn:
}
return(retval);
}
+
+/*
+ * try to send out and receive message.
+ * return 1 on success, 0 on failure
+ */
+
+static int
+send_recv(pkt,rpkt,f,_to,addrs)
+ KTEXT pkt;
+ KTEXT rpkt;
+ int f;
+ struct sockaddr_in *_to;
+ struct hostent *addrs;
+{
+ fd_set readfds;
+ register struct hostent *hp;
+ struct sockaddr_in from;
+ int sin_size;
+ int numsent;
+
+ if (krb_debug) {
+ if (_to->sin_family == AF_INET)
+ printf("Sending message to %s...",
+ inet_ntoa(_to->sin_addr));
+ else
+ printf("Sending message...");
+ (void) fflush(stdout);
+ }
+ if ((numsent = sendto(f,(char *)(pkt->dat), pkt->length, 0,
+ (struct sockaddr *)_to,
+ S_AD_SZ)) != pkt->length) {
+ if (krb_debug)
+ printf("sent only %d/%d\n",numsent, pkt->length);
+ return 0;
+ }
+ if (krb_debug) {
+ printf("Sent\nWaiting for reply...");
+ (void) fflush(stdout);
+ }
+ FD_ZERO(&readfds);
+ FD_SET(f, &readfds);
+ errno = 0;
+ /* select - either recv is ready, or timeout */
+ /* see if timeout or error or wrong descriptor */
+ if (select(f + 1, &readfds, (fd_set *)0, (fd_set *)0, &timeout) < 1
+ || !FD_ISSET(f, &readfds)) {
+ if (krb_debug) {
+ fprintf(stderr, "select failed: readfds=%x",
+ readfds);
+ perror("");
+ }
+ return 0;
+ }
+ sin_size = sizeof(from);
+ if (recvfrom(f, (char *)(rpkt->dat), sizeof(rpkt->dat), 0,
+ (struct sockaddr *)&from, &sin_size)
+ < 0) {
+ if (krb_debug)
+ perror("recvfrom");
+ return 0;
+ }
+ if (krb_debug) {
+ printf("received packet from %s\n", inet_ntoa(from.sin_addr));
+ fflush(stdout);
+ }
+ for (hp = addrs; hp->h_name != (char *)NULL; hp++) {
+ if (!bcmp(hp->h_addr, (char *)&from.sin_addr.s_addr,
+ hp->h_length)) {
+ if (krb_debug) {
+ printf("Received it\n");
+ (void) fflush(stdout);
+ }
+ return 1;
+ }
+ if (krb_debug)
+ fprintf(stderr,
+ "packet not from %lx\n",
+ (unsigned long)hp->h_addr);
+ }
+ if (krb_debug)
+ fprintf(stderr, "%s: received packet from wrong host! (%lx)\n",
+ "send_to_kdc(send_rcv)", from.sin_addr.s_addr);
+ return 0;
+}
diff --git a/eBones/krb/sendauth.c b/eBones/krb/sendauth.c
index add71d9..a1d79e7 100644
--- a/eBones/krb/sendauth.c
+++ b/eBones/krb/sendauth.c
@@ -28,6 +28,10 @@ static char rcsid[] =
* and make appropriate changes in krb_recvauth.c
*/
+extern int errno;
+
+extern char *krb_get_phost();
+
/*
* This file contains two routines: krb_sendauth() and krb_sendsrv().
*
@@ -107,10 +111,21 @@ static char rcsid[] =
* will disappear when krb_sendauth() returns.
*/
-int krb_sendauth(long options, int fd, KTEXT ticket, char *service, char *inst,
- char *realm, u_long checksum, MSG_DAT *msg_data, CREDENTIALS *cred,
- des_key_schedule schedule, struct sockaddr_in *laddr,
- struct sockaddr_in *faddr, char *version)
+int
+krb_sendauth(options, fd, ticket, service, inst, realm, checksum,
+ msg_data, cred, schedule, laddr, faddr, version)
+long options; /* bit-pattern of options */
+int fd; /* file descriptor to write onto */
+KTEXT ticket; /* where to put ticket (return); or
+ * supplied in case of KOPT_DONT_MK_REQ */
+char *service, *inst, *realm; /* service name, instance, realm */
+u_long checksum; /* checksum to include in request */
+MSG_DAT *msg_data; /* mutual auth MSG_DAT (return) */
+CREDENTIALS *cred; /* credentials (return) */
+Key_schedule schedule; /* key schedule (return) */
+struct sockaddr_in *laddr; /* local address */
+struct sockaddr_in *faddr; /* address of foreign host on fd */
+char *version; /* version string */
{
int rem, i, cc;
char srv_inst[INST_SZ];
@@ -198,7 +213,7 @@ int krb_sendauth(long options, int fd, KTEXT ticket, char *service, char *inst,
/* ...and decrypt it */
#ifndef NOENCRYPTION
- key_sched((des_cblock *)cred->session,schedule);
+ key_sched((C_Block *)cred->session,schedule);
#endif
if ((cc = krb_rd_priv(priv_buf,(unsigned long) tkt_len, schedule,
cred->session, faddr, laddr, msg_data)))
@@ -221,7 +236,10 @@ int krb_sendauth(long options, int fd, KTEXT ticket, char *service, char *inst,
* krb_sendsvc
*/
-int krb_sendsvc(int fd, char *service)
+int
+krb_sendsvc(fd, service)
+int fd;
+char *service;
{
/* write the service name length and then the service name to
the fd */
diff --git a/eBones/krb/stime.c b/eBones/krb/stime.c
index f70c33d..2da2463 100644
--- a/eBones/krb/stime.c
+++ b/eBones/krb/stime.c
@@ -26,7 +26,8 @@ static char *rcsid =
* "25-Jan-88 10:17:56"
*/
-char *stime(t)
+char *
+stime(t)
long *t;
{
static char st_data[40];
diff --git a/eBones/krb/tf_shm.c b/eBones/krb/tf_shm.c
index ad6690a..31894cb 100644
--- a/eBones/krb/tf_shm.c
+++ b/eBones/krb/tf_shm.c
@@ -28,6 +28,9 @@ static char rcsid[] =
#define MAX_BUFF sizeof(des_cblock)*1000 /* room for 1k keys */
+extern int errno;
+extern int krb_debug;
+
/*
* krb_create_shmtkt:
*
@@ -35,7 +38,9 @@ static char rcsid[] =
* in the specified filename.
*/
-int krb_shm_create(char *file_name)
+int
+krb_shm_create(file_name)
+char *file_name;
{
int retval;
int shmid;
@@ -133,7 +138,8 @@ int krb_is_diskless()
* file pointing to it.
*/
-int krb_shm_dest(char *file)
+int krb_shm_dest(file)
+char *file;
{
int shmid;
FILE *sfile;
@@ -165,3 +171,6 @@ int krb_shm_dest(char *file)
} else
return(RET_TKFIL); /* XXX */
}
+
+
+
diff --git a/eBones/krb/tf_util.c b/eBones/krb/tf_util.c
index ef91658..e939c38 100644
--- a/eBones/krb/tf_util.c
+++ b/eBones/krb/tf_util.c
@@ -14,9 +14,9 @@ static char rcsid[] =
#endif /* lint */
#endif
-#include <stdio.h>
-#include <string.h>
#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -33,12 +33,13 @@ static char rcsid[] =
#define TF_LCK_RETRY ((unsigned)2) /* seconds to sleep before
* retry if ticket file is
* locked */
+extern int krb_debug;
+
#ifdef TKT_SHMEM
char *krb_shm_addr = 0;
static char *tmp_shm_addr = 0;
static char krb_dummy_skey[8] = {0,0,0,0,0,0,0,0};
-char *shmat();
#endif /* TKT_SHMEM */
/*
@@ -54,12 +55,13 @@ char *shmat();
* c. In tf_close, be sure it gets reinitialized to a negative
* number.
*/
-static int fd = -1;
-static int curpos; /* Position in tfbfr */
-static int lastpos; /* End of tfbfr */
+static fd = -1;
+static curpos; /* Position in tfbfr */
+static lastpos; /* End of tfbfr */
static char tfbfr[BUFSIZ]; /* Buffer for ticket data */
-static tf_gets(), tf_read();
+static int tf_read(char *s, int n);
+static int tf_gets(char *s, int n);
/*
* This file contains routines for manipulating the ticket cache file.
@@ -123,7 +125,10 @@ static tf_gets(), tf_read();
* TKT_FIL_LCK - couldn't lock the file, even after a retry
*/
-int tf_init(char *tf_name, int rw)
+int
+tf_init(tf_name, rw)
+ char *tf_name;
+ int rw;
{
int wflag;
uid_t me, getuid();
@@ -259,7 +264,9 @@ int tf_init(char *tf_name, int rw)
* was longer than ANAME_SZ, TKT_FIL_FMT is returned.
*/
-int tf_get_pname(char *p)
+int
+tf_get_pname(p)
+ char *p;
{
if (fd < 0) {
if (krb_debug)
@@ -281,7 +288,9 @@ int tf_get_pname(char *p)
* instance may be null.
*/
-int tf_get_pinst(char *inst)
+int
+tf_get_pinst(inst)
+ char *inst;
{
if (fd < 0) {
if (krb_debug)
@@ -294,33 +303,6 @@ int tf_get_pinst(char *inst)
}
/*
- * tf_close() closes the ticket file and sets "fd" to -1. If "fd" is
- * not a valid file descriptor, it just returns. It also clears the
- * buffer used to read tickets.
- *
- * The return value is not defined.
- */
-
-void tf_close()
-{
- if (!(fd < 0)) {
-#ifdef TKT_SHMEM
- if (shmdt(krb_shm_addr)) {
- /* what kind of error? */
- if (krb_debug)
- fprintf(stderr, "shmdt 0x%x: errno %d",krb_shm_addr, errno);
- } else {
- krb_shm_addr = 0;
- }
-#endif TKT_SHMEM
- (void) flock(fd, LOCK_UN);
- (void) close(fd);
- fd = -1; /* see declaration of fd above */
- }
- bzero(tfbfr, sizeof(tfbfr));
-}
-
-/*
* tf_get_cred() reads a CREDENTIALS record from a ticket file and fills
* in the given structure "c". It should only be called after tf_init(),
* tf_get_pname(), and tf_get_pinst() have been called. If all goes well,
@@ -331,7 +313,9 @@ void tf_close()
* EOF - end of file encountered
*/
-int tf_get_cred(CREDENTIALS *c)
+int
+tf_get_cred(c)
+ CREDENTIALS *c;
{
KTEXT ticket = &c->ticket_st; /* pointer to ticket */
int k_errno;
@@ -388,6 +372,34 @@ int tf_get_cred(CREDENTIALS *c)
}
/*
+ * tf_close() closes the ticket file and sets "fd" to -1. If "fd" is
+ * not a valid file descriptor, it just returns. It also clears the
+ * buffer used to read tickets.
+ *
+ * The return value is not defined.
+ */
+
+void
+tf_close()
+{
+ if (!(fd < 0)) {
+#ifdef TKT_SHMEM
+ if (shmdt(krb_shm_addr)) {
+ /* what kind of error? */
+ if (krb_debug)
+ fprintf(stderr, "shmdt 0x%x: errno %d",krb_shm_addr, errno);
+ } else {
+ krb_shm_addr = 0;
+ }
+#endif TKT_SHMEM
+ (void) flock(fd, LOCK_UN);
+ (void) close(fd);
+ fd = -1; /* see declaration of fd above */
+ }
+ bzero(tfbfr, sizeof(tfbfr));
+}
+
+/*
* tf_gets() is an internal routine. It takes a string "s" and a count
* "n", and reads from the file until either it has read "n" characters,
* or until it reads a null byte. When finished, what has been read exists
@@ -405,7 +417,10 @@ int tf_get_cred(CREDENTIALS *c)
* file is seriously ill.
*/
-static int tf_gets(char *s, int n)
+static int
+tf_gets(s, n)
+ register char *s;
+ int n;
{
register count;
@@ -444,9 +459,12 @@ static int tf_gets(char *s, int n)
* 0 on end of file or read error
*/
-static int tf_read(char *s, int n)
+static int
+tf_read(s, n)
+ register char *s;
+ register int n;
{
- int count;
+ register count;
for (count = n; count > 0; --count) {
if (curpos >= sizeof(tfbfr)) {
@@ -462,8 +480,6 @@ static int tf_read(char *s, int n)
return n;
}
-char *tkt_string();
-
/*
* tf_save_cred() appends an incoming ticket to the end of the ticket
* file. You must call tf_init() before calling tf_save_cred().
@@ -478,8 +494,17 @@ char *tkt_string();
* called previously, and KFAILURE for anything else that went wrong.
*/
-int tf_save_cred(char *service, char *instance, char *realm,
- des_cblock session, int lifetime, int kvno, KTEXT ticket, long issue_date)
+int
+tf_save_cred(service, instance, realm, session, lifetime, kvno,
+ ticket, issue_date)
+ char *service; /* Service name */
+ char *instance; /* Instance */
+ char *realm; /* Auth domain */
+ C_Block session; /* Session key */
+ int lifetime; /* Lifetime */
+ int kvno; /* Key version number */
+ KTEXT ticket; /* The ticket itself */
+ long issue_date; /* The issue time */
{
off_t lseek();
diff --git a/eBones/krb/tkt_string.c b/eBones/krb/tkt_string.c
index bbbdbc5..d944833 100644
--- a/eBones/krb/tkt_string.c
+++ b/eBones/krb/tkt_string.c
@@ -15,8 +15,8 @@ static char *rcsid =
#endif /* lint */
#endif
-#include <stdio.h>
#include <stdlib.h>
+#include <stdio.h>
#include <sys/types.h>
#include <krb.h>
#include <string.h>
@@ -68,7 +68,9 @@ char *tkt_string()
* and return an undesired ticket file name until this routine is called.
*/
-void krb_set_tkt_string(char *val)
+void
+krb_set_tkt_string(val)
+char *val;
{
(void) strncpy(krb_ticket_string, val, sizeof(krb_ticket_string)-1);
diff --git a/eBones/krb/util.c b/eBones/krb/util.c
index 8dca743..68c0dbc 100644
--- a/eBones/krb/util.c
+++ b/eBones/krb/util.c
@@ -30,7 +30,9 @@ static char rcsid[] =
* pname, pinst, prealm, netaddr, flags, cksum, timestamp, session
*/
-void ad_print(AUTH_DAT *x)
+void
+ad_print(x)
+AUTH_DAT *x;
{
struct in_addr in;
@@ -44,7 +46,7 @@ void ad_print(AUTH_DAT *x)
#ifdef NOENCRYPTION
placebo_cblock_print(x->session);
#else
- des_cblock_print_file((des_cblock *)x->session,stdout);
+ des_cblock_print_file((C_Block *)x->session,stdout);
#endif
/* skip reply for now */
}
diff --git a/eBones/ksrvtgt/Makefile b/eBones/ksrvtgt/Makefile
index 1c6b0dc..9bf166d 100644
--- a/eBones/ksrvtgt/Makefile
+++ b/eBones/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/ksrvtgt/ksrvtgt.c b/eBones/ksrvtgt/ksrvtgt.c
index c51457c..0f92394 100644
--- a/eBones/ksrvtgt/ksrvtgt.c
+++ b/eBones/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/ksrvutil/Makefile b/eBones/ksrvutil/Makefile
index 1fcaf0c..a95d9ae 100644
--- a/eBones/ksrvutil/Makefile
+++ b/eBones/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/ksrvutil/ksrvutil.c b/eBones/ksrvutil/ksrvutil.c
index 6d81e72..1062ea5 100644
--- a/eBones/ksrvutil/ksrvutil.c
+++ b/eBones/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/kstash/Makefile b/eBones/kstash/Makefile
index b194a2c..1387f8c 100644
--- a/eBones/kstash/Makefile
+++ b/eBones/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/kstash/kstash.c b/eBones/kstash/kstash.c
index d5a59bf..ce26a1d 100644
--- a/eBones/kstash/kstash.c
+++ b/eBones/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/lib/libacl/Makefile b/eBones/lib/libacl/Makefile
index 0ac5183..c015eaa 100644
--- a/eBones/lib/libacl/Makefile
+++ b/eBones/lib/libacl/Makefile
@@ -6,5 +6,9 @@ SHLIB_MAJOR= 2
SHLIB_MINOR= 0
CFLAGS+=-DDEBUG -DKERBEROS -I${.CURDIR}/../include -Wall
SRCS= acl_files.c
+MAN3= acl_check.3
+MLINKS= acl_check.3 acl_canonicalize_principal.3 \
+ acl_check.3 acl_exact_match.3 acl_check.3 acl_add.3 \
+ acl_check.3 acl_delete.3 acl_check.3 acl_initialize.3
.include <bsd.lib.mk>
diff --git a/eBones/lib/libacl/acl_files.c b/eBones/lib/libacl/acl_files.c
index 1f488f3..a3e1f68 100644
--- a/eBones/lib/libacl/acl_files.c
+++ b/eBones/lib/libacl/acl_files.c
@@ -19,16 +19,16 @@ static char rcsid[] =
/*** Routines for manipulating access control list files ***/
-#include <stdio.h>
+#include <unistd.h>
#include <stdlib.h>
+#include <stdio.h>
#include <strings.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/errno.h>
#include <ctype.h>
-#include <unistd.h>
-#include <krb.h>
+#include "krb.h"
__BEGIN_DECLS
static int acl_abort __P((char *, FILE *));
@@ -57,16 +57,15 @@ __END_DECLS
#define COR(a,b) ((a!=NULL)?(a):(b))
-extern int errno;
-
-/* extern time_t time(); */
-
/* Canonicalize a principal name */
/* If instance is missing, it becomes "" */
/* If realm is missing, it becomes the local realm */
/* Canonicalized form is put in canon, which must be big enough to hold
MAX_PRINCIPAL_SIZE characters */
-void acl_canonicalize_principal(char *principal, char *canon)
+void
+acl_canonicalize_principal(principal, canon)
+char *principal;
+char *canon;
{
char *dot, *atsign, *end;
int len;
@@ -127,7 +126,9 @@ void acl_canonicalize_principal(char *principal, char *canon)
/* Return new FILE pointer */
/* or NULL if file cannot be modified */
/* REQUIRES WRITE PERMISSION TO CONTAINING DIRECTORY */
-static FILE *acl_lock_file(char *acl_file)
+static FILE *
+acl_lock_file(acl_file)
+char *acl_file;
{
struct stat s;
char new[LINESIZE];
@@ -174,7 +175,10 @@ static FILE *acl_lock_file(char *acl_file)
/* Returns > 0 if lock was broken */
/* Returns < 0 if some other error occurs */
/* Closes f */
-static int acl_commit(char *acl_file, FILE *f)
+static int
+acl_commit(acl_file, f)
+char *acl_file;
+FILE *f;
{
char new[LINESIZE];
int ret;
@@ -198,7 +202,10 @@ static int acl_commit(char *acl_file, FILE *f)
* Returns 0 if successful, < 0 otherwise
* Closes f
*/
-static int acl_abort(char *acl_file, FILE *f)
+static int
+acl_abort(acl_file, f)
+char *acl_file;
+FILE *f;
{
char new[LINESIZE];
int ret;
@@ -220,7 +227,10 @@ static int acl_abort(char *acl_file, FILE *f)
/* Creates the file with permissions perm if it does not exist */
/* Erases it if it does */
/* Returns return value of acl_commit */
-int acl_initialize(char *acl_file, int perm)
+int
+acl_initialize(acl_file, perm)
+char *acl_file;
+int perm;
{
FILE *new;
int fd;
@@ -241,7 +251,9 @@ int acl_initialize(char *acl_file, int perm)
/* Eliminate all whitespace character in buf */
/* Modifies its argument */
-static void nuke_whitespace(char *buf)
+static void
+nuke_whitespace(buf)
+char *buf;
{
register char *pin, *pout;
@@ -259,7 +271,8 @@ struct hashtbl {
};
/* Make an empty hash table of size s */
-static struct hashtbl *make_hash(size)
+static struct hashtbl *
+make_hash(size)
int size;
{
struct hashtbl *h;
@@ -273,7 +286,9 @@ int size;
}
/* Destroy a hash table */
-static void destroy_hash(struct hashtbl *h)
+static void
+destroy_hash(h)
+struct hashtbl *h;
{
int i;
@@ -285,7 +300,9 @@ static void destroy_hash(struct hashtbl *h)
}
/* Compute hash value for a string */
-static unsigned hashval(char *s)
+static unsigned
+hashval(s)
+register char *s;
{
register unsigned hv;
@@ -296,7 +313,10 @@ static unsigned hashval(char *s)
}
/* Add an element to a hash table */
-static void add_hash(struct hashtbl *h, char *el)
+static void
+add_hash(h, el)
+struct hashtbl *h;
+char *el;
{
unsigned hv;
char *s;
@@ -327,7 +347,10 @@ static void add_hash(struct hashtbl *h, char *el)
}
/* Returns nonzero if el is in h */
-static int check_hash(struct hashtbl *h, char *el)
+static int
+check_hash(h, el)
+struct hashtbl *h;
+char *el;
{
unsigned hv;
@@ -354,7 +377,9 @@ static int acl_cache_next = 0;
/* Returns < 0 if unsuccessful in loading acl */
/* Returns index into acl_cache otherwise */
/* Note that if acl is already loaded, this is just a lookup */
-static int acl_load(char *name)
+static int
+acl_load(name)
+char *name;
{
int i;
FILE *f;
@@ -421,7 +446,10 @@ static int acl_load(char *name)
/* Returns nonzero if it can be determined that acl contains principal */
/* Principal is not canonicalized, and no wildcarding is done */
-int acl_exact_match(char *acl, char *principal)
+int
+acl_exact_match(acl, principal)
+char *acl;
+char *principal;
{
int idx;
@@ -432,7 +460,10 @@ int acl_exact_match(char *acl, char *principal)
/* Returns nonzero if it can be determined that acl contains principal */
/* Recognizes wildcards in acl of the form
name.*@realm, *.*@realm, and *.*@* */
-int acl_check(char *acl, char *principal)
+int
+acl_check(acl, principal)
+char *acl;
+char *principal;
{
char buf[MAX_PRINCIPAL_SIZE];
char canon[MAX_PRINCIPAL_SIZE];
@@ -458,7 +489,10 @@ int acl_check(char *acl, char *principal)
/* Adds principal to acl */
/* Wildcards are interpreted literally */
-int acl_add(char *acl, char *principal)
+int
+acl_add(acl, principal)
+char *acl;
+char *principal;
{
int idx;
int i;
@@ -490,7 +524,10 @@ int acl_add(char *acl, char *principal)
/* Removes principal from acl */
/* Wildcards are interpreted literally */
-int acl_delete(char *acl, char *principal)
+int
+acl_delete(acl, principal)
+char *acl;
+char *principal;
{
int idx;
int i;
diff --git a/eBones/lib/libkadm/Makefile b/eBones/lib/libkadm/Makefile
index 4642530..293e842 100644
--- a/eBones/lib/libkadm/Makefile
+++ b/eBones/lib/libkadm/Makefile
@@ -3,7 +3,8 @@
LIB= kadm
SRCS= kadm_err.c kadm_stream.c kadm_supp.c kadm_cli_wrap.c
-CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/../include -I${KRBOBJDIR} -DPOSIX -Wall
+CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/../include -I${KRBOBJDIR} \
+ -DPOSIX -Wall
CLEANFILES+= kadm_err.c kadm_err.h
kadm_err.c kadm_err.h: kadm_err.et
diff --git a/eBones/lib/libkadm/kadm.h b/eBones/lib/libkadm/kadm.h
index eea05df..21a23bb 100644
--- a/eBones/lib/libkadm/kadm.h
+++ b/eBones/lib/libkadm/kadm.h
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <netinet/in.h>
#include <krb.h>
+#include <krb_db.h>
#include <des.h>
/* The global structures for the client and server */
@@ -145,4 +146,19 @@ int vts_short(u_short dat, u_char **st, int loc);
int vts_long(u_long dat, u_char **st, int loc);
int vts_char(u_char dat, u_char **st, int loc);
+int kadm_cli_conn(void);
+void kadm_cli_disconn(void);
+int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz);
+int kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz);
+int kadm_cli_keyd(des_cblock s_k, des_key_schedule s_s);
+
+int kadm_get(Kadm_vals *vals, u_char fl[4]);
+int kadm_mod(Kadm_vals *vals1, Kadm_vals *vals2);
+int kadm_add(Kadm_vals *vals);
+int kadm_change_pw(des_cblock newkey);
+int kadm_init_link(char n[], char i[], char r[]);
+void prin_vals(Kadm_vals *vals);
+void kadm_vals_to_prin(u_char fields[FLDSZ], Principal *new, Kadm_vals *old);
+void kadm_prin_to_vals(u_char fields[FLDSZ], Kadm_vals *new, Principal *old);
+
#endif KADM_DEFS
diff --git a/eBones/lib/libkadm/kadm_cli_wrap.c b/eBones/lib/libkadm/kadm_cli_wrap.c
index 3522e74..e25439d 100644
--- a/eBones/lib/libkadm/kadm_cli_wrap.c
+++ b/eBones/lib/libkadm/kadm_cli_wrap.c
@@ -20,9 +20,9 @@ static const char rcsid[] =
* kadm_cli_wrap.c the client side wrapping of the calls to the admin server
*/
-#include <sys/types.h>
#include <unistd.h>
#include <string.h>
+#include <sys/types.h>
#include <errno.h>
#include <signal.h>
#include <netdb.h>
@@ -31,12 +31,6 @@ static const char rcsid[] =
#include <kadm_err.h>
#include <krb_err.h>
-int kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz);
-int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz);
-int kadm_cli_keyd(des_cblock *s_k, des_key_schedule s_s);
-int kadm_cli_conn(void);
-void kadm_cli_disconn(void);
-
#ifndef NULL
#define NULL 0
#endif
@@ -50,11 +44,11 @@ static Kadm_Client client_parm;
static des_cblock sess_key; /* to be filled in by kadm_cli_keyd */
static Key_schedule sess_sched;
-static void clear_secrets()
+static void
+clear_secrets()
{
bzero((char *)sess_key, sizeof(sess_key));
bzero((char *)sess_sched, sizeof(sess_sched));
- return;
}
/*
@@ -65,7 +59,11 @@ static void clear_secrets()
* data about the connection between the server and client, the services
* used, the locations and other fun things
*/
-int kadm_init_link(char n[], char i[], char r[])
+int
+kadm_init_link(n, i, r)
+char n[];
+char i[];
+char r[];
{
struct servent *sep; /* service we will talk to */
struct hostent *hop; /* host we will talk to */
@@ -104,7 +102,9 @@ int kadm_init_link(char n[], char i[], char r[])
* key. Returns no actual data from the master server, since this is called
* by a user
*/
-int kadm_change_pw(des_cblock newkey)
+int
+kadm_change_pw(newkey)
+des_cblock newkey; /* The DES form of the users key */
{
int stsize, retc; /* stream size and return code */
u_char *send_st; /* send stream */
@@ -148,7 +148,9 @@ int kadm_change_pw(des_cblock newkey)
* entry, so if you leave certain fields blank you will be able to determine
* the default values they are set to
*/
-int kadm_add(Kadm_vals *vals)
+int
+kadm_add(vals)
+Kadm_vals *vals;
{
u_char *st, *st2; /* st will hold the stream of values */
int st_len; /* st2 the final stream with opcode */
@@ -184,7 +186,10 @@ int kadm_add(Kadm_vals *vals)
* Modifies all entries corresponding to the first values so they match the
* second values. returns the values for the changed entries in vals2
*/
-int kadm_mod(Kadm_vals *vals1, Kadm_vals *vals2)
+int
+kadm_mod(vals1, vals2)
+Kadm_vals *vals1;
+Kadm_vals *vals2;
{
u_char *st, *st2; /* st will hold the stream of values */
int st_len, nlen; /* st2 the final stream with opcode */
@@ -228,7 +233,11 @@ int kadm_mod(Kadm_vals *vals1, Kadm_vals *vals2)
* this data for each matching recipient, after a count of how many such
* matches there were
*/
-int kadm_get(Kadm_vals *vals, u_char fl[4])
+int
+kadm_get(vals, fl)
+Kadm_vals *vals;
+u_char fl[4];
+
{
int loop; /* for copying the fields data */
u_char *st, *st2; /* st will hold the stream of values */
@@ -276,7 +285,12 @@ int kadm_get(Kadm_vals *vals, u_char fl[4])
* connection to the admin server. If the connection is succesfully open
* then it sends the data and waits for a reply.
*/
-int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz)
+int
+kadm_cli_send(st_dat, st_siz, ret_dat, ret_siz)
+u_char *st_dat; /* the actual data */
+int st_siz; /* length of said data */
+u_char **ret_dat; /* to give return info */
+int *ret_siz; /* length of returned info */
{
int act_len, retdat; /* current offset into packet, return
* data */
@@ -292,7 +306,7 @@ int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz)
(void) strncpy((char *)act_st, KADM_VERSTR, KADM_VERSIZE);
act_len = KADM_VERSIZE;
- if ((retdat = kadm_cli_keyd(&sess_key, sess_sched)) != KADM_SUCCESS) {
+ if ((retdat = kadm_cli_keyd(sess_key, sess_sched)) != KADM_SUCCESS) {
free((char *)act_st);
return retdat; /* couldnt get key working */
}
@@ -312,7 +326,7 @@ int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz)
cksum = 0;
#else
cksum = quad_cksum((des_cblock *)priv_pak, (des_cblock *)0,
- (long)priv_len, 0, &sess_key);
+ (long)priv_len, 0, (des_cblock *)sess_key);
#endif
if ((retdat = krb_mk_req(&authent, client_parm.sname, client_parm.sinst,
client_parm.krbrlm, (long)cksum))) {
@@ -379,7 +393,10 @@ int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz)
}
/* takes in the sess_key and key_schedule and sets them appropriately */
-int kadm_cli_keyd(des_cblock *s_k, des_key_schedule s_s)
+int
+kadm_cli_keyd(s_k, s_s)
+des_cblock s_k; /* session key */
+des_key_schedule s_s; /* session key schedule */
{
CREDENTIALS cred; /* to get key data */
int stat;
@@ -393,7 +410,7 @@ int kadm_cli_keyd(des_cblock *s_k, des_key_schedule s_s)
#ifdef NOENCRYPTION
bzero(s_s, sizeof(des_key_schedule));
#else
- if ((stat = key_sched(s_k,s_s)))
+ if ((stat = key_sched((des_cblock *)s_k,s_s)))
return(stat+krb_err_base);
#endif
return KADM_SUCCESS;
@@ -401,7 +418,8 @@ int kadm_cli_keyd(des_cblock *s_k, des_key_schedule s_s)
static sigtype (*opipe)();
-int kadm_cli_conn()
+int
+kadm_cli_conn()
{ /* this connects and sets my_addr */
int on = 1;
@@ -435,15 +453,21 @@ int kadm_cli_conn()
return KADM_SUCCESS;
}
-void kadm_cli_disconn()
+void
+kadm_cli_disconn()
{
(void) close(client_parm.admin_fd);
(void) signal(SIGPIPE, opipe);
- return;
}
-int kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz)
+int
+kadm_cli_out(dat, dat_len, ret_dat, ret_siz)
+u_char *dat;
+int dat_len;
+u_char **ret_dat;
+int *ret_siz;
{
+ extern int errno;
u_short dlen;
int retval;
@@ -461,7 +485,7 @@ int kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz)
return (errno); /* XXX */
if ((retval = krb_net_read(client_parm.admin_fd, (char *) &dlen,
- sizeof(u_short))) != sizeof(u_short)) {
+ sizeof(u_short)) != sizeof(u_short))) {
if (retval < 0)
return(errno); /* XXX */
else
@@ -474,7 +498,7 @@ int kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz)
return(KADM_NOMEM);
if ((retval = krb_net_read(client_parm.admin_fd, (char *) *ret_dat,
- (int) dlen)) != dlen) {
+ (int) dlen) != dlen)) {
if (retval < 0)
return(errno); /* XXX */
else
diff --git a/eBones/lib/libkadm/kadm_stream.c b/eBones/lib/libkadm/kadm_stream.c
index 02b8263..58a625a 100644
--- a/eBones/lib/libkadm/kadm_stream.c
+++ b/eBones/lib/libkadm/kadm_stream.c
@@ -29,7 +29,7 @@ static const char rcsid[] =
*/
#include <string.h>
-#include "kadm.h"
+#include <kadm.h>
#define min(a,b) (((a) < (b)) ? (a) : (b))
@@ -40,7 +40,11 @@ vals_to_stream
this function creates a byte-stream representation of the kadm_vals structure
*/
-int vals_to_stream(Kadm_vals *dt_in, u_char **dt_out)
+
+int
+vals_to_stream(dt_in, dt_out)
+Kadm_vals *dt_in;
+u_char **dt_out;
{
int vsloop, stsize; /* loop counter, stream size */
@@ -74,21 +78,32 @@ int vals_to_stream(Kadm_vals *dt_in, u_char **dt_out)
return(stsize);
}
-int build_field_header(u_char *cont, u_char **st)
+int
+build_field_header(cont, st)
+u_char *cont; /* container for fields data */
+u_char **st; /* stream */
{
*st = (u_char *) malloc (4);
bcopy((char *) cont, (char *) *st, 4);
return 4; /* return pointer to current stream location */
}
-int vts_string(char *dat, u_char **st, int loc)
+int
+vts_string(dat, st, loc)
+char *dat; /* a string to put on the stream */
+u_char **st; /* base pointer to the stream */
+int loc; /* offset into the stream for current data */
{
*st = (u_char *) realloc ((char *)*st, (unsigned) (loc + strlen(dat) + 1));
bcopy(dat, (char *)(*st + loc), strlen(dat)+1);
return strlen(dat)+1;
}
-int vts_short(u_short dat, u_char **st, int loc)
+int
+vts_short(dat, st, loc)
+u_short dat; /* the attributes field */
+u_char **st; /* a base pointer to the stream */
+int loc; /* offset into the stream for current data */
{
u_short temp; /* to hold the net order short */
@@ -98,7 +113,11 @@ int vts_short(u_short dat, u_char **st, int loc)
return sizeof(u_short);
}
-int vts_long(u_long dat, u_char **st, int loc)
+int
+vts_long(dat, st, loc)
+u_long dat; /* the attributes field */
+u_char **st; /* a base pointer to the stream */
+int loc; /* offset into the stream for current data */
{
u_long temp; /* to hold the net order short */
@@ -108,8 +127,11 @@ int vts_long(u_long dat, u_char **st, int loc)
return sizeof(u_long);
}
-
-int vts_char(u_char dat, u_char **st, int loc)
+int
+vts_char(dat, st, loc)
+u_char dat; /* the attributes field */
+u_char **st; /* a base pointer to the stream */
+int loc; /* offset into the stream for current data */
{
*st = (u_char *) realloc ((char *)*st, (unsigned)(loc + sizeof(u_char)));
(*st)[loc] = (u_char) dat;
@@ -123,7 +145,11 @@ stream_to_vals
this decodes a byte stream represntation of a vals struct into kadm_vals
*/
-int stream_to_vals(u_char *dt_in, Kadm_vals *dt_out, int maxlen)
+int
+stream_to_vals(dt_in, dt_out, maxlen)
+u_char *dt_in;
+Kadm_vals *dt_out;
+int maxlen; /* max length to use */
{
register int vsloop, stsize; /* loop counter, stream size */
register int status;
@@ -182,7 +208,11 @@ int stream_to_vals(u_char *dt_in, Kadm_vals *dt_out, int maxlen)
return stsize;
}
-int check_field_header(u_char *st, u_char *cont, int maxlen)
+int
+check_field_header(st, cont, maxlen)
+u_char *st; /* stream */
+u_char *cont; /* container for fields data */
+int maxlen;
{
if (4 > maxlen)
return(-1);
@@ -190,7 +220,13 @@ int check_field_header(u_char *st, u_char *cont, int maxlen)
return 4; /* return pointer to current stream location */
}
-int stv_string(u_char *st, char *dat, int loc, int stlen, int maxlen)
+int
+stv_string(st, dat, loc, stlen, maxlen)
+register u_char *st; /* base pointer to the stream */
+char *dat; /* a string to read from the stream */
+register int loc; /* offset into the stream for current data */
+int stlen; /* max length of string to copy in */
+int maxlen; /* max length of input stream */
{
int maxcount; /* max count of chars to copy */
@@ -203,7 +239,12 @@ int stv_string(u_char *st, char *dat, int loc, int stlen, int maxlen)
return strlen(dat)+1;
}
-int stv_short(u_char *st, u_short *dat, int loc, int maxlen)
+int
+stv_short(st, dat, loc, maxlen)
+u_char *st; /* a base pointer to the stream */
+u_short *dat; /* the attributes field */
+int loc; /* offset into the stream for current data */
+int maxlen;
{
u_short temp; /* to hold the net order short */
@@ -214,7 +255,12 @@ int stv_short(u_char *st, u_short *dat, int loc, int maxlen)
return sizeof(u_short);
}
-int stv_long(u_char *st, u_long *dat, int loc, int maxlen)
+int
+stv_long(st, dat, loc, maxlen)
+u_char *st; /* a base pointer to the stream */
+u_long *dat; /* the attributes field */
+int loc; /* offset into the stream for current data */
+int maxlen; /* maximum length of st */
{
u_long temp; /* to hold the net order short */
@@ -225,10 +271,16 @@ int stv_long(u_char *st, u_long *dat, int loc, int maxlen)
return sizeof(u_long);
}
-int stv_char(u_char *st, u_char *dat, int loc, int maxlen)
+int
+stv_char(st, dat, loc, maxlen)
+u_char *st; /* a base pointer to the stream */
+u_char *dat; /* the attributes field */
+int loc; /* offset into the stream for current data */
+int maxlen;
{
if (loc + 1 > maxlen)
return(-1);
*dat = *(st + loc);
return 1;
}
+
diff --git a/eBones/lib/libkadm/kadm_supp.c b/eBones/lib/libkadm/kadm_supp.c
index deaf63b..353fed0 100644
--- a/eBones/lib/libkadm/kadm_supp.c
+++ b/eBones/lib/libkadm/kadm_supp.c
@@ -26,16 +26,18 @@ static const char rcsid[] =
structure
*/
-#include <time.h>
#include <string.h>
-#include "kadm.h"
-#include "krb_db.h"
+#include <time.h>
+#include <kadm.h>
+#include <krb_db.h>
/*
prin_vals:
recieves : a vals structure
*/
-void prin_vals(Kadm_vals *vals)
+void
+prin_vals(vals)
+Kadm_vals *vals;
{
printf("Info in Database for %s.%s:\n", vals->name, vals->instance);
printf(" Max Life: %d Exp Date: %s\n",vals->max_life,
@@ -45,9 +47,9 @@ void prin_vals(Kadm_vals *vals)
}
#ifdef notdef
-int nierror(int s)
+nierror(s)
+int s;
{
- extern char *error_message();
printf("Kerberos admin server loses..... %s\n",error_message(s));
return(s);
}
@@ -57,7 +59,11 @@ int nierror(int s)
it copies the fields in Principal specified by fields into Kadm_vals,
i.e from old to new */
-void kadm_prin_to_vals(u_char fields[], Kadm_vals *new, Principal *old)
+void
+kadm_prin_to_vals(fields, new, old)
+u_char fields[FLDSZ];
+Kadm_vals *new;
+Principal *old;
{
bzero((char *)new, sizeof(*new));
if (IS_FIELD(KADM_NAME,fields)) {
@@ -87,7 +93,11 @@ void kadm_prin_to_vals(u_char fields[], Kadm_vals *new, Principal *old)
}
}
-void kadm_vals_to_prin(u_char fields[], Principal *new, Kadm_vals *old)
+void
+kadm_vals_to_prin(fields, new, old)
+u_char fields[FLDSZ];
+Principal *new;
+Kadm_vals *old;
{
bzero((char *)new, sizeof(*new));
diff --git a/eBones/lib/libkdb/krb_cache.c b/eBones/lib/libkdb/krb_cache.c
index 0dafb140..1c7c9ce 100644
--- a/eBones/lib/libkdb/krb_cache.c
+++ b/eBones/lib/libkdb/krb_cache.c
@@ -49,21 +49,21 @@ kerb_cache_init()
*/
int
-kerb_cache_get_principal(char *serv, char *inst, Principal *principal,
- unsigned int max)
+kerb_cache_get_principal(serv, inst, principal, max)
+ char *serv; /* could have wild card */
+ char *inst; /* could have wild card */
+ Principal *principal;
+ unsigned int max; /* max number of name structs to return */
+
{
int found = 0;
if (!init)
kerb_cache_init();
#ifdef DEBUG
- if (kerb_debug & 2)
+ if (kerb_debug & 2) {
fprintf(stderr, "cache_get_principal for %s %s max = %d\n",
serv, inst, max);
-#endif DEBUG
-
-#ifdef DEBUG
- if (kerb_debug & 2) {
if (found) {
fprintf(stderr, "cache get %s %s found %s %s\n",
serv, inst, principal->name, principal->instance);
@@ -82,7 +82,11 @@ kerb_cache_get_principal(char *serv, char *inst, Principal *principal,
*/
int
-kerb_cache_put_principal(Principal *principal, unsigned int max)
+kerb_cache_put_principal(principal, max)
+ Principal *principal;
+ unsigned int max; /* max number of principal structs to
+ * insert */
+
{
u_long i;
int count = 0;
@@ -115,7 +119,12 @@ kerb_cache_put_principal(Principal *principal, unsigned int max)
*/
int
-kerb_cache_get_dba(char *serv, char *inst, Dba *dba, unsigned int max)
+kerb_cache_get_dba(serv, inst, dba, max)
+ char *serv; /* could have wild card */
+ char *inst; /* could have wild card */
+ Dba *dba;
+ unsigned int max; /* max number of name structs to return */
+
{
int found = 0;
@@ -123,13 +132,9 @@ kerb_cache_get_dba(char *serv, char *inst, Dba *dba, unsigned int max)
kerb_cache_init();
#ifdef DEBUG
- if (kerb_debug & 2)
+ if (kerb_debug & 2) {
fprintf(stderr, "cache_get_dba for %s %s max = %d\n",
serv, inst, max);
-#endif
-
-#ifdef DEBUG
- if (kerb_debug & 2) {
if (found) {
fprintf(stderr, "cache get %s %s found %s %s\n",
serv, inst, dba->name, dba->instance);
@@ -146,7 +151,10 @@ kerb_cache_get_dba(char *serv, char *inst, Dba *dba, unsigned int max)
*/
int
-kerb_cache_put_dba(Dba *dba, unsigned int max)
+kerb_cache_put_dba(dba, max)
+ Dba *dba;
+ unsigned int max; /* max number of dba structs to insert */
+
{
u_long i;
int count = 0;
@@ -170,3 +178,4 @@ kerb_cache_put_dba(Dba *dba, unsigned int max)
}
return count;
}
+
diff --git a/eBones/lib/libkdb/krb_dbm.c b/eBones/lib/libkdb/krb_dbm.c
index 68f428b..760bd6f 100644
--- a/eBones/lib/libkdb/krb_dbm.c
+++ b/eBones/lib/libkdb/krb_dbm.c
@@ -6,7 +6,7 @@
* from: krb_dbm.c,v 4.9 89/04/18 16:15:13 wesommer Exp $
* $Id: krb_dbm.c,v 1.4 1995/08/03 17:15:42 mark Exp $
*/
-
+
#if 0
#ifndef lint
static char rcsid[] =
@@ -15,16 +15,16 @@ static char rcsid[] =
#endif
#if defined(__FreeBSD__) || defined(__NetBSD__)
-#define NDBM_
+#define _NDBM_
#endif
#if defined(__FreeBSD__) || defined(__NetBSD__)
-#define DBM_
+#define _DBM_
#endif
+#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/uio.h>
@@ -35,17 +35,17 @@ static char rcsid[] =
#include <strings.h>
#include <des.h>
#include <sys/file.h>
-#ifdef NDBM_
+#ifdef _NDBM_
#include <ndbm.h>
-#else /*NDBM_*/
+#else /*_NDBM_*/
#include <dbm.h>
-#endif /*NDBM_*/
+#endif /*_NDBM_*/
/* before krb_db.h */
#include <krb.h>
#include <krb_db.h>
#ifdef dbm_pagfno
-#define DBM_
+#define DB
#endif
#define KERB_DB_MAX_RETRY 5
@@ -56,14 +56,18 @@ extern long kerb_debug;
extern char *progname;
#endif
-static init = 0;
+static init = 0;
static char default_db_name[] = DBM_FILE;
static char *current_db_name = default_db_name;
-static void encode_princ_key(), decode_princ_key();
-static void encode_princ_contents(), decode_princ_contents();
-static void kerb_dbl_fini();
-static int kerb_dbl_lock();
-static void kerb_dbl_unlock();
+static void encode_princ_key(datum *key, char *name, char *instance);
+static void decode_princ_key(datum *key, char *name, char *instance);
+static void encode_princ_contents(datum *contents, Principal *principal);
+static void decode_princ_contents(datum *contents, Principal *principal);
+static void kerb_dbl_fini(void);
+static int kerb_dbl_lock(int mode);
+static void kerb_dbl_unlock(void);
+static long kerb_start_update(char *db_name);
+static long kerb_end_update(char *db_name, long age);
static struct timeval timestamp;/* current time of request */
static int non_blocking = 0;
@@ -128,7 +132,7 @@ static int non_blocking = 0;
* Instead, all routines call "dbm_next" instead.
*/
-#ifndef NDBM_
+#ifndef _NDBM_
typedef char DBM;
#define dbm_open(file, flags, mode) ((dbminit(file) == 0)?"":((char *)0))
@@ -145,7 +149,9 @@ typedef char DBM;
* Utility routine: generate name of database file.
*/
-static char *gen_dbsuffix(char *db_name, char *sfx)
+static char *gen_dbsuffix(db_name, sfx)
+ char *db_name;
+ char *sfx;
{
char *dbsuffix;
@@ -162,7 +168,8 @@ static char *gen_dbsuffix(char *db_name, char *sfx)
* initialization for data base routines.
*/
-int kerb_db_init()
+int
+kerb_db_init()
{
init = 1;
return (0);
@@ -173,7 +180,8 @@ int kerb_db_init()
* a kerb_db_init
*/
-void kerb_db_fini()
+void
+kerb_db_fini()
{
}
@@ -184,7 +192,9 @@ void kerb_db_fini()
* If the alternate database doesn't exist, nothing is changed.
*/
-int kerb_db_set_name(char *name)
+int
+kerb_db_set_name(name)
+ char *name;
{
DBM *db;
@@ -203,7 +213,8 @@ int kerb_db_set_name(char *name)
* Return the last modification time of the database.
*/
-long kerb_get_db_age()
+long
+kerb_get_db_age()
{
struct stat st;
char *okname;
@@ -228,7 +239,9 @@ long kerb_get_db_age()
* the server (for example, during slave updates).
*/
-static long kerb_start_update(char *db_name)
+static long
+kerb_start_update(db_name)
+ char *db_name;
{
char *okname = gen_dbsuffix(db_name, ".ok");
long age = kerb_get_db_age();
@@ -241,7 +254,10 @@ static long kerb_start_update(char *db_name)
return age;
}
-static long kerb_end_update(char *db_name, long age)
+static long
+kerb_end_update(db_name, age)
+ char *db_name;
+ long age;
{
int fd;
int retval = 0;
@@ -276,12 +292,15 @@ static long kerb_end_update(char *db_name, long age)
return retval;
}
-static long kerb_start_read()
+static long
+kerb_start_read()
{
return kerb_get_db_age();
}
-static long kerb_end_read(u_long age)
+static long
+kerb_end_read(age)
+ u_long age;
{
if (kerb_get_db_age() != age || age == -1) {
return -1;
@@ -293,12 +312,14 @@ static long kerb_end_read(u_long age)
* Create the database, assuming it's not there.
*/
-int kerb_db_create(char *db_name)
+int
+kerb_db_create(db_name)
+ char *db_name;
{
char *okname = gen_dbsuffix(db_name, ".ok");
int fd;
register int ret = 0;
-#ifdef NDBM_
+#ifdef _NDBM_
DBM *db;
db = dbm_open(db_name, O_RDWR|O_CREAT|O_EXCL, 0600);
@@ -341,10 +362,12 @@ int kerb_db_create(char *db_name)
* necessarily know to complete the transaction the rename, but...
*/
-int kerb_db_rename(char *from, char *to)
+int
+kerb_db_rename(from, to)
+ char *from;
+ char *to;
{
- int ok = 0;
-#ifdef DBM_
+#ifdef _DBM_
char *fromdb = gen_dbsuffix (from, ".db");
char *todb = gen_dbsuffix (to, ".db");
#else
@@ -355,8 +378,9 @@ int kerb_db_rename(char *from, char *to)
#endif
char *fromok = gen_dbsuffix(from, ".ok");
long trans = kerb_start_update(to);
+ int ok = 0;
-#ifdef DBM_
+#ifdef _DBM_
if (rename (fromdb, todb) == 0) {
#else
if ((rename (fromdir, todir) == 0)
@@ -367,7 +391,7 @@ int kerb_db_rename(char *from, char *to)
}
free (fromok);
-#ifdef DBM_
+#ifdef _DBM_
free (fromdb);
free (todb);
#else
@@ -385,15 +409,16 @@ int kerb_db_rename(char *from, char *to)
/*
* look up a principal in the data base returns number of principals
* found , and whether there were more than requested.
- char *name could have wild card
- char *inst could have wild card
- Principal *principal
- unsigned int max max number of name structs to return
- int *more where there more than 'max' tuples?
*/
-int kerb_db_get_principal(char *name, char *inst, Principal *principal,
- unsigned int max, int *more)
+int
+kerb_db_get_principal(name, inst, principal, max, more)
+ char *name; /* could have wild card */
+ char *inst; /* could have wild card */
+ Principal *principal;
+ unsigned int max; /* max number of name structs to return */
+ int *more; /* where there more than 'max' tuples? */
+
{
int found = 0, code;
extern int errorproc();
@@ -491,7 +516,12 @@ int kerb_db_get_principal(char *name, char *inst, Principal *principal,
* successfully updated.
*/
-int kerb_db_put_principal(Principal *principal, unsigned int max)
+int
+kerb_db_put_principal(principal, max)
+ Principal *principal;
+ unsigned int max; /* number of principal structs to
+ * update */
+
{
int found = 0, code;
u_long i;
@@ -536,7 +566,9 @@ int kerb_db_put_principal(Principal *principal, unsigned int max)
}
static void
-encode_princ_key(datum *key, char *name, char *instance)
+encode_princ_key(key, name, instance)
+ datum *key;
+ char *name, *instance;
{
static char keystring[ANAME_SZ + INST_SZ];
@@ -548,7 +580,9 @@ encode_princ_key(datum *key, char *name, char *instance)
}
static void
-decode_princ_key(datum *key, char *name, char *instance)
+decode_princ_key(key, name, instance)
+ datum *key;
+ char *name, *instance;
{
strncpy(name, key->dptr, ANAME_SZ);
strncpy(instance, key->dptr + ANAME_SZ, INST_SZ);
@@ -557,19 +591,25 @@ decode_princ_key(datum *key, char *name, char *instance)
}
static void
-encode_princ_contents(datum *contents, Principal *principal)
+encode_princ_contents(contents, principal)
+ datum *contents;
+ Principal *principal;
{
contents->dsize = sizeof(*principal);
contents->dptr = (char *) principal;
}
static void
-decode_princ_contents(datum *contents, Principal *principal)
+decode_princ_contents(contents, principal)
+ datum *contents;
+ Principal *principal;
{
bcopy(contents->dptr, (char *) principal, sizeof(*principal));
}
-void kerb_db_get_stat(DB_stat *s)
+void
+kerb_db_get_stat(s)
+ DB_stat *s;
{
gettimeofday(&timestamp, NULL);
@@ -587,11 +627,15 @@ void kerb_db_get_stat(DB_stat *s)
/* update local copy too */
}
-void kerb_db_put_stat(DB_stat *s)
+void
+kerb_db_put_stat(s)
+ DB_stat *s;
{
}
-void delta_stat(DB_stat *a, DB_stat *b, DB_stat *c)
+void
+delta_stat(a, b, c)
+ DB_stat *a, *b, *c;
{
/* c = a - b then b = a for the next time */
@@ -614,14 +658,23 @@ void delta_stat(DB_stat *a, DB_stat *b, DB_stat *c)
* whether there were more than requested.
*/
-int kerb_db_get_dba(char *dba_name, char *dba_inst, Dba *dba, unsigned int max,
- int *more)
+int
+kerb_db_get_dba(dba_name, dba_inst, dba, max, more)
+ char *dba_name; /* could have wild card */
+ char *dba_inst; /* could have wild card */
+ Dba *dba;
+ unsigned int max; /* max number of name structs to return */
+ int *more; /* where there more than 'max' tuples? */
+
{
*more = 0;
return (0);
}
-int kerb_db_iterate (int (*func)(), char *arg)
+int
+kerb_db_iterate (func, arg)
+ int (*func)();
+ char *arg; /* void *, really */
{
datum key, contents;
Principal *principal;
@@ -650,7 +703,8 @@ static int dblfd = -1;
static int mylock = 0;
static int inited = 0;
-static int kerb_dbl_init()
+static void
+kerb_dbl_init()
{
if (!inited) {
char *filename = gen_dbsuffix (current_db_name, ".ok");
@@ -663,10 +717,10 @@ static int kerb_dbl_init()
free(filename);
inited++;
}
- return (0);
}
-static void kerb_dbl_fini()
+static void
+kerb_dbl_fini()
{
close(dblfd);
dblfd = -1;
@@ -674,7 +728,9 @@ static void kerb_dbl_fini()
mylock = 0;
}
-static int kerb_dbl_lock(int mode)
+static int
+kerb_dbl_lock(mode)
+ int mode;
{
int flock_mode;
@@ -706,7 +762,8 @@ static int kerb_dbl_lock(int mode)
return 0;
}
-static void kerb_dbl_unlock()
+static void
+kerb_dbl_unlock()
{
if (!mylock) { /* lock already unlocked */
fprintf(stderr, "Kerberos database lock not locked when unlocking.\n");
@@ -722,7 +779,9 @@ static void kerb_dbl_unlock()
mylock = 0;
}
-int kerb_db_set_lockmode(int mode)
+int
+kerb_db_set_lockmode(mode)
+ int mode;
{
int old = non_blocking;
non_blocking = mode;
diff --git a/eBones/lib/libkdb/krb_kdb_utils.c b/eBones/lib/libkdb/krb_kdb_utils.c
index 275cc39..0256348 100644
--- a/eBones/lib/libkdb/krb_kdb_utils.c
+++ b/eBones/lib/libkdb/krb_kdb_utils.c
@@ -20,17 +20,20 @@ static char rcsid[] =
#endif lint
#endif
+#include <des.h>
+#include <krb.h>
+#include <krb_db.h>
+#include <kdc.h>
#include <stdio.h>
-#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/file.h>
-#include <krb.h>
-#include <krb_db.h>
-#include <kdc.h>
-long kdb_get_master_key(int prompt, C_Block master_key,
- Key_schedule master_key_sched)
+long
+kdb_get_master_key(prompt, master_key, master_key_sched)
+ int prompt;
+ C_Block master_key;
+ Key_schedule master_key_sched;
{
int kfile;
@@ -39,7 +42,7 @@ long kdb_get_master_key(int prompt, C_Block master_key,
placebo_read_password(master_key,
"\nEnter Kerberos master key: ", 0);
#else
- des_read_password((C_Block *)master_key,
+ des_read_password((des_cblock *)master_key,
"\nEnter Kerberos master key: ", 0);
#endif
printf ("\n");
@@ -57,33 +60,21 @@ long kdb_get_master_key(int prompt, C_Block master_key,
}
#ifndef NOENCRYPTION
- key_sched((C_Block *)master_key,master_key_sched);
+ key_sched((des_cblock *)master_key,master_key_sched);
#endif
return (0);
}
-/* The old algorithm used the key schedule as the initial vector which
- was byte order depedent ... */
-
-void kdb_encrypt_key (C_Block in, C_Block out, C_Block master_key,
- Key_schedule master_key_sched, int e_d_flag)
-{
-
-#ifdef NOENCRYPTION
- bcopy(in, out, sizeof(C_Block));
-#else
- pcbc_encrypt((C_Block *)in,(C_Block *)out,(long)sizeof(C_Block),
- master_key_sched,(C_Block *)master_key, e_d_flag);
-#endif
-}
-
/* The caller is reasponsible for cleaning up the master key and sched,
even if we can't verify the master key */
/* Returns master key version if successful, otherwise -1 */
-long kdb_verify_master_key (C_Block master_key, Key_schedule master_key_sched,
- FILE *out)
+long
+kdb_verify_master_key (master_key, master_key_sched, out)
+ C_Block master_key;
+ Key_schedule master_key_sched;
+ FILE *out; /* setting this to non-null be do output */
{
C_Block key_from_db;
Principal principal_data[1];
@@ -137,3 +128,21 @@ long kdb_verify_master_key (C_Block master_key, Key_schedule master_key_sched,
return (master_key_version);
}
+
+/* The old algorithm used the key schedule as the initial vector which
+ was byte order depedent ... */
+
+void
+kdb_encrypt_key (in, out, master_key, master_key_sched, e_d_flag)
+ C_Block in, out, master_key;
+ Key_schedule master_key_sched;
+ int e_d_flag;
+{
+
+#ifdef NOENCRYPTION
+ bcopy(in, out, sizeof(C_Block));
+#else
+ pcbc_encrypt((des_cblock*)in,(des_cblock*)out,(long)sizeof(C_Block),
+ master_key_sched,(des_cblock*)master_key,e_d_flag);
+#endif
+}
diff --git a/eBones/lib/libkdb/krb_lib.c b/eBones/lib/libkdb/krb_lib.c
index 5610dbb..2cf4fb8 100644
--- a/eBones/lib/libkdb/krb_lib.c
+++ b/eBones/lib/libkdb/krb_lib.c
@@ -78,8 +78,13 @@ kerb_fini()
*/
int
-kerb_get_principal(char *name, char *inst, Principal *principal,
- unsigned int max, int *more)
+kerb_get_principal(name, inst, principal, max, more)
+ char *name; /* could have wild card */
+ char *inst; /* could have wild card */
+ Principal *principal;
+ unsigned int max; /* max number of name structs to return */
+ int *more; /* more tuples than room for */
+
{
int found = 0;
#ifdef CACHE
@@ -131,7 +136,10 @@ kerb_get_principal(char *name, char *inst, Principal *principal,
}
/* principals */
-int kerb_put_principal(Principal *principal, unsigned int n)
+int
+kerb_put_principal(principal, n)
+ Principal *principal;
+ unsigned int n; /* number of principal structs to write */
{
long time();
struct tm *tp, *localtime();
@@ -176,7 +184,13 @@ int kerb_put_principal(Principal *principal, unsigned int n)
}
int
-kerb_get_dba(char *name, char *inst, Dba *dba, unsigned int max, int *more)
+kerb_get_dba(name, inst, dba, max, more)
+ char *name; /* could have wild card */
+ char *inst; /* could have wild card */
+ Dba *dba;
+ unsigned int max; /* max number of name structs to return */
+ int *more; /* more tuples than room for */
+
{
int found = 0;
#ifdef CACHE
diff --git a/eBones/lib/libkdb/print_princ.c b/eBones/lib/libkdb/print_princ.c
index b1d1ca9..64e9106 100644
--- a/eBones/lib/libkdb/print_princ.c
+++ b/eBones/lib/libkdb/print_princ.c
@@ -15,6 +15,7 @@ static char rcsid[] =
#endif
#include <stdio.h>
+#include <time.h>
#include <sys/types.h>
#include <sys/time.h>
#include <strings.h>
@@ -26,7 +27,9 @@ extern int debug;
long kerb_debug;
static struct tm *time_p;
-void krb_print_principal(Principal *a_n)
+void
+krb_print_principal(a_n)
+ Principal *a_n;
{
/* run-time database does not contain string versions */
time_p = localtime(&(a_n->exp_date));
diff --git a/eBones/lib/libkrb/Makefile b/eBones/lib/libkrb/Makefile
index 10ef4ba..b09b96b 100644
--- a/eBones/lib/libkrb/Makefile
+++ b/eBones/lib/libkrb/Makefile
@@ -31,4 +31,26 @@ beforeinstall:
install -c -o ${BINOWN} -g ${BINGRP} -m 444 krb_err.h \
${DESTDIR}/usr/include/kerberosIV
+MAN3= krb.3 krb_realmofhost.3 krb_sendauth.3 krb_set_tkt_string.3 \
+ kuserok.3 tf_util.3
+
+MLINKS= krb.3 krb_mk_req.3 krb.3 krb_rd_req.3 krb.3 krb_kntoln.3 \
+ krb.3 krb_set_key.3 krb.3 krb_get_cred.3 krb.3 krb_mk_priv.3 \
+ krb.3 krb_rd_priv.3 krb.3 krb_mk_safe.3 krb.3 krb_rd_safe.3 \
+ krb.3 krb_mk_err.3 krb.3 krb_rd_err.3 krb.3 krb_ck_repl.3
+
+MLINKS+=krb_realmofhost.3 krb_get_phost.3 krb_realmofhost.3 krb_get_krbhst.3 \
+ krb_realmofhost.3 krb_get_admhst.3 krb_realmofhost.3 krb_get_lrealm.3
+
+MLINKS+=krb_realmofhost.3 realm.3
+
+MLINKS+=krb_sendauth.3 krb_recvauth.3 krb_sendauth.3 krb_net_write.3 \
+ krb_sendauth.3 krb_net_read.3
+
+MLINKS+=krb_sendauth.3 ksend.3
+
+MLINKS+=tf_util.3 tf_init.3 tf_util.3 tf_get_pname.3 \
+ tf_util.3 tf_get_pinst.3 tf_util.3 tf_get_cred.3 \
+ tf_util.3 tf_close.3
+
.include <bsd.lib.mk>
diff --git a/eBones/lib/libkrb/add_ticket.c b/eBones/lib/libkrb/add_ticket.c
index bec7cd8..14ef47c 100644
--- a/eBones/lib/libkrb/add_ticket.c
+++ b/eBones/lib/libkrb/add_ticket.c
@@ -46,6 +46,7 @@ static char rcsid[] =
/* XXX they aren't all used; to avoid incompatible changes we will
* fool lint for the moment */
/*ARGSUSED */
+int
add_ticket(cipher,n,session,lifetime,sname,instance,realm,kvno,ticket)
KTEXT cipher; /* Ciphertext info for ticket */
char *sname; /* Service name */
diff --git a/eBones/lib/libkrb/create_auth_reply.c b/eBones/lib/libkrb/create_auth_reply.c
index ea3afd6..e304b17 100644
--- a/eBones/lib/libkrb/create_auth_reply.c
+++ b/eBones/lib/libkrb/create_auth_reply.c
@@ -15,7 +15,6 @@ static char *rcsid =
#endif /* lint */
#endif
-#include <stdio.h>
#include <krb.h>
#include <prot.h>
#include <strings.h>
diff --git a/eBones/lib/libkrb/create_ciph.c b/eBones/lib/libkrb/create_ciph.c
index a383604..7fb93e3 100644
--- a/eBones/lib/libkrb/create_ciph.c
+++ b/eBones/lib/libkrb/create_ciph.c
@@ -56,9 +56,19 @@ static char *rcsid =
*
*/
-int create_ciph(KTEXT c, des_cblock session, char *service, char *instance,
- char *realm, unsigned long life, int kvno, KTEXT tkt,
- unsigned long kdc_time, des_cblock key)
+int
+create_ciph(c, session, service, instance, realm, life, kvno, tkt,
+ kdc_time, key)
+ KTEXT c; /* Text block to hold ciphertext */
+ C_Block session; /* Session key to send to user */
+ char *service; /* Service name on ticket */
+ char *instance; /* Instance name on ticket */
+ char *realm; /* Realm of this KDC */
+ unsigned long life; /* Lifetime of the ticket */
+ int kvno; /* Key version number for service */
+ KTEXT tkt; /* The ticket for the service */
+ unsigned long kdc_time; /* KDC time */
+ C_Block key; /* Key to encrypt ciphertext with */
{
char *ptr;
Key_schedule key_s;
@@ -93,9 +103,9 @@ int create_ciph(KTEXT c, des_cblock session, char *service, char *instance,
c->length = (((ptr - (char *) c->dat) + 7) / 8) * 8;
#ifndef NOENCRYPTION
- key_sched((des_cblock *)key,key_s);
- pcbc_encrypt((des_cblock *)c->dat,(des_cblock *)c->dat,(long) c->length,
- key_s,(des_cblock *)key,ENCRYPT);
+ key_sched((C_Block *)key,key_s);
+ pcbc_encrypt((C_Block *)c->dat,(C_Block *)c->dat,(long) c->length,key_s,
+ (C_Block *)key,ENCRYPT);
#endif /* NOENCRYPTION */
return(KSUCCESS);
diff --git a/eBones/lib/libkrb/create_ticket.c b/eBones/lib/libkrb/create_ticket.c
index 264d1ac..e1d6974 100644
--- a/eBones/lib/libkrb/create_ticket.c
+++ b/eBones/lib/libkrb/create_ticket.c
@@ -70,9 +70,20 @@ static char rcsid[] =
*
*/
-int krb_create_ticket(KTEXT tkt, unsigned char flags, char *pname,
- char *pinstance, char *prealm, long paddress, char *session, short life,
- long time_sec, char *sname, char *sinstance, des_cblock key)
+int krb_create_ticket(tkt, flags, pname, pinstance, prealm, paddress,
+ session, life, time_sec, sname, sinstance, key)
+ KTEXT tkt; /* Gets filled in by the ticket */
+ unsigned char flags; /* Various Kerberos flags */
+ char *pname; /* Principal's name */
+ char *pinstance; /* Principal's instance */
+ char *prealm; /* Principal's authentication domain */
+ long paddress; /* Net address of requesting entity */
+ char *session; /* Session key inserted in ticket */
+ short life; /* Lifetime of the ticket */
+ long time_sec; /* Issue time and date */
+ char *sname; /* Service Name */
+ char *sinstance; /* Instance Name */
+ C_Block key; /* Service's secret key */
{
Key_schedule key_s;
register char *data; /* running index into ticket */
@@ -113,9 +124,9 @@ int krb_create_ticket(KTEXT tkt, unsigned char flags, char *pname,
}
#ifndef NOENCRYPTION
- key_sched((des_cblock *)key,key_s);
- pcbc_encrypt((des_cblock *)tkt->dat,(des_cblock *)tkt->dat,
- (long)tkt->length,key_s,(des_cblock *)key,ENCRYPT);
+ key_sched((C_Block *)key,key_s);
+ pcbc_encrypt((C_Block *)tkt->dat,(C_Block *)tkt->dat,(long)tkt->length,
+ key_s,(C_Block *)key,ENCRYPT);
#endif
return 0;
}
diff --git a/eBones/lib/libkrb/decomp_ticket.c b/eBones/lib/libkrb/decomp_ticket.c
index ab46450..04316ad 100644
--- a/eBones/lib/libkrb/decomp_ticket.c
+++ b/eBones/lib/libkrb/decomp_ticket.c
@@ -46,18 +46,32 @@ static char *rcsid =
* See create_ticket.c for the format of the ticket packet.
*/
-int decomp_ticket(KTEXT tkt, unsigned char *flags, char *pname,
- char *pinstance, char *prealm, unsigned long *paddress, des_cblock session,
- int *life, unsigned long *time_sec, char *sname, char *sinstance,
- des_cblock key, des_key_schedule key_s)
+int
+decomp_ticket(tkt, flags, pname, pinstance, prealm, paddress, session,
+ life, time_sec, sname, sinstance, key, key_s)
+ KTEXT tkt; /* The ticket to be decoded */
+ unsigned char *flags; /* Kerberos ticket flags */
+ char *pname; /* Authentication name */
+ char *pinstance; /* Principal's instance */
+ char *prealm; /* Principal's authentication domain */
+ unsigned long *paddress; /* Net address of entity
+ * requesting ticket */
+ C_Block session; /* Session key inserted in ticket */
+ int *life; /* Lifetime of the ticket */
+ unsigned long *time_sec; /* Issue time and date */
+ char *sname; /* Service name */
+ char *sinstance; /* Service instance */
+ C_Block key; /* Service's secret key
+ * (to decrypt the ticket) */
+ Key_schedule key_s; /* The precomputed key schedule */
{
static int tkt_swap_bytes;
unsigned char *uptr;
char *ptr = (char *)tkt->dat;
#ifndef NOENCRYPTION
- pcbc_encrypt((des_cblock *)tkt->dat,(des_cblock *)tkt->dat,
- (long)tkt->length,key_s,(des_cblock *)key,DECRYPT);
+ pcbc_encrypt((C_Block *)tkt->dat,(C_Block *)tkt->dat,(long)tkt->length,
+ key_s,(C_Block *)key,DECRYPT);
#endif /* ! NOENCRYPTION */
*flags = *ptr; /* get flags byte */
diff --git a/eBones/lib/libkrb/des_rw.c b/eBones/lib/libkrb/des_rw.c
index 774e62b..5b339ee 100644
--- a/eBones/lib/libkrb/des_rw.c
+++ b/eBones/lib/libkrb/des_rw.c
@@ -1,4 +1,4 @@
-/* -
+/*
* Copyright (c) 1994 Geoffrey M. Rehmet, Rhodes University
* All rights reserved.
*
@@ -100,10 +100,10 @@
#include <sys/param.h>
#include <sys/types.h>
-#include <krb.h>
#include <des.h>
+#include <krb.h>
-static bit_64 des_key;
+static des_cblock des_key;
static des_key_schedule key_schedule;
/*
@@ -120,10 +120,15 @@ static u_char *buff_ptr = buffer;
* inkey is the initial vector for the DES encryption, while insched is
* the DES key, in unwrapped form.
*/
-void des_set_key(bit_64 *inkey, u_char *insched)
+
+int
+des_set_key(inkey, insched)
+ des_cblock *inkey;
+ des_key_schedule insched;
{
- bcopy(inkey, &des_key, sizeof(bit_64));
+ bcopy(inkey, des_key, sizeof(des_cblock));
bcopy(insched, &key_schedule, sizeof(des_key_schedule));
+ return 0;
}
/*
@@ -136,7 +141,11 @@ void des_clear_key()
bzero(&key_schedule, sizeof(des_key_schedule));
}
-int des_read(int fd, char *buf, int len)
+int
+des_read(fd, buf, len)
+ int fd;
+ register char * buf;
+ int len;
{
int msg_length; /* length of actual message data */
int pad_length; /* length of padded message */
@@ -161,7 +170,7 @@ int des_read(int fd, char *buf, int len)
}
}
- nread = krb_net_read(fd,(char *)&msg_length, sizeof(msg_length));
+ nread = krb_net_read(fd, (char *)&msg_length, sizeof(msg_length));
if(nread != (int)(sizeof(msg_length)))
return(0);
@@ -200,7 +209,11 @@ int des_read(int fd, char *buf, int len)
* Write a message onto a file descriptor (generally a socket), using
* DES to encrypt the message.
*/
-int des_write(int fd, char *buf, int len)
+int
+des_write(fd, buf, len)
+ int fd;
+ char * buf;
+ int len;
{
static int seeded = 0;
char garbage[8];
diff --git a/eBones/lib/libkrb/dest_tkt.c b/eBones/lib/libkrb/dest_tkt.c
index 6e6082e..df04be0 100644
--- a/eBones/lib/libkrb/dest_tkt.c
+++ b/eBones/lib/libkrb/dest_tkt.c
@@ -15,10 +15,9 @@ static char *rcsid =
#endif /* lint */
#endif
+#include <unistd.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <krb.h>
#include <sys/file.h>
#include <sys/types.h>
@@ -37,7 +36,8 @@ static char *rcsid =
* The ticket file (TKT_FILE) is defined in "krb.h".
*/
-int dest_tkt()
+int
+dest_tkt()
{
char *file = TKT_FILE;
int i,fd;
diff --git a/eBones/lib/libkrb/extract_ticket.c b/eBones/lib/libkrb/extract_ticket.c
index 97e8432..8ad3097 100644
--- a/eBones/lib/libkrb/extract_ticket.c
+++ b/eBones/lib/libkrb/extract_ticket.c
@@ -27,8 +27,15 @@ static char *rcsid =
* session, liftime and kvno.
*/
-void extract_ticket(KTEXT cipher, int n, char *session, int *lifetime,
- int *kvno, char *realm, KTEXT ticket)
+void
+extract_ticket(cipher,n,session,lifetime,kvno,realm,ticket)
+ KTEXT cipher; /* The ciphertext */
+ int n; /* Which ticket */
+ char *session; /* The session key for this tkt */
+ int *lifetime; /* The life of this ticket */
+ int *kvno; /* The kvno for the service */
+ char *realm; /* Realm in which tkt issued */
+ KTEXT ticket; /* The ticket itself */
{
char *ptr;
int i;
diff --git a/eBones/lib/libkrb/fgetst.c b/eBones/lib/libkrb/fgetst.c
index 4c6a364..796caca 100644
--- a/eBones/lib/libkrb/fgetst.c
+++ b/eBones/lib/libkrb/fgetst.c
@@ -25,9 +25,13 @@ static char rcsid[] =
* returns the number of characters read, including the null terminator.
*/
-int fgetst(FILE *f, char *s, int n)
+int
+fgetst(f, s, n)
+ FILE *f;
+ register char *s;
+ int n;
{
- register count = n;
+ register int count = n;
int ch; /* NOT char; otherwise you don't see EOF */
while ((ch = getc(f)) != EOF && ch && --count) {
diff --git a/eBones/lib/libkrb/get_ad_tkt.c b/eBones/lib/libkrb/get_ad_tkt.c
index ad76a4f..f96644a 100644
--- a/eBones/lib/libkrb/get_ad_tkt.c
+++ b/eBones/lib/libkrb/get_ad_tkt.c
@@ -27,6 +27,8 @@ static char rcsid[] =
#include <sys/time.h>
#include <sys/types.h>
+extern int krb_debug;
+
struct timeval tt_local = { 0, 0 };
int swap_bytes;
@@ -65,7 +67,12 @@ unsigned long rep_err_code;
* extraction macros like pkt_version(), pkt_msg_type(), etc.
*/
-int get_ad_tkt(char *service, char *sinstance, char *realm, int lifetime)
+int
+get_ad_tkt(service,sinstance,realm,lifetime)
+ char *service;
+ char *sinstance;
+ char *realm;
+ int lifetime;
{
static KTEXT_ST pkt_st;
KTEXT pkt = & pkt_st; /* Packet to KDC */
@@ -177,9 +184,9 @@ int get_ad_tkt(char *service, char *sinstance, char *realm, int lifetime)
bcopy((char *) pkt_cipher(rpkt),(char *) (cip->dat),cip->length);
#ifndef NOENCRYPTION
- key_sched((des_cblock *)cr.session,key_s);
- pcbc_encrypt((des_cblock *)cip->dat,(des_cblock *)cip->dat,
- (long)cip->length,key_s,(des_cblock *)cr.session,DECRYPT);
+ key_sched((C_Block *)cr.session,key_s);
+ pcbc_encrypt((C_Block *)cip->dat,(C_Block *)cip->dat,(long)cip->length,
+ key_s,(C_Block *)cr.session,DECRYPT);
#endif
/* Get rid of all traces of key */
bzero((char *) cr.session, sizeof(key));
diff --git a/eBones/lib/libkrb/get_admhst.c b/eBones/lib/libkrb/get_admhst.c
index b33b828..a01a40f 100644
--- a/eBones/lib/libkrb/get_admhst.c
+++ b/eBones/lib/libkrb/get_admhst.c
@@ -39,7 +39,11 @@ static char *rcsid =
* provided by a nameserver.
*/
-int krb_get_admhst(char *h, char *r, int n)
+int
+krb_get_admhst(h, r, n)
+ char *h;
+ char *r;
+ int n;
{
FILE *cnffile;
char tr[REALM_SZ];
diff --git a/eBones/lib/libkrb/get_cred.c b/eBones/lib/libkrb/get_cred.c
index 14e1cc1..6023386 100644
--- a/eBones/lib/libkrb/get_cred.c
+++ b/eBones/lib/libkrb/get_cred.c
@@ -27,7 +27,12 @@ static char *rcsid =
* On failure it returns a Kerberos error code.
*/
-int krb_get_cred(char *service, char *instance, char *realm, CREDENTIALS *c)
+int
+krb_get_cred(service,instance,realm,c)
+ char *service; /* Service name */
+ char *instance; /* Instance */
+ char *realm; /* Auth domain */
+ CREDENTIALS *c; /* Credentials struct */
{
int tf_status; /* return value of tf function calls */
diff --git a/eBones/lib/libkrb/get_in_tkt.c b/eBones/lib/libkrb/get_in_tkt.c
index 79758f6..b95f073 100644
--- a/eBones/lib/libkrb/get_in_tkt.c
+++ b/eBones/lib/libkrb/get_in_tkt.c
@@ -16,10 +16,10 @@ static char rcsid[] =
#include <krb.h>
#include <prot.h>
-#include <des.h>
-#include "conf.h"
-#include <stdio.h>
+#ifndef NULL
+#define NULL 0
+#endif
/*
* This file contains two routines: passwd_to_key() converts
@@ -44,17 +44,18 @@ static char rcsid[] =
*/
/*ARGSUSED */
-static int passwd_to_key(char *user, char *instance, char *realm,
- char *passwd, des_cblock key)
+static int passwd_to_key(user,instance,realm,passwd,key)
+ char *user, *instance, *realm, *passwd;
+ C_Block *key;
{
#ifdef NOENCRYPTION
if (!passwd)
placebo_read_password(key, "Password: ", 0);
#else
if (passwd)
- string_to_key(passwd,(des_cblock *)key);
+ string_to_key(passwd,key);
else
- des_read_password((des_cblock *)key,"Password: ",0);
+ des_read_password(key,"Password: ",0);
#endif
return (0);
}
@@ -76,8 +77,11 @@ static int passwd_to_key(char *user, char *instance, char *realm,
* The result of the call to krb_get_in_tkt() is returned.
*/
-int krb_get_pw_in_tkt(char *user, char *instance, char *realm, char *service,
- char *sinstance, int life, char *password)
+int
+krb_get_pw_in_tkt(user,instance,realm,service,sinstance,life,password)
+ char *user, *instance, *realm, *service, *sinstance;
+ int life;
+ char *password;
{
return(krb_get_in_tkt(user,instance,realm,service,sinstance,life,
passwd_to_key, NULL, password));
@@ -99,16 +103,36 @@ int krb_get_pw_in_tkt(char *user, char *instance, char *realm, char *service,
* echoing.
*/
-#if 0
-#ifndef lint
-static char rcsid_read_password_c[] =
-"Bones$Header: /usr/cvs/src/eBones/krb/get_in_tkt.c,v 1.3 1995/07/18 16:38:30 mark Exp $";
-#endif lint
+#include <des.h>
+#include "conf.h"
+
+#include <stdio.h>
+#ifdef BSDUNIX
+#include <strings.h>
+#include <sys/ioctl.h>
+#include <signal.h>
+#include <setjmp.h>
+#else
+/* char *strcpy();
+int strcmp(); */
#endif
+#ifdef BSDUNIX
+static jmp_buf env;
+#endif
+
+#ifdef BSDUNIX
+static void sig_restore();
+static push_signals(), pop_signals();
+int placebo_read_pw_string();
+#endif
/*** Routines ****************************************************** */
-int placebo_read_password(des_cblock *k, char *prompt, int verify)
+int
+placebo_read_password(k,prompt,verify)
+ des_cblock *k;
+ char *prompt;
+ int verify;
{
int ok;
char key_string[BUFSIZ];
@@ -135,7 +159,8 @@ lose:
* Returns 0 on success, non-zero on failure.
*/
-int placebo_read_pw_string(char *s, int max, char *prompt, int verify)
+int
+placebo_read_pw_string(s,max,prompt,verify)
char *s;
int max;
char *prompt;
@@ -237,21 +262,23 @@ static void (*old_sigfunc[NSIG])();
static int (*old_sigfunc[NSIG])();
#endif POSIX
-static void push_signals()
+static push_signals()
{
register i;
for (i = 0; i < NSIG; i++)
old_sigfunc[i] = signal(i,sig_restore);
}
-static void pop_signals()
+static pop_signals()
{
register i;
for (i = 0; i < NSIG; i++)
signal(i,old_sigfunc[i]);
}
-static void sig_restore(int sig, int code, struct sigcontext *scp)
+static void sig_restore(sig,code,scp)
+ int sig,code;
+ struct sigcontext *scp;
{
longjmp(env,1);
}
diff --git a/eBones/lib/libkrb/get_krbhst.c b/eBones/lib/libkrb/get_krbhst.c
index ab3abbd..cfc6e1c 100644
--- a/eBones/lib/libkrb/get_krbhst.c
+++ b/eBones/lib/libkrb/get_krbhst.c
@@ -50,7 +50,11 @@ static char *rcsid =
* nameserver.
*/
-int krb_get_krbhst(char *h, char *r, int n)
+int
+krb_get_krbhst(h,r,n)
+ char *h;
+ char *r;
+ int n;
{
FILE *cnffile;
char tr[REALM_SZ];
diff --git a/eBones/lib/libkrb/get_krbrlm.c b/eBones/lib/libkrb/get_krbrlm.c
index 150a916..a4803e5 100644
--- a/eBones/lib/libkrb/get_krbrlm.c
+++ b/eBones/lib/libkrb/get_krbrlm.c
@@ -34,9 +34,12 @@ static char *rcsid =
* krb_get_krbhst().
*/
-int krb_get_lrealm(char *r, int n)
+int
+krb_get_lrealm(r,n)
+ char *r;
+ int n;
{
- FILE *cnffile;
+ FILE *cnffile, *fopen();
if (n > 1)
return(KFAILURE); /* Temporary restriction */
diff --git a/eBones/lib/libkrb/get_phost.c b/eBones/lib/libkrb/get_phost.c
index 4b0f495..cd83b2d 100644
--- a/eBones/lib/libkrb/get_phost.c
+++ b/eBones/lib/libkrb/get_phost.c
@@ -15,10 +15,10 @@ static char rcsid[] =
#endif
#include <stdio.h>
-#include <string.h>
#include <ctype.h>
#include <netdb.h>
-#include <krb.h>
+
+char *index();
/*
* This routine takes an alias for a host name and returns the first
@@ -37,7 +37,8 @@ static char rcsid[] =
* to the original "alias" argument is returned.
*/
-char *krb_get_phost(char *alias)
+char * krb_get_phost(alias)
+ char *alias;
{
struct hostent *h;
char *phost = alias;
diff --git a/eBones/lib/libkrb/get_pw_tkt.c b/eBones/lib/libkrb/get_pw_tkt.c
index 1b016a8..48b6126 100644
--- a/eBones/lib/libkrb/get_pw_tkt.c
+++ b/eBones/lib/libkrb/get_pw_tkt.c
@@ -48,7 +48,12 @@ static char *rcsid =
* the password-changing server will be in the user's ticket file.
*/
-int get_pw_tkt(char *user, char *instance, char *realm, char *cpw)
+int
+get_pw_tkt(user,instance,realm,cpw)
+ char *user;
+ char *instance;
+ char *realm;
+ char *cpw;
{
int kerror;
diff --git a/eBones/lib/libkrb/get_request.c b/eBones/lib/libkrb/get_request.c
index dec742b..c4982bf3 100644
--- a/eBones/lib/libkrb/get_request.c
+++ b/eBones/lib/libkrb/get_request.c
@@ -28,7 +28,12 @@ static char *rcsid =
* if there are less than n requests in the packet.
*/
-int get_request(KTEXT pkt, int n, char **s_name, char **instance)
+int
+get_request(pkt, n, s_name, instance)
+ KTEXT pkt; /* The packet itself */
+ int n; /* Which request do we want */
+ char **s_name; /* Service name to be filled in */
+ char **instance; /* Instance name to be filled in */
{
/* Go to the beginning of the request list */
char *ptr = (char *) pkt_a_realm(pkt) + 6 +
diff --git a/eBones/lib/libkrb/get_svc_in_tkt.c b/eBones/lib/libkrb/get_svc_in_tkt.c
index cd90f9e..f5680db 100644
--- a/eBones/lib/libkrb/get_svc_in_tkt.c
+++ b/eBones/lib/libkrb/get_svc_in_tkt.c
@@ -44,7 +44,8 @@ static char rcsid[] =
* The service key is placed in "key".
*/
-static int srvtab_to_key(user, instance, realm, srvtab, key)
+static int
+srvtab_to_key(user, instance, realm, srvtab, key)
char *user, *instance, *realm, *srvtab;
C_Block key;
{
@@ -65,7 +66,8 @@ static int srvtab_to_key(user, instance, realm, srvtab, key)
* It returns the return value of the krb_get_in_tkt() call.
*/
-int krb_get_svc_in_tkt(user, instance, realm, service, sinstance, life, srvtab)
+int
+krb_get_svc_in_tkt(user, instance, realm, service, sinstance, life, srvtab)
char *user, *instance, *realm, *service, *sinstance;
int life;
char *srvtab;
diff --git a/eBones/lib/libkrb/get_tf_fullname.c b/eBones/lib/libkrb/get_tf_fullname.c
index 45226db..8d76399 100644
--- a/eBones/lib/libkrb/get_tf_fullname.c
+++ b/eBones/lib/libkrb/get_tf_fullname.c
@@ -32,8 +32,12 @@ static char rcsid[] =
* krb_get_in_tkt().
*/
-int krb_get_tf_fullname(char *ticket_file, char *name, char *instance,
- char *realm)
+int
+krb_get_tf_fullname(ticket_file, name, instance, realm)
+ char *ticket_file;
+ char *name;
+ char *instance;
+ char *realm;
{
int tf_status;
CREDENTIALS c;
diff --git a/eBones/lib/libkrb/get_tf_realm.c b/eBones/lib/libkrb/get_tf_realm.c
index 704c687..8d75a9d 100644
--- a/eBones/lib/libkrb/get_tf_realm.c
+++ b/eBones/lib/libkrb/get_tf_realm.c
@@ -28,7 +28,10 @@ static char rcsid[] =
*
*/
-int krb_get_tf_realm(char *ticket_file, char *realm)
+int
+krb_get_tf_realm(ticket_file, realm)
+ char *ticket_file;
+ char *realm;
{
return(krb_get_tf_fullname(ticket_file, 0, 0, realm));
}
diff --git a/eBones/lib/libkrb/getrealm.c b/eBones/lib/libkrb/getrealm.c
index 37686c4..dcd4d28 100644
--- a/eBones/lib/libkrb/getrealm.c
+++ b/eBones/lib/libkrb/getrealm.c
@@ -47,7 +47,9 @@ static char rcsid[] =
static char ret_realm[REALM_SZ+1];
-char *krb_realmofhost(char *host)
+char *
+krb_realmofhost(host)
+char *host;
{
char *domain;
FILE *trans_file;
diff --git a/eBones/lib/libkrb/getst.c b/eBones/lib/libkrb/getst.c
index 549ec50..e50e4bb 100644
--- a/eBones/lib/libkrb/getst.c
+++ b/eBones/lib/libkrb/getst.c
@@ -26,7 +26,11 @@ static char rcsid[] =
* the null terminator.
*/
-int getst(int fd, char *s, int n)
+int
+getst(fd, s, n)
+ int fd;
+ register char *s;
+ int n;
{
register count = n;
while (read(fd, s, 1) > 0 && --count)
diff --git a/eBones/lib/libkrb/in_tkt.c b/eBones/lib/libkrb/in_tkt.c
index 12fbb39..1f6ee8a 100644
--- a/eBones/lib/libkrb/in_tkt.c
+++ b/eBones/lib/libkrb/in_tkt.c
@@ -16,8 +16,8 @@ static char rcsid[] =
#endif
#include <unistd.h>
-#include <stdio.h>
#include <string.h>
+#include <stdio.h>
#include <krb.h>
#include <sys/file.h>
#include <sys/fcntl.h>
@@ -27,6 +27,8 @@ static char rcsid[] =
#include <sys/param.h>
#endif
+extern int krb_debug;
+
/*
* in_tkt() is used to initialize the ticket store. It creates the
* file to contain the tickets and writes the given user's name "pname"
@@ -34,7 +36,10 @@ static char rcsid[] =
* success, or KFAILURE if something goes wrong.
*/
-int in_tkt(char *pname, char *pinst)
+int
+in_tkt(pname,pinst)
+ char *pname;
+ char *pinst;
{
int tktfile;
uid_t me, metoo;
diff --git a/eBones/lib/libkrb/k_gethostname.c b/eBones/lib/libkrb/k_gethostname.c
index 093ee5d..cfb4f92 100644
--- a/eBones/lib/libkrb/k_gethostname.c
+++ b/eBones/lib/libkrb/k_gethostname.c
@@ -41,7 +41,10 @@ extern get_custom();
* not work.
*/
-int k_gethostname(char *name, int namelen)
+int
+k_gethostname(name, namelen)
+ char *name;
+ int namelen;
{
#ifdef BSD42
return gethostname(name, namelen);
diff --git a/eBones/lib/libkrb/klog.c b/eBones/lib/libkrb/klog.c
index 97d52c7..7fdc774 100644
--- a/eBones/lib/libkrb/klog.c
+++ b/eBones/lib/libkrb/klog.c
@@ -50,11 +50,13 @@ static char logtxt[1000];
* text string "logtxt".
*/
-char *klog(int type, char *format, int a1, int a2, int a3, int a4, int a5,
- int a6, int a7, int a8, int a9, int a0)
+char * klog(type,format,a1,a2,a3,a4,a5,a6,a7,a8,a9,a0)
+ int type;
+ char *format;
+ int a1,a2,a3,a4,a5,a6,a7,a8,a9,a0;
{
FILE *logfile;
- long time(),now;
+ long now;
struct tm *tm;
static int logtype_array[NLOGTYPE] = {0,0};
static int array_initialized;
@@ -99,7 +101,9 @@ char *klog(int type, char *format, int a1, int a2, int a3, int a4, int a5,
* the logfile defaults to KRBLOG, defined in "krb.h".
*/
-void kset_logfile(char *filename)
+void
+kset_logfile(filename)
+ char *filename;
{
log_name = filename;
is_open = 0;
diff --git a/eBones/lib/libkrb/kname_parse.c b/eBones/lib/libkrb/kname_parse.c
index c69b5cc..da7ec93 100644
--- a/eBones/lib/libkrb/kname_parse.c
+++ b/eBones/lib/libkrb/kname_parse.c
@@ -54,7 +54,9 @@ extern char *krb_err_txt[];
* KNAME_FMT is returned.
*/
-int kname_parse(char *np, char *ip, char *rp, char *fullname)
+int
+kname_parse(np, ip, rp, fullname)
+ char *np, *ip, *rp, *fullname;
{
static char buf[FULL_SZ];
char *rnext, *wnext; /* next char to read, write */
@@ -137,7 +139,9 @@ int kname_parse(char *np, char *ip, char *rp, char *fullname)
* Kerberos name; returns 0 if it's not.
*/
-int k_isname(char *s)
+int
+k_isname(s)
+ char *s;
{
register char c;
int backslash = 0;
@@ -172,7 +176,9 @@ int k_isname(char *s)
* Kerberos instance; returns 0 if it's not.
*/
-int k_isinst(char *s)
+int
+k_isinst(s)
+ char *s;
{
register char c;
int backslash = 0;
@@ -204,7 +210,9 @@ int k_isinst(char *s)
* Kerberos realm; returns 0 if it's not.
*/
-int k_isrealm(char *s)
+int
+k_isrealm(s)
+ char *s;
{
register char c;
int backslash = 0;
diff --git a/eBones/lib/libkrb/kntoln.c b/eBones/lib/libkrb/kntoln.c
index ddb1ba2..388704c 100644
--- a/eBones/lib/libkrb/kntoln.c
+++ b/eBones/lib/libkrb/kntoln.c
@@ -44,7 +44,10 @@ static char *rcsid =
* KSUCCESS if all goes well, otherwise KFAILURE.
*/
-int krb_kntoln(AUTH_DAT *ad, char *lname)
+int
+krb_kntoln(ad,lname)
+ AUTH_DAT *ad;
+ char *lname;
{
static char lrealm[REALM_SZ] = "";
diff --git a/eBones/lib/libkrb/kparse.c b/eBones/lib/libkrb/kparse.c
index edb471c..5b25ac7 100644
--- a/eBones/lib/libkrb/kparse.c
+++ b/eBones/lib/libkrb/kparse.c
@@ -40,8 +40,8 @@ static char rcsid[] =
#endif lint
#endif
-#include <stdio.h>
#include <stdlib.h>
+#include <stdio.h>
#include <ctype.h>
#include <kparse.h>
@@ -53,18 +53,20 @@ static char rcsid[] =
#define MAXKEY 80
#define MAXVALUE 80
-int fGetKeywordValue(FILE *fp, char *keyword, int klen, char *value, int vlen);
-int fGetToken(FILE *fp, char *dest, int maxlen);
+int fUngetChar(int ch, FILE *fp);
int fGetChar(FILE *fp);
-int fUngetChar(int ch, FILE*fp);
-int fGetLiteral(FILE *fp);;
+int fGetLiteral(FILE *fp);
int LineNbr=1; /* current line nbr in parameter file */
char ErrorMsg[80]; /* meaningful only when KV_SYNTAX, PS_SYNTAX,
* or PS_BAD_KEYWORD is returned by
* fGetKeywordValue or fGetParameterSet */
-int fGetParameterSet(FILE *fp, parmtable parm[], int parmcount )
+int
+fGetParameterSet( fp,parm,parmcount )
+ FILE *fp;
+ parmtable parm[];
+ int parmcount;
{
int rc,i;
char keyword[MAXKEY];
@@ -127,7 +129,12 @@ int fGetParameterSet(FILE *fp, parmtable parm[], int parmcount )
* different. Like strcmp, ParmCompare returns 0 for a match found, -1
* otherwise
*/
-int ParmCompare(parmtable parm[], int parmcount, char *keyword, char *value )
+int
+ParmCompare( parm, parmcount, keyword, value )
+ parmtable parm[];
+ int parmcount;
+ char *keyword;
+ char *value;
{
int i;
@@ -143,7 +150,10 @@ int ParmCompare(parmtable parm[], int parmcount, char *keyword, char *value )
return(-1);
}
-void FreeParameterSet(parmtable parm[], int parmcount)
+void
+FreeParameterSet(parm,parmcount)
+ parmtable parm[];
+ int parmcount;
{
int i;
@@ -155,7 +165,13 @@ void FreeParameterSet(parmtable parm[], int parmcount)
}
}
-int fGetKeywordValue(FILE *fp, char *keyword, int klen, char *value, int vlen)
+int
+fGetKeywordValue( fp, keyword, klen, value, vlen )
+ FILE *fp;
+ char *keyword;
+ int klen;
+ char *value;
+ int vlen;
{
int rc;
int gotit;
@@ -311,7 +327,7 @@ int fGetKeywordValue(FILE *fp, char *keyword, int klen, char *value, int vlen)
} while ( !gotit );
/*NOTREACHED*/
- return 0; /* I know, I know. - markm */
+ return(0); /*just to shut up -Wall MRVM*/
}
/*
@@ -343,7 +359,11 @@ int fGetKeywordValue(FILE *fp, char *keyword, int klen, char *value, int vlen)
* classification for end of file is
* always zero.
*/
-int fGetToken(FILE *fp, char *dest, int maxlen)
+int
+fGetToken(fp, dest, maxlen)
+ FILE *fp;
+ char *dest;
+ int maxlen;
{
int ch='\0';
int len=0;
@@ -436,7 +456,9 @@ int fGetToken(FILE *fp, char *dest, int maxlen)
* special case certain values (\n, \f, \r, \b) or return a literal
* otherwise (useful for \", for example).
*/
-int fGetLiteral(FILE *fp)
+int
+fGetLiteral(fp)
+ FILE *fp;
{
int ch;
int n=0;
@@ -511,7 +533,10 @@ int fGetLiteral(FILE *fp)
* exactly the same as ungetc(3) except that the line number of the
* input file is maintained.
*/
-int fUngetChar(int ch, FILE*fp)
+int
+fUngetChar(ch,fp)
+ int ch;
+ FILE *fp;
{
if (ch=='\n') LineNbr--;
return(ungetc(ch,fp));
@@ -522,7 +547,9 @@ int fUngetChar(int ch, FILE*fp)
* exactly the same as fgetc(3) except that the line number of the
* input file is maintained.
*/
-int fGetChar(FILE *fp)
+int
+fGetChar(fp)
+ FILE *fp;
{
int ch = fgetc(fp);
if (ch=='\n') LineNbr++;
@@ -548,7 +575,9 @@ int fGetChar(FILE *fp)
* Return Value: pointer to copied string
*
*/
-char *strsave(char *p)
+char *
+strsave(p)
+ char *p;
{
return(strcpy(malloc(strlen(p)+1),p));
}
@@ -559,7 +588,9 @@ char *strsave(char *p)
* the pointer to the beginning of the string is returned.
*/
-char *strutol(char *start)
+char *
+strutol( start )
+ char *start;
{
char *q;
for (q=start; *q; q++)
@@ -574,7 +605,9 @@ char *strutol(char *start)
char *pgm = "gettoken";
-main(int argc, char **argv)
+main(argc,argv)
+ int argc;
+ char **argv;
{
char *p;
int type;
@@ -627,7 +660,9 @@ main(int argc, char **argv)
#ifdef KVTEST
-main(int argc, char **argv)
+main(argc,argv)
+ int argc;
+ char **argv;
{
int rc,ch;
FILE *fp;
@@ -684,7 +719,9 @@ parmtable kparm[] = {
{ "instance", "", (char *)NULL }
};
-main(int argc, char **argv)
+main(argc,argv)
+ int argc;
+ char **argv;
{
int rc,i,ch;
FILE *fp;
diff --git a/eBones/lib/libkrb/krb_get_in_tkt.c b/eBones/lib/libkrb/krb_get_in_tkt.c
index e17b60e..b6ff308 100644
--- a/eBones/lib/libkrb/krb_get_in_tkt.c
+++ b/eBones/lib/libkrb/krb_get_in_tkt.c
@@ -35,8 +35,14 @@ int swap_bytes;
* using the key returned by key_proc.
*/
-static int decrypt_tkt(char *user, char *instance, char *realm, char *arg,
- int (*key_proc)(), KTEXT *cipp)
+static int
+decrypt_tkt(user, instance, realm, arg, key_proc, cipp)
+ char *user;
+ char *instance;
+ char *realm;
+ char *arg;
+ int (*key_proc)();
+ KTEXT *cipp;
{
KTEXT cip = *cipp;
C_Block key; /* Key for decrypting cipher */
@@ -56,9 +62,9 @@ static int decrypt_tkt(char *user, char *instance, char *realm, char *arg,
}
#ifndef NOENCRYPTION
- key_sched((des_cblock *)key,key_s);
- pcbc_encrypt((des_cblock *)cip->dat,(des_cblock *)cip->dat,
- (long) cip->length,key_s,(des_cblock *)key,DES_DECRYPT);
+ key_sched(&key,key_s);
+ pcbc_encrypt((C_Block *)cip->dat,(C_Block *)cip->dat,
+ (long) cip->length,key_s,(C_Block *)key,DES_DECRYPT);
#endif /* !NOENCRYPTION */
/* Get rid of all traces of key */
bzero((char *)key,sizeof(key));
@@ -108,9 +114,18 @@ static int decrypt_tkt(char *user, char *instance, char *realm, char *arg,
* string sinstance service's instance
*/
-int krb_get_in_tkt(char *user, char *instance, char *realm, char *service,
- char *sinstance, int life, int (*key_proc)(), int (*decrypt_proc)(),
- char *arg)
+int
+krb_get_in_tkt(user, instance, realm, service, sinstance, life,
+ key_proc, decrypt_proc, arg)
+ char *user;
+ char *instance;
+ char *realm;
+ char *service;
+ char *sinstance;
+ int life;
+ int (*key_proc)();
+ int (*decrypt_proc)();
+ char *arg;
{
KTEXT_ST pkt_st;
KTEXT pkt = &pkt_st; /* Packet to KDC */
diff --git a/eBones/lib/libkrb/krbglue.c b/eBones/lib/libkrb/krbglue.c
index de5b7e2..f82cf70 100644
--- a/eBones/lib/libkrb/krbglue.c
+++ b/eBones/lib/libkrb/krbglue.c
@@ -22,10 +22,11 @@ $Id: krbglue.c,v 1.3 1995/07/18 16:39:05 mark Exp $";
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
-#include "des.h"
+#include <des.h>
#include "krb.h"
/* These definitions should be in krb.h, no? */
+/*
#if defined(__HIGHC__)
#undef __STDC__
#endif
@@ -59,7 +60,7 @@ extern char *krb_get_phost (char *);
extern int krb_get_krbhst (char *, char *, int);
#ifdef DEBUG
extern KTEXT krb_create_death_packet (char *);
-#endif /* DEBUG */
+#endif
#else
extern int krb_mk_req ();
extern int krb_rd_req ();
@@ -81,8 +82,11 @@ extern char *krb_get_phost ();
extern int krb_get_krbhst ();
#ifdef DEBUG
extern KTEXT krb_create_death_packet ();
-#endif /* DEBUG */
-#endif /* STDC */
+#endif
+#endif
+*/
+
+
int mk_ap_req(authent, service, instance, realm, checksum)
KTEXT authent;
char *service, *instance, *realm;
diff --git a/eBones/lib/libkrb/kuserok.c b/eBones/lib/libkrb/kuserok.c
index 15a25e8..8e5d18a 100644
--- a/eBones/lib/libkrb/kuserok.c
+++ b/eBones/lib/libkrb/kuserok.c
@@ -86,7 +86,10 @@ parmtable kparm[] = {
#define KPARMS kparm,PARMCOUNT(kparm)
#endif ATHENA_COMPAT
-int kuserok(AUTH_DAT *kdata, char *luser)
+int
+kuserok(kdata, luser)
+ AUTH_DAT *kdata;
+ char *luser;
{
struct stat sbuf;
struct passwd *pwd;
diff --git a/eBones/lib/libkrb/log.c b/eBones/lib/libkrb/log.c
index aea6ab9..e33477f 100644
--- a/eBones/lib/libkrb/log.c
+++ b/eBones/lib/libkrb/log.c
@@ -44,12 +44,18 @@ static is_open;
* The return value is undefined.
*/
+__BEGIN_DECLS
+char *month_sname __P((int));
+__END_DECLS
+
+
/*VARARGS1 */
-void log(char *format,int a1,int a2,int a3,int a4,int a5,int a6,int a7,
- int a8,int a9,int a0)
+void log(format,a1,a2,a3,a4,a5,a6,a7,a8,a9,a0)
+ char *format;
+ int a1,a2,a3,a4,a5,a6,a7,a8,a9,a0;
{
- FILE *logfile;
- long now;
+ FILE *logfile, *fopen();
+ long time(),now;
struct tm *tm;
if ((logfile = fopen(log_name,"a")) == NULL)
@@ -73,7 +79,9 @@ void log(char *format,int a1,int a2,int a3,int a4,int a5,int a6,int a7,
* the logfile defaults to KRBLOG, defined in "krb.h".
*/
-void set_logfile(char *filename)
+void
+set_logfile(filename)
+ char *filename;
{
log_name = filename;
is_open = 0;
@@ -86,7 +94,10 @@ void set_logfile(char *filename)
* on success.
*/
-int new_log(long t, char *string)
+int
+new_log(t,string)
+ long t;
+ char *string;
{
static FILE *logfile;
diff --git a/eBones/lib/libkrb/mk_priv.c b/eBones/lib/libkrb/mk_priv.c
index bc377de..d45d734 100644
--- a/eBones/lib/libkrb/mk_priv.c
+++ b/eBones/lib/libkrb/mk_priv.c
@@ -40,8 +40,13 @@ static char rcsid[] =
#include <prot.h>
#include "lsb_addr_comp.h"
+extern char *errmsg();
+extern int errno;
+extern int krb_debug;
+
/* static storage */
+
static u_long c_length;
static struct timeval msg_time;
static u_char msg_time_5ms;
@@ -90,9 +95,16 @@ static long msg_time_sec;
* 0<=n<=7 bytes pad to 8 byte multiple zeroes
*/
-long krb_mk_priv(u_char *in, u_char *out, u_long length,
- des_key_schedule schedule, des_cblock key, struct sockaddr_in *sender,
- struct sockaddr_in *receiver)
+long krb_mk_priv(in,out,length,schedule,key,sender,receiver)
+ u_char *in; /* application data */
+ u_char *out; /* put msg here, leave room for
+ * header! breaks if in and out
+ * (header stuff) overlap */
+ u_long length; /* of in data */
+ Key_schedule schedule; /* precomputed key schedule */
+ C_Block key; /* encryption key for seed and ivec */
+ struct sockaddr_in *sender; /* sender address */
+ struct sockaddr_in *receiver; /* receiver address */
{
register u_char *p,*q;
static u_char *c_length_ptr;
@@ -187,8 +199,8 @@ long krb_mk_priv(u_char *in, u_char *out, u_long length,
bcopy((char *) &c_length,(char *)c_length_ptr,sizeof(c_length));
#ifndef NOENCRYPTION
- pcbc_encrypt((des_cblock *)q,(des_cblock *)q,(long)(p-q),schedule,
- (des_cblock *)key,ENCRYPT);
+ pcbc_encrypt((C_Block *)q,(C_Block *)q,(long)(p-q),schedule,(C_Block *)key,
+ ENCRYPT);
#endif /* NOENCRYPTION */
return (q - out + c_length); /* resulting size */
diff --git a/eBones/lib/libkrb/mk_req.c b/eBones/lib/libkrb/mk_req.c
index 971e6a2..a27c1c0 100644
--- a/eBones/lib/libkrb/mk_req.c
+++ b/eBones/lib/libkrb/mk_req.c
@@ -21,6 +21,7 @@ static char *rcsid =
#include <sys/time.h>
#include <strings.h>
+extern int krb_ap_req_debug;
static struct timeval tv_local = { 0, 0 };
static int lifetime = DEFAULT_TKT_LIFE;
@@ -68,8 +69,13 @@ static int lifetime = DEFAULT_TKT_LIFE;
* all rounded up to multiple of 8.
*/
-int krb_mk_req(KTEXT authent, char *service, char *instance, char *realm,
- long checksum)
+int
+krb_mk_req(authent,service,instance,realm,checksum)
+ register KTEXT authent; /* Place to build the authenticator */
+ char *service; /* Name of the service */
+ char *instance; /* Service instance */
+ char *realm; /* Authentication domain of service */
+ long checksum; /* Checksum of data (optional) */
{
static KTEXT_ST req_st; /* Temp storage for req id */
register KTEXT req_id = &req_st;
@@ -151,9 +157,9 @@ int krb_mk_req(KTEXT authent, char *service, char *instance, char *realm,
req_id->length = ((req_id->length+7)/8)*8;
#ifndef NOENCRYPTION
- key_sched((des_cblock *)cr.session,key_s);
- pcbc_encrypt((des_cblock *)req_id->dat,(des_cblock *)req_id->dat,
- (long)req_id->length,key_s,(des_cblock *)cr.session,ENCRYPT);
+ key_sched((C_Block *)cr.session,key_s);
+ pcbc_encrypt((C_Block *)req_id->dat,(C_Block *)req_id->dat,
+ (long)req_id->length,key_s,(C_Block *)cr.session,ENCRYPT);
bzero((char *) key_s, sizeof(key_s));
#endif /* NOENCRYPTION */
@@ -181,7 +187,9 @@ int krb_mk_req(KTEXT authent, char *service, char *instance, char *realm,
* It returns the previous value of the default lifetime.
*/
-int krb_set_lifetime(int newval)
+int
+krb_set_lifetime(newval)
+int newval;
{
int olife = lifetime;
diff --git a/eBones/lib/libkrb/mk_safe.c b/eBones/lib/libkrb/mk_safe.c
index f4aab32..e5490bc 100644
--- a/eBones/lib/libkrb/mk_safe.c
+++ b/eBones/lib/libkrb/mk_safe.c
@@ -83,8 +83,17 @@ static long msg_time_sec;
* above using "key"
*/
-long krb_mk_safe(u_char *in, u_char *out, u_long length, des_cblock key,
- struct sockaddr_in *sender, struct sockaddr_in *receiver)
+long krb_mk_safe(in,out,length,key,sender,receiver)
+ u_char *in; /* application data */
+ u_char *out; /*
+ * put msg here, leave room for header!
+ * breaks if in and out (header stuff)
+ * overlap
+ */
+ u_long length; /* of in data */
+ C_Block *key; /* encryption key for seed and ivec */
+ struct sockaddr_in *sender; /* sender address */
+ struct sockaddr_in *receiver; /* receiver address */
{
register u_char *p,*q;
@@ -148,7 +157,7 @@ long krb_mk_safe(u_char *in, u_char *out, u_long length, des_cblock key,
cksum = 0;
bzero(big_cksum, sizeof(big_cksum));
#else
- cksum=quad_cksum((des_cblock *)q,big_cksum,p-q,2,(des_cblock *)key);
+ cksum=quad_cksum((C_Block *)q,big_cksum,p-q,2,key);
#endif
if (krb_debug)
printf("\ncksum = %lu",cksum);
diff --git a/eBones/lib/libkrb/month_sname.c b/eBones/lib/libkrb/month_sname.c
index 3443e41..f4ef339 100644
--- a/eBones/lib/libkrb/month_sname.c
+++ b/eBones/lib/libkrb/month_sname.c
@@ -22,7 +22,8 @@ static char *rcsid =
* month. Returns 0 if the argument is out of range.
*/
-char *month_sname(int n)
+char *month_sname(n)
+ int n;
{
static char *name[] = {
"Jan","Feb","Mar","Apr","May","Jun",
diff --git a/eBones/lib/libkrb/netread.c b/eBones/lib/libkrb/netread.c
index c773bc8..628004e 100644
--- a/eBones/lib/libkrb/netread.c
+++ b/eBones/lib/libkrb/netread.c
@@ -14,9 +14,7 @@ static char rcsid[] =
#endif lint
#endif
-#include <stdio.h>
#include <unistd.h>
-#include <krb.h>
/*
* krb_net_read() reads from the file descriptor "fd" to the buffer
@@ -28,7 +26,11 @@ static char rcsid[] =
* XXX must not use non-blocking I/O
*/
-int krb_net_read(int fd, char *buf, int len)
+int
+krb_net_read(fd, buf, len)
+int fd;
+register char *buf;
+register int len;
{
int cc, len2 = 0;
diff --git a/eBones/lib/libkrb/netwrite.c b/eBones/lib/libkrb/netwrite.c
index 7af91ff..f85f7ba 100644
--- a/eBones/lib/libkrb/netwrite.c
+++ b/eBones/lib/libkrb/netwrite.c
@@ -14,9 +14,7 @@ static char rcsid[] =
#endif lint
#endif
-#include <stdio.h>
#include <unistd.h>
-#include <krb.h>
/*
* krb_net_write() writes "len" bytes from "buf" to the file
@@ -27,7 +25,11 @@ static char rcsid[] =
* XXX must not use non-blocking I/O
*/
-int krb_net_write(int fd, char *buf, int len)
+int
+krb_net_write(fd, buf, len)
+int fd;
+register char *buf;
+int len;
{
int cc;
register int wrlen = len;
diff --git a/eBones/lib/libkrb/pkt_clen.c b/eBones/lib/libkrb/pkt_clen.c
index 17d46c2..f8dacae 100644
--- a/eBones/lib/libkrb/pkt_clen.c
+++ b/eBones/lib/libkrb/pkt_clen.c
@@ -15,10 +15,12 @@ static char *rcsid =
#endif /* lint */
#endif
+#include <string.h>
+
#include <krb.h>
#include <prot.h>
-#include <string.h>
+extern int krb_debug;
extern int swap_bytes;
/*
@@ -29,7 +31,9 @@ extern int swap_bytes;
* ciphertext length out of the packet.
*/
-int pkt_clen(KTEXT pkt)
+int
+pkt_clen(pkt)
+ KTEXT pkt;
{
static unsigned short temp,temp2;
int clen = 0;
diff --git a/eBones/lib/libkrb/rd_err.c b/eBones/lib/libkrb/rd_err.c
index 8c5b8a2..e46dc66 100644
--- a/eBones/lib/libkrb/rd_err.c
+++ b/eBones/lib/libkrb/rd_err.c
@@ -24,8 +24,8 @@ static char rcsid[] =
#endif
/* system include files */
-#include <stdio.h>
#include <string.h>
+#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <netinet/in.h>
@@ -50,7 +50,12 @@ static char rcsid[] =
* The AUTH_MSG_APPL_ERR message format can be found in mk_err.c
*/
-int krb_rd_err(u_char *in, u_long in_length, long *code, MSG_DAT *m_data)
+int
+krb_rd_err(in,in_length,code,m_data)
+ u_char *in; /* pointer to the msg received */
+ u_long in_length; /* of in msg */
+ long *code; /* received error code */
+ MSG_DAT *m_data;
{
register u_char *p;
int swap_bytes = 0;
diff --git a/eBones/lib/libkrb/rd_priv.c b/eBones/lib/libkrb/rd_priv.c
index 457352e..0c21a1d 100644
--- a/eBones/lib/libkrb/rd_priv.c
+++ b/eBones/lib/libkrb/rd_priv.c
@@ -26,8 +26,8 @@ static char rcsid[]=
#endif
/* system include files */
-#include <stdio.h>
#include <string.h>
+#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <netinet/in.h>
@@ -39,6 +39,8 @@ static char rcsid[]=
#include <prot.h>
#include "lsb_addr_comp.h"
+extern int krb_debug;
+
/* static storage */
static u_long c_length;
@@ -68,9 +70,15 @@ int private_msg_ver = KRB_PROT_VERSION;
* information, MSG_DAT, is defined in "krb.h".
*/
-long krb_rd_priv(u_char *in, u_long in_length, des_key_schedule schedule,
- des_cblock key, struct sockaddr_in *sender, struct sockaddr_in *receiver,
- MSG_DAT *m_data)
+long
+krb_rd_priv(in,in_length,schedule,key,sender,receiver,m_data)
+ u_char *in; /* pointer to the msg received */
+ u_long in_length; /* length of "in" msg */
+ Key_schedule schedule; /* precomputed key schedule */
+ C_Block key; /* encryption key for seed and ivec */
+ struct sockaddr_in *sender;
+ struct sockaddr_in *receiver;
+ MSG_DAT *m_data; /*various input/output data from msg */
{
register u_char *p,*q;
static u_long src_addr; /* Can't send structs since no
@@ -103,8 +111,8 @@ long krb_rd_priv(u_char *in, u_long in_length, des_key_schedule schedule,
q = p; /* mark start of encrypted stuff */
#ifndef NOENCRYPTION
- pcbc_encrypt((des_cblock *)q,(des_cblock *)q,(long)c_length,schedule,
- (des_cblock *)key,DECRYPT);
+ pcbc_encrypt((C_Block *)q,(C_Block *)q,(long)c_length,schedule,
+ (C_Block *)key,DECRYPT);
#endif
/* safely get application data length */
diff --git a/eBones/lib/libkrb/rd_req.c b/eBones/lib/libkrb/rd_req.c
index b77ec48..60ee948 100644
--- a/eBones/lib/libkrb/rd_req.c
+++ b/eBones/lib/libkrb/rd_req.c
@@ -15,13 +15,14 @@ static char *rcsid =
#endif /* lint */
#endif
-#include <stdio.h>
#include <des.h>
#include <krb.h>
#include <prot.h>
#include <sys/time.h>
#include <strings.h>
+extern int krb_ap_req_debug;
+
static struct timeval t_local = { 0, 0 };
/*
@@ -65,17 +66,20 @@ static char st_inst[INST_SZ]; /* server's instance */
* krb_rd_req().
*/
-int krb_set_key(char *key, int cvt)
+int
+krb_set_key(key,cvt)
+ char *key;
+ int cvt;
{
#ifdef NOENCRYPTION
bzero(ky, sizeof(ky));
return KSUCCESS;
#else
if (cvt)
- string_to_key(key,(des_cblock *)ky);
+ string_to_key(key,(C_Block *)ky);
else
bcopy(key,(char *)ky,8);
- return(des_key_sched((des_cblock *)ky,serv_key));
+ return(des_key_sched((C_Block *)ky,serv_key));
#endif
}
@@ -121,8 +125,14 @@ int krb_set_key(char *key, int cvt)
* Mutual authentication is not implemented.
*/
-int krb_rd_req (KTEXT authent, char *service, char *instance, long from_addr,
- AUTH_DAT *ad, char *fn)
+int
+krb_rd_req(authent,service,instance,from_addr,ad,fn)
+ register KTEXT authent; /* The received message */
+ char *service; /* Service name */
+ char *instance; /* Service instance */
+ long from_addr; /* Net address of originating host */
+ AUTH_DAT *ad; /* Structure to be filled in */
+ char *fn; /* Filename to get keys from */
{
static KTEXT_ST ticket; /* Temp storage for ticket */
static KTEXT tkt = &ticket;
@@ -241,10 +251,9 @@ int krb_rd_req (KTEXT authent, char *service, char *instance, long from_addr,
bcopy(ptr + tkt->length, (char *)(req_id->dat),req_id->length);
#ifndef NOENCRYPTION
- key_sched((des_cblock *)ad->session,seskey_sched);
- pcbc_encrypt((des_cblock *)req_id->dat,(des_cblock *)req_id->dat,
- (long)req_id->length,seskey_sched,(des_cblock *)ad->session,
- DES_DECRYPT);
+ key_sched((C_Block *)ad->session,seskey_sched);
+ pcbc_encrypt((C_Block *)req_id->dat,(C_Block *)req_id->dat,
+ (long)req_id->length,seskey_sched,(C_Block *)ad->session,DES_DECRYPT);
#endif /* NOENCRYPTION */
#define check_ptr() if ((ptr - (char *) req_id->dat) > req_id->length) return(RD_AP_MODIFIED);
diff --git a/eBones/lib/libkrb/rd_safe.c b/eBones/lib/libkrb/rd_safe.c
index 48d43c5..4d3e8d6 100644
--- a/eBones/lib/libkrb/rd_safe.c
+++ b/eBones/lib/libkrb/rd_safe.c
@@ -37,6 +37,10 @@ static char rcsid[] =
#include <prot.h>
#include "lsb_addr_comp.h"
+extern char *errmsg();
+extern int errno;
+extern int krb_debug;
+
/* static storage */
static C_Block calc_cksum[2];
@@ -62,9 +66,13 @@ static u_long delta_t;
* information, MSG_DAT, is defined in "krb.h".
*/
-long krb_rd_safe(u_char *in, u_long in_length, des_cblock key,
- struct sockaddr_in *sender, struct sockaddr_in *receiver,
- MSG_DAT *m_data)
+long krb_rd_safe(in,in_length,key,sender,receiver,m_data)
+ u_char *in; /* pointer to the msg received */
+ u_long in_length; /* length of "in" msg */
+ C_Block *key; /* encryption key for seed and ivec */
+ struct sockaddr_in *sender; /* sender's address */
+ struct sockaddr_in *receiver; /* receiver's address -- me */
+ MSG_DAT *m_data; /* where to put message information */
{
register u_char *p,*q;
static u_long src_addr; /* Can't send structs since no
@@ -162,7 +170,7 @@ krb_rd_safe protocol err sizeof(u_long) != sizeof(struct in_addr)");
#ifdef NOENCRYPTION
bzero(calc_cksum, sizeof(calc_cksum));
#else
- quad_cksum((des_cblock *)q,calc_cksum,p-q,2,(des_cblock *)key);
+ quad_cksum((C_Block *)q,calc_cksum,p-q,2,key);
#endif
if (krb_debug)
diff --git a/eBones/lib/libkrb/read_service_key.c b/eBones/lib/libkrb/read_service_key.c
index aa577fd..6064292 100644
--- a/eBones/lib/libkrb/read_service_key.c
+++ b/eBones/lib/libkrb/read_service_key.c
@@ -17,8 +17,8 @@ static char *rcsid =
#include <krb.h>
#include <stdio.h>
-#include <strings.h>
#include <unistd.h>
+#include <strings.h>
/*
* The private keys for servers on a given host are stored in a
@@ -54,8 +54,14 @@ static char *rcsid =
/*ARGSUSED */
-int read_service_key(char *service, char *instance, char *realm, int kvno,
- char *file, char *key)
+int
+read_service_key(service,instance,realm,kvno,file,key)
+ char *service; /* Service Name */
+ char *instance; /* Instance name or "*" */
+ char *realm; /* Realm */
+ int kvno; /* Key version number */
+ char *file; /* Filename */
+ char *key; /* Pointer to key to be filled in */
{
char serv[SNAME_SZ];
char inst[INST_SZ];
diff --git a/eBones/lib/libkrb/recvauth.c b/eBones/lib/libkrb/recvauth.c
index 8e9a6bb..45d68ee 100644
--- a/eBones/lib/libkrb/recvauth.c
+++ b/eBones/lib/libkrb/recvauth.c
@@ -14,6 +14,7 @@ static char rcsid[] =
#endif lint
#endif
+#include <krb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <syslog.h>
@@ -22,7 +23,6 @@ static char rcsid[] =
#include <stdlib.h>
#include <unistd.h>
#include <strings.h>
-#include <krb.h>
#define KRB_SENDAUTH_VERS "AUTHV0.1" /* MUST be KRB_SENDAUTH_VLEN
@@ -34,6 +34,8 @@ static char rcsid[] =
* be sure to support old versions of krb_sendauth!
*/
+extern int errno;
+
/*
* krb_recvauth() reads (and optionally responds to) a message sent
* using krb_sendauth(). The "options" argument is a bit-field of
@@ -120,14 +122,24 @@ static char rcsid[] =
#endif /* max */
int
-krb_recvauth(long options, int fd, KTEXT ticket, char *service, char *instance,
- struct sockaddr_in *faddr, struct sockaddr_in *laddr, AUTH_DAT *kdata,
- char *filename, des_key_schedule schedule, char *version)
+krb_recvauth(options, fd, ticket, service, instance, faddr, laddr, kdata,
+ filename, schedule, version)
+long options; /* bit-pattern of options */
+int fd; /* file descr. to read from */
+KTEXT ticket; /* storage for client's ticket */
+char *service; /* service expected */
+char *instance; /* inst expected (may be filled in) */
+struct sockaddr_in *faddr; /* address of foreign host on fd */
+struct sockaddr_in *laddr; /* local address */
+AUTH_DAT *kdata; /* kerberos data (returned) */
+char *filename; /* name of file with service keys */
+Key_schedule schedule; /* key schedule (return) */
+char *version; /* version string (filled in) */
{
int i, cc, old_vers = 0;
char krb_vers[KRB_SENDAUTH_VLEN + 1]; /* + 1 for the null terminator */
- char *cp = NULL;
+ char *cp;
int rem;
long tkt_len, priv_len;
u_long cksum;
@@ -242,7 +254,7 @@ krb_recvauth(long options, int fd, KTEXT ticket, char *service, char *instance,
cksum = kdata->checksum + 1;
cksum = htonl(cksum);
#ifndef NOENCRYPTION
- key_sched((des_cblock *)kdata->session,schedule);
+ key_sched((C_Block *)kdata->session,schedule);
#endif
priv_len = krb_mk_priv((unsigned char *)&cksum,
tmp_buf,
diff --git a/eBones/lib/libkrb/save_credentials.c b/eBones/lib/libkrb/save_credentials.c
index bec225f..268bb77 100644
--- a/eBones/lib/libkrb/save_credentials.c
+++ b/eBones/lib/libkrb/save_credentials.c
@@ -30,8 +30,17 @@ static char *rcsid =
* by the tf_init() or tf_save_cred() routines.
*/
-int save_credentials(char *service, char *instance, char *realm,
- des_cblock session, int lifetime, int kvno, KTEXT ticket, long issue_date)
+int
+save_credentials(service, instance, realm, session, lifetime, kvno,
+ ticket, issue_date)
+ char *service; /* Service name */
+ char *instance; /* Instance */
+ char *realm; /* Auth domain */
+ C_Block session; /* Session key */
+ int lifetime; /* Lifetime */
+ int kvno; /* Key version number */
+ KTEXT ticket; /* The ticket itself */
+ long issue_date; /* The issue time */
{
int tf_status; /* return values of the tf_util calls */
diff --git a/eBones/lib/libkrb/send_to_kdc.c b/eBones/lib/libkrb/send_to_kdc.c
index 96b3cb5..a2a329a 100644
--- a/eBones/lib/libkrb/send_to_kdc.c
+++ b/eBones/lib/libkrb/send_to_kdc.c
@@ -4,7 +4,7 @@
* <Copyright.MIT>.
*
* from: send_to_kdc.c,v 4.20 90/01/02 13:40:37 jtkohl Exp $
- * $Id: send_to_kdc.c,v 1.5 1995/08/25 22:52:05 markm Exp $
+ * $Id: send_to_kdc.c,v 1.3 1995/07/18 16:39:42 mark Exp $
*/
#if 0
@@ -17,9 +17,9 @@ static char rcsid_send_to_kdc_c[] =
#include <krb.h>
#include <prot.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -34,6 +34,11 @@ static char rcsid_send_to_kdc_c[] =
#define S_AD_SZ sizeof(struct sockaddr_in)
+extern int errno;
+extern int krb_debug;
+
+extern char *malloc(), *calloc(), *realloc();
+
int krb_udp_port = 0;
/* CLIENT_KRB_TIMEOUT indicates the time to wait before
@@ -41,6 +46,7 @@ int krb_udp_port = 0;
*/
static struct timeval timeout = { CLIENT_KRB_TIMEOUT, 0};
static char *prog = "send_to_kdc";
+static send_recv();
/*
* This file contains two routines, send_to_kdc() and send_recv().
@@ -48,106 +54,6 @@ static char *prog = "send_to_kdc";
*/
/*
- * try to send out and receive message.
- * return 1 on success, 0 on failure
- */
-
-static int send_recv(KTEXT pkt, KTEXT rpkt, int f, struct sockaddr_in *_to,
- struct hostent *addrs)
-{
- fd_set readfds;
- register struct hostent *hp;
- struct sockaddr_in from;
- int sin_size;
- int numsent;
- int addr_count;
-
- if (krb_debug) {
- if (_to->sin_family == AF_INET)
- printf("Sending message to %s...",
- inet_ntoa(_to->sin_addr));
- else
- printf("Sending message...");
- (void) fflush(stdout);
- }
- if ((numsent = sendto(f,(char *)(pkt->dat), pkt->length, 0,
- (struct sockaddr *)_to,
- S_AD_SZ)) != pkt->length) {
- if (krb_debug)
- printf("sent only %d/%d\n",numsent, pkt->length);
- return 0;
- }
- if (krb_debug) {
- printf("Sent\nWaiting for reply...");
- (void) fflush(stdout);
- }
- FD_ZERO(&readfds);
- FD_SET(f, &readfds);
- errno = 0;
- /* select - either recv is ready, or timeout */
- /* see if timeout or error or wrong descriptor */
- if (select(f + 1, &readfds, (fd_set *)0, (fd_set *)0, &timeout) < 1
- || !FD_ISSET(f, &readfds)) {
- if (krb_debug) {
- fprintf(stderr, "select failed: readfds=%lx",
- (unsigned long)&readfds);
- perror("");
- }
- return 0;
- }
- sin_size = sizeof(from);
- if (recvfrom(f, (char *)(rpkt->dat), sizeof(rpkt->dat), 0,
- (struct sockaddr *)&from, &sin_size)
- < 0) {
- if (krb_debug)
- perror("recvfrom");
- return 0;
- }
- if (krb_debug) {
- printf("received packet from %s\n", inet_ntoa(from.sin_addr));
- fflush(stdout);
- }
-/* At least Sun OS version 3.2 (or worse) and Ultrix version 2.2
- (or worse) only return one address ... */
-#if (defined(ULTRIX022) || (defined(SunOS) && SunOS < 40))
- for (hp = addrs; hp->h_name != (char *)NULL; hp++) {
- if (!bcmp(hp->h_addr, (char *)&from.sin_addr.s_addr,
- hp->h_length)) {
- if (krb_debug) {
- printf("Received it\n");
- (void) fflush(stdout);
- }
- return 1;
- }
- if (krb_debug)
- fprintf(stderr, "packet not from %s\n",
- inet_ntoa(*(struct in_addr *)hp->h_addr));
- }
- }
-#else /* !(ULTRIX022 || (SunOS < 40)) */
- for (hp = addrs; hp->h_name != (char *)NULL; hp++) {
- for (addr_count = 0; hp->h_addr_list[addr_count]; addr_count++) {
- if (!bcmp(hp->h_addr_list[addr_count],
- (char *)&from.sin_addr.s_addr, hp->h_length)) {
- if (krb_debug) {
- printf("Received it\n");
- (void) fflush(stdout);
- }
- return 1;
- }
- if (krb_debug)
- fprintf(stderr, "packet not from %s\n",
- inet_ntoa(*(struct in_addr *)hp->h_addr_list[addr_count]));
- }
- }
-#endif /* !(ULTRIX022 || (SunOS < 40)) */
- if (krb_debug)
- fprintf(stderr, "%s: received packet from wrong host! (%s)\n",
- "send_to_kdc(send_rcv)", inet_ntoa(from.sin_addr));
- return 0;
-}
-
-/*
* send_to_kdc() sends a message to the Kerberos authentication
* server(s) in the given realm and returns the reply message.
* The "pkt" argument points to the message to be sent to Kerberos;
@@ -174,16 +80,20 @@ static int send_recv(KTEXT pkt, KTEXT rpkt, int f, struct sockaddr_in *_to,
* after several retries
*/
-int send_to_kdc(KTEXT pkt, KTEXT rpkt, char *realm)
+int
+send_to_kdc(pkt,rpkt,realm)
+ KTEXT pkt;
+ KTEXT rpkt;
+ char *realm;
{
int i, f;
int no_host; /* was a kerberos host found? */
int retry;
int n_hosts;
int retval;
- int addr_count;
struct sockaddr_in to;
struct hostent *host, *hostlist;
+ char *cp;
char krbhst[MAX_HSTNM];
char lrealm[REALM_SZ];
@@ -242,70 +152,35 @@ int send_to_kdc(KTEXT pkt, KTEXT rpkt, char *realm)
continue;
no_host = 0; /* found at least one */
n_hosts++;
- /*
- * Preserve host network addresses to check against later
- */
+ /* preserve host network address to check later
+ * (would be better to preserve *all* addresses,
+ * take care of that later)
+ */
hostlist = (struct hostent *)
realloc((char *)hostlist,
(unsigned)
sizeof(struct hostent)*(n_hosts+1));
- if (!hostlist) {
- fprintf(stderr, "Could not grow hostlist\n");
- return /*errno */SKDC_CANT;
- }
- bcopy((char *)host, (char *)&hostlist[n_hosts-1],
- sizeof(struct hostent));
- host = &hostlist[n_hosts-1];
+ if (!hostlist)
+ return /*errno */SKDC_CANT;
+ bcopy((char *)host, (char *)&hostlist[n_hosts-1],
+ sizeof(struct hostent));
+ host = &hostlist[n_hosts-1];
+ cp = malloc((unsigned)host->h_length);
+ if (!cp) {
+ retval = /*errno */SKDC_CANT;
+ goto rtn;
+ }
+ bcopy((char *)host->h_addr, cp, host->h_length);
/* At least Sun OS version 3.2 (or worse) and Ultrix version 2.2
- (or worse) only return one address ... */
-#if (defined(ULTRIX022) || (defined(SunOS) && SunOS < 40))
- {
- char *cp = malloc((unsigned)host->h_length);
- if (!cp) {
- retval = /*errno */SKDC_CANT;
- goto rtn;
- }
- bcopy((char *)host->h_addr, cp, host->h_length);
- host->h_addr = cp;
- }
-#else /* !(ULTRIX022 || (SunOS < 40)) */
- /*
- * Make a copy of the entire h_addr_list.
- */
- {
- char *addr;
- char **old_addr_list;
- addr_count = 0;
- old_addr_list = host->h_addr_list;
- while(old_addr_list[addr_count++])
- ;
- host->h_addr_list = (char **)malloc(addr_count+1 * sizeof(char *));
- if (host->h_addr_list == NULL) {
- fprintf(stderr, "Could not allocate host->h_addr_list\n");
- retval = SKDC_CANT;
- goto rtn;
- }
- if (krb_debug) {
- printf("h_length = %d\n", host->h_length);
- printf("Number of addresses = %d\n", addr_count);
- }
- for (addr_count = 0; old_addr_list[addr_count]; addr_count++) {
- if (krb_debug)
- printf ("addr[%d] = %s\n", addr_count,
- inet_ntoa(*(struct in_addr *)old_addr_list[addr_count]));
- addr = (char *)malloc(host->h_length);
- if (addr == NULL) {
- fprintf(stderr, "Could not allocate address\n");
- retval = SKDC_CANT;
- goto rtn;
- }
- bcopy(old_addr_list[addr_count], addr, host->h_length);
- host->h_addr_list[addr_count] = addr;
- }
- host->h_addr_list[addr_count] = NULL;
- }
-#endif /* !(ULTRIX022 || (SunOS < 40)) */
-
+ (or worse) only return one name ... */
+#if !(defined(ULTRIX022) || (defined(SunOS) && SunOS < 40))
+ host->h_addr_list = (char **)malloc(sizeof(char *));
+ if (!host->h_addr_list) {
+ retval = /*errno */SKDC_CANT;
+ goto rtn;
+ }
+#endif /* ULTRIX022 || SunOS */
+ host->h_addr = cp;
bzero((char *)&hostlist[n_hosts],
sizeof(struct hostent));
to.sin_family = host->h_addrtype;
@@ -323,36 +198,22 @@ int send_to_kdc(KTEXT pkt, KTEXT rpkt, char *realm)
}
if (no_host) {
if (krb_debug)
- fprintf(stderr, "%s: can't find any Kerberos host.\n", prog);
+ fprintf(stderr, "%s: can't find any Kerberos host.\n",
+ prog);
retval = SKDC_CANT;
goto rtn;
}
- /*
- * retry each host in sequence. Some addresses may be unreachable
- * from where we are, so loop through them as well.
- */
+ /* retry each host in sequence */
for (retry = 0; retry < CLIENT_KRB_RETRY; ++retry) {
for (host = hostlist; host->h_name != (char *)NULL; host++) {
-#if (defined(ULTRIX022) || (defined(SunOS) && SunOS < 40))
- to.sin_family = host->h_addrtype;
- bcopy(host->h_addr_list[addr_count], (char *)&to.sin_addr,
- host->h_length);
- if (send_recv(pkt, rpkt, f, &to, hostlist)) {
- retval = KSUCCESS;
- goto rtn;
- }
-#else /* !(ULTRIX022 || (SunOS < 40)) */
- for (addr_count = 0; host->h_addr_list[addr_count]; addr_count++) {
- to.sin_family = host->h_addrtype;
- bcopy(host->h_addr_list[addr_count], (char *)&to.sin_addr,
- host->h_length);
- if (send_recv(pkt, rpkt, f, &to, hostlist)) {
- retval = KSUCCESS;
- goto rtn;
- }
- }
-#endif /* !(ULTRIX022 || (SunOS < 40)) */
- }
+ to.sin_family = host->h_addrtype;
+ bcopy(host->h_addr, (char *)&to.sin_addr,
+ host->h_length);
+ if (send_recv(pkt, rpkt, f, &to, hostlist)) {
+ retval = KSUCCESS;
+ goto rtn;
+ }
+ }
}
retval = SKDC_RETRY;
rtn:
@@ -375,3 +236,87 @@ rtn:
}
return(retval);
}
+
+/*
+ * try to send out and receive message.
+ * return 1 on success, 0 on failure
+ */
+
+static int
+send_recv(pkt,rpkt,f,_to,addrs)
+ KTEXT pkt;
+ KTEXT rpkt;
+ int f;
+ struct sockaddr_in *_to;
+ struct hostent *addrs;
+{
+ fd_set readfds;
+ register struct hostent *hp;
+ struct sockaddr_in from;
+ int sin_size;
+ int numsent;
+
+ if (krb_debug) {
+ if (_to->sin_family == AF_INET)
+ printf("Sending message to %s...",
+ inet_ntoa(_to->sin_addr));
+ else
+ printf("Sending message...");
+ (void) fflush(stdout);
+ }
+ if ((numsent = sendto(f,(char *)(pkt->dat), pkt->length, 0,
+ (struct sockaddr *)_to,
+ S_AD_SZ)) != pkt->length) {
+ if (krb_debug)
+ printf("sent only %d/%d\n",numsent, pkt->length);
+ return 0;
+ }
+ if (krb_debug) {
+ printf("Sent\nWaiting for reply...");
+ (void) fflush(stdout);
+ }
+ FD_ZERO(&readfds);
+ FD_SET(f, &readfds);
+ errno = 0;
+ /* select - either recv is ready, or timeout */
+ /* see if timeout or error or wrong descriptor */
+ if (select(f + 1, &readfds, (fd_set *)0, (fd_set *)0, &timeout) < 1
+ || !FD_ISSET(f, &readfds)) {
+ if (krb_debug) {
+ fprintf(stderr, "select failed: readfds=%x",
+ readfds);
+ perror("");
+ }
+ return 0;
+ }
+ sin_size = sizeof(from);
+ if (recvfrom(f, (char *)(rpkt->dat), sizeof(rpkt->dat), 0,
+ (struct sockaddr *)&from, &sin_size)
+ < 0) {
+ if (krb_debug)
+ perror("recvfrom");
+ return 0;
+ }
+ if (krb_debug) {
+ printf("received packet from %s\n", inet_ntoa(from.sin_addr));
+ fflush(stdout);
+ }
+ for (hp = addrs; hp->h_name != (char *)NULL; hp++) {
+ if (!bcmp(hp->h_addr, (char *)&from.sin_addr.s_addr,
+ hp->h_length)) {
+ if (krb_debug) {
+ printf("Received it\n");
+ (void) fflush(stdout);
+ }
+ return 1;
+ }
+ if (krb_debug)
+ fprintf(stderr,
+ "packet not from %lx\n",
+ (unsigned long)hp->h_addr);
+ }
+ if (krb_debug)
+ fprintf(stderr, "%s: received packet from wrong host! (%lx)\n",
+ "send_to_kdc(send_rcv)", from.sin_addr.s_addr);
+ return 0;
+}
diff --git a/eBones/lib/libkrb/sendauth.c b/eBones/lib/libkrb/sendauth.c
index add71d9..a1d79e7 100644
--- a/eBones/lib/libkrb/sendauth.c
+++ b/eBones/lib/libkrb/sendauth.c
@@ -28,6 +28,10 @@ static char rcsid[] =
* and make appropriate changes in krb_recvauth.c
*/
+extern int errno;
+
+extern char *krb_get_phost();
+
/*
* This file contains two routines: krb_sendauth() and krb_sendsrv().
*
@@ -107,10 +111,21 @@ static char rcsid[] =
* will disappear when krb_sendauth() returns.
*/
-int krb_sendauth(long options, int fd, KTEXT ticket, char *service, char *inst,
- char *realm, u_long checksum, MSG_DAT *msg_data, CREDENTIALS *cred,
- des_key_schedule schedule, struct sockaddr_in *laddr,
- struct sockaddr_in *faddr, char *version)
+int
+krb_sendauth(options, fd, ticket, service, inst, realm, checksum,
+ msg_data, cred, schedule, laddr, faddr, version)
+long options; /* bit-pattern of options */
+int fd; /* file descriptor to write onto */
+KTEXT ticket; /* where to put ticket (return); or
+ * supplied in case of KOPT_DONT_MK_REQ */
+char *service, *inst, *realm; /* service name, instance, realm */
+u_long checksum; /* checksum to include in request */
+MSG_DAT *msg_data; /* mutual auth MSG_DAT (return) */
+CREDENTIALS *cred; /* credentials (return) */
+Key_schedule schedule; /* key schedule (return) */
+struct sockaddr_in *laddr; /* local address */
+struct sockaddr_in *faddr; /* address of foreign host on fd */
+char *version; /* version string */
{
int rem, i, cc;
char srv_inst[INST_SZ];
@@ -198,7 +213,7 @@ int krb_sendauth(long options, int fd, KTEXT ticket, char *service, char *inst,
/* ...and decrypt it */
#ifndef NOENCRYPTION
- key_sched((des_cblock *)cred->session,schedule);
+ key_sched((C_Block *)cred->session,schedule);
#endif
if ((cc = krb_rd_priv(priv_buf,(unsigned long) tkt_len, schedule,
cred->session, faddr, laddr, msg_data)))
@@ -221,7 +236,10 @@ int krb_sendauth(long options, int fd, KTEXT ticket, char *service, char *inst,
* krb_sendsvc
*/
-int krb_sendsvc(int fd, char *service)
+int
+krb_sendsvc(fd, service)
+int fd;
+char *service;
{
/* write the service name length and then the service name to
the fd */
diff --git a/eBones/lib/libkrb/stime.c b/eBones/lib/libkrb/stime.c
index f70c33d..2da2463 100644
--- a/eBones/lib/libkrb/stime.c
+++ b/eBones/lib/libkrb/stime.c
@@ -26,7 +26,8 @@ static char *rcsid =
* "25-Jan-88 10:17:56"
*/
-char *stime(t)
+char *
+stime(t)
long *t;
{
static char st_data[40];
diff --git a/eBones/lib/libkrb/tf_shm.c b/eBones/lib/libkrb/tf_shm.c
index ad6690a..31894cb 100644
--- a/eBones/lib/libkrb/tf_shm.c
+++ b/eBones/lib/libkrb/tf_shm.c
@@ -28,6 +28,9 @@ static char rcsid[] =
#define MAX_BUFF sizeof(des_cblock)*1000 /* room for 1k keys */
+extern int errno;
+extern int krb_debug;
+
/*
* krb_create_shmtkt:
*
@@ -35,7 +38,9 @@ static char rcsid[] =
* in the specified filename.
*/
-int krb_shm_create(char *file_name)
+int
+krb_shm_create(file_name)
+char *file_name;
{
int retval;
int shmid;
@@ -133,7 +138,8 @@ int krb_is_diskless()
* file pointing to it.
*/
-int krb_shm_dest(char *file)
+int krb_shm_dest(file)
+char *file;
{
int shmid;
FILE *sfile;
@@ -165,3 +171,6 @@ int krb_shm_dest(char *file)
} else
return(RET_TKFIL); /* XXX */
}
+
+
+
diff --git a/eBones/lib/libkrb/tf_util.c b/eBones/lib/libkrb/tf_util.c
index ef91658..e939c38 100644
--- a/eBones/lib/libkrb/tf_util.c
+++ b/eBones/lib/libkrb/tf_util.c
@@ -14,9 +14,9 @@ static char rcsid[] =
#endif /* lint */
#endif
-#include <stdio.h>
-#include <string.h>
#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -33,12 +33,13 @@ static char rcsid[] =
#define TF_LCK_RETRY ((unsigned)2) /* seconds to sleep before
* retry if ticket file is
* locked */
+extern int krb_debug;
+
#ifdef TKT_SHMEM
char *krb_shm_addr = 0;
static char *tmp_shm_addr = 0;
static char krb_dummy_skey[8] = {0,0,0,0,0,0,0,0};
-char *shmat();
#endif /* TKT_SHMEM */
/*
@@ -54,12 +55,13 @@ char *shmat();
* c. In tf_close, be sure it gets reinitialized to a negative
* number.
*/
-static int fd = -1;
-static int curpos; /* Position in tfbfr */
-static int lastpos; /* End of tfbfr */
+static fd = -1;
+static curpos; /* Position in tfbfr */
+static lastpos; /* End of tfbfr */
static char tfbfr[BUFSIZ]; /* Buffer for ticket data */
-static tf_gets(), tf_read();
+static int tf_read(char *s, int n);
+static int tf_gets(char *s, int n);
/*
* This file contains routines for manipulating the ticket cache file.
@@ -123,7 +125,10 @@ static tf_gets(), tf_read();
* TKT_FIL_LCK - couldn't lock the file, even after a retry
*/
-int tf_init(char *tf_name, int rw)
+int
+tf_init(tf_name, rw)
+ char *tf_name;
+ int rw;
{
int wflag;
uid_t me, getuid();
@@ -259,7 +264,9 @@ int tf_init(char *tf_name, int rw)
* was longer than ANAME_SZ, TKT_FIL_FMT is returned.
*/
-int tf_get_pname(char *p)
+int
+tf_get_pname(p)
+ char *p;
{
if (fd < 0) {
if (krb_debug)
@@ -281,7 +288,9 @@ int tf_get_pname(char *p)
* instance may be null.
*/
-int tf_get_pinst(char *inst)
+int
+tf_get_pinst(inst)
+ char *inst;
{
if (fd < 0) {
if (krb_debug)
@@ -294,33 +303,6 @@ int tf_get_pinst(char *inst)
}
/*
- * tf_close() closes the ticket file and sets "fd" to -1. If "fd" is
- * not a valid file descriptor, it just returns. It also clears the
- * buffer used to read tickets.
- *
- * The return value is not defined.
- */
-
-void tf_close()
-{
- if (!(fd < 0)) {
-#ifdef TKT_SHMEM
- if (shmdt(krb_shm_addr)) {
- /* what kind of error? */
- if (krb_debug)
- fprintf(stderr, "shmdt 0x%x: errno %d",krb_shm_addr, errno);
- } else {
- krb_shm_addr = 0;
- }
-#endif TKT_SHMEM
- (void) flock(fd, LOCK_UN);
- (void) close(fd);
- fd = -1; /* see declaration of fd above */
- }
- bzero(tfbfr, sizeof(tfbfr));
-}
-
-/*
* tf_get_cred() reads a CREDENTIALS record from a ticket file and fills
* in the given structure "c". It should only be called after tf_init(),
* tf_get_pname(), and tf_get_pinst() have been called. If all goes well,
@@ -331,7 +313,9 @@ void tf_close()
* EOF - end of file encountered
*/
-int tf_get_cred(CREDENTIALS *c)
+int
+tf_get_cred(c)
+ CREDENTIALS *c;
{
KTEXT ticket = &c->ticket_st; /* pointer to ticket */
int k_errno;
@@ -388,6 +372,34 @@ int tf_get_cred(CREDENTIALS *c)
}
/*
+ * tf_close() closes the ticket file and sets "fd" to -1. If "fd" is
+ * not a valid file descriptor, it just returns. It also clears the
+ * buffer used to read tickets.
+ *
+ * The return value is not defined.
+ */
+
+void
+tf_close()
+{
+ if (!(fd < 0)) {
+#ifdef TKT_SHMEM
+ if (shmdt(krb_shm_addr)) {
+ /* what kind of error? */
+ if (krb_debug)
+ fprintf(stderr, "shmdt 0x%x: errno %d",krb_shm_addr, errno);
+ } else {
+ krb_shm_addr = 0;
+ }
+#endif TKT_SHMEM
+ (void) flock(fd, LOCK_UN);
+ (void) close(fd);
+ fd = -1; /* see declaration of fd above */
+ }
+ bzero(tfbfr, sizeof(tfbfr));
+}
+
+/*
* tf_gets() is an internal routine. It takes a string "s" and a count
* "n", and reads from the file until either it has read "n" characters,
* or until it reads a null byte. When finished, what has been read exists
@@ -405,7 +417,10 @@ int tf_get_cred(CREDENTIALS *c)
* file is seriously ill.
*/
-static int tf_gets(char *s, int n)
+static int
+tf_gets(s, n)
+ register char *s;
+ int n;
{
register count;
@@ -444,9 +459,12 @@ static int tf_gets(char *s, int n)
* 0 on end of file or read error
*/
-static int tf_read(char *s, int n)
+static int
+tf_read(s, n)
+ register char *s;
+ register int n;
{
- int count;
+ register count;
for (count = n; count > 0; --count) {
if (curpos >= sizeof(tfbfr)) {
@@ -462,8 +480,6 @@ static int tf_read(char *s, int n)
return n;
}
-char *tkt_string();
-
/*
* tf_save_cred() appends an incoming ticket to the end of the ticket
* file. You must call tf_init() before calling tf_save_cred().
@@ -478,8 +494,17 @@ char *tkt_string();
* called previously, and KFAILURE for anything else that went wrong.
*/
-int tf_save_cred(char *service, char *instance, char *realm,
- des_cblock session, int lifetime, int kvno, KTEXT ticket, long issue_date)
+int
+tf_save_cred(service, instance, realm, session, lifetime, kvno,
+ ticket, issue_date)
+ char *service; /* Service name */
+ char *instance; /* Instance */
+ char *realm; /* Auth domain */
+ C_Block session; /* Session key */
+ int lifetime; /* Lifetime */
+ int kvno; /* Key version number */
+ KTEXT ticket; /* The ticket itself */
+ long issue_date; /* The issue time */
{
off_t lseek();
diff --git a/eBones/lib/libkrb/tkt_string.c b/eBones/lib/libkrb/tkt_string.c
index bbbdbc5..d944833 100644
--- a/eBones/lib/libkrb/tkt_string.c
+++ b/eBones/lib/libkrb/tkt_string.c
@@ -15,8 +15,8 @@ static char *rcsid =
#endif /* lint */
#endif
-#include <stdio.h>
#include <stdlib.h>
+#include <stdio.h>
#include <sys/types.h>
#include <krb.h>
#include <string.h>
@@ -68,7 +68,9 @@ char *tkt_string()
* and return an undesired ticket file name until this routine is called.
*/
-void krb_set_tkt_string(char *val)
+void
+krb_set_tkt_string(val)
+char *val;
{
(void) strncpy(krb_ticket_string, val, sizeof(krb_ticket_string)-1);
diff --git a/eBones/lib/libkrb/util.c b/eBones/lib/libkrb/util.c
index 8dca743..68c0dbc 100644
--- a/eBones/lib/libkrb/util.c
+++ b/eBones/lib/libkrb/util.c
@@ -30,7 +30,9 @@ static char rcsid[] =
* pname, pinst, prealm, netaddr, flags, cksum, timestamp, session
*/
-void ad_print(AUTH_DAT *x)
+void
+ad_print(x)
+AUTH_DAT *x;
{
struct in_addr in;
@@ -44,7 +46,7 @@ void ad_print(AUTH_DAT *x)
#ifdef NOENCRYPTION
placebo_cblock_print(x->session);
#else
- des_cblock_print_file((des_cblock *)x->session,stdout);
+ des_cblock_print_file((C_Block *)x->session,stdout);
#endif
/* skip reply for now */
}
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));
diff --git a/eBones/libkadm/Makefile b/eBones/libkadm/Makefile
index 4642530..293e842 100644
--- a/eBones/libkadm/Makefile
+++ b/eBones/libkadm/Makefile
@@ -3,7 +3,8 @@
LIB= kadm
SRCS= kadm_err.c kadm_stream.c kadm_supp.c kadm_cli_wrap.c
-CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/../include -I${KRBOBJDIR} -DPOSIX -Wall
+CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/../include -I${KRBOBJDIR} \
+ -DPOSIX -Wall
CLEANFILES+= kadm_err.c kadm_err.h
kadm_err.c kadm_err.h: kadm_err.et
diff --git a/eBones/libkadm/kadm.h b/eBones/libkadm/kadm.h
index eea05df..21a23bb 100644
--- a/eBones/libkadm/kadm.h
+++ b/eBones/libkadm/kadm.h
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <netinet/in.h>
#include <krb.h>
+#include <krb_db.h>
#include <des.h>
/* The global structures for the client and server */
@@ -145,4 +146,19 @@ int vts_short(u_short dat, u_char **st, int loc);
int vts_long(u_long dat, u_char **st, int loc);
int vts_char(u_char dat, u_char **st, int loc);
+int kadm_cli_conn(void);
+void kadm_cli_disconn(void);
+int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz);
+int kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz);
+int kadm_cli_keyd(des_cblock s_k, des_key_schedule s_s);
+
+int kadm_get(Kadm_vals *vals, u_char fl[4]);
+int kadm_mod(Kadm_vals *vals1, Kadm_vals *vals2);
+int kadm_add(Kadm_vals *vals);
+int kadm_change_pw(des_cblock newkey);
+int kadm_init_link(char n[], char i[], char r[]);
+void prin_vals(Kadm_vals *vals);
+void kadm_vals_to_prin(u_char fields[FLDSZ], Principal *new, Kadm_vals *old);
+void kadm_prin_to_vals(u_char fields[FLDSZ], Kadm_vals *new, Principal *old);
+
#endif KADM_DEFS
diff --git a/eBones/libkadm/kadm_cli_wrap.c b/eBones/libkadm/kadm_cli_wrap.c
index 3522e74..e25439d 100644
--- a/eBones/libkadm/kadm_cli_wrap.c
+++ b/eBones/libkadm/kadm_cli_wrap.c
@@ -20,9 +20,9 @@ static const char rcsid[] =
* kadm_cli_wrap.c the client side wrapping of the calls to the admin server
*/
-#include <sys/types.h>
#include <unistd.h>
#include <string.h>
+#include <sys/types.h>
#include <errno.h>
#include <signal.h>
#include <netdb.h>
@@ -31,12 +31,6 @@ static const char rcsid[] =
#include <kadm_err.h>
#include <krb_err.h>
-int kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz);
-int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz);
-int kadm_cli_keyd(des_cblock *s_k, des_key_schedule s_s);
-int kadm_cli_conn(void);
-void kadm_cli_disconn(void);
-
#ifndef NULL
#define NULL 0
#endif
@@ -50,11 +44,11 @@ static Kadm_Client client_parm;
static des_cblock sess_key; /* to be filled in by kadm_cli_keyd */
static Key_schedule sess_sched;
-static void clear_secrets()
+static void
+clear_secrets()
{
bzero((char *)sess_key, sizeof(sess_key));
bzero((char *)sess_sched, sizeof(sess_sched));
- return;
}
/*
@@ -65,7 +59,11 @@ static void clear_secrets()
* data about the connection between the server and client, the services
* used, the locations and other fun things
*/
-int kadm_init_link(char n[], char i[], char r[])
+int
+kadm_init_link(n, i, r)
+char n[];
+char i[];
+char r[];
{
struct servent *sep; /* service we will talk to */
struct hostent *hop; /* host we will talk to */
@@ -104,7 +102,9 @@ int kadm_init_link(char n[], char i[], char r[])
* key. Returns no actual data from the master server, since this is called
* by a user
*/
-int kadm_change_pw(des_cblock newkey)
+int
+kadm_change_pw(newkey)
+des_cblock newkey; /* The DES form of the users key */
{
int stsize, retc; /* stream size and return code */
u_char *send_st; /* send stream */
@@ -148,7 +148,9 @@ int kadm_change_pw(des_cblock newkey)
* entry, so if you leave certain fields blank you will be able to determine
* the default values they are set to
*/
-int kadm_add(Kadm_vals *vals)
+int
+kadm_add(vals)
+Kadm_vals *vals;
{
u_char *st, *st2; /* st will hold the stream of values */
int st_len; /* st2 the final stream with opcode */
@@ -184,7 +186,10 @@ int kadm_add(Kadm_vals *vals)
* Modifies all entries corresponding to the first values so they match the
* second values. returns the values for the changed entries in vals2
*/
-int kadm_mod(Kadm_vals *vals1, Kadm_vals *vals2)
+int
+kadm_mod(vals1, vals2)
+Kadm_vals *vals1;
+Kadm_vals *vals2;
{
u_char *st, *st2; /* st will hold the stream of values */
int st_len, nlen; /* st2 the final stream with opcode */
@@ -228,7 +233,11 @@ int kadm_mod(Kadm_vals *vals1, Kadm_vals *vals2)
* this data for each matching recipient, after a count of how many such
* matches there were
*/
-int kadm_get(Kadm_vals *vals, u_char fl[4])
+int
+kadm_get(vals, fl)
+Kadm_vals *vals;
+u_char fl[4];
+
{
int loop; /* for copying the fields data */
u_char *st, *st2; /* st will hold the stream of values */
@@ -276,7 +285,12 @@ int kadm_get(Kadm_vals *vals, u_char fl[4])
* connection to the admin server. If the connection is succesfully open
* then it sends the data and waits for a reply.
*/
-int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz)
+int
+kadm_cli_send(st_dat, st_siz, ret_dat, ret_siz)
+u_char *st_dat; /* the actual data */
+int st_siz; /* length of said data */
+u_char **ret_dat; /* to give return info */
+int *ret_siz; /* length of returned info */
{
int act_len, retdat; /* current offset into packet, return
* data */
@@ -292,7 +306,7 @@ int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz)
(void) strncpy((char *)act_st, KADM_VERSTR, KADM_VERSIZE);
act_len = KADM_VERSIZE;
- if ((retdat = kadm_cli_keyd(&sess_key, sess_sched)) != KADM_SUCCESS) {
+ if ((retdat = kadm_cli_keyd(sess_key, sess_sched)) != KADM_SUCCESS) {
free((char *)act_st);
return retdat; /* couldnt get key working */
}
@@ -312,7 +326,7 @@ int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz)
cksum = 0;
#else
cksum = quad_cksum((des_cblock *)priv_pak, (des_cblock *)0,
- (long)priv_len, 0, &sess_key);
+ (long)priv_len, 0, (des_cblock *)sess_key);
#endif
if ((retdat = krb_mk_req(&authent, client_parm.sname, client_parm.sinst,
client_parm.krbrlm, (long)cksum))) {
@@ -379,7 +393,10 @@ int kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz)
}
/* takes in the sess_key and key_schedule and sets them appropriately */
-int kadm_cli_keyd(des_cblock *s_k, des_key_schedule s_s)
+int
+kadm_cli_keyd(s_k, s_s)
+des_cblock s_k; /* session key */
+des_key_schedule s_s; /* session key schedule */
{
CREDENTIALS cred; /* to get key data */
int stat;
@@ -393,7 +410,7 @@ int kadm_cli_keyd(des_cblock *s_k, des_key_schedule s_s)
#ifdef NOENCRYPTION
bzero(s_s, sizeof(des_key_schedule));
#else
- if ((stat = key_sched(s_k,s_s)))
+ if ((stat = key_sched((des_cblock *)s_k,s_s)))
return(stat+krb_err_base);
#endif
return KADM_SUCCESS;
@@ -401,7 +418,8 @@ int kadm_cli_keyd(des_cblock *s_k, des_key_schedule s_s)
static sigtype (*opipe)();
-int kadm_cli_conn()
+int
+kadm_cli_conn()
{ /* this connects and sets my_addr */
int on = 1;
@@ -435,15 +453,21 @@ int kadm_cli_conn()
return KADM_SUCCESS;
}
-void kadm_cli_disconn()
+void
+kadm_cli_disconn()
{
(void) close(client_parm.admin_fd);
(void) signal(SIGPIPE, opipe);
- return;
}
-int kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz)
+int
+kadm_cli_out(dat, dat_len, ret_dat, ret_siz)
+u_char *dat;
+int dat_len;
+u_char **ret_dat;
+int *ret_siz;
{
+ extern int errno;
u_short dlen;
int retval;
@@ -461,7 +485,7 @@ int kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz)
return (errno); /* XXX */
if ((retval = krb_net_read(client_parm.admin_fd, (char *) &dlen,
- sizeof(u_short))) != sizeof(u_short)) {
+ sizeof(u_short)) != sizeof(u_short))) {
if (retval < 0)
return(errno); /* XXX */
else
@@ -474,7 +498,7 @@ int kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz)
return(KADM_NOMEM);
if ((retval = krb_net_read(client_parm.admin_fd, (char *) *ret_dat,
- (int) dlen)) != dlen) {
+ (int) dlen) != dlen)) {
if (retval < 0)
return(errno); /* XXX */
else
diff --git a/eBones/libkadm/kadm_stream.c b/eBones/libkadm/kadm_stream.c
index 02b8263..58a625a 100644
--- a/eBones/libkadm/kadm_stream.c
+++ b/eBones/libkadm/kadm_stream.c
@@ -29,7 +29,7 @@ static const char rcsid[] =
*/
#include <string.h>
-#include "kadm.h"
+#include <kadm.h>
#define min(a,b) (((a) < (b)) ? (a) : (b))
@@ -40,7 +40,11 @@ vals_to_stream
this function creates a byte-stream representation of the kadm_vals structure
*/
-int vals_to_stream(Kadm_vals *dt_in, u_char **dt_out)
+
+int
+vals_to_stream(dt_in, dt_out)
+Kadm_vals *dt_in;
+u_char **dt_out;
{
int vsloop, stsize; /* loop counter, stream size */
@@ -74,21 +78,32 @@ int vals_to_stream(Kadm_vals *dt_in, u_char **dt_out)
return(stsize);
}
-int build_field_header(u_char *cont, u_char **st)
+int
+build_field_header(cont, st)
+u_char *cont; /* container for fields data */
+u_char **st; /* stream */
{
*st = (u_char *) malloc (4);
bcopy((char *) cont, (char *) *st, 4);
return 4; /* return pointer to current stream location */
}
-int vts_string(char *dat, u_char **st, int loc)
+int
+vts_string(dat, st, loc)
+char *dat; /* a string to put on the stream */
+u_char **st; /* base pointer to the stream */
+int loc; /* offset into the stream for current data */
{
*st = (u_char *) realloc ((char *)*st, (unsigned) (loc + strlen(dat) + 1));
bcopy(dat, (char *)(*st + loc), strlen(dat)+1);
return strlen(dat)+1;
}
-int vts_short(u_short dat, u_char **st, int loc)
+int
+vts_short(dat, st, loc)
+u_short dat; /* the attributes field */
+u_char **st; /* a base pointer to the stream */
+int loc; /* offset into the stream for current data */
{
u_short temp; /* to hold the net order short */
@@ -98,7 +113,11 @@ int vts_short(u_short dat, u_char **st, int loc)
return sizeof(u_short);
}
-int vts_long(u_long dat, u_char **st, int loc)
+int
+vts_long(dat, st, loc)
+u_long dat; /* the attributes field */
+u_char **st; /* a base pointer to the stream */
+int loc; /* offset into the stream for current data */
{
u_long temp; /* to hold the net order short */
@@ -108,8 +127,11 @@ int vts_long(u_long dat, u_char **st, int loc)
return sizeof(u_long);
}
-
-int vts_char(u_char dat, u_char **st, int loc)
+int
+vts_char(dat, st, loc)
+u_char dat; /* the attributes field */
+u_char **st; /* a base pointer to the stream */
+int loc; /* offset into the stream for current data */
{
*st = (u_char *) realloc ((char *)*st, (unsigned)(loc + sizeof(u_char)));
(*st)[loc] = (u_char) dat;
@@ -123,7 +145,11 @@ stream_to_vals
this decodes a byte stream represntation of a vals struct into kadm_vals
*/
-int stream_to_vals(u_char *dt_in, Kadm_vals *dt_out, int maxlen)
+int
+stream_to_vals(dt_in, dt_out, maxlen)
+u_char *dt_in;
+Kadm_vals *dt_out;
+int maxlen; /* max length to use */
{
register int vsloop, stsize; /* loop counter, stream size */
register int status;
@@ -182,7 +208,11 @@ int stream_to_vals(u_char *dt_in, Kadm_vals *dt_out, int maxlen)
return stsize;
}
-int check_field_header(u_char *st, u_char *cont, int maxlen)
+int
+check_field_header(st, cont, maxlen)
+u_char *st; /* stream */
+u_char *cont; /* container for fields data */
+int maxlen;
{
if (4 > maxlen)
return(-1);
@@ -190,7 +220,13 @@ int check_field_header(u_char *st, u_char *cont, int maxlen)
return 4; /* return pointer to current stream location */
}
-int stv_string(u_char *st, char *dat, int loc, int stlen, int maxlen)
+int
+stv_string(st, dat, loc, stlen, maxlen)
+register u_char *st; /* base pointer to the stream */
+char *dat; /* a string to read from the stream */
+register int loc; /* offset into the stream for current data */
+int stlen; /* max length of string to copy in */
+int maxlen; /* max length of input stream */
{
int maxcount; /* max count of chars to copy */
@@ -203,7 +239,12 @@ int stv_string(u_char *st, char *dat, int loc, int stlen, int maxlen)
return strlen(dat)+1;
}
-int stv_short(u_char *st, u_short *dat, int loc, int maxlen)
+int
+stv_short(st, dat, loc, maxlen)
+u_char *st; /* a base pointer to the stream */
+u_short *dat; /* the attributes field */
+int loc; /* offset into the stream for current data */
+int maxlen;
{
u_short temp; /* to hold the net order short */
@@ -214,7 +255,12 @@ int stv_short(u_char *st, u_short *dat, int loc, int maxlen)
return sizeof(u_short);
}
-int stv_long(u_char *st, u_long *dat, int loc, int maxlen)
+int
+stv_long(st, dat, loc, maxlen)
+u_char *st; /* a base pointer to the stream */
+u_long *dat; /* the attributes field */
+int loc; /* offset into the stream for current data */
+int maxlen; /* maximum length of st */
{
u_long temp; /* to hold the net order short */
@@ -225,10 +271,16 @@ int stv_long(u_char *st, u_long *dat, int loc, int maxlen)
return sizeof(u_long);
}
-int stv_char(u_char *st, u_char *dat, int loc, int maxlen)
+int
+stv_char(st, dat, loc, maxlen)
+u_char *st; /* a base pointer to the stream */
+u_char *dat; /* the attributes field */
+int loc; /* offset into the stream for current data */
+int maxlen;
{
if (loc + 1 > maxlen)
return(-1);
*dat = *(st + loc);
return 1;
}
+
diff --git a/eBones/libkadm/kadm_supp.c b/eBones/libkadm/kadm_supp.c
index deaf63b..353fed0 100644
--- a/eBones/libkadm/kadm_supp.c
+++ b/eBones/libkadm/kadm_supp.c
@@ -26,16 +26,18 @@ static const char rcsid[] =
structure
*/
-#include <time.h>
#include <string.h>
-#include "kadm.h"
-#include "krb_db.h"
+#include <time.h>
+#include <kadm.h>
+#include <krb_db.h>
/*
prin_vals:
recieves : a vals structure
*/
-void prin_vals(Kadm_vals *vals)
+void
+prin_vals(vals)
+Kadm_vals *vals;
{
printf("Info in Database for %s.%s:\n", vals->name, vals->instance);
printf(" Max Life: %d Exp Date: %s\n",vals->max_life,
@@ -45,9 +47,9 @@ void prin_vals(Kadm_vals *vals)
}
#ifdef notdef
-int nierror(int s)
+nierror(s)
+int s;
{
- extern char *error_message();
printf("Kerberos admin server loses..... %s\n",error_message(s));
return(s);
}
@@ -57,7 +59,11 @@ int nierror(int s)
it copies the fields in Principal specified by fields into Kadm_vals,
i.e from old to new */
-void kadm_prin_to_vals(u_char fields[], Kadm_vals *new, Principal *old)
+void
+kadm_prin_to_vals(fields, new, old)
+u_char fields[FLDSZ];
+Kadm_vals *new;
+Principal *old;
{
bzero((char *)new, sizeof(*new));
if (IS_FIELD(KADM_NAME,fields)) {
@@ -87,7 +93,11 @@ void kadm_prin_to_vals(u_char fields[], Kadm_vals *new, Principal *old)
}
}
-void kadm_vals_to_prin(u_char fields[], Principal *new, Kadm_vals *old)
+void
+kadm_vals_to_prin(fields, new, old)
+u_char fields[FLDSZ];
+Principal *new;
+Kadm_vals *old;
{
bzero((char *)new, sizeof(*new));
diff --git a/eBones/make_keypair/Makefile b/eBones/make_keypair/Makefile
index b00048e..7d435e7 100644
--- a/eBones/make_keypair/Makefile
+++ b/eBones/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/make_keypair/make_keypair.c b/eBones/make_keypair/make_keypair.c
index 5cc1777..deb67ac 100644
--- a/eBones/make_keypair/make_keypair.c
+++ b/eBones/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);
diff --git a/eBones/man/Makefile b/eBones/man/Makefile
index 849a430..526ca8e 100644
--- a/eBones/man/Makefile
+++ b/eBones/man/Makefile
@@ -1,18 +1,10 @@
# from: @(#)Makefile 5.4 (Berkeley) 7/25/90
-# $Id: Makefile,v 1.3 1995/01/20 01:26:53 wollman Exp $
+# $Id: Makefile,v 1.3 1995/07/18 16:40:32 mark Exp $
-MAN1= kdestroy.1 kerberos.1 kinit.1 klist.1 ksrvtgt.1
-MAN3= acl_check.3 des_crypt.3 krb.3 krb_realmofhost.3 krb_sendauth.3 \
- krb_set_tkt_string.3 kuserok.3 tf_util.3
+MAN1= kerberos.1
+MAN3= des_crypt.3
MAN5= krb.conf.5 krb.realms.5
-MAN8= ext_srvtab.8 kdb_destroy.8 kdb_edit.8 kdb_init.8 kdb_util.8 kstash.8 \
- kadmin.8 kadmind.8
-MLINKS+=krb_realmofhost.3 realm.3
+
MLINKS+=des_crypt.3 des.3
-MLINKS+=krb.3 kerberos.3 krb.3 krb_mk_req.3 krb.3 krb_rd_req.3
-MLINKS+=krb.3 krb_kntoln.3 krb.3 krb_set_key.3 krb.3 krb_get_cred.3
-MLINKS+=krb.3 krb_mk_priv.3 krb.3 krb_mk_safe.3 krb.3 krb_rd_safe.3
-MLINKS+=krb.3 krb_mk_err.3 krb.3 krb_rd_err.3 krb.3 krb_ck_repl.3
-MLINKS+=krb_sendauth.3 ksend.3
.include <bsd.prog.mk>
diff --git a/eBones/register/Makefile b/eBones/register/Makefile
index 909569bb..9adfc93 100644
--- a/eBones/register/Makefile
+++ b/eBones/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/register/register.c b/eBones/register/register.c
index 3f3cbbf..4f083a7 100644
--- a/eBones/register/register.c
+++ b/eBones/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;
}
diff --git a/eBones/registerd/Makefile b/eBones/registerd/Makefile
index 5f12e59..89b6ca7 100644
--- a/eBones/registerd/Makefile
+++ b/eBones/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/registerd/registerd.c b/eBones/registerd/registerd.c
index b5c7434..12a3939 100644
--- a/eBones/registerd/registerd.c
+++ b/eBones/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));
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;
}
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