1995-01-20 02:02:54 +00:00
|
|
|
/*
|
|
|
|
* Copyright 1988 by the Massachusetts Institute of Technology.
|
|
|
|
*
|
|
|
|
* For copying and distribution information, please see the file
|
|
|
|
* Copyright.MIT.
|
|
|
|
*
|
|
|
|
* Support functions for Kerberos administration server & clients
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if 0
|
1995-08-25 22:52:32 +00:00
|
|
|
#ifndef lint
|
1995-01-20 02:02:54 +00:00
|
|
|
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 ";
|
|
|
|
static const char rcsid[] =
|
1995-08-25 22:52:32 +00:00
|
|
|
"$Id: kadm_supp.c,v 1.1 1995/07/18 16:40:28 mark Exp $";
|
1995-01-20 02:02:54 +00:00
|
|
|
#endif lint
|
1995-08-25 22:52:32 +00:00
|
|
|
#endif
|
1995-01-20 02:02:54 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
kadm_supp.c
|
|
|
|
this holds the support routines for the kerberos administration server
|
|
|
|
|
|
|
|
error: prints out a kadm error message, returns
|
|
|
|
fatal: prints out a kadm fatal error message, exits
|
|
|
|
prin_vals: prints out data associated with a Principal in the vals
|
|
|
|
structure
|
|
|
|
*/
|
|
|
|
|
1995-08-25 22:52:32 +00:00
|
|
|
#include <string.h>
|
1995-09-07 21:39:00 +00:00
|
|
|
#include <time.h>
|
|
|
|
#include <kadm.h>
|
|
|
|
#include <krb_db.h>
|
1995-05-30 06:41:30 +00:00
|
|
|
|
1995-01-20 02:02:54 +00:00
|
|
|
/*
|
|
|
|
prin_vals:
|
|
|
|
recieves : a vals structure
|
|
|
|
*/
|
1995-09-07 21:39:00 +00:00
|
|
|
void
|
|
|
|
prin_vals(vals)
|
|
|
|
Kadm_vals *vals;
|
1995-01-20 02:02:54 +00:00
|
|
|
{
|
|
|
|
printf("Info in Database for %s.%s:\n", vals->name, vals->instance);
|
1995-05-30 06:41:30 +00:00
|
|
|
printf(" Max Life: %d Exp Date: %s\n",vals->max_life,
|
1995-01-20 02:02:54 +00:00
|
|
|
asctime(localtime((long *)&vals->exp_date)));
|
1995-08-25 22:52:32 +00:00
|
|
|
printf(" Attribs: %.2x key: %lu %lu\n",vals->attributes,
|
1995-01-20 02:02:54 +00:00
|
|
|
vals->key_low, vals->key_high);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef notdef
|
1995-09-07 21:39:00 +00:00
|
|
|
nierror(s)
|
|
|
|
int s;
|
1995-01-20 02:02:54 +00:00
|
|
|
{
|
|
|
|
printf("Kerberos admin server loses..... %s\n",error_message(s));
|
|
|
|
return(s);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* kadm_prin_to_vals takes a fields arguments, a Kadm_vals and a Principal,
|
1995-05-30 06:41:30 +00:00
|
|
|
it copies the fields in Principal specified by fields into Kadm_vals,
|
1995-01-20 02:02:54 +00:00
|
|
|
i.e from old to new */
|
|
|
|
|
1995-09-07 21:39:00 +00:00
|
|
|
void
|
|
|
|
kadm_prin_to_vals(fields, new, old)
|
|
|
|
u_char fields[FLDSZ];
|
|
|
|
Kadm_vals *new;
|
|
|
|
Principal *old;
|
1995-01-20 02:02:54 +00:00
|
|
|
{
|
|
|
|
bzero((char *)new, sizeof(*new));
|
|
|
|
if (IS_FIELD(KADM_NAME,fields)) {
|
1995-05-30 06:41:30 +00:00
|
|
|
(void) strncpy(new->name, old->name, ANAME_SZ);
|
1995-01-20 02:02:54 +00:00
|
|
|
SET_FIELD(KADM_NAME, new->fields);
|
|
|
|
}
|
|
|
|
if (IS_FIELD(KADM_INST,fields)) {
|
1995-05-30 06:41:30 +00:00
|
|
|
(void) strncpy(new->instance, old->instance, INST_SZ);
|
1995-01-20 02:02:54 +00:00
|
|
|
SET_FIELD(KADM_INST, new->fields);
|
1995-05-30 06:41:30 +00:00
|
|
|
}
|
1995-01-20 02:02:54 +00:00
|
|
|
if (IS_FIELD(KADM_EXPDATE,fields)) {
|
1995-05-30 06:41:30 +00:00
|
|
|
new->exp_date = old->exp_date;
|
1995-01-20 02:02:54 +00:00
|
|
|
SET_FIELD(KADM_EXPDATE, new->fields);
|
1995-05-30 06:41:30 +00:00
|
|
|
}
|
1995-01-20 02:02:54 +00:00
|
|
|
if (IS_FIELD(KADM_ATTR,fields)) {
|
1995-05-30 06:41:30 +00:00
|
|
|
new->attributes = old->attributes;
|
1995-01-20 02:02:54 +00:00
|
|
|
SET_FIELD(KADM_MAXLIFE, new->fields);
|
1995-05-30 06:41:30 +00:00
|
|
|
}
|
1995-01-20 02:02:54 +00:00
|
|
|
if (IS_FIELD(KADM_MAXLIFE,fields)) {
|
1995-05-30 06:41:30 +00:00
|
|
|
new->max_life = old->max_life;
|
1995-01-20 02:02:54 +00:00
|
|
|
SET_FIELD(KADM_MAXLIFE, new->fields);
|
1995-05-30 06:41:30 +00:00
|
|
|
}
|
1995-01-20 02:02:54 +00:00
|
|
|
if (IS_FIELD(KADM_DESKEY,fields)) {
|
1995-05-30 06:41:30 +00:00
|
|
|
new->key_low = old->key_low;
|
|
|
|
new->key_high = old->key_high;
|
1995-01-20 02:02:54 +00:00
|
|
|
SET_FIELD(KADM_DESKEY, new->fields);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1995-09-07 21:39:00 +00:00
|
|
|
void
|
|
|
|
kadm_vals_to_prin(fields, new, old)
|
|
|
|
u_char fields[FLDSZ];
|
|
|
|
Principal *new;
|
|
|
|
Kadm_vals *old;
|
1995-01-20 02:02:54 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
bzero((char *)new, sizeof(*new));
|
|
|
|
if (IS_FIELD(KADM_NAME,fields))
|
1995-05-30 06:41:30 +00:00
|
|
|
(void) strncpy(new->name, old->name, ANAME_SZ);
|
1995-01-20 02:02:54 +00:00
|
|
|
if (IS_FIELD(KADM_INST,fields))
|
1995-05-30 06:41:30 +00:00
|
|
|
(void) strncpy(new->instance, old->instance, INST_SZ);
|
1995-01-20 02:02:54 +00:00
|
|
|
if (IS_FIELD(KADM_EXPDATE,fields))
|
1995-05-30 06:41:30 +00:00
|
|
|
new->exp_date = old->exp_date;
|
1995-01-20 02:02:54 +00:00
|
|
|
if (IS_FIELD(KADM_ATTR,fields))
|
1995-05-30 06:41:30 +00:00
|
|
|
new->attributes = old->attributes;
|
1995-01-20 02:02:54 +00:00
|
|
|
if (IS_FIELD(KADM_MAXLIFE,fields))
|
1995-05-30 06:41:30 +00:00
|
|
|
new->max_life = old->max_life;
|
1995-01-20 02:02:54 +00:00
|
|
|
if (IS_FIELD(KADM_DESKEY,fields)) {
|
1995-05-30 06:41:30 +00:00
|
|
|
new->key_low = old->key_low;
|
|
|
|
new->key_high = old->key_high;
|
1995-01-20 02:02:54 +00:00
|
|
|
}
|
|
|
|
}
|