2 * Copyright (c) 1997 - 2005 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 #include "krb5_locl.h"
39 #define INIT_FIELD(C, T, E, D, F) \
40 (C)->E = krb5_config_get_ ## T ## _default ((C), NULL, (D), \
41 "libdefaults", F, NULL)
43 #define INIT_FLAG(C, O, V, D, F) \
45 if (krb5_config_get_bool_default((C), NULL, (D),"libdefaults", F, NULL)) { \
51 * Set the list of etypes `ret_etypes' from the configuration variable
55 static krb5_error_code
56 set_etypes (krb5_context context,
58 krb5_enctype **ret_enctypes)
61 krb5_enctype *etypes = NULL;
63 etypes_str = krb5_config_get_strings(context, NULL, "libdefaults",
67 for(i = 0; etypes_str[i]; i++);
68 etypes = malloc((i+1) * sizeof(*etypes));
70 krb5_config_free_strings (etypes_str);
71 krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
74 for(j = 0, k = 0; j < i; j++) {
76 if(krb5_string_to_enctype(context, etypes_str[j], &e) != 0)
78 if (krb5_enctype_valid(context, e) != 0)
82 etypes[k] = ETYPE_NULL;
83 krb5_config_free_strings(etypes_str);
85 *ret_enctypes = etypes;
90 * read variables from the configuration file and set in `context'
93 static krb5_error_code
94 init_context_from_config_file(krb5_context context)
98 krb5_enctype *tmptypes;
100 INIT_FIELD(context, time, max_skew, 5 * 60, "clockskew");
101 INIT_FIELD(context, time, kdc_timeout, 3, "kdc_timeout");
102 INIT_FIELD(context, int, max_retries, 3, "max_retries");
104 INIT_FIELD(context, string, http_proxy, NULL, "http_proxy");
106 ret = set_etypes (context, "default_etypes", &tmptypes);
109 free(context->etypes);
110 context->etypes = tmptypes;
112 ret = set_etypes (context, "default_etypes_des", &tmptypes);
115 free(context->etypes_des);
116 context->etypes_des = tmptypes;
118 /* default keytab name */
121 tmp = getenv("KRB5_KTNAME");
123 context->default_keytab = tmp;
125 INIT_FIELD(context, string, default_keytab,
126 KEYTAB_DEFAULT, "default_keytab_name");
128 INIT_FIELD(context, string, default_keytab_modify,
129 NULL, "default_keytab_modify_name");
131 INIT_FIELD(context, string, time_fmt,
132 "%Y-%m-%dT%H:%M:%S", "time_format");
134 INIT_FIELD(context, string, date_fmt,
135 "%Y-%m-%d", "date_format");
137 INIT_FIELD(context, bool, log_utc,
142 /* init dns-proxy slime */
143 tmp = krb5_config_get_string(context, NULL, "libdefaults",
146 roken_gethostby_setup(context->http_proxy, tmp);
147 krb5_free_host_realm (context, context->default_realms);
148 context->default_realms = NULL;
151 krb5_addresses addresses;
154 krb5_set_extra_addresses(context, NULL);
155 adr = krb5_config_get_strings(context, NULL,
159 memset(&addresses, 0, sizeof(addresses));
160 for(a = adr; a && *a; a++) {
161 ret = krb5_parse_address(context, *a, &addresses);
163 krb5_add_extra_addresses(context, &addresses);
164 krb5_free_addresses(context, &addresses);
167 krb5_config_free_strings(adr);
169 krb5_set_ignore_addresses(context, NULL);
170 adr = krb5_config_get_strings(context, NULL,
174 memset(&addresses, 0, sizeof(addresses));
175 for(a = adr; a && *a; a++) {
176 ret = krb5_parse_address(context, *a, &addresses);
178 krb5_add_ignore_addresses(context, &addresses);
179 krb5_free_addresses(context, &addresses);
182 krb5_config_free_strings(adr);
185 INIT_FIELD(context, bool, scan_interfaces, TRUE, "scan_interfaces");
186 INIT_FIELD(context, int, fcache_vno, 0, "fcache_version");
187 /* prefer dns_lookup_kdc over srv_lookup. */
188 INIT_FIELD(context, bool, srv_lookup, TRUE, "srv_lookup");
189 INIT_FIELD(context, bool, srv_lookup, context->srv_lookup, "dns_lookup_kdc");
190 INIT_FIELD(context, int, large_msg_size, 1400, "large_message_size");
191 INIT_FLAG(context, flags, KRB5_CTX_F_DNS_CANONICALIZE_HOSTNAME, TRUE, "dns_canonicalize_hostname");
192 INIT_FLAG(context, flags, KRB5_CTX_F_CHECK_PAC, TRUE, "check_pac");
193 context->default_cc_name = NULL;
194 context->default_cc_name_set = 0;
196 ret = krb5_config_get_bool_default(context, NULL, FALSE,
198 "allow_weak_crypto", NULL);
200 krb5_enctype_enable(context, ETYPE_DES_CBC_CRC);
201 krb5_enctype_enable(context, ETYPE_DES_CBC_MD4);
202 krb5_enctype_enable(context, ETYPE_DES_CBC_MD5);
203 krb5_enctype_enable(context, ETYPE_DES_CBC_NONE);
204 krb5_enctype_enable(context, ETYPE_DES_CFB64_NONE);
205 krb5_enctype_enable(context, ETYPE_DES_PCBC_NONE);
212 * Initializes the context structure and reads the configuration file
213 * /etc/krb5.conf. The structure should be freed by calling
214 * krb5_free_context() when it is no longer being used.
216 * @param context pointer to returned context
218 * @return Returns 0 to indicate success. Otherwise an errno code is
219 * returned. Failure means either that something bad happened during
220 * initialization (typically ENOMEM) or that Kerberos should not be
226 krb5_error_code KRB5_LIB_FUNCTION
227 krb5_init_context(krb5_context *context)
235 p = calloc(1, sizeof(*p));
239 p->mutex = malloc(sizeof(HEIMDAL_MUTEX));
240 if (p->mutex == NULL) {
244 HEIMDAL_MUTEX_init(p->mutex);
246 ret = krb5_get_default_config_files(&files);
249 ret = krb5_set_config_files(p, files);
250 krb5_free_config_files(files);
254 /* init error tables */
259 krb5_cc_register(p, &krb5_acc_ops, TRUE);
260 krb5_cc_register(p, &krb5_fcc_ops, TRUE);
261 krb5_cc_register(p, &krb5_mcc_ops, TRUE);
262 krb5_cc_register(p, &krb5_scc_ops, TRUE);
264 krb5_cc_register(p, &krb5_kcm_ops, TRUE);
269 krb5_kt_register (p, &krb5_fkt_ops);
270 krb5_kt_register (p, &krb5_wrfkt_ops);
271 krb5_kt_register (p, &krb5_javakt_ops);
272 krb5_kt_register (p, &krb5_mkt_ops);
273 krb5_kt_register (p, &krb5_akf_ops);
274 krb5_kt_register (p, &krb5_any_ops);
278 krb5_free_context(p);
286 * Frees the krb5_context allocated by krb5_init_context().
288 * @param context context to be freed.
293 void KRB5_LIB_FUNCTION
294 krb5_free_context(krb5_context context)
296 if (context->default_cc_name)
297 free(context->default_cc_name);
298 if (context->default_cc_name_env)
299 free(context->default_cc_name_env);
300 free(context->etypes);
301 free(context->etypes_des);
302 krb5_free_host_realm (context, context->default_realms);
303 krb5_config_file_free (context, context->cf);
304 free_error_table (context->et_list);
305 free(context->cc_ops);
306 free(context->kt_types);
307 krb5_clear_error_string(context);
308 if(context->warn_dest != NULL)
309 krb5_closelog(context, context->warn_dest);
310 krb5_set_extra_addresses(context, NULL);
311 krb5_set_ignore_addresses(context, NULL);
312 krb5_set_send_to_kdc_func(context, NULL, NULL);
313 if (context->mutex != NULL) {
314 HEIMDAL_MUTEX_destroy(context->mutex);
315 free(context->mutex);
317 memset(context, 0, sizeof(*context));
322 * Reinit the context from a new set of filenames.
324 * @param context context to add configuration too.
325 * @param filenames array of filenames, end of list is indicated with a NULL filename.
327 * @return Returns 0 to indicate success. Otherwise an kerberos et
328 * error code is returned, see krb5_get_error_message().
333 krb5_error_code KRB5_LIB_FUNCTION
334 krb5_set_config_files(krb5_context context, char **filenames)
337 krb5_config_binding *tmp = NULL;
338 while(filenames != NULL && *filenames != NULL && **filenames != '\0') {
339 ret = krb5_config_parse_file_multi(context, *filenames, &tmp);
340 if(ret != 0 && ret != ENOENT && ret != EACCES) {
341 krb5_config_file_free(context, tmp);
347 /* with this enabled and if there are no config files, Kerberos is
348 considererd disabled */
352 krb5_config_file_free(context, context->cf);
354 ret = init_context_from_config_file(context);
358 static krb5_error_code
359 add_file(char ***pfilenames, int *len, char *file)
361 char **pp = *pfilenames;
364 for(i = 0; i < *len; i++) {
365 if(strcmp(pp[i], file) == 0) {
371 pp = realloc(*pfilenames, (*len + 2) * sizeof(*pp));
385 * `pq' isn't free, it's up the the caller
388 krb5_error_code KRB5_LIB_FUNCTION
389 krb5_prepend_config_files(const char *filelist, char **pq, char ***ret_pp)
404 l = strsep_copy(&q, ":", NULL, 0);
409 krb5_free_config_files(pp);
412 l = strsep_copy(&p, ":", fn, l + 1);
413 ret = add_file(&pp, &len, fn);
415 krb5_free_config_files(pp);
423 for (i = 0; pq[i] != NULL; i++) {
426 krb5_free_config_files(pp);
429 ret = add_file(&pp, &len, fn);
431 krb5_free_config_files(pp);
442 * Prepend the filename to the global configuration list.
444 * @param filelist a filename to add to the default list of filename
445 * @param pfilenames return array of filenames, should be freed with krb5_free_config_files().
447 * @return Returns 0 to indicate success. Otherwise an kerberos et
448 * error code is returned, see krb5_get_error_message().
453 krb5_error_code KRB5_LIB_FUNCTION
454 krb5_prepend_config_files_default(const char *filelist, char ***pfilenames)
457 char **defpp, **pp = NULL;
459 ret = krb5_get_default_config_files(&defpp);
463 ret = krb5_prepend_config_files(filelist, defpp, &pp);
464 krb5_free_config_files(defpp);
473 * Get the global configuration list.
475 * @param pfilenames return array of filenames, should be freed with krb5_free_config_files().
477 * @return Returns 0 to indicate success. Otherwise an kerberos et
478 * error code is returned, see krb5_get_error_message().
483 krb5_error_code KRB5_LIB_FUNCTION
484 krb5_get_default_config_files(char ***pfilenames)
486 const char *files = NULL;
488 if (pfilenames == NULL)
491 files = getenv("KRB5_CONFIG");
493 files = krb5_config_file;
495 return krb5_prepend_config_files(files, NULL, pfilenames);
499 * Free a list of configuration files.
501 * @param filenames list to be freed.
503 * @return Returns 0 to indicate success. Otherwise an kerberos et
504 * error code is returned, see krb5_get_error_message().
509 void KRB5_LIB_FUNCTION
510 krb5_free_config_files(char **filenames)
513 for(p = filenames; *p != NULL; p++)
519 * Returns the list of Kerberos encryption types sorted in order of
520 * most preferred to least preferred encryption type. Note that some
521 * encryption types might be disabled, so you need to check with
522 * krb5_enctype_valid() before using the encryption type.
524 * @return list of enctypes, terminated with ETYPE_NULL. Its a static
525 * array completed into the Kerberos library so the content doesn't
531 const krb5_enctype * KRB5_LIB_FUNCTION
532 krb5_kerberos_enctypes(krb5_context context)
534 static const krb5_enctype p[] = {
535 ETYPE_AES256_CTS_HMAC_SHA1_96,
536 ETYPE_AES128_CTS_HMAC_SHA1_96,
539 ETYPE_ARCFOUR_HMAC_MD5,
549 * set `etype' to a malloced list of the default enctypes
552 static krb5_error_code
553 default_etypes(krb5_context context, krb5_enctype **etype)
555 const krb5_enctype *p;
556 krb5_enctype *e = NULL, *ep;
559 p = krb5_kerberos_enctypes(context);
561 for (i = 0; p[i] != ETYPE_NULL; i++) {
562 if (krb5_enctype_valid(context, p[i]) != 0)
564 ep = realloc(e, (n + 2) * sizeof(*e));
567 krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
572 e[n + 1] = ETYPE_NULL;
580 * Set the default encryption types that will be use in communcation
581 * with the KDC, clients and servers.
583 * @param context Kerberos 5 context.
584 * @param etypes Encryption types, array terminated with ETYPE_NULL (0).
586 * @return Returns 0 to indicate success. Otherwise an kerberos et
587 * error code is returned, see krb5_get_error_message().
592 krb5_error_code KRB5_LIB_FUNCTION
593 krb5_set_default_in_tkt_etypes(krb5_context context,
594 const krb5_enctype *etypes)
596 krb5_enctype *p = NULL;
600 for (i = 0; etypes[i]; ++i) {
602 ret = krb5_enctype_valid(context, etypes[i]);
609 krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
612 memmove(p, etypes, i * sizeof(krb5_enctype));
615 free(context->etypes);
621 * Get the default encryption types that will be use in communcation
622 * with the KDC, clients and servers.
624 * @param context Kerberos 5 context.
625 * @param etypes Encryption types, array terminated with
626 * ETYPE_NULL(0), caller should free array with krb5_xfree():
628 * @return Returns 0 to indicate success. Otherwise an kerberos et
629 * error code is returned, see krb5_get_error_message().
634 krb5_error_code KRB5_LIB_FUNCTION
635 krb5_get_default_in_tkt_etypes(krb5_context context,
636 krb5_enctype **etypes)
642 if(context->etypes) {
643 for(i = 0; context->etypes[i]; i++);
647 krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
650 memmove(p, context->etypes, i * sizeof(krb5_enctype));
652 ret = default_etypes(context, &p);
661 * Return the error string for the error code. The caller must not
664 * @param context Kerberos 5 context.
665 * @param code Kerberos error code.
667 * @return the error message matching code
672 const char* KRB5_LIB_FUNCTION
673 krb5_get_err_text(krb5_context context, krb5_error_code code)
675 const char *p = NULL;
677 p = com_right(context->et_list, code);
686 * Init the built-in ets in the Kerberos library.
688 * @param context kerberos context to add the ets too
693 void KRB5_LIB_FUNCTION
694 krb5_init_ets(krb5_context context)
696 if(context->et_list == NULL){
697 krb5_add_et_list(context, initialize_krb5_error_table_r);
698 krb5_add_et_list(context, initialize_asn1_error_table_r);
699 krb5_add_et_list(context, initialize_heim_error_table_r);
700 krb5_add_et_list(context, initialize_k524_error_table_r);
702 krb5_add_et_list(context, initialize_hx_error_table_r);
708 * Make the kerberos library default to the admin KDC.
710 * @param context Kerberos 5 context.
711 * @param flag boolean flag to select if the use the admin KDC or not.
716 void KRB5_LIB_FUNCTION
717 krb5_set_use_admin_kdc (krb5_context context, krb5_boolean flag)
719 context->use_admin_kdc = flag;
723 * Make the kerberos library default to the admin KDC.
725 * @param context Kerberos 5 context.
727 * @return boolean flag to telling the context will use admin KDC as the default KDC.
732 krb5_boolean KRB5_LIB_FUNCTION
733 krb5_get_use_admin_kdc (krb5_context context)
735 return context->use_admin_kdc;
739 * Add extra address to the address list that the library will add to
740 * the client's address list when communicating with the KDC.
742 * @param context Kerberos 5 context.
743 * @param addresses addreses to add
745 * @return Returns 0 to indicate success. Otherwise an kerberos et
746 * error code is returned, see krb5_get_error_message().
751 krb5_error_code KRB5_LIB_FUNCTION
752 krb5_add_extra_addresses(krb5_context context, krb5_addresses *addresses)
755 if(context->extra_addresses)
756 return krb5_append_addresses(context,
757 context->extra_addresses, addresses);
759 return krb5_set_extra_addresses(context, addresses);
763 * Set extra address to the address list that the library will add to
764 * the client's address list when communicating with the KDC.
766 * @param context Kerberos 5 context.
767 * @param addresses addreses to set
769 * @return Returns 0 to indicate success. Otherwise an kerberos et
770 * error code is returned, see krb5_get_error_message().
775 krb5_error_code KRB5_LIB_FUNCTION
776 krb5_set_extra_addresses(krb5_context context, const krb5_addresses *addresses)
778 if(context->extra_addresses)
779 krb5_free_addresses(context, context->extra_addresses);
781 if(addresses == NULL) {
782 if(context->extra_addresses != NULL) {
783 free(context->extra_addresses);
784 context->extra_addresses = NULL;
788 if(context->extra_addresses == NULL) {
789 context->extra_addresses = malloc(sizeof(*context->extra_addresses));
790 if(context->extra_addresses == NULL) {
791 krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
795 return krb5_copy_addresses(context, addresses, context->extra_addresses);
799 * Get extra address to the address list that the library will add to
800 * the client's address list when communicating with the KDC.
802 * @param context Kerberos 5 context.
803 * @param addresses addreses to set
805 * @return Returns 0 to indicate success. Otherwise an kerberos et
806 * error code is returned, see krb5_get_error_message().
811 krb5_error_code KRB5_LIB_FUNCTION
812 krb5_get_extra_addresses(krb5_context context, krb5_addresses *addresses)
814 if(context->extra_addresses == NULL) {
815 memset(addresses, 0, sizeof(*addresses));
818 return krb5_copy_addresses(context,context->extra_addresses, addresses);
822 * Add extra addresses to ignore when fetching addresses from the
823 * underlaying operating system.
825 * @param context Kerberos 5 context.
826 * @param addresses addreses to ignore
828 * @return Returns 0 to indicate success. Otherwise an kerberos et
829 * error code is returned, see krb5_get_error_message().
834 krb5_error_code KRB5_LIB_FUNCTION
835 krb5_add_ignore_addresses(krb5_context context, krb5_addresses *addresses)
838 if(context->ignore_addresses)
839 return krb5_append_addresses(context,
840 context->ignore_addresses, addresses);
842 return krb5_set_ignore_addresses(context, addresses);
846 * Set extra addresses to ignore when fetching addresses from the
847 * underlaying operating system.
849 * @param context Kerberos 5 context.
850 * @param addresses addreses to ignore
852 * @return Returns 0 to indicate success. Otherwise an kerberos et
853 * error code is returned, see krb5_get_error_message().
858 krb5_error_code KRB5_LIB_FUNCTION
859 krb5_set_ignore_addresses(krb5_context context, const krb5_addresses *addresses)
861 if(context->ignore_addresses)
862 krb5_free_addresses(context, context->ignore_addresses);
863 if(addresses == NULL) {
864 if(context->ignore_addresses != NULL) {
865 free(context->ignore_addresses);
866 context->ignore_addresses = NULL;
870 if(context->ignore_addresses == NULL) {
871 context->ignore_addresses = malloc(sizeof(*context->ignore_addresses));
872 if(context->ignore_addresses == NULL) {
873 krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
877 return krb5_copy_addresses(context, addresses, context->ignore_addresses);
881 * Get extra addresses to ignore when fetching addresses from the
882 * underlaying operating system.
884 * @param context Kerberos 5 context.
885 * @param addresses list addreses ignored
887 * @return Returns 0 to indicate success. Otherwise an kerberos et
888 * error code is returned, see krb5_get_error_message().
893 krb5_error_code KRB5_LIB_FUNCTION
894 krb5_get_ignore_addresses(krb5_context context, krb5_addresses *addresses)
896 if(context->ignore_addresses == NULL) {
897 memset(addresses, 0, sizeof(*addresses));
900 return krb5_copy_addresses(context, context->ignore_addresses, addresses);
904 * Set version of fcache that the library should use.
906 * @param context Kerberos 5 context.
907 * @param version version number.
909 * @return Returns 0 to indicate success. Otherwise an kerberos et
910 * error code is returned, see krb5_get_error_message().
915 krb5_error_code KRB5_LIB_FUNCTION
916 krb5_set_fcache_version(krb5_context context, int version)
918 context->fcache_vno = version;
923 * Get version of fcache that the library should use.
925 * @param context Kerberos 5 context.
926 * @param version version number.
928 * @return Returns 0 to indicate success. Otherwise an kerberos et
929 * error code is returned, see krb5_get_error_message().
934 krb5_error_code KRB5_LIB_FUNCTION
935 krb5_get_fcache_version(krb5_context context, int *version)
937 *version = context->fcache_vno;
942 * Runtime check if the Kerberos library was complied with thread support.
944 * @return TRUE if the library was compiled with thread support, FALSE if not.
950 krb5_boolean KRB5_LIB_FUNCTION
951 krb5_is_thread_safe(void)
953 #ifdef ENABLE_PTHREAD_SUPPORT
961 * Set if the library should use DNS to canonicalize hostnames.
963 * @param context Kerberos 5 context.
964 * @param flag if its dns canonicalizion is used or not.
969 void KRB5_LIB_FUNCTION
970 krb5_set_dns_canonicalize_hostname (krb5_context context, krb5_boolean flag)
973 context->flags |= KRB5_CTX_F_DNS_CANONICALIZE_HOSTNAME;
975 context->flags &= ~KRB5_CTX_F_DNS_CANONICALIZE_HOSTNAME;
979 * Get if the library uses DNS to canonicalize hostnames.
981 * @param context Kerberos 5 context.
983 * @return return non zero if the library uses DNS to canonicalize hostnames.
988 krb5_boolean KRB5_LIB_FUNCTION
989 krb5_get_dns_canonicalize_hostname (krb5_context context)
991 return (context->flags & KRB5_CTX_F_DNS_CANONICALIZE_HOSTNAME) ? 1 : 0;
995 * Get current offset in time to the KDC.
997 * @param context Kerberos 5 context.
998 * @param sec seconds part of offset.
999 * @param usec micro seconds part of offset.
1001 * @return returns zero
1006 krb5_error_code KRB5_LIB_FUNCTION
1007 krb5_get_kdc_sec_offset (krb5_context context, int32_t *sec, int32_t *usec)
1010 *sec = context->kdc_sec_offset;
1012 *usec = context->kdc_usec_offset;
1017 * Set current offset in time to the KDC.
1019 * @param context Kerberos 5 context.
1020 * @param sec seconds part of offset.
1021 * @param usec micro seconds part of offset.
1023 * @return returns zero
1028 krb5_error_code KRB5_LIB_FUNCTION
1029 krb5_set_kdc_sec_offset (krb5_context context, int32_t sec, int32_t usec)
1031 context->kdc_sec_offset = sec;
1033 context->kdc_usec_offset = usec;
1038 * Get max time skew allowed.
1040 * @param context Kerberos 5 context.
1042 * @return timeskew in seconds.
1047 time_t KRB5_LIB_FUNCTION
1048 krb5_get_max_time_skew (krb5_context context)
1050 return context->max_skew;
1054 * Set max time skew allowed.
1056 * @param context Kerberos 5 context.
1057 * @param t timeskew in seconds.
1062 void KRB5_LIB_FUNCTION
1063 krb5_set_max_time_skew (krb5_context context, time_t t)
1065 context->max_skew = t;