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