xref: /minix3/crypto/external/bsd/heimdal/dist/doc/init-creds (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel SambucCurrently, getting an initial ticket for a user involves many function
2*ebfedea0SLionel Sambuccalls, especially when a full set of features including password
3*ebfedea0SLionel Sambucexpiration and challenge preauthentication is desired.  In order to
4*ebfedea0SLionel Sambucsolve this problem, a new api is proposed.
5*ebfedea0SLionel Sambuc
6*ebfedea0SLionel Sambuctypedef struct _krb5_prompt {
7*ebfedea0SLionel Sambuc    char *prompt;
8*ebfedea0SLionel Sambuc    int hidden;
9*ebfedea0SLionel Sambuc    krb5_data *reply;
10*ebfedea0SLionel Sambuc} krb5_prompt;
11*ebfedea0SLionel Sambuc
12*ebfedea0SLionel Sambuctypedef int (*krb5_prompter_fct)(krb5_context context,
13*ebfedea0SLionel Sambuc				 void *data,
14*ebfedea0SLionel Sambuc				 const char *banner,
15*ebfedea0SLionel Sambuc				 int num_prompts,
16*ebfedea0SLionel Sambuc				 krb5_prompt prompts[]);
17*ebfedea0SLionel Sambuc
18*ebfedea0SLionel Sambuctypedef struct _krb5_get_init_creds_opt {
19*ebfedea0SLionel Sambuc    krb5_flags flags;
20*ebfedea0SLionel Sambuc    krb5_deltat tkt_life;
21*ebfedea0SLionel Sambuc    krb5_deltat renew_life;
22*ebfedea0SLionel Sambuc    int forwardable;
23*ebfedea0SLionel Sambuc    int proxiable;
24*ebfedea0SLionel Sambuc    krb5_enctype *etype_list;
25*ebfedea0SLionel Sambuc    int etype_list_length;
26*ebfedea0SLionel Sambuc    krb5_address **address_list;
27*ebfedea0SLionel Sambuc	/* XXX the next three should not be used, as they may be
28*ebfedea0SLionel Sambuc	removed later */
29*ebfedea0SLionel Sambuc    krb5_preauthtype *preauth_list;
30*ebfedea0SLionel Sambuc    int preauth_list_length;
31*ebfedea0SLionel Sambuc    krb5_data *salt;
32*ebfedea0SLionel Sambuc} krb5_get_init_creds_opt;
33*ebfedea0SLionel Sambuc
34*ebfedea0SLionel Sambuc#define KRB5_GET_INIT_CREDS_OPT_TKT_LIFE	0x0001
35*ebfedea0SLionel Sambuc#define KRB5_GET_INIT_CREDS_OPT_RENEW_LIFE	0x0002
36*ebfedea0SLionel Sambuc#define KRB5_GET_INIT_CREDS_OPT_FORWARDABLE	0x0004
37*ebfedea0SLionel Sambuc#define KRB5_GET_INIT_CREDS_OPT_PROXIABLE	0x0008
38*ebfedea0SLionel Sambuc#define KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST	0x0010
39*ebfedea0SLionel Sambuc#define KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST	0x0020
40*ebfedea0SLionel Sambuc#define KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST	0x0040
41*ebfedea0SLionel Sambuc#define KRB5_GET_INIT_CREDS_OPT_SALT		0x0080
42*ebfedea0SLionel Sambuc
43*ebfedea0SLionel Sambucvoid krb5_get_init_creds_opt_init(krb5_get_init_creds_opt *opt);
44*ebfedea0SLionel Sambuc
45*ebfedea0SLionel Sambucvoid krb5_get_init_creds_opt_set_tkt_life(krb5_get_init_creds_opt *opt,
46*ebfedea0SLionel Sambuc					  krb5_deltat tkt_life);
47*ebfedea0SLionel Sambucvoid krb5_get_init_creds_opt_set_renew_life(krb5_get_init_creds_opt *opt,
48*ebfedea0SLionel Sambuc					    krb5_deltat renew_life);
49*ebfedea0SLionel Sambucvoid krb5_get_init_creds_opt_set_forwardable(krb5_get_init_creds_opt *opt,
50*ebfedea0SLionel Sambuc					     int forwardable);
51*ebfedea0SLionel Sambucvoid krb5_get_init_creds_opt_set_proxiable(krb5_get_init_creds_opt *opt,
52*ebfedea0SLionel Sambuc					   int proxiable);
53*ebfedea0SLionel Sambucvoid krb5_get_init_creds_opt_set_etype_list(krb5_get_init_creds_opt *opt,
54*ebfedea0SLionel Sambuc					    krb5_enctype *etype_list,
55*ebfedea0SLionel Sambuc					    int etype_list_length);
56*ebfedea0SLionel Sambucvoid krb5_get_init_creds_opt_set_address_list(krb5_get_init_creds_opt *opt,
57*ebfedea0SLionel Sambuc					      krb5_address **addresses);
58*ebfedea0SLionel Sambucvoid krb5_get_init_creds_opt_set_preauth_list(krb5_get_init_creds_opt *opt,
59*ebfedea0SLionel Sambuc					      krb5_preauthtype *preauth_list,
60*ebfedea0SLionel Sambuc					      int preauth_list_length);
61*ebfedea0SLionel Sambucvoid krb5_get_init_creds_opt_set_salt(krb5_get_init_creds_opt *opt,
62*ebfedea0SLionel Sambuc				      krb5_data *salt);
63*ebfedea0SLionel Sambuc
64*ebfedea0SLionel Sambuckrb5_error_code
65*ebfedea0SLionel Sambuckrb5_get_init_creds_password(krb5_context context,
66*ebfedea0SLionel Sambuc			     krb5_creds *creds,
67*ebfedea0SLionel Sambuc			     krb5_principal client,
68*ebfedea0SLionel Sambuc			     char *password,
69*ebfedea0SLionel Sambuc			     krb5_prompter_fct prompter,
70*ebfedea0SLionel Sambuc			     void *data,
71*ebfedea0SLionel Sambuc			     krb5_deltat start_time,
72*ebfedea0SLionel Sambuc			     char *in_tkt_service,
73*ebfedea0SLionel Sambuc			     krb5_get_init_creds_opt *options);
74*ebfedea0SLionel Sambuc
75*ebfedea0SLionel SambucThis function will attempt to acquire an initial ticket.  The function
76*ebfedea0SLionel Sambucwill perform whatever tasks are necessary to do so.  This may include
77*ebfedea0SLionel Sambucchanging an expired password, preauthentication.
78*ebfedea0SLionel Sambuc
79*ebfedea0SLionel SambucThe arguments divide into two types.  Some arguments are basically
80*ebfedea0SLionel Sambucinvariant and arbitrary across all initial tickets, and if not
81*ebfedea0SLionel Sambucspecified are determined by configuration or library defaults.  Some
82*ebfedea0SLionel Sambucarguments are different for each execution or application, and if not
83*ebfedea0SLionel Sambucspecified can be determined correctly from system configuration or
84*ebfedea0SLionel Sambucenvironment.  The former arguments are contained in a structure whose
85*ebfedea0SLionel Sambucpointer is passed to the function.  A bitmask specifies which elements
86*ebfedea0SLionel Sambucof the structure should be used.  In most cases, a NULL pointer can be
87*ebfedea0SLionel Sambucused.  The latter arguments are specified as individual arguments to
88*ebfedea0SLionel Sambucthe function.
89*ebfedea0SLionel Sambuc
90*ebfedea0SLionel SambucIf a pointer to a credential is specified, the initial credential is
91*ebfedea0SLionel Sambucfilled in.  If the caller only wishes to do a simple password check
92*ebfedea0SLionel Sambucand will not be doing any other kerberos functions, then a NULL
93*ebfedea0SLionel Sambucpointer may be specified, and the credential will be destroyed.
94*ebfedea0SLionel Sambuc
95*ebfedea0SLionel SambucIf the client name is non-NULL, the initial ticket requested will be
96*ebfedea0SLionel Sambucfor that principal.  Otherwise, the principal will be the username
97*ebfedea0SLionel Sambucspecified by the USER environment variable, or if the USER environment
98*ebfedea0SLionel Sambucvariable is not set, the username corresponding to the real user id of
99*ebfedea0SLionel Sambucthe caller.
100*ebfedea0SLionel Sambuc
101*ebfedea0SLionel SambucIf the password is non-NULL, then this string is used as the password.
102*ebfedea0SLionel SambucOtherwise, the prompter function will be used to prompt the user for
103*ebfedea0SLionel Sambucthe password.
104*ebfedea0SLionel Sambuc
105*ebfedea0SLionel SambucIf a prompter function is non-NULL, it will be used if additional user
106*ebfedea0SLionel Sambucinput is required, such as if the user's password has expired and
107*ebfedea0SLionel Sambucneeds to be changed, or if input preauthentication is necessary.  If
108*ebfedea0SLionel Sambucno function is specified and input is required, then the login will
109*ebfedea0SLionel Sambucfail.
110*ebfedea0SLionel Sambuc
111*ebfedea0SLionel Sambuc	The context argument is the same as that passed to krb5_login.
112*ebfedea0SLionel Sambuc	The data argument is passed unmodified to the prompter
113*ebfedea0SLionel Sambuc	function and is intended to be used to pass application data
114*ebfedea0SLionel Sambuc	(such as a display handle) to the prompter function.
115*ebfedea0SLionel Sambuc
116*ebfedea0SLionel Sambuc	The banner argument, if non-NULL, will indicate what sort of
117*ebfedea0SLionel Sambuc	input is expected from the user (for example, "Password has
118*ebfedea0SLionel Sambuc	expired and must be changed" or "Enter Activcard response for
119*ebfedea0SLionel Sambuc	challenge 012345678"), and should be displayed accordingly.
120*ebfedea0SLionel Sambuc
121*ebfedea0SLionel Sambuc	The num_prompts argument indicates the number of values which
122*ebfedea0SLionel Sambuc	should be prompted for.  If num_prompts == 0, then the banner
123*ebfedea0SLionel Sambuc	contains an informational message which should be displayed to
124*ebfedea0SLionel Sambuc	the user.
125*ebfedea0SLionel Sambuc
126*ebfedea0SLionel Sambuc	The prompts argument contains an array describing the values
127*ebfedea0SLionel Sambuc	for which the user should be prompted.  The prompt member
128*ebfedea0SLionel Sambuc	indicates the prompt for each value ("Enter new
129*ebfedea0SLionel Sambuc	password"/"Enter it again", or "Challenge response").  The
130*ebfedea0SLionel Sambuc	hidden member is nonzero if the response should not be
131*ebfedea0SLionel Sambuc	displayed back to the user.  The reply member is a pointer to
132*ebfedea0SLionel Sambuc	krb5_data structure which has already been allocated.  The
133*ebfedea0SLionel Sambuc	prompter should fill in the structure with the NUL-terminated
134*ebfedea0SLionel Sambuc	response from the user.
135*ebfedea0SLionel Sambuc
136*ebfedea0SLionel Sambuc	If the response data does not fit, or if any other error
137*ebfedea0SLionel Sambuc	occurs, then the prompter function should return a non-zero
138*ebfedea0SLionel Sambuc	value which will be returned by the krb5_get_init_creds
139*ebfedea0SLionel Sambuc	function. Otherwise, zero should be returned.
140*ebfedea0SLionel Sambuc
141*ebfedea0SLionel Sambuc	The library function krb5_prompter_posix() implements
142*ebfedea0SLionel Sambuc	a prompter using a posix terminal for user in.  This function
143*ebfedea0SLionel Sambuc	does not use the data argument.
144*ebfedea0SLionel Sambuc
145*ebfedea0SLionel SambucIf the start_time is zero, then the requested ticket will be valid
146*ebfedea0SLionel Sambucbeginning immediately.  Otherwise, the start_time indicates how far in
147*ebfedea0SLionel Sambucthe future the ticket should be postdated.
148*ebfedea0SLionel Sambuc
149*ebfedea0SLionel SambucIf the in_tkt_service name is non-NULL, that principal name will be
150*ebfedea0SLionel Sambucused as the server name for the initial ticket request.  The realm of
151*ebfedea0SLionel Sambucthe name specified will be ignored and will be set to the realm of the
152*ebfedea0SLionel Sambucclient name.  If no in_tkt_service name is specified,
153*ebfedea0SLionel Sambuckrbtgt/CLIENT-REALM@CLIENT-REALM will be used.
154*ebfedea0SLionel Sambuc
155*ebfedea0SLionel SambucFor the rest of arguments, a configuration or library default will be
156*ebfedea0SLionel Sambucused if no value is specified in the options structure.
157*ebfedea0SLionel Sambuc
158*ebfedea0SLionel SambucIf a tkt_life is specified, that will be the lifetime of the ticket.
159*ebfedea0SLionel SambucThe library default is 10 hours; there is no configuration variable
160*ebfedea0SLionel Sambuc(there should be, but it's not there now).
161*ebfedea0SLionel Sambuc
162*ebfedea0SLionel SambucIf a renew_life is specified and non-zero, then the RENEWABLE option
163*ebfedea0SLionel Sambucon the ticket will be set, and the value of the argument will be the
164*ebfedea0SLionel Sambucthe renewable lifetime.  The configuration variable [libdefaults]
165*ebfedea0SLionel Sambuc"renew_lifetime" is the renewable lifetime if none is passed in.  The
166*ebfedea0SLionel Sambuclibrary default is not to set the RENEWABLE option.
167*ebfedea0SLionel Sambuc
168*ebfedea0SLionel SambucIf forwardable is specified, the FORWARDABLE option on the ticket will
169*ebfedea0SLionel Sambucbe set if and only if forwardable is non-zero.  The configuration
170*ebfedea0SLionel Sambucvariable [libdefaults] "forwardable" is used if no value is passed in.
171*ebfedea0SLionel SambucThe option will be set if and only if the variable is "y", "yes",
172*ebfedea0SLionel Sambuc"true", "t", "1", or "on", case insensitive.  The library default is
173*ebfedea0SLionel Sambucnot to set the FORWARDABLE option.
174*ebfedea0SLionel Sambuc
175*ebfedea0SLionel SambucIf proxiable is specified, the PROXIABLE option on the ticket will be
176*ebfedea0SLionel Sambucset if and only if proxiable is non-zero.  The configuration variable
177*ebfedea0SLionel Sambuc[libdefaults] "proxiable" is used if no value is passed in.  The
178*ebfedea0SLionel Sambucoption will be set if and only if the variable is "y", "yes", "true",
179*ebfedea0SLionel Sambuc"t", "1", or "on", case insensitive.  The library default is not to
180*ebfedea0SLionel Sambucset the PROXIABLE option.
181*ebfedea0SLionel Sambuc
182*ebfedea0SLionel SambucIf etype_list is specified, it will be used as the list of desired
183*ebfedea0SLionel Sambucencryption algorithms in the request.  The configuration variable
184*ebfedea0SLionel Sambuc[libdefaults] "default_tkt_enctypes" is used if no value is passed in.
185*ebfedea0SLionel SambucThe library default is "des-cbc-md5 des-cbc-crc".
186*ebfedea0SLionel Sambuc
187*ebfedea0SLionel SambucIf address_list is specified, it will be used as the list of addresses
188*ebfedea0SLionel Sambucfor which the ticket will be valid.  The library default is to use all
189*ebfedea0SLionel Sambuclocal non-loopback addresses.  There is no configuration variable.
190*ebfedea0SLionel Sambuc
191*ebfedea0SLionel SambucIf preauth_list is specified, it names preauth data types which will
192*ebfedea0SLionel Sambucbe included in the request.  The library default is to interact with
193*ebfedea0SLionel Sambucthe kdc to determine the required preauth types.  There is no
194*ebfedea0SLionel Sambucconfiguration variable.
195*ebfedea0SLionel Sambuc
196*ebfedea0SLionel SambucIf salt is specified, it specifies the salt which will be used when
197*ebfedea0SLionel Sambucconverting the password to a key.  The library default is to interact
198*ebfedea0SLionel Sambucwith the kdc to determine the correct salt.  There is no configuration
199*ebfedea0SLionel Sambucvariable.
200*ebfedea0SLionel Sambuc
201*ebfedea0SLionel Sambuc================================================================
202*ebfedea0SLionel Sambuc
203*ebfedea0SLionel Sambuctypedef struct _krb5_verify_init_creds_opt {
204*ebfedea0SLionel Sambuc    krb5_flags flags;
205*ebfedea0SLionel Sambuc    int ap_req_nofail;
206*ebfedea0SLionel Sambuc} krb5_verify_init_creds_opt;
207*ebfedea0SLionel Sambuc
208*ebfedea0SLionel Sambuc#define KRB5_VERIFY_INIT_CREDS_OPT_AP_REQ_NOFAIL	0x0001
209*ebfedea0SLionel Sambuc
210*ebfedea0SLionel Sambucvoid krb5_verify_init_creds_opt_init(krb5_init_creds_opt *options);
211*ebfedea0SLionel Sambucvoid krb5_verify_init_creds_opt_set_ap_req_nofail(krb5_init_creds_opt *options,
212*ebfedea0SLionel Sambuc						  int ap_req_nofail);
213*ebfedea0SLionel Sambuc
214*ebfedea0SLionel Sambuckrb5_error_code
215*ebfedea0SLionel Sambuckrb5_verify_init_creds(krb5_context context,
216*ebfedea0SLionel Sambuc		       krb5_creds *creds,
217*ebfedea0SLionel Sambuc		       krb5_principal ap_req_server,
218*ebfedea0SLionel Sambuc		       krb5_keytab ap_req_keytab,
219*ebfedea0SLionel Sambuc		       krb5_ccache *ccache,
220*ebfedea0SLionel Sambuc		       krb5_verify_init_creds_opt *options);
221*ebfedea0SLionel Sambuc
222*ebfedea0SLionel SambucThis function will use the initial ticket in creds to make an AP_REQ
223*ebfedea0SLionel Sambucand verify it to insure that the AS_REP has not been spoofed.
224*ebfedea0SLionel Sambuc
225*ebfedea0SLionel SambucIf the ap_req_server name is non-NULL, then this service name will be
226*ebfedea0SLionel Sambucused for the AP_REQ; otherwise, the default host key
227*ebfedea0SLionel Sambuc(host/hostname.domain@LOCAL-REALM) will be used.
228*ebfedea0SLionel Sambuc
229*ebfedea0SLionel SambucIf ap_req_keytab is non-NULL, the service key for the verification
230*ebfedea0SLionel Sambucwill be read from that keytab; otherwise, the service key will be read
231*ebfedea0SLionel Sambucfrom the default keytab.
232*ebfedea0SLionel Sambuc
233*ebfedea0SLionel SambucIf the service of the ticket in creds is the same as the service name
234*ebfedea0SLionel Sambucfor the AP_REQ, then this ticket will be used directly.  If the ticket
235*ebfedea0SLionel Sambucis a tgt, then it will be used to obtain credentials for the service.
236*ebfedea0SLionel SambucOtherwise, the verification will fail, and return an error.
237*ebfedea0SLionel Sambuc
238*ebfedea0SLionel SambucOther failures of the AP_REQ verification may or may not be considered
239*ebfedea0SLionel Sambucerrors, as described below.
240*ebfedea0SLionel Sambuc
241*ebfedea0SLionel SambucIf a pointer to a credential cache handle is specified, and the handle
242*ebfedea0SLionel Sambucis NULL, a credential cache handle referring to all credentials
243*ebfedea0SLionel Sambucobtained in the course of verifying the user will be returned.  In
244*ebfedea0SLionel Sambucorder to avoid potential setuid race conditions and other problems
245*ebfedea0SLionel Sambucrelated to file system access, this handle will refer to a memory
246*ebfedea0SLionel Sambuccredential cache.  If the handle is non-NULL, then the credentials
247*ebfedea0SLionel Sambucwill be added to the existing ccache.  If the caller only wishes to
248*ebfedea0SLionel Sambucverify the password and will not be doing any other kerberos
249*ebfedea0SLionel Sambucfunctions, then a NULL pointer may be specified, and the credentials
250*ebfedea0SLionel Sambucwill be deleted before the function returns.
251*ebfedea0SLionel Sambuc
252*ebfedea0SLionel SambucIf ap_req_nofail is specified, then failures of the AP_REQ
253*ebfedea0SLionel Sambucverification are considered errors if and only if ap_req_nofail is
254*ebfedea0SLionel Sambucnon-zero.
255*ebfedea0SLionel Sambuc
256*ebfedea0SLionel SambucWhether or not AP_REQ validation is performed and what failures mean
257*ebfedea0SLionel Sambucdepends on these inputs:
258*ebfedea0SLionel Sambuc
259*ebfedea0SLionel Sambuc A) The appropriate keytab exists and contains the named key.
260*ebfedea0SLionel Sambuc
261*ebfedea0SLionel Sambuc B) An AP_REQ request to the kdc succeeds, and the resulting AP_REQ
262*ebfedea0SLionel Sambuccan be decrypted and verified.
263*ebfedea0SLionel Sambuc
264*ebfedea0SLionel Sambuc C) The administrator has specified in a configuration file that
265*ebfedea0SLionel SambucAP_REQ validation must succeed.  This is basically a paranoid bit, and
266*ebfedea0SLionel Sambuccan be overridden by the application based on a command line flag or
267*ebfedea0SLionel Sambucother application-specific info.  This flag is especially useful if
268*ebfedea0SLionel Sambucthe admin is concerned that DNS might be spoofed while determining the
269*ebfedea0SLionel Sambuchost/FQDN name.  The configuration variable [libdefaults]
270*ebfedea0SLionel Sambuc"verify_ap_req_nofail" is used if no value is passed in.  The library
271*ebfedea0SLionel Sambucdefault is not to set this option.
272*ebfedea0SLionel Sambuc
273*ebfedea0SLionel SambucInitial ticket verification will succeed if and only if:
274*ebfedea0SLionel Sambuc
275*ebfedea0SLionel Sambuc - A && B    or
276*ebfedea0SLionel Sambuc - !A && !C
277*ebfedea0SLionel Sambuc
278*ebfedea0SLionel Sambuc================================================================
279*ebfedea0SLionel Sambuc
280*ebfedea0SLionel SambucFor illustrative purposes, here's the invocations I expect some
281*ebfedea0SLionel Sambucprograms will use.  Of course, error checking needs to be added.
282*ebfedea0SLionel Sambuc
283*ebfedea0SLionel Sambuckinit:
284*ebfedea0SLionel Sambuc
285*ebfedea0SLionel Sambuc    /* Fill in client from the command line || existing ccache, and,
286*ebfedea0SLionel Sambuc       start_time, and options.{tkt_life,renew_life,forwardable,proxiable}
287*ebfedea0SLionel Sambuc       from the command line.  Some or all may remain unset. */
288*ebfedea0SLionel Sambuc
289*ebfedea0SLionel Sambuc    krb5_get_init_creds(context, &creds, client,
290*ebfedea0SLionel Sambuc			krb5_initial_prompter_posix, NULL,
291*ebfedea0SLionel Sambuc			start_time, NULL, &options);
292*ebfedea0SLionel Sambuc    krb5_cc_store_cred(context, ccache, &creds);
293*ebfedea0SLionel Sambuc    krb5_free_cred_contents(context, &creds);
294*ebfedea0SLionel Sambuc
295*ebfedea0SLionel Sambuclogin:
296*ebfedea0SLionel Sambuc
297*ebfedea0SLionel Sambuc    krb5_get_init_creds(context, &creds, client,
298*ebfedea0SLionel Sambuc			krb5_initial_prompter_posix, NULL,
299*ebfedea0SLionel Sambuc			0, NULL, NULL);
300*ebfedea0SLionel Sambuc    krb5_verify_init_creds(context, &creds, NULL, NULL, &vcc, NULL);
301*ebfedea0SLionel Sambuc    /* setuid */
302*ebfedea0SLionel Sambuc    krb5_cc_store_cred(context, ccache, &creds);
303*ebfedea0SLionel Sambuc    krb5_cc_copy(context, vcc, ccache);
304*ebfedea0SLionel Sambuc    krb5_free_cred_contents(context, &creds);
305*ebfedea0SLionel Sambuc    krb5_cc_destroy(context, vcc);
306*ebfedea0SLionel Sambuc
307*ebfedea0SLionel Sambucxdm:
308*ebfedea0SLionel Sambuc
309*ebfedea0SLionel Sambuc    krb5_get_initial_creds(context, &creds, client,
310*ebfedea0SLionel Sambuc			   krb5_initial_prompter_xt, (void *) &xtstuff,
311*ebfedea0SLionel Sambuc			   0, NULL, NULL);
312*ebfedea0SLionel Sambuc    krb5_verify_init_creds(context, &creds, NULL, NULL, &vcc, NULL);
313*ebfedea0SLionel Sambuc    /* setuid */
314*ebfedea0SLionel Sambuc    krb5_cc_store_cred(context, ccache, &creds);
315*ebfedea0SLionel Sambuc    krb5_free_cred_contents(context, &creds);
316*ebfedea0SLionel Sambuc    krb5_cc_copy(context, vcc, ccache);
317*ebfedea0SLionel Sambuc    krb5_cc_destroy(context, vcc);
318*ebfedea0SLionel Sambuc
319*ebfedea0SLionel Sambucpasswd:
320*ebfedea0SLionel Sambuc
321*ebfedea0SLionel Sambuc    krb5_init_creds_opt_init(&options);
322*ebfedea0SLionel Sambuc    krb5_init_creds_opt_set_tkt_life = 300;
323*ebfedea0SLionel Sambuc    krb5_get_initial_creds(context, &creds, client,
324*ebfedea0SLionel Sambuc			   krb5_initial_prompter_posix, NULL,
325*ebfedea0SLionel Sambuc			   0, "kadmin/changepw", &options);
326*ebfedea0SLionel Sambuc    /* change password */
327*ebfedea0SLionel Sambuc    krb5_free_cred_contents(context, &creds);
328*ebfedea0SLionel Sambuc
329*ebfedea0SLionel Sambucpop3d (simple password validator when no user interation possible):
330*ebfedea0SLionel Sambuc
331*ebfedea0SLionel Sambuc    krb5_get_initial_creds(context, &creds, client,
332*ebfedea0SLionel Sambuc			   NULL, NULL, 0, NULL, NULL);
333*ebfedea0SLionel Sambuc    krb5_verify_init_creds(context, &creds, NULL, NULL, &vcc, NULL);
334*ebfedea0SLionel Sambuc    krb5_cc_destroy(context, vcc);
335*ebfedea0SLionel Sambuc
336*ebfedea0SLionel Sambuc================================================================
337*ebfedea0SLionel Sambuc
338*ebfedea0SLionel Sambucpassword expiration has a subtlety.  When a password expires and is
339*ebfedea0SLionel Sambucchanged, there is a delay between when the master gets the new key
340*ebfedea0SLionel Sambuc(immediately), and the slaves (propogation interval).  So, when
341*ebfedea0SLionel Sambucgetting an in_tkt, if the password is expired, the request should be
342*ebfedea0SLionel Sambucreissued to the master (this kind of sucks if you have SAM, oh well).
343*ebfedea0SLionel SambucIf this says expired, too, then the password should be changed, and
344*ebfedea0SLionel Sambucthen the initial ticket request should be issued to the master again.
345*ebfedea0SLionel SambucIf the master times out, then a message that the password has expired
346*ebfedea0SLionel Sambucand cannot be changed due to the master being unreachable should be
347*ebfedea0SLionel Sambucdisplayed.
348*ebfedea0SLionel Sambuc
349*ebfedea0SLionel Sambuc================================================================
350*ebfedea0SLionel Sambuc
351*ebfedea0SLionel Sambucget_init_creds reads config stuff from:
352*ebfedea0SLionel Sambuc
353*ebfedea0SLionel Sambuc[libdefaults]
354*ebfedea0SLionel Sambuc	varname1 = defvalue
355*ebfedea0SLionel Sambuc	REALM = {
356*ebfedea0SLionel Sambuc		varname1 = value
357*ebfedea0SLionel Sambuc		varname2 = value
358*ebfedea0SLionel Sambuc	}
359*ebfedea0SLionel Sambuc
360*ebfedea0SLionel Sambuctypedef struct _krb5_get_init_creds_opt {
361*ebfedea0SLionel Sambuc    krb5_flags flags;
362*ebfedea0SLionel Sambuc    krb5_deltat tkt_life;	/* varname = "ticket_lifetime" */
363*ebfedea0SLionel Sambuc    krb5_deltat renew_life;	/* varname = "renew_lifetime" */
364*ebfedea0SLionel Sambuc    int forwardable;		/* varname = "forwardable" */
365*ebfedea0SLionel Sambuc    int proxiable;		/* varname = "proxiable" */
366*ebfedea0SLionel Sambuc    krb5_enctype *etype_list;	/* varname = "default_tkt_enctypes" */
367*ebfedea0SLionel Sambuc    int etype_list_length;
368*ebfedea0SLionel Sambuc    krb5_address **address_list; /* no varname */
369*ebfedea0SLionel Sambuc    krb5_preauthtype *preauth_list; /* no varname */
370*ebfedea0SLionel Sambuc    int preauth_list_length;
371*ebfedea0SLionel Sambuc    krb5_data *salt;
372*ebfedea0SLionel Sambuc} krb5_get_init_creds_opt;
373*ebfedea0SLionel Sambuc
374*ebfedea0SLionel Sambuc
375