#ifndef KADM_DEFS
#define KADM_DEFS
#include <sys/types.h>
#include "port-sockets.h"
#include <kerberosIV/krb.h>
#include <kerberosIV/des.h>
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif
typedef struct {
struct sockaddr_in admin_addr;
struct sockaddr_in my_addr;
int my_addr_len;
int admin_fd;
char sname[ANAME_SZ];
char sinst[INST_SZ];
char krbrlm[REALM_SZ];
int default_port;
CREDENTIALS creds;
} Kadm_Client;
typedef struct {
int inter;
char *sysfile;
} admin_params;
#define MAX_KPW_LEN 128
#define KADM_RET_MAX 2048
#define KADM_VERSTR "KADM0.0A"
#define KADM_ULOSE "KYOULOSE"
#define KADM_VERSIZE strlen(KADM_VERSTR)
#define PWSERV_NAME "changepw"
#define KADM_SNAME "kerberos_master"
#define KADM_SINST "kerberos"
#define ALLOC 2
#define RESERVED 3
#define DEALLOC 4
#define DEACTIVATED 5
#define ACTIVE 6
#define FLDSZ 4
typedef struct {
u_char fields[FLDSZ];
char name[ANAME_SZ];
char instance[INST_SZ];
KRB_UINT32 key_low;
KRB_UINT32 key_high;
KRB_UINT32 exp_date;
unsigned short attributes;
unsigned char max_life;
} Kadm_vals;
#define FLDSZ 4
#define KADM_NAME 31
#define KADM_INST 30
#define KADM_EXPDATE 29
#define KADM_ATTR 28
#define KADM_MAXLIFE 27
#define KADM_DESKEY 26
#define SET_FIELD(f,d) (d[3-(f/8)]|=(1<<(f%8)))
#define CLEAR_FIELD(f,d) (d[3-(f/8)]&=(~(1<<(f%8))))
#define IS_FIELD(f,d) (d[3-(f/8)]&(1<<(f%8)))
#define KADM_SUCCESS 0
#define WILDCARD_STR "*"
enum acl_types {
ADDACL,
GETACL,
MODACL,
STABACL,
DELACL
};
#define CHANGE_PW 2
#define ADD_ENT 3
#define MOD_ENT 4
#define GET_ENT 5
#define CHECK_PW 6
#define CHG_STAB 7
#define KADM_CYGNUS_EXT_BASE 64
#define DEL_ENT (KADM_CYGNUS_EXT_BASE+1)
#ifdef POSIX
typedef void sigtype;
#else
typedef int sigtype;
#endif
#define vals_to_stream kadm_vals_to_stream
#define build_field_header kadm_build_field_header
#define vts_string kadm_vts_string
#define vts_short kadm_vts_short
#define vts_long kadm_vts_long
#define vts_char kadm_vts_char
#define stream_to_vals kadm_stream_to_vals
#define check_field_header kadm_check_field_header
#define stv_string kadm_stv_string
#define stv_short kadm_stv_short
#define stv_long kadm_stv_long
#define stv_char kadm_stv_char
int vals_to_stream(Kadm_vals *, u_char **);
int build_field_header(u_char *, u_char **);
int vts_string(char *, u_char **, int);
int vts_short(KRB_UINT32, u_char **, int);
int vts_long(KRB_UINT32, u_char **, int);
int vts_char(KRB_UINT32, u_char **, int);
int stream_to_vals(u_char *, Kadm_vals *, int);
int check_field_header(u_char *, u_char *, int);
int stv_string(u_char *, char *, int, int, int);
int stv_short(u_char *, u_short *, int, int);
int stv_long(u_char *, KRB_UINT32 *, int, int);
int stv_char(u_char *, u_char *, int, int);
int kadm_init_link(char *, char *, char *, Kadm_Client *, int);
int kadm_cli_send(Kadm_Client *, u_char *, size_t, u_char **, size_t *);
int kadm_cli_conn(Kadm_Client *);
void kadm_cli_disconn(Kadm_Client *);
int kadm_cli_out(Kadm_Client *, u_char *, int, u_char **, size_t *);
int kadm_cli_keyd(Kadm_Client *, des_cblock, des_key_schedule);
#endif