• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /macosx-10.9.5/passwordserver_sasl-170/cyrus_sasl/mac/CommonKClient/mac_kclient3/Headers/KerberosLogin/
1/*
2 * KerberosLogin.h
3 *
4 * $Header: /Volumes/backup/dsmigrate/Dumps/../CVS/passwordserver_sasl/cyrus_sasl/mac/CommonKClient/mac_kclient3/Headers/KerberosLogin/KerberosLogin.h,v 1.4 2005/01/10 19:17:29 snsimon Exp $
5 *
6 */
7
8/*
9 * This file contains part of the login library API. See
10 * <http://web.mit.edu/macdev/mit/lib/Login/doc/API.html>
11 * for API documentation
12 */
13
14#ifndef __KERBEROSLOGIN__
15#define __KERBEROSLOGIN__
16
17
18/*
19 *
20 * Constants
21 *
22 */
23
24/* Kerberos versions */
25enum KLEKerberosVersion {
26	kerberosVersion_Any		= 0,
27	kerberosVersion_V4		= 1,
28	kerberosVersion_V5		= 2,
29	kerberosVersion_All		= 0xFFFFFFFF
30};
31
32/* dialog identifier constants */
33enum KLEDialogIdentifiers {
34	loginLibrary_LoginDialog,
35	loginLibrary_OptionsDialog,
36	loginLibrary_ChangePasswordDialog,
37	loginLibrary_ProgressDialog,
38	loginLibrary_PrompterDialog
39};
40
41/* Login dialog items */
42enum KLELoginDialogItems {
43	loginDialog_Username,
44	loginDialog_Password,
45	loginDialog_Realm,
46	loginDialog_TicketLifetime,
47	loginDialog_ForwardableTicket
48};
49
50/* Password dialog items */
51enum KLEChangePasswordDialogItems {
52	changePasswordDialog_OldPassword,
53	changePasswordDialog_NewPassword,
54	changePasswordDialog_VerifyPassword
55};
56
57/* Option identifier constants */
58enum KLEDefaultLoginOptions {
59	/* Dialog state options */
60	loginOption_LoginName                    = 'name',
61	loginOption_LoginInstance                = 'inst',
62	loginOption_AdvancedLoginMode            = 'adv ',
63	loginOption_ShowTicketLifetime           = 'life',
64	loginOption_ShowForwardableTicket        = 'forw',
65	loginOption_ShowProxiableTicket      	 = 'prox',
66
67	/* Initial values and ranges */
68	loginOption_RememberPrincipal            = 'prin',
69	loginOption_RememberExtras               = 'extr',
70
71	loginOption_MinimalTicketLifetime        = '-lif',
72	loginOption_MaximalTicketLifetime        = '+lif',
73	loginOption_DefaultTicketLifetime        = '0lif',
74	loginOption_LongTicketLifetimeDisplay    = 'hms ',
75
76	loginOption_DefaultForwardableTicket     = '0fwd',
77	loginOption_DefaultProxiableTicket		 = '0prx'
78};
79
80/* Login mode identifier constants (for loginOption_AdvancedLoginMode) */
81enum KLELoginMode {
82	loginMode_Basic							 = 1,
83	loginMode_Advanced						 = 2
84};
85
86/* Realm list constants */
87enum KLERealmListIndexes {
88	realmList_Start		= 0,
89	realmList_End		= 0xFFFF
90};
91
92#define klFirstError	19276
93#define klLastError		19876
94
95/* Error codes */
96enum KLEStatus {
97	klNoErr										=	0,
98
99	/* parameter errors */
100	klParameterErr								=	19276,
101	klBadPrincipalErr,
102	klBadPasswordErr,
103	klBadLoginOptionsErr,
104	klInvalidVersionErr,
105
106	/* Runtime Login errors */
107	klUserCanceledErr							=	19476,
108	klMemFullErr,
109	klPreferencesReadErr,
110	klPreferencesWriteErr,
111	klV5InitializationFailedErr,
112	klPrincipalDoesNotExistErr,
113	klSystemDefaultDoesNotExistErr,
114	klCredentialsExpiredErr,
115	klNoRealmsErr,
116	klRealmDoesNotExistErr,
117	klNoCredentialsErr,
118	klCredentialsBadAddressErr,
119	klCacheDoesNotExistErr,
120
121	/* Get/SetKerberosOption errors */
122	klBufferTooSmallErr							=	19376,
123	klBufferTooLargeErr,
124	klInvalidOptionErr,
125	klBadOptionValueErr,
126
127	/* Password changing errors */
128	klPasswordMismatchErr						=	19576,
129	klInsecurePasswordErr,
130	klPasswordChangeFailedErr,
131
132	/* Dialog errors */
133	klDialogDoesNotExistErr						=	19676,
134	klDialogAlreadyExistsErr,
135	klNotInForegroundErr,
136	klNoAppearanceErr,
137	klFatalDialogErr,
138	klCarbonUnavailableErr,
139
140	/* Login IPC errors */
141	klCantContactServerErr						=	19776
142
143};
144
145#ifndef rez  /* This stuff will confuse rez */
146
147#include <KerberosSupport/KerberosConditionalMacros.h>
148
149#if TARGET_API_MAC_OSX && TARGET_API_MAC_CARBON
150    #include <Carbon/Carbon.h>
151#elif TARGET_API_MAC_OS8 || TARGET_API_MAC_CARBON
152    #include <Dialogs.h>
153    #include <Events.h>
154    #include <MacTypes.h>
155#else
156	#error "Unknown OS"
157#endif
158
159#if PRAGMA_ONCE
160#pragma once
161#endif
162
163#if PRAGMA_IMPORT
164#pragma import on
165#endif
166
167#ifdef __cplusplus
168extern "C" {
169#endif
170
171#if PRAGMA_STRUCT_ALIGN
172	#pragma options align=mac68k
173#elif PRAGMA_STRUCT_PACKPUSH
174	#pragma pack(push, 2)
175#elif PRAGMA_STRUCT_PACK
176	#pragma pack(2)
177#endif
178
179
180/*
181 *
182 * Types
183 *
184 */
185
186typedef	OSStatus	KLStatus;					/* one of KLEStatus 																	*/
187typedef	UInt32		KLKerberosVersion;			/* one of KLEKerberosVersion 															*/
188typedef	UInt32		KLDefaultLoginOption;		/* one of KLEDefaultLoginOptions														*/
189typedef	UInt32		KLLoginMode;				/* one of KLELoginMode																	*/
190typedef	UInt32		KLDialogIdentifier;			/* one of KLEDialogIdentifiers															*/
191typedef	UInt32		KLIndex;					/* index (used for the realm list)														*/
192typedef	UInt32		KLLifetime;					/* Lifetime in seconds																	*/
193typedef	UInt32		KLTime;						/* Unix time (seconds since 1/1/1970 00:00:00 GMT)										*/
194typedef	UInt32		KLSize;						/* size of a buffer (KLG/SetDefaultLoginOptions) or realm list (CountKerberosRealms)	*/
195typedef	UInt32		KLRefCon;					/* application ref con																	*/
196typedef	Boolean		KLBoolean;					/* true or false!																		*/
197typedef	SInt16		KLSInt16;					/* used for Darwin-compat for KLApplicationOptions										*/
198
199/* Callback API for Kerberos Login event filter */
200/* Must be the same as an Idle Library event filter */
201/* Callback API for Event handler proc for idle loop */
202typedef CALLBACK_API (Boolean, KLEventFilterProcPtr) (const EventRecord *theEvent, KLRefCon appData);
203
204/* Procinfo for Login Library event filter */
205enum {
206	uppKLEventFilterProcInfo = kPascalStackBased |
207		RESULT_SIZE (sizeof (Boolean)) |
208		STACK_ROUTINE_PARAMETER (1, SIZE_CODE (sizeof (const EventRecord *))) |
209		STACK_ROUTINE_PARAMETER (2, SIZE_CODE (sizeof (KLRefCon)))
210};
211
212#if !TARGET_API_MAC_CARBON
213	/* UPP for Kerberos Login event filter */
214	typedef STACK_UPP_TYPE (KLEventFilterProcPtr) KLEventFilterUPP;
215
216	#define	NewKLEventFilterProc(userRoutine) 			\
217		(KLEventFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKLEventFilterProcInfo, GetCurrentArchitecture())
218
219	/* How to call the event Handler UPPs */
220	#define CallKLEventFilterProc(userRoutine, theEvent, appData)			\
221		((Boolean)CALL_TWO_PARAMETER_UPP ((userRoutine), uppKLEventFilterProcInfo, theEvent, appData))
222
223#else
224	typedef KLEventFilterProcPtr KLEventFilterUPP;
225
226	#define	NewKLEventFilterProc(userRoutine) 			\
227		userRoutine
228
229	#define CallKLEventFilterProc(userRoutine, theEvent, appData)			\
230		((userRoutine) (theEvent, appData))
231#endif
232
233/* Application options */
234typedef struct {
235	KLEventFilterUPP 	eventFilter;
236	KLRefCon 			eventFilterAppData;
237	KLSInt16 			realmsPopupMenuID;
238	KLSInt16 			loginModeMenuID;
239} KLApplicationOptions;
240
241/* Principal information */
242struct OpaqueKLPrincipal;
243typedef struct OpaqueKLPrincipal 	* KLPrincipal;
244
245/* Login Options */
246struct OpaqueKLLoginOptions;
247typedef struct OpaqueKLLoginOptions	* KLLoginOptions;
248
249
250/*
251 *
252 * Functions
253 *
254 */
255
256/* Kerberos Login high-level API */
257KLStatus KLAcquireTickets (
258		KLPrincipal		  inPrincipal,
259		KLPrincipal		 *outPrincipal,
260		char 			**outCredCacheName);
261
262KLStatus KLAcquireNewTickets (
263		KLPrincipal 	  inPrincipal,
264		KLPrincipal 	 *outPrincipal,
265		char 			**outCredCacheName);
266
267KLStatus KLDestroyTickets (KLPrincipal inPrincipal);
268
269KLStatus KLChangePassword (KLPrincipal inPrincipal);
270
271
272/* Kerberos Login dialog low level functions */
273
274KLStatus KLAcquireTicketsWithPassword (
275		KLPrincipal		  inPrincipal,
276		KLLoginOptions	  inLoginOptions,
277		const char		 *inPassword,
278		char 			**outCredCacheName);
279
280KLStatus KLAcquireNewTicketsWithPassword (
281		KLPrincipal		  inPrincipal,
282		KLLoginOptions	  inLoginOptions,
283		const char		 *inPassword,
284		char 			**outCredCacheName);
285
286KLStatus KLLastChangedTime (KLTime	*outLastChangedTime);
287
288KLStatus KLCacheHasValidTickets (
289		KLPrincipal		 	  inPrincipal,
290		KLKerberosVersion	  inKerberosVersion,
291		KLBoolean 			 *outFoundValidTickets,
292		KLPrincipal			 *outPrincipal,
293		char				**outCredCacheName);
294
295KLStatus KLTicketStartTime (
296		KLPrincipal					 inPrincipal,
297		KLKerberosVersion			 inKerberosVersion,
298		KLTime						*outStartTime);
299
300KLStatus KLTicketExpirationTime (
301		KLPrincipal			 inPrincipal,
302		KLKerberosVersion	 inKerberosVersion,
303		KLTime				*outExpirationTime);
304
305KLStatus KLSetSystemDefaultCache (KLPrincipal inPrincipal);
306
307KLStatus KLHandleError (
308		KLStatus				inError,
309		KLDialogIdentifier		inDialogIdentifier,
310		Boolean					inShowAlert);
311
312KLStatus KLGetErrorString (
313		KLStatus		  inError,
314		char			**outErrorString);
315
316KLStatus KLCancelAllDialogs (void);
317
318/* Kerberos change password dialog low level functions */
319
320KLStatus KLChangePasswordWithPasswords (
321		KLPrincipal		 inPrincipal,
322		const char		*inOldPassword,
323		const char		*inNewPassword);
324
325/* Application Configuration functions */
326
327KLStatus KLSetApplicationOptions (const KLApplicationOptions *inAppOptions);
328
329KLStatus KLGetApplicationOptions (KLApplicationOptions *outAppOptions);
330
331
332/* Library configuration functions */
333KLStatus KLGetDefaultLoginOption (
334		const KLDefaultLoginOption	 inOption,
335		void						*ioBuffer,
336		KLSize						*ioBufferSize);
337
338KLStatus KLSetDefaultLoginOption (
339		const KLDefaultLoginOption	 inOption,
340		const void					*inBuffer,
341		const KLSize				 inBufferSize);
342
343/* Realm configuration functions */
344
345KLStatus KLFindKerberosRealmByName (
346		const char		*inRealmName,
347		KLIndex			*outIndex);
348
349KLStatus KLGetKerberosRealm (
350		KLIndex			  inIndex,
351		char			**outRealmName);
352
353KLStatus KLSetKerberosRealm (
354		KLIndex			 inIndex,
355		const char		*inRealmName);
356
357KLStatus KLRemoveKerberosRealm (UInt32 inIndex);
358
359KLStatus KLInsertKerberosRealm (
360		KLIndex			 inInsertBeforeIndex,
361		const char		*inRealmName);
362
363KLStatus KLRemoveAllKerberosRealms (void);
364
365KLSize KLCountKerberosRealms (void);
366
367KLStatus KLGetKerberosDefaultRealm(KLIndex *outIndex);
368
369KLStatus KLGetKerberosDefaultRealmByName (char **outRealmName);
370
371KLStatus KLSetKerberosDefaultRealm (KLIndex inIndex);
372
373KLStatus KLSetKerberosDefaultRealmByName (const char *inRealm);
374
375/* KLPrincipal functions */
376
377KLStatus KLCreatePrincipalFromTriplet(
378		const char		*inName,
379		const char		*inInstance,
380		const char		*inRealm,
381		KLPrincipal 	*outPrincipal);
382
383KLStatus KLCreatePrincipalFromString(
384		const char				*inFullPrincipal,
385		KLKerberosVersion		 inKerberosVersion,
386		KLPrincipal				*outPrincipal);
387
388KLStatus KLGetTripletFromPrincipal(
389		KLPrincipal		  inPrincipal,
390		char			**outName,
391		char			**outInstance,
392		char			**outRealm);
393
394KLStatus KLGetStringFromPrincipal(
395		KLPrincipal			  inPrincipal,
396		KLKerberosVersion	  inKerberosVersion,
397		char				**outFullPrincipal);
398
399KLStatus KLGetDisplayStringFromPrincipal(
400		KLPrincipal			  inPrincipal,
401		KLKerberosVersion	  inKerberosVersion,
402		char				**outFullPrincipal);
403
404KLStatus KLComparePrincipal(
405		KLPrincipal		 inFirstPrincipal,
406		KLPrincipal		 inSecondPrincipal,
407		KLBoolean		*outAreEquivalent);
408
409KLStatus KLDisposePrincipal(KLPrincipal inPrincipal);
410
411/* KLLoginOptions functions */
412
413KLStatus KLCreateLoginOptions (KLLoginOptions 	*outOptions);
414
415KLStatus KLLoginOptionsSetTicketLifetime (
416		KLLoginOptions	ioOptions,
417		KLLifetime		inTicketLifetime);
418
419KLStatus KLLoginOptionsSetForwardable (
420		KLLoginOptions	ioOptions,
421		KLBoolean		inForwardable);
422
423KLStatus KLLoginOptionsSetProxiable (
424		KLLoginOptions	ioOptions,
425		KLBoolean		inProxiable);
426
427KLStatus KLDisposeLoginOptions(KLLoginOptions ioOptions);
428
429
430/* Misc function */
431
432KLStatus KLDisposeString(char *inStringToDispose);
433
434#if PRAGMA_STRUCT_ALIGN
435	#pragma options align=reset
436#elif PRAGMA_STRUCT_PACKPUSH
437	#pragma pack(pop)
438#elif PRAGMA_STRUCT_PACK
439	#pragma pack()
440#endif
441
442#ifdef PRAGMA_IMPORT_OFF
443#pragma import off
444#elif PRAGMA_IMPORT
445#pragma import reset
446#endif
447
448#ifdef __cplusplus
449}
450#endif
451
452#endif /* Rez */
453
454#endif /* __KERBEROSLOGIN__ */
455
456