summaryrefslogtreecommitdiffstats
path: root/eBones/lib/libkrb
diff options
context:
space:
mode:
Diffstat (limited to 'eBones/lib/libkrb')
-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
55 files changed, 774 insertions, 427 deletions
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 */
}
OpenPOWER on IntegriCloud