1 /*
\r * KerberosLogin.h
\r *
\r * $Header: /afs/andrew/system/cvs/src/sasl/mac/CommonKClient/mac_kclient3/Headers/KerberosLogin/KerberosLogin.h,v 1.2 2001/12/04 02:05:52 rjs3 Exp $
\r *
\r */
\r \r/*
\r * This file contains part of the login library API. See
\r * <http://web.mit.edu/macdev/mit/lib/Login/doc/API.html>
\r * for API documentation
\r */
\r\r#ifndef __KERBEROSLOGIN__
\r#define __KERBEROSLOGIN__
\r\r\r/*
\r *
\r * Constants
\r *
\r */
\r\r/* Kerberos versions */
\renum KLEKerberosVersion {
\r kerberosVersion_Any = 0,
\r kerberosVersion_V4 = 1,
\r kerberosVersion_V5 = 2,
\r kerberosVersion_All = 0xFFFFFFFF
\r};
\r\r/* dialog identifier constants */
\renum KLEDialogIdentifiers {
\r loginLibrary_LoginDialog,
\r loginLibrary_OptionsDialog,
\r loginLibrary_ChangePasswordDialog,
\r loginLibrary_ProgressDialog,
\r loginLibrary_PrompterDialog
\r};
\r\r/* Login dialog items */
\renum KLELoginDialogItems {
\r loginDialog_Username,
\r loginDialog_Password,
\r loginDialog_Realm,
\r loginDialog_TicketLifetime,
\r loginDialog_ForwardableTicket
\r};
\r\r/* Password dialog items */
\renum KLEChangePasswordDialogItems {
\r changePasswordDialog_OldPassword,
\r changePasswordDialog_NewPassword,
\r changePasswordDialog_VerifyPassword
\r};
\r\r/* Option identifier constants */
\renum KLEDefaultLoginOptions {
\r /* Dialog state options */
\r loginOption_LoginName = 'name',
\r loginOption_LoginInstance = 'inst',
\r loginOption_AdvancedLoginMode = 'adv ',
\r loginOption_ShowTicketLifetime = 'life',
\r loginOption_ShowForwardableTicket = 'forw',
\r loginOption_ShowProxiableTicket = 'prox',
\r \r /* Initial values and ranges */
\r loginOption_RememberPrincipal = 'prin',
\r loginOption_RememberExtras = 'extr',
\r \r loginOption_MinimalTicketLifetime = '-lif',
\r loginOption_MaximalTicketLifetime = '+lif',
\r loginOption_DefaultTicketLifetime = '0lif',
\r loginOption_LongTicketLifetimeDisplay = 'hms ',
\r \r loginOption_DefaultForwardableTicket = '0fwd',
\r loginOption_DefaultProxiableTicket = '0prx'
\r};
\r\r/* Login mode identifier constants (for loginOption_AdvancedLoginMode) */
\renum KLELoginMode {
\r loginMode_Basic = 1,
\r loginMode_Advanced = 2
\r};
\r\r/* Realm list constants */
\renum KLERealmListIndexes {
\r realmList_Start = 0,
\r realmList_End = 0xFFFF
\r};
\r\r#define klFirstError 19276
\r#define klLastError 19876
\r\r/* Error codes */
\renum KLEStatus {
\r klNoErr = 0,
\r\r /* parameter errors */
\r klParameterErr = 19276,
\r klBadPrincipalErr,
\r klBadPasswordErr,
\r klBadLoginOptionsErr,
\r klInvalidVersionErr,
\r \r /* Runtime Login errors */
\r klUserCanceledErr = 19476,
\r klMemFullErr,
\r klPreferencesReadErr,
\r klPreferencesWriteErr,
\r klV5InitializationFailedErr,
\r klPrincipalDoesNotExistErr,
\r klSystemDefaultDoesNotExistErr,
\r klCredentialsExpiredErr,
\r klNoRealmsErr,
\r klRealmDoesNotExistErr,
\r klNoCredentialsErr,
\r klCredentialsBadAddressErr,
\r klCacheDoesNotExistErr,
\r \r /* Get/SetKerberosOption errors */
\r klBufferTooSmallErr = 19376,
\r klBufferTooLargeErr,
\r klInvalidOptionErr,
\r klBadOptionValueErr,
\r \r /* Password changing errors */
\r klPasswordMismatchErr = 19576,
\r klInsecurePasswordErr,
\r klPasswordChangeFailedErr,
\r \r /* Dialog errors */
\r klDialogDoesNotExistErr = 19676,
\r klDialogAlreadyExistsErr,
\r klNotInForegroundErr,
\r klNoAppearanceErr,
\r klFatalDialogErr,
\r klCarbonUnavailableErr,
\r \r /* Login IPC errors */
\r klCantContactServerErr = 19776
\r\r};
\r\r#ifndef rez /* This stuff will confuse rez */
\r\r#include <KerberosSupport/KerberosConditionalMacros.h>
\r\r#if TARGET_API_MAC_OSX && TARGET_API_MAC_CARBON
\r #include <Carbon/Carbon.h>
\r#elif TARGET_API_MAC_OS8 || TARGET_API_MAC_CARBON
\r #include <Dialogs.h>
\r #include <Events.h>
\r #include <MacTypes.h>
\r#else
\r #error "Unknown OS"
\r#endif
\r\r#if PRAGMA_ONCE
\r#pragma once
\r#endif
\r\r#if PRAGMA_IMPORT
\r#pragma import on
\r#endif
\r\r#ifdef __cplusplus
\rextern "C" {
\r#endif
\r\r#if PRAGMA_STRUCT_ALIGN
\r #pragma options align=mac68k
\r#elif PRAGMA_STRUCT_PACKPUSH
\r #pragma pack(push, 2)
\r#elif PRAGMA_STRUCT_PACK
\r #pragma pack(2)
\r#endif
\r\r\r/*
\r *
\r * Types
\r *
\r */
\r \rtypedef OSStatus KLStatus; /* one of KLEStatus */
\rtypedef UInt32 KLKerberosVersion; /* one of KLEKerberosVersion */
\rtypedef UInt32 KLDefaultLoginOption; /* one of KLEDefaultLoginOptions */
\rtypedef UInt32 KLLoginMode; /* one of KLELoginMode */
\rtypedef UInt32 KLDialogIdentifier; /* one of KLEDialogIdentifiers */
\rtypedef UInt32 KLIndex; /* index (used for the realm list) */
\rtypedef UInt32 KLLifetime; /* Lifetime in seconds */
\rtypedef UInt32 KLTime; /* Unix time (seconds since 1/1/1970 00:00:00 GMT) */
\rtypedef UInt32 KLSize; /* size of a buffer (KLG/SetDefaultLoginOptions) or realm list (CountKerberosRealms) */
\rtypedef UInt32 KLRefCon; /* application ref con */
\rtypedef Boolean KLBoolean; /* true or false! */
\rtypedef SInt16 KLSInt16; /* used for Darwin-compat for KLApplicationOptions */
\r\r/* Callback API for Kerberos Login event filter */
\r/* Must be the same as an Idle Library event filter */
\r/* Callback API for Event handler proc for idle loop */
\rtypedef CALLBACK_API (Boolean, KLEventFilterProcPtr) (const EventRecord *theEvent, KLRefCon appData);
\r\r/* Procinfo for Login Library event filter */
\renum {
\r uppKLEventFilterProcInfo = kPascalStackBased |
\r RESULT_SIZE (sizeof (Boolean)) |
\r STACK_ROUTINE_PARAMETER (1, SIZE_CODE (sizeof (const EventRecord *))) |
\r STACK_ROUTINE_PARAMETER (2, SIZE_CODE (sizeof (KLRefCon)))
\r};
\r\r#if !TARGET_API_MAC_CARBON
\r /* UPP for Kerberos Login event filter */
\r typedef STACK_UPP_TYPE (KLEventFilterProcPtr) KLEventFilterUPP;
\r \r #define NewKLEventFilterProc(userRoutine) \
\r (KLEventFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKLEventFilterProcInfo, GetCurrentArchitecture())
\r\r /* How to call the event Handler UPPs */
\r #define CallKLEventFilterProc(userRoutine, theEvent, appData) \
\r ((Boolean)CALL_TWO_PARAMETER_UPP ((userRoutine), uppKLEventFilterProcInfo, theEvent, appData))
\r\r#else
\r typedef KLEventFilterProcPtr KLEventFilterUPP;
\r \r #define NewKLEventFilterProc(userRoutine) \
\r userRoutine
\r\r #define CallKLEventFilterProc(userRoutine, theEvent, appData) \
\r ((userRoutine) (theEvent, appData))
\r#endif
\r\r/* Application options */
\rtypedef struct {
\r KLEventFilterUPP eventFilter;
\r KLRefCon eventFilterAppData;
\r KLSInt16 realmsPopupMenuID;
\r KLSInt16 loginModeMenuID;
\r} KLApplicationOptions;
\r\r/* Principal information */
\rstruct OpaqueKLPrincipal;
\rtypedef struct OpaqueKLPrincipal * KLPrincipal;
\r\r/* Login Options */
\rstruct OpaqueKLLoginOptions;
\rtypedef struct OpaqueKLLoginOptions * KLLoginOptions;
\r\r\r/*
\r *
\r * Functions
\r *
\r */
\r\r/* Kerberos Login high-level API */
\rKLStatus KLAcquireTickets (
\r KLPrincipal inPrincipal,
\r KLPrincipal *outPrincipal,
\r char **outCredCacheName);
\r\rKLStatus KLAcquireNewTickets (
\r KLPrincipal inPrincipal,
\r KLPrincipal *outPrincipal,
\r char **outCredCacheName);
\r\rKLStatus KLDestroyTickets (KLPrincipal inPrincipal);
\r\rKLStatus KLChangePassword (KLPrincipal inPrincipal);
\r\r\r/* Kerberos Login dialog low level functions */
\r\rKLStatus KLAcquireTicketsWithPassword (
\r KLPrincipal inPrincipal,
\r KLLoginOptions inLoginOptions,
\r const char *inPassword,
\r char **outCredCacheName);
\r\rKLStatus KLAcquireNewTicketsWithPassword (
\r KLPrincipal inPrincipal,
\r KLLoginOptions inLoginOptions,
\r const char *inPassword,
\r char **outCredCacheName);
\r\rKLStatus KLLastChangedTime (KLTime *outLastChangedTime);
\r\rKLStatus KLCacheHasValidTickets (
\r KLPrincipal inPrincipal,
\r KLKerberosVersion inKerberosVersion,
\r KLBoolean *outFoundValidTickets,
\r KLPrincipal *outPrincipal,
\r char **outCredCacheName);
\r\rKLStatus KLTicketStartTime (
\r KLPrincipal inPrincipal,
\r KLKerberosVersion inKerberosVersion,
\r KLTime *outStartTime);
\r\rKLStatus KLTicketExpirationTime (
\r KLPrincipal inPrincipal,
\r KLKerberosVersion inKerberosVersion,
\r KLTime *outExpirationTime);
\r \rKLStatus KLSetSystemDefaultCache (KLPrincipal inPrincipal);
\r\rKLStatus KLHandleError (
\r KLStatus inError,
\r KLDialogIdentifier inDialogIdentifier,
\r Boolean inShowAlert);
\r\rKLStatus KLGetErrorString (
\r KLStatus inError,
\r char **outErrorString);
\r\rKLStatus KLCancelAllDialogs (void);
\r\r/* Kerberos change password dialog low level functions */
\r\rKLStatus KLChangePasswordWithPasswords (
\r KLPrincipal inPrincipal,
\r const char *inOldPassword,
\r const char *inNewPassword);
\r\r/* Application Configuration functions */
\r\rKLStatus KLSetApplicationOptions (const KLApplicationOptions *inAppOptions);
\r\rKLStatus KLGetApplicationOptions (KLApplicationOptions *outAppOptions);
\r\r\r/* Library configuration functions */
\rKLStatus KLGetDefaultLoginOption (
\r const KLDefaultLoginOption inOption,
\r void *ioBuffer,
\r KLSize *ioBufferSize);
\r\rKLStatus KLSetDefaultLoginOption (
\r const KLDefaultLoginOption inOption,
\r const void *inBuffer,
\r const KLSize inBufferSize);
\r\r/* Realm configuration functions */
\r\rKLStatus KLFindKerberosRealmByName (
\r const char *inRealmName,
\r KLIndex *outIndex);
\r\rKLStatus KLGetKerberosRealm (
\r KLIndex inIndex,
\r char **outRealmName);
\r\rKLStatus KLSetKerberosRealm (
\r KLIndex inIndex,
\r const char *inRealmName);
\r\rKLStatus KLRemoveKerberosRealm (UInt32 inIndex);
\r\rKLStatus KLInsertKerberosRealm (
\r KLIndex inInsertBeforeIndex,
\r const char *inRealmName);
\r \rKLStatus KLRemoveAllKerberosRealms (void);
\r \rKLSize KLCountKerberosRealms (void);
\r \rKLStatus KLGetKerberosDefaultRealm(KLIndex *outIndex);
\r \rKLStatus KLGetKerberosDefaultRealmByName (char **outRealmName);
\r \rKLStatus KLSetKerberosDefaultRealm (KLIndex inIndex);
\r \rKLStatus KLSetKerberosDefaultRealmByName (const char *inRealm);
\r\r/* KLPrincipal functions */
\r\rKLStatus KLCreatePrincipalFromTriplet(
\r const char *inName,
\r const char *inInstance,
\r const char *inRealm,
\r KLPrincipal *outPrincipal);
\r\rKLStatus KLCreatePrincipalFromString(
\r const char *inFullPrincipal,
\r KLKerberosVersion inKerberosVersion,
\r KLPrincipal *outPrincipal);
\r \rKLStatus KLGetTripletFromPrincipal(
\r KLPrincipal inPrincipal,
\r char **outName,
\r char **outInstance,
\r char **outRealm);
\r\rKLStatus KLGetStringFromPrincipal(
\r KLPrincipal inPrincipal,
\r KLKerberosVersion inKerberosVersion,
\r char **outFullPrincipal);
\r\rKLStatus KLGetDisplayStringFromPrincipal(
\r KLPrincipal inPrincipal,
\r KLKerberosVersion inKerberosVersion,
\r char **outFullPrincipal);
\r\rKLStatus KLComparePrincipal(
\r KLPrincipal inFirstPrincipal,
\r KLPrincipal inSecondPrincipal,
\r KLBoolean *outAreEquivalent);
\r\rKLStatus KLDisposePrincipal(KLPrincipal inPrincipal);
\r\r/* KLLoginOptions functions */
\r\rKLStatus KLCreateLoginOptions (KLLoginOptions *outOptions);
\r\rKLStatus KLLoginOptionsSetTicketLifetime (
\r KLLoginOptions ioOptions,
\r KLLifetime inTicketLifetime);
\r\rKLStatus KLLoginOptionsSetForwardable (
\r KLLoginOptions ioOptions,
\r KLBoolean inForwardable);
\r \rKLStatus KLLoginOptionsSetProxiable (
\r KLLoginOptions ioOptions,
\r KLBoolean inProxiable);
\r \rKLStatus KLDisposeLoginOptions(KLLoginOptions ioOptions);
\r\r\r/* Misc function */
\r\rKLStatus KLDisposeString(char *inStringToDispose);
\r\r#if PRAGMA_STRUCT_ALIGN
\r #pragma options align=reset
\r#elif PRAGMA_STRUCT_PACKPUSH
\r #pragma pack(pop)
\r#elif PRAGMA_STRUCT_PACK
\r #pragma pack()
\r#endif
\r\r#ifdef PRAGMA_IMPORT_OFF
\r#pragma import off
\r#elif PRAGMA_IMPORT
\r#pragma import reset
\r#endif
\r\r#ifdef __cplusplus
\r}
\r#endif
\r\r#endif /* Rez */
\r\r#endif /* __KERBEROSLOGIN__ */
\r\r