xref: /freebsd/crypto/krb5/src/windows/include/leashwin.h (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert #ifndef __LEASHWIN__
2*7f2fe78bSCy Schubert #define __LEASHWIN__
3*7f2fe78bSCy Schubert 
4*7f2fe78bSCy Schubert ////Is this sufficient?
5*7f2fe78bSCy Schubert #include <krb5.h>
6*7f2fe78bSCy Schubert #define ANAME_SZ	        40
7*7f2fe78bSCy Schubert #define	REALM_SZ	        40
8*7f2fe78bSCy Schubert #define	SNAME_SZ	        40
9*7f2fe78bSCy Schubert #define	INST_SZ		        40
10*7f2fe78bSCy Schubert /* include space for '.' and '@' */
11*7f2fe78bSCy Schubert #define	MAX_K_NAME_SZ	    (ANAME_SZ + INST_SZ + REALM_SZ + 2)
12*7f2fe78bSCy Schubert 
13*7f2fe78bSCy Schubert #define DLGTYPE_PASSWD   0
14*7f2fe78bSCy Schubert #define DLGTYPE_CHPASSWD 1
15*7f2fe78bSCy Schubert #define DLGTYPE_MASK 0x0000ffff
16*7f2fe78bSCy Schubert #define DLGFLAG_READONLYPRINC 0x10000
17*7f2fe78bSCy Schubert typedef struct {
18*7f2fe78bSCy Schubert     int dlgtype;
19*7f2fe78bSCy Schubert     // Tells whether dialog box is in change pwd more or init ticket mode???
20*7f2fe78bSCy Schubert     // (verify this):
21*7f2fe78bSCy Schubert     int dlgstatemax; // What is this???
22*7f2fe78bSCy Schubert     // The title on the Dialog box - for Renewing or Initializing:
23*7f2fe78bSCy Schubert     LPSTR title;
24*7f2fe78bSCy Schubert     LPSTR principal;
25*7f2fe78bSCy Schubert } LSH_DLGINFO, FAR *LPLSH_DLGINFO;
26*7f2fe78bSCy Schubert 
27*7f2fe78bSCy Schubert #define LEASH_USERNAME_SZ        64
28*7f2fe78bSCy Schubert #define LEASH_REALM_SZ          192
29*7f2fe78bSCy Schubert #define LEASH_TITLE_SZ          128
30*7f2fe78bSCy Schubert #define LEASH_CCACHE_NAME_SZ 	264
31*7f2fe78bSCy Schubert 
32*7f2fe78bSCy Schubert typedef struct {
33*7f2fe78bSCy Schubert     DWORD size;
34*7f2fe78bSCy Schubert     int dlgtype;
35*7f2fe78bSCy Schubert     // Tells whether dialog box is in change pwd mode or init ticket mode
36*7f2fe78bSCy Schubert     LPSTR title;		// in v3, set to in.title
37*7f2fe78bSCy Schubert     LPSTR username;		// in v3, set to in.username
38*7f2fe78bSCy Schubert     LPSTR realm;		// in v3, set to in.realm
39*7f2fe78bSCy Schubert     int   use_defaults;
40*7f2fe78bSCy Schubert     int   forwardable;
41*7f2fe78bSCy Schubert     int   noaddresses;
42*7f2fe78bSCy Schubert     int   lifetime;
43*7f2fe78bSCy Schubert     int   renew_till;
44*7f2fe78bSCy Schubert     int   proxiable;
45*7f2fe78bSCy Schubert     int   publicip;
46*7f2fe78bSCy Schubert     // Version 1 of this structure ends here
47*7f2fe78bSCy Schubert     struct {
48*7f2fe78bSCy Schubert         char username[LEASH_USERNAME_SZ];
49*7f2fe78bSCy Schubert         char realm[LEASH_REALM_SZ];
50*7f2fe78bSCy Schubert 	// Version 2 of this structure ends here
51*7f2fe78bSCy Schubert 	char ccache[LEASH_CCACHE_NAME_SZ];
52*7f2fe78bSCy Schubert     } out;
53*7f2fe78bSCy Schubert     struct {
54*7f2fe78bSCy Schubert 	char title[LEASH_TITLE_SZ];
55*7f2fe78bSCy Schubert 	char username[LEASH_USERNAME_SZ];
56*7f2fe78bSCy Schubert 	char realm[LEASH_REALM_SZ];
57*7f2fe78bSCy Schubert 	char ccache[LEASH_CCACHE_NAME_SZ];
58*7f2fe78bSCy Schubert     } in;
59*7f2fe78bSCy Schubert } LSH_DLGINFO_EX, *LPLSH_DLGINFO_EX;
60*7f2fe78bSCy Schubert 
61*7f2fe78bSCy Schubert #define LSH_DLGINFO_EX_V1_SZ (sizeof(DWORD) + 3 * sizeof(LPSTR) + 8 * sizeof(int))
62*7f2fe78bSCy Schubert #define LSH_DLGINFO_EX_V2_SZ (LSH_DLGINFO_EX_V1_SZ + LEASH_USERNAME_SZ + LEASH_REALM_SZ)
63*7f2fe78bSCy Schubert #define LSH_DLGINFO_EX_V3_SZ (LSH_DLGINFO_EX_V2_SZ + LEASH_TITLE_SZ + LEASH_USERNAME_SZ + LEASH_REALM_SZ + 2 * LEASH_CCACHE_NAME_SZ)
64*7f2fe78bSCy Schubert 
65*7f2fe78bSCy Schubert #ifndef NETIDMGR
66*7f2fe78bSCy Schubert #define NETID_USERNAME_SZ       128
67*7f2fe78bSCy Schubert #define NETID_REALM_SZ          192
68*7f2fe78bSCy Schubert #define NETID_TITLE_SZ          256
69*7f2fe78bSCy Schubert #define NETID_CCACHE_NAME_SZ 	264
70*7f2fe78bSCy Schubert 
71*7f2fe78bSCy Schubert #define NETID_DLGTYPE_TGT      0
72*7f2fe78bSCy Schubert #define NETID_DLGTYPE_CHPASSWD 1
73*7f2fe78bSCy Schubert typedef struct {
74*7f2fe78bSCy Schubert     DWORD size;
75*7f2fe78bSCy Schubert     DWORD dlgtype;
76*7f2fe78bSCy Schubert     // Tells whether dialog box is in change pwd mode or init ticket mode
77*7f2fe78bSCy Schubert     struct {
78*7f2fe78bSCy Schubert 	WCHAR title[NETID_TITLE_SZ];
79*7f2fe78bSCy Schubert 	WCHAR username[NETID_USERNAME_SZ];
80*7f2fe78bSCy Schubert 	WCHAR realm[NETID_REALM_SZ];
81*7f2fe78bSCy Schubert 	WCHAR ccache[NETID_CCACHE_NAME_SZ];
82*7f2fe78bSCy Schubert 	DWORD use_defaults;
83*7f2fe78bSCy Schubert 	DWORD forwardable;
84*7f2fe78bSCy Schubert 	DWORD noaddresses;
85*7f2fe78bSCy Schubert 	DWORD lifetime;
86*7f2fe78bSCy Schubert 	DWORD renew_till;
87*7f2fe78bSCy Schubert 	DWORD proxiable;
88*7f2fe78bSCy Schubert 	DWORD publicip;
89*7f2fe78bSCy Schubert 	DWORD must_use_specified_principal;
90*7f2fe78bSCy Schubert     } in;
91*7f2fe78bSCy Schubert     struct {
92*7f2fe78bSCy Schubert         WCHAR username[NETID_USERNAME_SZ];
93*7f2fe78bSCy Schubert         WCHAR realm[NETID_REALM_SZ];
94*7f2fe78bSCy Schubert 	WCHAR ccache[NETID_CCACHE_NAME_SZ];
95*7f2fe78bSCy Schubert     } out;
96*7f2fe78bSCy Schubert     // Version 1 of this structure ends here
97*7f2fe78bSCy Schubert } NETID_DLGINFO, *LPNETID_DLGINFO;
98*7f2fe78bSCy Schubert 
99*7f2fe78bSCy Schubert #define NETID_DLGINFO_V1_SZ (10 * sizeof(DWORD) \
100*7f2fe78bSCy Schubert         + sizeof(WCHAR) * (NETID_TITLE_SZ + \
101*7f2fe78bSCy Schubert         2 * NETID_USERNAME_SZ + 2 * NETID_REALM_SZ + \
102*7f2fe78bSCy Schubert         2 * NETID_CCACHE_NAME_SZ))
103*7f2fe78bSCy Schubert #endif /* NETIDMGR */
104*7f2fe78bSCy Schubert 
105*7f2fe78bSCy Schubert typedef struct TicketList TicketList;
106*7f2fe78bSCy Schubert struct TicketList {
107*7f2fe78bSCy Schubert     TicketList *next;
108*7f2fe78bSCy Schubert     char *service;
109*7f2fe78bSCy Schubert     char *encTypes;
110*7f2fe78bSCy Schubert     time_t issued;
111*7f2fe78bSCy Schubert     time_t valid_until;
112*7f2fe78bSCy Schubert     time_t renew_until;
113*7f2fe78bSCy Schubert     unsigned long flags;
114*7f2fe78bSCy Schubert };
115*7f2fe78bSCy Schubert 
116*7f2fe78bSCy Schubert typedef struct TICKETINFO TICKETINFO;
117*7f2fe78bSCy Schubert struct TICKETINFO {
118*7f2fe78bSCy Schubert     TICKETINFO *next;
119*7f2fe78bSCy Schubert     char   *principal;                /* Principal name/instance@realm */
120*7f2fe78bSCy Schubert     char   *ccache_name;
121*7f2fe78bSCy Schubert     TicketList *ticket_list;
122*7f2fe78bSCy Schubert     int     btickets;                 /* Do we have tickets? */
123*7f2fe78bSCy Schubert     time_t  issued;                   /* The issue time */
124*7f2fe78bSCy Schubert     time_t  valid_until;              /* */
125*7f2fe78bSCy Schubert     time_t  renew_until;              /* The Renew time (k5 only) */
126*7f2fe78bSCy Schubert     unsigned long flags;
127*7f2fe78bSCy Schubert };
128*7f2fe78bSCy Schubert 
129*7f2fe78bSCy Schubert #ifdef __cplusplus
130*7f2fe78bSCy Schubert extern "C" {
131*7f2fe78bSCy Schubert #endif
132*7f2fe78bSCy Schubert 
133*7f2fe78bSCy Schubert int FAR Leash_kinit_dlg(HWND hParent, LPLSH_DLGINFO lpdlginfo);
134*7f2fe78bSCy Schubert int FAR Leash_kinit_dlg_ex(HWND hParent, LPLSH_DLGINFO_EX lpdlginfoex);
135*7f2fe78bSCy Schubert int FAR Leash_changepwd_dlg(HWND hParent, LPLSH_DLGINFO lpdlginfo);
136*7f2fe78bSCy Schubert int FAR Leash_changepwd_dlg_ex(HWND hParent, LPLSH_DLGINFO_EX lpdlginfo);
137*7f2fe78bSCy Schubert 
138*7f2fe78bSCy Schubert long FAR Leash_checkpwd(char *principal, char *password);
139*7f2fe78bSCy Schubert long FAR Leash_changepwd(char *principal, char *password, char *newpassword, char** result_string);
140*7f2fe78bSCy Schubert long FAR Leash_kinit(char *principal, char *password, int lifetime);
141*7f2fe78bSCy Schubert long FAR Leash_kinit_ex(char * principal, char * password, int lifetime,
142*7f2fe78bSCy Schubert 						int forwardable, int proxiable, int renew_life,
143*7f2fe78bSCy Schubert 						int addressless, unsigned long publicIP);
144*7f2fe78bSCy Schubert 
145*7f2fe78bSCy Schubert long FAR Leash_klist(HWND hlist, TICKETINFO FAR *ticketinfo);
146*7f2fe78bSCy Schubert long FAR Leash_kdestroy(void);
147*7f2fe78bSCy Schubert long FAR Leash_get_lsh_errno( LONG FAR *err_val);
148*7f2fe78bSCy Schubert 
149*7f2fe78bSCy Schubert long FAR Leash_renew(void);
150*7f2fe78bSCy Schubert long FAR Leash_importable(void);
151*7f2fe78bSCy Schubert long FAR Leash_import(void);
152*7f2fe78bSCy Schubert 
153*7f2fe78bSCy Schubert BOOL Leash_set_help_file( char FAR *szHelpFile );
154*7f2fe78bSCy Schubert LPSTR Leash_get_help_file(void);
155*7f2fe78bSCy Schubert 
156*7f2fe78bSCy Schubert void Leash_reset_defaults(void);
157*7f2fe78bSCy Schubert 
158*7f2fe78bSCy Schubert #define NO_TICKETS 0
159*7f2fe78bSCy Schubert #define EXPD_TICKETS 2
160*7f2fe78bSCy Schubert #define GOOD_TICKETS 1
161*7f2fe78bSCy Schubert 
162*7f2fe78bSCy Schubert /* Leash Configuration functions - alters Current User Registry */
163*7f2fe78bSCy Schubert DWORD Leash_get_default_lifetime();
164*7f2fe78bSCy Schubert DWORD Leash_set_default_lifetime(DWORD minutes);
165*7f2fe78bSCy Schubert DWORD Leash_reset_default_lifetime();
166*7f2fe78bSCy Schubert DWORD Leash_get_default_renew_till();
167*7f2fe78bSCy Schubert DWORD Leash_set_default_renew_till(DWORD minutes);
168*7f2fe78bSCy Schubert DWORD Leash_reset_default_renew_till();
169*7f2fe78bSCy Schubert DWORD Leash_get_default_renewable();
170*7f2fe78bSCy Schubert DWORD Leash_set_default_renewable(DWORD onoff);
171*7f2fe78bSCy Schubert DWORD Leash_reset_default_renewable();
172*7f2fe78bSCy Schubert DWORD Leash_get_default_forwardable();
173*7f2fe78bSCy Schubert DWORD Leash_set_default_forwardable(DWORD onoff);
174*7f2fe78bSCy Schubert DWORD Leash_reset_default_forwardable();
175*7f2fe78bSCy Schubert DWORD Leash_get_default_noaddresses();
176*7f2fe78bSCy Schubert DWORD Leash_set_default_noaddresses(DWORD onoff);
177*7f2fe78bSCy Schubert DWORD Leash_reset_default_noaddresses();
178*7f2fe78bSCy Schubert DWORD Leash_get_default_proxiable();
179*7f2fe78bSCy Schubert DWORD Leash_set_default_proxiable(DWORD onoff);
180*7f2fe78bSCy Schubert DWORD Leash_reset_default_proxiable();
181*7f2fe78bSCy Schubert DWORD Leash_get_default_publicip();
182*7f2fe78bSCy Schubert DWORD Leash_set_default_publicip(DWORD ipv4addr);
183*7f2fe78bSCy Schubert DWORD Leash_reset_default_publicip();
184*7f2fe78bSCy Schubert DWORD Leash_get_hide_kinit_options();
185*7f2fe78bSCy Schubert DWORD Leash_set_hide_kinit_options(DWORD onoff);
186*7f2fe78bSCy Schubert DWORD Leash_reset_hide_kinit_options();
187*7f2fe78bSCy Schubert DWORD Leash_get_default_life_min();
188*7f2fe78bSCy Schubert DWORD Leash_set_default_life_min(DWORD minutes);
189*7f2fe78bSCy Schubert DWORD Leash_reset_default_life_min();
190*7f2fe78bSCy Schubert DWORD Leash_get_default_life_max();
191*7f2fe78bSCy Schubert DWORD Leash_set_default_life_max(DWORD minutes);
192*7f2fe78bSCy Schubert DWORD Leash_reset_default_life_max();
193*7f2fe78bSCy Schubert DWORD Leash_get_default_renew_min();
194*7f2fe78bSCy Schubert DWORD Leash_set_default_renew_min(DWORD minutes);
195*7f2fe78bSCy Schubert DWORD Leash_reset_default_renew_min();
196*7f2fe78bSCy Schubert DWORD Leash_get_default_renew_max();
197*7f2fe78bSCy Schubert DWORD Leash_set_default_renew_max(DWORD minutes);
198*7f2fe78bSCy Schubert DWORD Leash_reset_default_renew_max();
199*7f2fe78bSCy Schubert DWORD Leash_get_default_uppercaserealm();
200*7f2fe78bSCy Schubert DWORD Leash_set_default_uppercaserealm(DWORD onoff);
201*7f2fe78bSCy Schubert DWORD Leash_reset_default_uppercaserealm();
202*7f2fe78bSCy Schubert DWORD Leash_get_default_mslsa_import();
203*7f2fe78bSCy Schubert DWORD Leash_set_default_mslsa_import(DWORD onoffmatch);
204*7f2fe78bSCy Schubert DWORD Leash_reset_default_mslsa_import();
205*7f2fe78bSCy Schubert DWORD Leash_get_default_preserve_kinit_settings();
206*7f2fe78bSCy Schubert DWORD Leash_set_default_preserve_kinit_settings(DWORD onoff);
207*7f2fe78bSCy Schubert DWORD Leash_reset_default_preserve_kinit_settings();
208*7f2fe78bSCy Schubert #ifdef __cplusplus
209*7f2fe78bSCy Schubert }
210*7f2fe78bSCy Schubert #endif
211*7f2fe78bSCy Schubert 
212*7f2fe78bSCy Schubert #endif /* LEASHWIN */
213