summaryrefslogtreecommitdiffstats
path: root/eBones/lib/libkadm
diff options
context:
space:
mode:
Diffstat (limited to 'eBones/lib/libkadm')
-rw-r--r--eBones/lib/libkadm/Makefile4
-rw-r--r--eBones/lib/libkadm/kadm.h30
-rw-r--r--eBones/lib/libkadm/kadm_cli_wrap.c86
-rw-r--r--eBones/lib/libkadm/kadm_err.et8
-rw-r--r--eBones/lib/libkadm/kadm_stream.c71
-rw-r--r--eBones/lib/libkadm/kadm_supp.c26
6 files changed, 87 insertions, 138 deletions
diff --git a/eBones/lib/libkadm/Makefile b/eBones/lib/libkadm/Makefile
index f587d5c..4642530 100644
--- a/eBones/lib/libkadm/Makefile
+++ b/eBones/lib/libkadm/Makefile
@@ -1,9 +1,9 @@
-# $Id$
+# $Id: Makefile,v 1.1 1995/07/18 16:40:20 mark Exp $
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
+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 965b530..eea05df 100644
--- a/eBones/lib/libkadm/kadm.h
+++ b/eBones/lib/libkadm/kadm.h
@@ -1,6 +1,6 @@
/*
- * $Source: /home/ncvs/src/eBones/libkadm/kadm.h,v $
- * $Author: wollman $
+ * $Source: /usr/cvs/src/eBones/libkadm/kadm.h,v $
+ * $Author: mark $
* Header: /afs/athena.mit.edu/astaff/project/kerberos/src/include/RCS/kadm.h,v 4.2 89/09/26 09:15:20 jtkohl Exp
*
* Copyright 1988 by the Massachusetts Institute of Technology.
@@ -25,6 +25,7 @@
#define MAXHOSTNAMELEN 64
#endif
+#include <stdlib.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <krb.h>
@@ -121,20 +122,27 @@ MODACL
#define MOD_ENT 4
#define GET_ENT 5
-extern long kdb_get_master_key(); /* XXX should be in krb_db.h */
-extern long kdb_verify_master_key(); /* XXX ditto */
-
-extern long krb_mk_priv(), krb_rd_priv(); /* XXX should be in krb.h */
-extern void krb_set_tkt_string(); /* XXX ditto */
-
-extern unsigned long quad_cksum(); /* XXX should be in des.h */
-
/* XXX This doesn't belong here!!! */
-char *malloc(), *realloc();
#ifdef POSIX
typedef void sigtype;
#else
typedef int sigtype;
#endif
+int vals_to_stream(Kadm_vals *dt_in, u_char **dt_out);
+int stream_to_vals(u_char *dt_in, Kadm_vals *dt_out, int maxlen);
+
+int build_field_header(u_char *cont, u_char **st);
+int check_field_header(u_char *st, u_char *cont, int maxlen);
+
+int stv_string(u_char *st, char *dat, int loc, int stlen, int maxlen);
+int stv_short(u_char *st, u_short *dat, int loc, int maxlen);
+int stv_long(u_char *st, u_long *dat, int loc, int maxlen);
+int stv_char(u_char *st, u_char *dat, int loc, int maxlen);
+
+int vts_string(char *dat, u_char **st, int loc);
+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);
+
#endif KADM_DEFS
diff --git a/eBones/lib/libkadm/kadm_cli_wrap.c b/eBones/lib/libkadm/kadm_cli_wrap.c
index 7e1cfa9..3522e74 100644
--- a/eBones/lib/libkadm/kadm_cli_wrap.c
+++ b/eBones/lib/libkadm/kadm_cli_wrap.c
@@ -7,20 +7,22 @@
* Kerberos administration server client-side routines
*/
-#ifndef lint
#if 0
+#ifndef lint
static char rcsid_kadm_cli_wrap_c[] =
"from: Id: kadm_cli_wrap.c,v 4.6 89/12/30 20:09:45 qjb Exp";
-#endif
static const char rcsid[] =
- "$Id: kadm_cli_wrap.c,v 1.1 1995/01/20 02:02:51 wollman Exp $";
+ "$Id: kadm_cli_wrap.c,v 1.1 1995/07/18 16:40:23 mark Exp $";
#endif lint
+#endif
/*
* 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 <errno.h>
#include <signal.h>
#include <netdb.h>
@@ -29,6 +31,12 @@ 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
@@ -42,8 +50,7 @@ static Kadm_Client client_parm;
static des_cblock sess_key; /* to be filled in by kadm_cli_keyd */
static Key_schedule sess_sched;
-static
-clear_secrets()
+static void clear_secrets()
{
bzero((char *)sess_key, sizeof(sess_key));
bzero((char *)sess_sched, sizeof(sess_sched));
@@ -58,10 +65,7 @@ clear_secrets()
* data about the connection between the server and client, the services
* used, the locations and other fun things
*/
-kadm_init_link(n, i, r)
-char n[];
-char i[];
-char r[];
+int kadm_init_link(char n[], char i[], char r[])
{
struct servent *sep; /* service we will talk to */
struct hostent *hop; /* host we will talk to */
@@ -100,8 +104,7 @@ char r[];
* key. Returns no actual data from the master server, since this is called
* by a user
*/
-kadm_change_pw(newkey)
-des_cblock newkey; /* The DES form of the users key */
+int kadm_change_pw(des_cblock newkey)
{
int stsize, retc; /* stream size and return code */
u_char *send_st; /* send stream */
@@ -145,8 +148,7 @@ des_cblock newkey; /* The DES form of the users key */
* entry, so if you leave certain fields blank you will be able to determine
* the default values they are set to
*/
-kadm_add(vals)
-Kadm_vals *vals;
+int kadm_add(Kadm_vals *vals)
{
u_char *st, *st2; /* st will hold the stream of values */
int st_len; /* st2 the final stream with opcode */
@@ -182,9 +184,7 @@ 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
*/
-kadm_mod(vals1, vals2)
-Kadm_vals *vals1;
-Kadm_vals *vals2;
+int kadm_mod(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,10 +228,7 @@ Kadm_vals *vals2;
* this data for each matching recipient, after a count of how many such
* matches there were
*/
-kadm_get(vals, fl)
-Kadm_vals *vals;
-u_char fl[4];
-
+int kadm_get(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 */
@@ -279,11 +276,7 @@ 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.
*/
-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 kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz)
{
int act_len, retdat; /* current offset into packet, return
* data */
@@ -299,7 +292,7 @@ int *ret_siz; /* length of returned info */
(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 */
}
@@ -318,11 +311,11 @@ int *ret_siz; /* length of returned info */
#ifdef NOENCRYPTION
cksum = 0;
#else
- cksum = quad_cksum(priv_pak, (u_long *)0, (long)priv_len, 0,
- sess_key);
+ cksum = quad_cksum((des_cblock *)priv_pak, (des_cblock *)0,
+ (long)priv_len, 0, &sess_key);
#endif
- if (retdat = krb_mk_req(&authent, client_parm.sname, client_parm.sinst,
- client_parm.krbrlm, (long)cksum)) {
+ if ((retdat = krb_mk_req(&authent, client_parm.sname, client_parm.sinst,
+ client_parm.krbrlm, (long)cksum))) {
/* authenticator? */
RET_N_FREE(retdat + krb_err_base);
}
@@ -359,9 +352,9 @@ int *ret_siz; /* length of returned info */
RET_N_FREE2(retdat);
}
/* need to decode the ret_dat */
- if (retdat = krb_rd_priv(*ret_dat, (u_long)*ret_siz, sess_sched,
+ if ((retdat = krb_rd_priv(*ret_dat, (u_long)*ret_siz, sess_sched,
sess_key, &client_parm.admin_addr,
- &client_parm.my_addr, &mdat))
+ &client_parm.my_addr, &mdat)))
RET_N_FREE2(retdat+krb_err_base);
if (mdat.app_length < KADM_VERSIZE + 4)
/* too short! */
@@ -386,23 +379,21 @@ int *ret_siz; /* length of returned info */
}
/* takes in the sess_key and key_schedule and sets them appropriately */
-kadm_cli_keyd(s_k, s_s)
-des_cblock s_k; /* session key */
-des_key_schedule s_s; /* session key schedule */
+int kadm_cli_keyd(des_cblock *s_k, des_key_schedule s_s)
{
CREDENTIALS cred; /* to get key data */
int stat;
/* want .sname and .sinst here.... */
- if (stat = krb_get_cred(client_parm.sname, client_parm.sinst,
- client_parm.krbrlm, &cred))
+ if ((stat = krb_get_cred(client_parm.sname, client_parm.sinst,
+ client_parm.krbrlm, &cred)))
return stat + krb_err_base;
bcopy((char *) cred.session, (char *) s_k, sizeof(des_cblock));
bzero((char *) cred.session, sizeof(des_cblock));
#ifdef NOENCRYPTION
bzero(s_s, sizeof(des_key_schedule));
#else
- if (stat = key_sched(s_k,s_s))
+ if ((stat = key_sched(s_k,s_s)))
return(stat+krb_err_base);
#endif
return KADM_SUCCESS;
@@ -410,7 +401,7 @@ des_key_schedule s_s; /* session key schedule */
static sigtype (*opipe)();
-kadm_cli_conn()
+int kadm_cli_conn()
{ /* this connects and sets my_addr */
int on = 1;
@@ -444,20 +435,15 @@ kadm_cli_conn()
return KADM_SUCCESS;
}
-kadm_cli_disconn()
+void kadm_cli_disconn()
{
(void) close(client_parm.admin_fd);
(void) signal(SIGPIPE, opipe);
return;
}
-kadm_cli_out(dat, dat_len, ret_dat, ret_siz)
-u_char *dat;
-int dat_len;
-u_char **ret_dat;
-int *ret_siz;
+int kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz)
{
- extern int errno;
u_short dlen;
int retval;
@@ -474,8 +460,8 @@ int *ret_siz;
if (krb_net_write(client_parm.admin_fd, (char *) dat, dat_len) < 0)
return (errno); /* XXX */
- if (retval = krb_net_read(client_parm.admin_fd, (char *) &dlen,
- sizeof(u_short)) != sizeof(u_short)) {
+ if ((retval = krb_net_read(client_parm.admin_fd, (char *) &dlen,
+ sizeof(u_short))) != sizeof(u_short)) {
if (retval < 0)
return(errno); /* XXX */
else
@@ -487,8 +473,8 @@ int *ret_siz;
if (!*ret_dat)
return(KADM_NOMEM);
- if (retval = krb_net_read(client_parm.admin_fd, (char *) *ret_dat,
- (int) dlen) != dlen) {
+ if ((retval = krb_net_read(client_parm.admin_fd, (char *) *ret_dat,
+ (int) dlen)) != dlen) {
if (retval < 0)
return(errno); /* XXX */
else
diff --git a/eBones/lib/libkadm/kadm_err.et b/eBones/lib/libkadm/kadm_err.et
index 9a04851..e45a9c2 100644
--- a/eBones/lib/libkadm/kadm_err.et
+++ b/eBones/lib/libkadm/kadm_err.et
@@ -1,6 +1,6 @@
-# $Source: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_err.et,v $
-# $Author: jtkohl $
-# $Header: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_err.et,v 4.0 89/01/24 15:16:10 jtkohl Exp $
+# $Source: /usr/cvs/src/eBones/libkadm/kadm_err.et,v $
+# $Author: mark $
+# $Header: /usr/cvs/src/eBones/libkadm/kadm_err.et,v 1.1 1995/07/18 16:40:25 mark Exp $
# Copyright 1988 by the Massachusetts Institute of Technology.
#
# For copying and distribution information, please see the file
@@ -12,7 +12,7 @@
# KADM_SUCCESS, as all success codes should be, is zero
-ec KADM_RCSID, "$Header: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kadm_err.et,v 4.0 89/01/24 15:16:10 jtkohl Exp $"
+ec KADM_RCSID, "$Header: /usr/cvs/src/eBones/libkadm/kadm_err.et,v 1.1 1995/07/18 16:40:25 mark Exp $"
# /* Building and unbuilding the packet errors */
ec KADM_NO_REALM, "Cannot fetch local realm"
ec KADM_NO_CRED, "Unable to fetch credentials"
diff --git a/eBones/lib/libkadm/kadm_stream.c b/eBones/lib/libkadm/kadm_stream.c
index 6ceb02e..02b8263 100644
--- a/eBones/lib/libkadm/kadm_stream.c
+++ b/eBones/lib/libkadm/kadm_stream.c
@@ -7,14 +7,14 @@
* Stream conversion functions for Kerberos administration server
*/
-#ifndef lint
#if 0
+#ifndef lint
static char rcsid_kadm_stream_c[] =
"Header: /afs/athena.mit.edu/astaff/project/kerberos/src/lib/kadm/RCS/kadm_stream.c,v 4.2 89/09/26 09:20:48 jtkohl Exp ";
-#endif
static const char rcsid[] =
- "$Id: kadm_stream.c,v 1.1 1995/01/20 02:02:53 wollman Exp $";
+ "$Id: kadm_stream.c,v 1.1 1995/07/18 16:40:27 mark Exp $";
#endif lint
+#endif
/*
kadm_stream.c
@@ -28,6 +28,7 @@ static const char rcsid[] =
fatal: prints out a kadm fatal error message, exits
*/
+#include <string.h>
#include "kadm.h"
#define min(a,b) (((a) < (b)) ? (a) : (b))
@@ -39,9 +40,7 @@ vals_to_stream
this function creates a byte-stream representation of the kadm_vals structure
*/
-vals_to_stream(dt_in, dt_out)
-Kadm_vals *dt_in;
-u_char **dt_out;
+int vals_to_stream(Kadm_vals *dt_in, u_char **dt_out)
{
int vsloop, stsize; /* loop counter, stream size */
@@ -75,29 +74,21 @@ u_char **dt_out;
return(stsize);
}
-build_field_header(cont, st)
-u_char *cont; /* container for fields data */
-u_char **st; /* stream */
+int build_field_header(u_char *cont, u_char **st)
{
*st = (u_char *) malloc (4);
bcopy((char *) cont, (char *) *st, 4);
return 4; /* return pointer to current stream location */
}
-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 */
+int vts_string(char *dat, u_char **st, int loc)
{
*st = (u_char *) realloc ((char *)*st, (unsigned) (loc + strlen(dat) + 1));
bcopy(dat, (char *)(*st + loc), strlen(dat)+1);
return strlen(dat)+1;
}
-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 */
+int vts_short(u_short dat, u_char **st, int loc)
{
u_short temp; /* to hold the net order short */
@@ -107,10 +98,7 @@ int loc; /* offset into the stream for current data */
return sizeof(u_short);
}
-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 */
+int vts_long(u_long dat, u_char **st, int loc)
{
u_long temp; /* to hold the net order short */
@@ -121,10 +109,7 @@ int loc; /* offset into the stream for current data */
}
-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 */
+int vts_char(u_char dat, u_char **st, int loc)
{
*st = (u_char *) realloc ((char *)*st, (unsigned)(loc + sizeof(u_char)));
(*st)[loc] = (u_char) dat;
@@ -138,10 +123,7 @@ stream_to_vals
this decodes a byte stream represntation of a vals struct into kadm_vals
*/
-stream_to_vals(dt_in, dt_out, maxlen)
-u_char *dt_in;
-Kadm_vals *dt_out;
-int maxlen; /* max length to use */
+int stream_to_vals(u_char *dt_in, Kadm_vals *dt_out, int maxlen)
{
register int vsloop, stsize; /* loop counter, stream size */
register int status;
@@ -200,10 +182,7 @@ int maxlen; /* max length to use */
return stsize;
}
-check_field_header(st, cont, maxlen)
-u_char *st; /* stream */
-u_char *cont; /* container for fields data */
-int maxlen;
+int check_field_header(u_char *st, u_char *cont, int maxlen)
{
if (4 > maxlen)
return(-1);
@@ -211,12 +190,7 @@ int maxlen;
return 4; /* return pointer to current stream location */
}
-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 stv_string(u_char *st, char *dat, int loc, int stlen, int maxlen)
{
int maxcount; /* max count of chars to copy */
@@ -229,11 +203,7 @@ int maxlen; /* max length of input stream */
return strlen(dat)+1;
}
-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;
+int stv_short(u_char *st, u_short *dat, int loc, int maxlen)
{
u_short temp; /* to hold the net order short */
@@ -244,11 +214,7 @@ int maxlen;
return sizeof(u_short);
}
-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 */
+int stv_long(u_char *st, u_long *dat, int loc, int maxlen)
{
u_long temp; /* to hold the net order short */
@@ -259,15 +225,10 @@ int maxlen; /* maximum length of st */
return sizeof(u_long);
}
-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;
+int stv_char(u_char *st, u_char *dat, int loc, 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 8b18621..deaf63b 100644
--- a/eBones/lib/libkadm/kadm_supp.c
+++ b/eBones/lib/libkadm/kadm_supp.c
@@ -7,14 +7,14 @@
* Support functions for Kerberos administration server & clients
*/
-#ifndef lint
#if 0
+#ifndef lint
static char rcsid_kadm_supp_c[] =
"Header: /afs/athena.mit.edu/astaff/project/kerberos/src/lib/kadm/RCS/kadm_supp.c,v 4.1 89/09/26 09:21:07 jtkohl Exp ";
-#endif
static const char rcsid[] =
- "$Id: kadm_supp.c,v 1.1 1995/01/20 02:02:54 wollman Exp $";
+ "$Id: kadm_supp.c,v 1.1 1995/07/18 16:40:28 mark Exp $";
#endif lint
+#endif
/*
kadm_supp.c
@@ -26,6 +26,8 @@ static const char rcsid[] =
structure
*/
+#include <time.h>
+#include <string.h>
#include "kadm.h"
#include "krb_db.h"
@@ -33,19 +35,17 @@ static const char rcsid[] =
prin_vals:
recieves : a vals structure
*/
-prin_vals(vals)
-Kadm_vals *vals;
+void prin_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,
asctime(localtime((long *)&vals->exp_date)));
- printf(" Attribs: %.2x key: %u %u\n",vals->attributes,
+ printf(" Attribs: %.2x key: %lu %lu\n",vals->attributes,
vals->key_low, vals->key_high);
}
#ifdef notdef
-nierror(s)
-int s;
+int nierror(int s)
{
extern char *error_message();
printf("Kerberos admin server loses..... %s\n",error_message(s));
@@ -57,10 +57,7 @@ int s;
it copies the fields in Principal specified by fields into Kadm_vals,
i.e from old to new */
-kadm_prin_to_vals(fields, new, old)
-u_char fields[FLDSZ];
-Kadm_vals *new;
-Principal *old;
+void kadm_prin_to_vals(u_char fields[], Kadm_vals *new, Principal *old)
{
bzero((char *)new, sizeof(*new));
if (IS_FIELD(KADM_NAME,fields)) {
@@ -90,10 +87,7 @@ Principal *old;
}
}
-kadm_vals_to_prin(fields, new, old)
-u_char fields[FLDSZ];
-Principal *new;
-Kadm_vals *old;
+void kadm_vals_to_prin(u_char fields[], Principal *new, Kadm_vals *old)
{
bzero((char *)new, sizeof(*new));
OpenPOWER on IntegriCloud