1*0a6a1f1dSLionel Sambuc /* $NetBSD: deprecated.c,v 1.1.1.2 2014/04/24 12:45:49 pettai Exp $ */
2ebfedea0SLionel Sambuc
3ebfedea0SLionel Sambuc /*
4ebfedea0SLionel Sambuc * Copyright (c) 1997 - 2009 Kungliga Tekniska H�gskolan
5ebfedea0SLionel Sambuc * (Royal Institute of Technology, Stockholm, Sweden).
6ebfedea0SLionel Sambuc * All rights reserved.
7ebfedea0SLionel Sambuc *
8ebfedea0SLionel Sambuc * Redistribution and use in source and binary forms, with or without
9ebfedea0SLionel Sambuc * modification, are permitted provided that the following conditions
10ebfedea0SLionel Sambuc * are met:
11ebfedea0SLionel Sambuc *
12ebfedea0SLionel Sambuc * 1. Redistributions of source code must retain the above copyright
13ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer.
14ebfedea0SLionel Sambuc *
15ebfedea0SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
16ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer in the
17ebfedea0SLionel Sambuc * documentation and/or other materials provided with the distribution.
18ebfedea0SLionel Sambuc *
19ebfedea0SLionel Sambuc * 3. Neither the name of the Institute nor the names of its contributors
20ebfedea0SLionel Sambuc * may be used to endorse or promote products derived from this software
21ebfedea0SLionel Sambuc * without specific prior written permission.
22ebfedea0SLionel Sambuc *
23ebfedea0SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24ebfedea0SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25ebfedea0SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ebfedea0SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27ebfedea0SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28ebfedea0SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29ebfedea0SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30ebfedea0SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31ebfedea0SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32ebfedea0SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33ebfedea0SLionel Sambuc * SUCH DAMAGE.
34ebfedea0SLionel Sambuc */
35ebfedea0SLionel Sambuc
36*0a6a1f1dSLionel Sambuc #ifdef __GNUC__
37*0a6a1f1dSLionel Sambuc /* For some GCCs there's no way to shut them up about deprecated functions */
38*0a6a1f1dSLionel Sambuc #define KRB5_DEPRECATED_FUNCTION(x)
39*0a6a1f1dSLionel Sambuc #endif
40ebfedea0SLionel Sambuc
41ebfedea0SLionel Sambuc #include "krb5_locl.h"
42ebfedea0SLionel Sambuc
43ebfedea0SLionel Sambuc #undef __attribute__
44ebfedea0SLionel Sambuc #define __attribute__(x)
45ebfedea0SLionel Sambuc
46ebfedea0SLionel Sambuc #ifndef HEIMDAL_SMALLER
47ebfedea0SLionel Sambuc
48ebfedea0SLionel Sambuc /**
49ebfedea0SLionel Sambuc * Same as krb5_data_free(). MIT compat.
50ebfedea0SLionel Sambuc *
51ebfedea0SLionel Sambuc * Deprecated: use krb5_data_free().
52ebfedea0SLionel Sambuc *
53ebfedea0SLionel Sambuc * @param context Kerberos 5 context.
54ebfedea0SLionel Sambuc * @param data krb5_data to free.
55ebfedea0SLionel Sambuc *
56ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
57ebfedea0SLionel Sambuc */
58ebfedea0SLionel Sambuc
59ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_free_data_contents(krb5_context context,krb5_data * data)60ebfedea0SLionel Sambuc krb5_free_data_contents(krb5_context context, krb5_data *data)
61*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
62ebfedea0SLionel Sambuc {
63ebfedea0SLionel Sambuc krb5_data_free(data);
64ebfedea0SLionel Sambuc }
65ebfedea0SLionel Sambuc
66ebfedea0SLionel Sambuc /**
67ebfedea0SLionel Sambuc * Deprecated: keytypes doesn't exists, they are really enctypes.
68ebfedea0SLionel Sambuc *
69ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
70ebfedea0SLionel Sambuc */
71ebfedea0SLionel Sambuc
72ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_keytype_to_enctypes_default(krb5_context context,krb5_keytype keytype,unsigned * len,krb5_enctype ** val)73ebfedea0SLionel Sambuc krb5_keytype_to_enctypes_default (krb5_context context,
74ebfedea0SLionel Sambuc krb5_keytype keytype,
75ebfedea0SLionel Sambuc unsigned *len,
76ebfedea0SLionel Sambuc krb5_enctype **val)
77*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
78ebfedea0SLionel Sambuc {
79ebfedea0SLionel Sambuc unsigned int i, n;
80ebfedea0SLionel Sambuc krb5_enctype *ret;
81ebfedea0SLionel Sambuc
82ebfedea0SLionel Sambuc if (keytype != KEYTYPE_DES || context->etypes_des == NULL)
83ebfedea0SLionel Sambuc return krb5_keytype_to_enctypes (context, keytype, len, val);
84ebfedea0SLionel Sambuc
85ebfedea0SLionel Sambuc for (n = 0; context->etypes_des[n]; ++n)
86ebfedea0SLionel Sambuc ;
87ebfedea0SLionel Sambuc ret = malloc (n * sizeof(*ret));
88ebfedea0SLionel Sambuc if (ret == NULL && n != 0) {
89ebfedea0SLionel Sambuc krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
90ebfedea0SLionel Sambuc return ENOMEM;
91ebfedea0SLionel Sambuc }
92ebfedea0SLionel Sambuc for (i = 0; i < n; ++i)
93ebfedea0SLionel Sambuc ret[i] = context->etypes_des[i];
94ebfedea0SLionel Sambuc *len = n;
95ebfedea0SLionel Sambuc *val = ret;
96ebfedea0SLionel Sambuc return 0;
97ebfedea0SLionel Sambuc }
98ebfedea0SLionel Sambuc
99ebfedea0SLionel Sambuc
100ebfedea0SLionel Sambuc static struct {
101ebfedea0SLionel Sambuc const char *name;
102ebfedea0SLionel Sambuc krb5_keytype type;
103ebfedea0SLionel Sambuc } keys[] = {
104ebfedea0SLionel Sambuc { "null", ENCTYPE_NULL },
105ebfedea0SLionel Sambuc { "des", ETYPE_DES_CBC_CRC },
106ebfedea0SLionel Sambuc { "des3", ETYPE_OLD_DES3_CBC_SHA1 },
107ebfedea0SLionel Sambuc { "aes-128", ETYPE_AES128_CTS_HMAC_SHA1_96 },
108ebfedea0SLionel Sambuc { "aes-256", ETYPE_AES256_CTS_HMAC_SHA1_96 },
109ebfedea0SLionel Sambuc { "arcfour", ETYPE_ARCFOUR_HMAC_MD5 },
110ebfedea0SLionel Sambuc { "arcfour-56", ETYPE_ARCFOUR_HMAC_MD5_56 }
111ebfedea0SLionel Sambuc };
112ebfedea0SLionel Sambuc
113ebfedea0SLionel Sambuc static int num_keys = sizeof(keys) / sizeof(keys[0]);
114ebfedea0SLionel Sambuc
115ebfedea0SLionel Sambuc /**
116ebfedea0SLionel Sambuc * Deprecated: keytypes doesn't exists, they are really enctypes in
117ebfedea0SLionel Sambuc * most cases, use krb5_enctype_to_string().
118ebfedea0SLionel Sambuc *
119ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
120ebfedea0SLionel Sambuc */
121ebfedea0SLionel Sambuc
122ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_keytype_to_string(krb5_context context,krb5_keytype keytype,char ** string)123ebfedea0SLionel Sambuc krb5_keytype_to_string(krb5_context context,
124ebfedea0SLionel Sambuc krb5_keytype keytype,
125ebfedea0SLionel Sambuc char **string)
126*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
127ebfedea0SLionel Sambuc {
128*0a6a1f1dSLionel Sambuc const char *name = NULL;
129ebfedea0SLionel Sambuc int i;
130ebfedea0SLionel Sambuc
131ebfedea0SLionel Sambuc for(i = 0; i < num_keys; i++) {
132ebfedea0SLionel Sambuc if(keys[i].type == keytype) {
133ebfedea0SLionel Sambuc name = keys[i].name;
134ebfedea0SLionel Sambuc break;
135ebfedea0SLionel Sambuc }
136ebfedea0SLionel Sambuc }
137ebfedea0SLionel Sambuc
138ebfedea0SLionel Sambuc if(i >= num_keys) {
139ebfedea0SLionel Sambuc krb5_set_error_message(context, KRB5_PROG_KEYTYPE_NOSUPP,
140ebfedea0SLionel Sambuc "key type %d not supported", keytype);
141ebfedea0SLionel Sambuc return KRB5_PROG_KEYTYPE_NOSUPP;
142ebfedea0SLionel Sambuc }
143ebfedea0SLionel Sambuc *string = strdup(name);
144ebfedea0SLionel Sambuc if(*string == NULL) {
145ebfedea0SLionel Sambuc krb5_set_error_message(context, ENOMEM,
146ebfedea0SLionel Sambuc N_("malloc: out of memory", ""));
147ebfedea0SLionel Sambuc return ENOMEM;
148ebfedea0SLionel Sambuc }
149ebfedea0SLionel Sambuc return 0;
150ebfedea0SLionel Sambuc }
151ebfedea0SLionel Sambuc
152ebfedea0SLionel Sambuc /**
153ebfedea0SLionel Sambuc * Deprecated: keytypes doesn't exists, they are really enctypes in
154ebfedea0SLionel Sambuc * most cases, use krb5_string_to_enctype().
155ebfedea0SLionel Sambuc *
156ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
157ebfedea0SLionel Sambuc */
158ebfedea0SLionel Sambuc
159ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_string_to_keytype(krb5_context context,const char * string,krb5_keytype * keytype)160ebfedea0SLionel Sambuc krb5_string_to_keytype(krb5_context context,
161ebfedea0SLionel Sambuc const char *string,
162ebfedea0SLionel Sambuc krb5_keytype *keytype)
163*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
164ebfedea0SLionel Sambuc {
165ebfedea0SLionel Sambuc char *end;
166ebfedea0SLionel Sambuc int i;
167ebfedea0SLionel Sambuc
168ebfedea0SLionel Sambuc for(i = 0; i < num_keys; i++)
169ebfedea0SLionel Sambuc if(strcasecmp(keys[i].name, string) == 0){
170ebfedea0SLionel Sambuc *keytype = keys[i].type;
171ebfedea0SLionel Sambuc return 0;
172ebfedea0SLionel Sambuc }
173ebfedea0SLionel Sambuc
174ebfedea0SLionel Sambuc /* check if the enctype is a number */
175ebfedea0SLionel Sambuc *keytype = strtol(string, &end, 0);
176ebfedea0SLionel Sambuc if(*end == '\0' && *keytype != 0) {
177ebfedea0SLionel Sambuc if (krb5_enctype_valid(context, *keytype) == 0)
178ebfedea0SLionel Sambuc return 0;
179ebfedea0SLionel Sambuc }
180ebfedea0SLionel Sambuc
181ebfedea0SLionel Sambuc krb5_set_error_message(context, KRB5_PROG_KEYTYPE_NOSUPP,
182ebfedea0SLionel Sambuc "key type %s not supported", string);
183ebfedea0SLionel Sambuc return KRB5_PROG_KEYTYPE_NOSUPP;
184ebfedea0SLionel Sambuc }
185ebfedea0SLionel Sambuc
186ebfedea0SLionel Sambuc /**
187ebfedea0SLionel Sambuc * Deprecated: use krb5_get_init_creds() and friends.
188ebfedea0SLionel Sambuc *
189ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
190ebfedea0SLionel Sambuc */
191ebfedea0SLionel Sambuc
192ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_CALLCONV
krb5_password_key_proc(krb5_context context,krb5_enctype type,krb5_salt salt,krb5_const_pointer keyseed,krb5_keyblock ** key)193ebfedea0SLionel Sambuc krb5_password_key_proc (krb5_context context,
194ebfedea0SLionel Sambuc krb5_enctype type,
195ebfedea0SLionel Sambuc krb5_salt salt,
196ebfedea0SLionel Sambuc krb5_const_pointer keyseed,
197ebfedea0SLionel Sambuc krb5_keyblock **key)
198*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
199ebfedea0SLionel Sambuc {
200ebfedea0SLionel Sambuc krb5_error_code ret;
201ebfedea0SLionel Sambuc const char *password = (const char *)keyseed;
202ebfedea0SLionel Sambuc char buf[BUFSIZ];
203ebfedea0SLionel Sambuc
204ebfedea0SLionel Sambuc *key = malloc (sizeof (**key));
205ebfedea0SLionel Sambuc if (*key == NULL) {
206ebfedea0SLionel Sambuc krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
207ebfedea0SLionel Sambuc return ENOMEM;
208ebfedea0SLionel Sambuc }
209ebfedea0SLionel Sambuc if (password == NULL) {
210ebfedea0SLionel Sambuc if(UI_UTIL_read_pw_string (buf, sizeof(buf), "Password: ", 0)) {
211ebfedea0SLionel Sambuc free (*key);
212ebfedea0SLionel Sambuc krb5_clear_error_message(context);
213ebfedea0SLionel Sambuc return KRB5_LIBOS_PWDINTR;
214ebfedea0SLionel Sambuc }
215ebfedea0SLionel Sambuc password = buf;
216ebfedea0SLionel Sambuc }
217ebfedea0SLionel Sambuc ret = krb5_string_to_key_salt (context, type, password, salt, *key);
218ebfedea0SLionel Sambuc memset (buf, 0, sizeof(buf));
219ebfedea0SLionel Sambuc return ret;
220ebfedea0SLionel Sambuc }
221ebfedea0SLionel Sambuc
222ebfedea0SLionel Sambuc /**
223ebfedea0SLionel Sambuc * Deprecated: use krb5_get_init_creds() and friends.
224ebfedea0SLionel Sambuc *
225ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
226ebfedea0SLionel Sambuc */
227ebfedea0SLionel Sambuc
228ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_in_tkt_with_password(krb5_context context,krb5_flags options,krb5_addresses * addrs,const krb5_enctype * etypes,const krb5_preauthtype * pre_auth_types,const char * password,krb5_ccache ccache,krb5_creds * creds,krb5_kdc_rep * ret_as_reply)229ebfedea0SLionel Sambuc krb5_get_in_tkt_with_password (krb5_context context,
230ebfedea0SLionel Sambuc krb5_flags options,
231ebfedea0SLionel Sambuc krb5_addresses *addrs,
232ebfedea0SLionel Sambuc const krb5_enctype *etypes,
233ebfedea0SLionel Sambuc const krb5_preauthtype *pre_auth_types,
234ebfedea0SLionel Sambuc const char *password,
235ebfedea0SLionel Sambuc krb5_ccache ccache,
236ebfedea0SLionel Sambuc krb5_creds *creds,
237ebfedea0SLionel Sambuc krb5_kdc_rep *ret_as_reply)
238*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
239ebfedea0SLionel Sambuc {
240ebfedea0SLionel Sambuc return krb5_get_in_tkt (context,
241ebfedea0SLionel Sambuc options,
242ebfedea0SLionel Sambuc addrs,
243ebfedea0SLionel Sambuc etypes,
244ebfedea0SLionel Sambuc pre_auth_types,
245ebfedea0SLionel Sambuc krb5_password_key_proc,
246ebfedea0SLionel Sambuc password,
247ebfedea0SLionel Sambuc NULL,
248ebfedea0SLionel Sambuc NULL,
249ebfedea0SLionel Sambuc creds,
250ebfedea0SLionel Sambuc ccache,
251ebfedea0SLionel Sambuc ret_as_reply);
252ebfedea0SLionel Sambuc }
253ebfedea0SLionel Sambuc
254ebfedea0SLionel Sambuc static krb5_error_code KRB5_CALLCONV
krb5_skey_key_proc(krb5_context context,krb5_enctype type,krb5_salt salt,krb5_const_pointer keyseed,krb5_keyblock ** key)255ebfedea0SLionel Sambuc krb5_skey_key_proc (krb5_context context,
256ebfedea0SLionel Sambuc krb5_enctype type,
257ebfedea0SLionel Sambuc krb5_salt salt,
258ebfedea0SLionel Sambuc krb5_const_pointer keyseed,
259ebfedea0SLionel Sambuc krb5_keyblock **key)
260ebfedea0SLionel Sambuc {
261ebfedea0SLionel Sambuc return krb5_copy_keyblock (context, keyseed, key);
262ebfedea0SLionel Sambuc }
263ebfedea0SLionel Sambuc
264ebfedea0SLionel Sambuc /**
265ebfedea0SLionel Sambuc * Deprecated: use krb5_get_init_creds() and friends.
266ebfedea0SLionel Sambuc *
267ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
268ebfedea0SLionel Sambuc */
269ebfedea0SLionel Sambuc
270ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_in_tkt_with_skey(krb5_context context,krb5_flags options,krb5_addresses * addrs,const krb5_enctype * etypes,const krb5_preauthtype * pre_auth_types,const krb5_keyblock * key,krb5_ccache ccache,krb5_creds * creds,krb5_kdc_rep * ret_as_reply)271ebfedea0SLionel Sambuc krb5_get_in_tkt_with_skey (krb5_context context,
272ebfedea0SLionel Sambuc krb5_flags options,
273ebfedea0SLionel Sambuc krb5_addresses *addrs,
274ebfedea0SLionel Sambuc const krb5_enctype *etypes,
275ebfedea0SLionel Sambuc const krb5_preauthtype *pre_auth_types,
276ebfedea0SLionel Sambuc const krb5_keyblock *key,
277ebfedea0SLionel Sambuc krb5_ccache ccache,
278ebfedea0SLionel Sambuc krb5_creds *creds,
279ebfedea0SLionel Sambuc krb5_kdc_rep *ret_as_reply)
280*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
281ebfedea0SLionel Sambuc {
282ebfedea0SLionel Sambuc if(key == NULL)
283ebfedea0SLionel Sambuc return krb5_get_in_tkt_with_keytab (context,
284ebfedea0SLionel Sambuc options,
285ebfedea0SLionel Sambuc addrs,
286ebfedea0SLionel Sambuc etypes,
287ebfedea0SLionel Sambuc pre_auth_types,
288ebfedea0SLionel Sambuc NULL,
289ebfedea0SLionel Sambuc ccache,
290ebfedea0SLionel Sambuc creds,
291ebfedea0SLionel Sambuc ret_as_reply);
292ebfedea0SLionel Sambuc else
293ebfedea0SLionel Sambuc return krb5_get_in_tkt (context,
294ebfedea0SLionel Sambuc options,
295ebfedea0SLionel Sambuc addrs,
296ebfedea0SLionel Sambuc etypes,
297ebfedea0SLionel Sambuc pre_auth_types,
298ebfedea0SLionel Sambuc krb5_skey_key_proc,
299ebfedea0SLionel Sambuc key,
300ebfedea0SLionel Sambuc NULL,
301ebfedea0SLionel Sambuc NULL,
302ebfedea0SLionel Sambuc creds,
303ebfedea0SLionel Sambuc ccache,
304ebfedea0SLionel Sambuc ret_as_reply);
305ebfedea0SLionel Sambuc }
306ebfedea0SLionel Sambuc
307ebfedea0SLionel Sambuc /**
308ebfedea0SLionel Sambuc * Deprecated: use krb5_get_init_creds() and friends.
309ebfedea0SLionel Sambuc *
310ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
311ebfedea0SLionel Sambuc */
312ebfedea0SLionel Sambuc
313ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_CALLCONV
krb5_keytab_key_proc(krb5_context context,krb5_enctype enctype,krb5_salt salt,krb5_const_pointer keyseed,krb5_keyblock ** key)314ebfedea0SLionel Sambuc krb5_keytab_key_proc (krb5_context context,
315ebfedea0SLionel Sambuc krb5_enctype enctype,
316ebfedea0SLionel Sambuc krb5_salt salt,
317ebfedea0SLionel Sambuc krb5_const_pointer keyseed,
318ebfedea0SLionel Sambuc krb5_keyblock **key)
319*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
320ebfedea0SLionel Sambuc {
321ebfedea0SLionel Sambuc krb5_keytab_key_proc_args *args = rk_UNCONST(keyseed);
322ebfedea0SLionel Sambuc krb5_keytab keytab = args->keytab;
323ebfedea0SLionel Sambuc krb5_principal principal = args->principal;
324ebfedea0SLionel Sambuc krb5_error_code ret;
325ebfedea0SLionel Sambuc krb5_keytab real_keytab;
326ebfedea0SLionel Sambuc krb5_keytab_entry entry;
327ebfedea0SLionel Sambuc
328ebfedea0SLionel Sambuc if(keytab == NULL)
329ebfedea0SLionel Sambuc krb5_kt_default(context, &real_keytab);
330ebfedea0SLionel Sambuc else
331ebfedea0SLionel Sambuc real_keytab = keytab;
332ebfedea0SLionel Sambuc
333ebfedea0SLionel Sambuc ret = krb5_kt_get_entry (context, real_keytab, principal,
334ebfedea0SLionel Sambuc 0, enctype, &entry);
335ebfedea0SLionel Sambuc
336ebfedea0SLionel Sambuc if (keytab == NULL)
337ebfedea0SLionel Sambuc krb5_kt_close (context, real_keytab);
338ebfedea0SLionel Sambuc
339ebfedea0SLionel Sambuc if (ret)
340ebfedea0SLionel Sambuc return ret;
341ebfedea0SLionel Sambuc
342ebfedea0SLionel Sambuc ret = krb5_copy_keyblock (context, &entry.keyblock, key);
343ebfedea0SLionel Sambuc krb5_kt_free_entry(context, &entry);
344ebfedea0SLionel Sambuc return ret;
345ebfedea0SLionel Sambuc }
346ebfedea0SLionel Sambuc
347ebfedea0SLionel Sambuc /**
348ebfedea0SLionel Sambuc * Deprecated: use krb5_get_init_creds() and friends.
349ebfedea0SLionel Sambuc *
350ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
351ebfedea0SLionel Sambuc */
352ebfedea0SLionel Sambuc
353ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_in_tkt_with_keytab(krb5_context context,krb5_flags options,krb5_addresses * addrs,const krb5_enctype * etypes,const krb5_preauthtype * pre_auth_types,krb5_keytab keytab,krb5_ccache ccache,krb5_creds * creds,krb5_kdc_rep * ret_as_reply)354ebfedea0SLionel Sambuc krb5_get_in_tkt_with_keytab (krb5_context context,
355ebfedea0SLionel Sambuc krb5_flags options,
356ebfedea0SLionel Sambuc krb5_addresses *addrs,
357ebfedea0SLionel Sambuc const krb5_enctype *etypes,
358ebfedea0SLionel Sambuc const krb5_preauthtype *pre_auth_types,
359ebfedea0SLionel Sambuc krb5_keytab keytab,
360ebfedea0SLionel Sambuc krb5_ccache ccache,
361ebfedea0SLionel Sambuc krb5_creds *creds,
362ebfedea0SLionel Sambuc krb5_kdc_rep *ret_as_reply)
363*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
364ebfedea0SLionel Sambuc {
365ebfedea0SLionel Sambuc krb5_keytab_key_proc_args a;
366ebfedea0SLionel Sambuc
367ebfedea0SLionel Sambuc a.principal = creds->client;
368ebfedea0SLionel Sambuc a.keytab = keytab;
369ebfedea0SLionel Sambuc
370ebfedea0SLionel Sambuc return krb5_get_in_tkt (context,
371ebfedea0SLionel Sambuc options,
372ebfedea0SLionel Sambuc addrs,
373ebfedea0SLionel Sambuc etypes,
374ebfedea0SLionel Sambuc pre_auth_types,
375ebfedea0SLionel Sambuc krb5_keytab_key_proc,
376ebfedea0SLionel Sambuc &a,
377ebfedea0SLionel Sambuc NULL,
378ebfedea0SLionel Sambuc NULL,
379ebfedea0SLionel Sambuc creds,
380ebfedea0SLionel Sambuc ccache,
381ebfedea0SLionel Sambuc ret_as_reply);
382ebfedea0SLionel Sambuc }
383ebfedea0SLionel Sambuc
384ebfedea0SLionel Sambuc /**
385ebfedea0SLionel Sambuc * Generate a new ccache of type `ops' in `id'.
386ebfedea0SLionel Sambuc *
387ebfedea0SLionel Sambuc * Deprecated: use krb5_cc_new_unique() instead.
388ebfedea0SLionel Sambuc *
389ebfedea0SLionel Sambuc * @return Return an error code or 0, see krb5_get_error_message().
390ebfedea0SLionel Sambuc *
391ebfedea0SLionel Sambuc * @ingroup krb5_ccache
392ebfedea0SLionel Sambuc */
393ebfedea0SLionel Sambuc
394ebfedea0SLionel Sambuc
395ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_gen_new(krb5_context context,const krb5_cc_ops * ops,krb5_ccache * id)396ebfedea0SLionel Sambuc krb5_cc_gen_new(krb5_context context,
397ebfedea0SLionel Sambuc const krb5_cc_ops *ops,
398ebfedea0SLionel Sambuc krb5_ccache *id)
399*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
400ebfedea0SLionel Sambuc {
401ebfedea0SLionel Sambuc return krb5_cc_new_unique(context, ops->prefix, NULL, id);
402ebfedea0SLionel Sambuc }
403ebfedea0SLionel Sambuc
404ebfedea0SLionel Sambuc /**
405ebfedea0SLionel Sambuc * Deprecated: use krb5_principal_get_realm()
406ebfedea0SLionel Sambuc *
407ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
408ebfedea0SLionel Sambuc */
409ebfedea0SLionel Sambuc
410ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_realm * KRB5_LIB_CALL
krb5_princ_realm(krb5_context context,krb5_principal principal)411ebfedea0SLionel Sambuc krb5_princ_realm(krb5_context context,
412ebfedea0SLionel Sambuc krb5_principal principal)
413*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
414ebfedea0SLionel Sambuc {
415ebfedea0SLionel Sambuc return &principal->realm;
416ebfedea0SLionel Sambuc }
417ebfedea0SLionel Sambuc
418ebfedea0SLionel Sambuc
419ebfedea0SLionel Sambuc /**
420ebfedea0SLionel Sambuc * Deprecated: use krb5_principal_set_realm()
421ebfedea0SLionel Sambuc *
422ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
423ebfedea0SLionel Sambuc */
424ebfedea0SLionel Sambuc
425ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_princ_set_realm(krb5_context context,krb5_principal principal,krb5_realm * realm)426ebfedea0SLionel Sambuc krb5_princ_set_realm(krb5_context context,
427ebfedea0SLionel Sambuc krb5_principal principal,
428ebfedea0SLionel Sambuc krb5_realm *realm)
429*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
430ebfedea0SLionel Sambuc {
431ebfedea0SLionel Sambuc principal->realm = *realm;
432ebfedea0SLionel Sambuc }
433ebfedea0SLionel Sambuc
434ebfedea0SLionel Sambuc /**
435ebfedea0SLionel Sambuc * Deprecated: use krb5_free_cred_contents()
436ebfedea0SLionel Sambuc *
437ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
438ebfedea0SLionel Sambuc */
439ebfedea0SLionel Sambuc
440ebfedea0SLionel Sambuc /* keep this for compatibility with older code */
441ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_free_creds_contents(krb5_context context,krb5_creds * c)442ebfedea0SLionel Sambuc krb5_free_creds_contents (krb5_context context, krb5_creds *c)
443*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
444ebfedea0SLionel Sambuc {
445ebfedea0SLionel Sambuc return krb5_free_cred_contents (context, c);
446ebfedea0SLionel Sambuc }
447ebfedea0SLionel Sambuc
448ebfedea0SLionel Sambuc /**
449ebfedea0SLionel Sambuc * Free the error message returned by krb5_get_error_string().
450ebfedea0SLionel Sambuc *
451ebfedea0SLionel Sambuc * Deprecated: use krb5_free_error_message()
452ebfedea0SLionel Sambuc *
453ebfedea0SLionel Sambuc * @param context Kerberos context
454ebfedea0SLionel Sambuc * @param str error message to free
455ebfedea0SLionel Sambuc *
456ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
457ebfedea0SLionel Sambuc */
458ebfedea0SLionel Sambuc
459ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_free_error_string(krb5_context context,char * str)460ebfedea0SLionel Sambuc krb5_free_error_string(krb5_context context, char *str)
461*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
462ebfedea0SLionel Sambuc {
463ebfedea0SLionel Sambuc krb5_free_error_message(context, str);
464ebfedea0SLionel Sambuc }
465ebfedea0SLionel Sambuc
466ebfedea0SLionel Sambuc /**
467ebfedea0SLionel Sambuc * Set the error message returned by krb5_get_error_string().
468ebfedea0SLionel Sambuc *
469ebfedea0SLionel Sambuc * Deprecated: use krb5_get_error_message()
470ebfedea0SLionel Sambuc *
471ebfedea0SLionel Sambuc * @param context Kerberos context
472ebfedea0SLionel Sambuc * @param fmt error message to free
473ebfedea0SLionel Sambuc *
474ebfedea0SLionel Sambuc * @return Return an error code or 0.
475ebfedea0SLionel Sambuc *
476ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
477ebfedea0SLionel Sambuc */
478ebfedea0SLionel Sambuc
479ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_set_error_string(krb5_context context,const char * fmt,...)480ebfedea0SLionel Sambuc krb5_set_error_string(krb5_context context, const char *fmt, ...)
481ebfedea0SLionel Sambuc __attribute__((format (printf, 2, 3)))
482*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
483ebfedea0SLionel Sambuc {
484ebfedea0SLionel Sambuc va_list ap;
485ebfedea0SLionel Sambuc
486ebfedea0SLionel Sambuc va_start(ap, fmt);
487ebfedea0SLionel Sambuc krb5_vset_error_message (context, 0, fmt, ap);
488ebfedea0SLionel Sambuc va_end(ap);
489ebfedea0SLionel Sambuc return 0;
490ebfedea0SLionel Sambuc }
491ebfedea0SLionel Sambuc
492ebfedea0SLionel Sambuc /**
493ebfedea0SLionel Sambuc * Set the error message returned by krb5_get_error_string(),
494ebfedea0SLionel Sambuc * deprecated, use krb5_set_error_message().
495ebfedea0SLionel Sambuc *
496ebfedea0SLionel Sambuc * Deprecated: use krb5_vset_error_message()
497ebfedea0SLionel Sambuc *
498ebfedea0SLionel Sambuc * @param context Kerberos context
499ebfedea0SLionel Sambuc * @param msg error message to free
500ebfedea0SLionel Sambuc *
501ebfedea0SLionel Sambuc * @return Return an error code or 0.
502ebfedea0SLionel Sambuc *
503ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
504ebfedea0SLionel Sambuc */
505ebfedea0SLionel Sambuc
506ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_vset_error_string(krb5_context context,const char * fmt,va_list args)507ebfedea0SLionel Sambuc krb5_vset_error_string(krb5_context context, const char *fmt, va_list args)
508ebfedea0SLionel Sambuc __attribute__ ((format (printf, 2, 0)))
509*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
510ebfedea0SLionel Sambuc {
511ebfedea0SLionel Sambuc krb5_vset_error_message(context, 0, fmt, args);
512ebfedea0SLionel Sambuc return 0;
513ebfedea0SLionel Sambuc }
514ebfedea0SLionel Sambuc
515ebfedea0SLionel Sambuc /**
516ebfedea0SLionel Sambuc * Clear the error message returned by krb5_get_error_string().
517ebfedea0SLionel Sambuc *
518ebfedea0SLionel Sambuc * Deprecated: use krb5_clear_error_message()
519ebfedea0SLionel Sambuc *
520ebfedea0SLionel Sambuc * @param context Kerberos context
521ebfedea0SLionel Sambuc *
522ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
523ebfedea0SLionel Sambuc */
524ebfedea0SLionel Sambuc
525ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_clear_error_string(krb5_context context)526ebfedea0SLionel Sambuc krb5_clear_error_string(krb5_context context)
527*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
528ebfedea0SLionel Sambuc {
529ebfedea0SLionel Sambuc krb5_clear_error_message(context);
530ebfedea0SLionel Sambuc }
531ebfedea0SLionel Sambuc
532ebfedea0SLionel Sambuc /**
533ebfedea0SLionel Sambuc * Deprecated: use krb5_get_credentials_with_flags().
534ebfedea0SLionel Sambuc *
535ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
536ebfedea0SLionel Sambuc */
537ebfedea0SLionel Sambuc
538ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_cred_from_kdc_opt(krb5_context context,krb5_ccache ccache,krb5_creds * in_creds,krb5_creds ** out_creds,krb5_creds *** ret_tgts,krb5_flags flags)539ebfedea0SLionel Sambuc krb5_get_cred_from_kdc_opt(krb5_context context,
540ebfedea0SLionel Sambuc krb5_ccache ccache,
541ebfedea0SLionel Sambuc krb5_creds *in_creds,
542ebfedea0SLionel Sambuc krb5_creds **out_creds,
543ebfedea0SLionel Sambuc krb5_creds ***ret_tgts,
544ebfedea0SLionel Sambuc krb5_flags flags)
545*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
546ebfedea0SLionel Sambuc {
547ebfedea0SLionel Sambuc krb5_kdc_flags f;
548ebfedea0SLionel Sambuc f.i = flags;
549ebfedea0SLionel Sambuc return _krb5_get_cred_kdc_any(context, f, ccache,
550ebfedea0SLionel Sambuc in_creds, NULL, NULL,
551ebfedea0SLionel Sambuc out_creds, ret_tgts);
552ebfedea0SLionel Sambuc }
553ebfedea0SLionel Sambuc
554ebfedea0SLionel Sambuc /**
555ebfedea0SLionel Sambuc * Deprecated: use krb5_get_credentials_with_flags().
556ebfedea0SLionel Sambuc *
557ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
558ebfedea0SLionel Sambuc */
559ebfedea0SLionel Sambuc
560ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_cred_from_kdc(krb5_context context,krb5_ccache ccache,krb5_creds * in_creds,krb5_creds ** out_creds,krb5_creds *** ret_tgts)561ebfedea0SLionel Sambuc krb5_get_cred_from_kdc(krb5_context context,
562ebfedea0SLionel Sambuc krb5_ccache ccache,
563ebfedea0SLionel Sambuc krb5_creds *in_creds,
564ebfedea0SLionel Sambuc krb5_creds **out_creds,
565ebfedea0SLionel Sambuc krb5_creds ***ret_tgts)
566*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
567ebfedea0SLionel Sambuc {
568ebfedea0SLionel Sambuc return krb5_get_cred_from_kdc_opt(context, ccache,
569ebfedea0SLionel Sambuc in_creds, out_creds, ret_tgts, 0);
570ebfedea0SLionel Sambuc }
571ebfedea0SLionel Sambuc
572ebfedea0SLionel Sambuc /**
573ebfedea0SLionel Sambuc * Deprecated: use krb5_xfree().
574ebfedea0SLionel Sambuc *
575ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
576ebfedea0SLionel Sambuc */
577ebfedea0SLionel Sambuc
578ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_free_unparsed_name(krb5_context context,char * str)579ebfedea0SLionel Sambuc krb5_free_unparsed_name(krb5_context context, char *str)
580*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
581ebfedea0SLionel Sambuc {
582ebfedea0SLionel Sambuc krb5_xfree(str);
583ebfedea0SLionel Sambuc }
584ebfedea0SLionel Sambuc
585ebfedea0SLionel Sambuc /**
586ebfedea0SLionel Sambuc * Deprecated: use krb5_generate_subkey_extended()
587ebfedea0SLionel Sambuc *
588ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
589ebfedea0SLionel Sambuc */
590ebfedea0SLionel Sambuc
591ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_generate_subkey(krb5_context context,const krb5_keyblock * key,krb5_keyblock ** subkey)592ebfedea0SLionel Sambuc krb5_generate_subkey(krb5_context context,
593ebfedea0SLionel Sambuc const krb5_keyblock *key,
594ebfedea0SLionel Sambuc krb5_keyblock **subkey)
595*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
596ebfedea0SLionel Sambuc {
597ebfedea0SLionel Sambuc return krb5_generate_subkey_extended(context, key, ETYPE_NULL, subkey);
598ebfedea0SLionel Sambuc }
599ebfedea0SLionel Sambuc
600ebfedea0SLionel Sambuc /**
601ebfedea0SLionel Sambuc * Deprecated: use krb5_auth_con_getremoteseqnumber()
602ebfedea0SLionel Sambuc *
603ebfedea0SLionel Sambuc * @ingroup krb5_deprecated
604ebfedea0SLionel Sambuc */
605ebfedea0SLionel Sambuc
606ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_auth_getremoteseqnumber(krb5_context context,krb5_auth_context auth_context,int32_t * seqnumber)607ebfedea0SLionel Sambuc krb5_auth_getremoteseqnumber(krb5_context context,
608ebfedea0SLionel Sambuc krb5_auth_context auth_context,
609ebfedea0SLionel Sambuc int32_t *seqnumber)
610*0a6a1f1dSLionel Sambuc KRB5_DEPRECATED_FUNCTION("Use X instead")
611ebfedea0SLionel Sambuc {
612ebfedea0SLionel Sambuc *seqnumber = auth_context->remote_seqnumber;
613ebfedea0SLionel Sambuc return 0;
614ebfedea0SLionel Sambuc }
615ebfedea0SLionel Sambuc
616ebfedea0SLionel Sambuc #endif /* HEIMDAL_SMALLER */
617