#ifndef _KCLIENT_
#define _KCLIENT_
#ifndef _TYPES_
#include <Types.h>
#endif
enum {
cKrbCorruptedFile = -1024,
cKrbNoKillIO,
cKrbBadSelector,
cKrbCantClose,
cKrbMapDoesntExist,
cKrbSessDoesntExist,
cKrbCredsDontExist,
cKrbTCPunavailable,
cKrbUserCancelled,
cKrbConfigurationErr,
cKrbServerRejected,
cKrbServerImposter,
cKrbServerRespIncomplete,
cKrbNotLoggedIn,
cKrbOldDriver,
cKrbDriverInUse,
cKrbAppInBkgnd,
cKrbInvalidSession,
cKrbOptionNotDefined,
cKrbKerberosErrBlock = -20000
};
#define LARGEST_DRIVER_ERROR cKrbOptionNotDefined
typedef char KClientErrString[64];
enum { KClientLoggedIn, KClientNotLoggedIn };
enum {
KClientLocalName,
KClientCommonName,
KClientFullName
};
enum {
kclientOptionSaveName = 1,
kclientOptionSynchTime,
kclientOptionShowMenu,
kclientOptionInstalled_1_6
};
struct KClientKey {
unsigned char keyBytes[8];
};
typedef struct KClientKey KClientKey;
struct KClientSessionInfo {
char sessionBytes[256];
};
typedef struct KClientSessionInfo KClientSessionInfo;
typedef KClientSessionInfo *KClientSessionPtr;
#define KClientInitSession KClientNewSession
#define KClientVerifySendAuth KClientVerifyReplyTicket
#if defined(powerc) || defined(__powerc)
#pragma options align=mac68k
#endif
#ifndef DES_DEFS
typedef unsigned char des_cblock[8];
typedef struct des_ks_struct { des_cblock _; } des_key_schedule[16];
#endif
#ifndef KRB_DEFS
#define C_Block des_cblock
#define Key_schedule des_key_schedule
#define ANAME_SZ 40
#define REALM_SZ 40
#define SNAME_SZ 40
#define INST_SZ 40
#define MAX_KTXT_LEN 1250
struct ktext {
long length;
unsigned char dat[MAX_KTXT_LEN];
unsigned long mbz;
};
typedef struct ktext *KTEXT;
typedef struct ktext KTEXT_ST;
struct credentials {
char service[ANAME_SZ];
char instance[INST_SZ];
char realm[REALM_SZ];
C_Block session;
long lifetime;
long kvno;
KTEXT_ST ticket_st;
long issue_date;
char pname[ANAME_SZ];
char pinst[INST_SZ];
};
typedef struct credentials CREDENTIALS;
struct msg_dat {
unsigned char *app_data;
unsigned long app_length;
unsigned long hash;
long swap;
long time_sec;
unsigned char time_5ms;
};
typedef struct msg_dat MSG_DAT;
typedef unsigned long u_long;
typedef unsigned short u_short;
#define KRB_PASSWORD_SERVICE "changepw.kerberos"
#endif
#if defined(powerc) || defined(__powerc)
#pragma options align=reset
#endif
#ifdef __cplusplus
extern "C" {
#endif
int KClient_des_ecb_encrypt(KClientSessionInfo *session,des_cblock v1,des_cblock v2,int do_encrypt);
int KClient_des_pcbc_encrypt(KClientSessionInfo *session,des_cblock v1,des_cblock v2,long len,int do_encrypt);
OSErr KClientNewSession(KClientSessionInfo *session, unsigned long lAddr,unsigned short lPort,unsigned long fAddr,unsigned short fPort);
OSErr KClientDisposeSession(KClientSessionInfo *session);
OSErr KClientGetTicketForServiceFull(KClientSessionInfo *session, char *service,void *buf,unsigned long *buflen,long cks);
OSErr KClientGetTicketForService(KClientSessionInfo *session, char *service,void *buf,unsigned long *buflen);
OSErr KClientLogin( KClientSessionInfo *session, KClientKey *privateKey );
OSErr KClientSetPrompt( KClientSessionInfo *session, char *prompt );
OSErr KClientPasswordLogin( KClientSessionInfo *session, char *password, KClientKey *privateKey );
OSErr KClientPasswordToKey( char *password, KClientKey *privateKey );
OSErr KClientKeyLogin( KClientSessionInfo *session, KClientKey *privateKey );
OSErr KClientLogout( void );
short KClientStatus( void );
OSErr KClientVersion( short *majorVersion, short *minorVersion, char *versionString );
OSErr KClientGetUserName(char *user);
OSErr KClientGetSessionUserName(KClientSessionInfo *session, char *user, short nameType);
OSErr KClientSetUserName(char *user);
OSErr KClientCacheInitialTicket(KClientSessionInfo *session, char *service);
OSErr KClientGetSessionKey(KClientSessionInfo *session, KClientKey *sessionKey);
OSErr KClientMakeSendAuth(KClientSessionInfo *session, char *service,void *buf,unsigned long *buflen,long checksum, char *applicationVersion);
OSErr KClientVerifyReplyTicket(KClientSessionInfo *session, void *buf,unsigned long *buflen );
OSErr KClientEncrypt(KClientSessionInfo *session, void *buf,unsigned long buflen,void *encryptBuf,unsigned long *encryptLength);
OSErr KClientDecrypt(KClientSessionInfo *session, void *buf,unsigned long buflen,unsigned long *decryptOffset,unsigned long *decryptLength);
void KClientErrorText(OSErr err, char *text);
OSErr KServerNewSession( KClientSessionInfo *session, char *service,
unsigned long lAddr,unsigned short lPort,unsigned long fAddr,unsigned short fPort);
OSErr KServerVerifyTicket( KClientSessionInfo *session, void *buf, char *keyFileName );
OSErr KServerGetReplyTicket( KClientSessionInfo *session, void *buf, unsigned long *buflen );
OSErr KServerGetKey( KClientSessionInfo *session, KClientKey *privateKey, char *service, long version, char *filename );
OSErr KServerAddKey( KClientSessionInfo *session, KClientKey *privateKey, char *service, long version, char *filename );
OSErr KServerGetSessionTimeRemaining( KClientSessionInfo *session, long *seconds );
OSErr KClientGetLocalRealm( char *realm );
OSErr KClientSetLocalRealm( char *realm );
OSErr KClientGetRealm( char *host, char *realm );
OSErr KClientAddRealmMap( char *host, char *realm );
OSErr KClientDeleteRealmMap( char *host );
OSErr KClientGetNthRealmMap( long n, char *host, char *realm );
OSErr KClientGetNthServer( long n, char *host, char *realm, Boolean admin );
OSErr KClientAddServerMap( char *host, char *realm, Boolean admin );
OSErr KClientDeleteServerMap( char *host, char *realm );
OSErr KClientGetNthServerMap( long n, char *host, char *realm, Boolean *admin );
OSErr KClientGetNthServerPort( long n, short *port );
OSErr KClientSetNthServerPort( long n, short port );
OSErr KClientGetNumSessions( long *n );
OSErr KClientGetNthSession( long n, char *name, char *instance, char *realm );
OSErr KClientDeleteSession( char *name, char *instance, char *realm );
OSErr KClientGetCredentials( char *name, char *instance, char *realm, CREDENTIALS *cred );
OSErr KClientAddCredentials( char *name, char *instance, char *realm, CREDENTIALS *cred );
OSErr KClientDeleteCredentials( char *name, char *instance, char *realm,
char *sname, char *sinstance, char *srealm );
OSErr KClientGetNumCredentials( long *n, char *name, char *instance, char *realm );
OSErr KClientGetNthCredential( long n, char *name, char *instance, char *realm,
char *sname, char *sinstance, char *srealm );
OSErr KClientAddSpecial( char *service, char *name );
OSErr KClientDeleteSpecial( char *service );
OSErr KClientGetNumSpecials( long *n );
OSErr KClientGetNthSpecial( long n, char *name, char *service );
OSErr KClientSetOption( short option, void *value );
OSErr KClientGetOption( short option, void *value );
#ifdef __cplusplus
}
#endif
#endif