From 08730652fbf1c9f6d53378b1b094a2c5ddf2cf62 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 27 Aug 2005 11:49:06 +0000 Subject: r9680: Update Heimdal to current lorikeet-heimdal (which was itself updated to Heimdal CVS as of 2005-08-27). Andrew Bartlett (This used to be commit 913924a4997f5e14c503f87510cbd8e4bfd965a9) --- source4/heimdal/lib/krb5/get_host_realm.c | 27 +++++++++----- source4/heimdal/lib/krb5/krb5-private.h | 1 + source4/heimdal/lib/krb5/krb5-protos.h | 23 +++++++++--- source4/heimdal/lib/krb5/principal.c | 59 ++++++++++++++++++++++--------- 4 files changed, 81 insertions(+), 29 deletions(-) (limited to 'source4/heimdal/lib/krb5') diff --git a/source4/heimdal/lib/krb5/get_host_realm.c b/source4/heimdal/lib/krb5/get_host_realm.c index d9c5bd5dc1..feb01f0036 100644 --- a/source4/heimdal/lib/krb5/get_host_realm.c +++ b/source4/heimdal/lib/krb5/get_host_realm.c @@ -34,7 +34,7 @@ #include "krb5_locl.h" #include -RCSID("$Id: get_host_realm.c,v 1.34 2005/04/19 18:52:51 lha Exp $"); +RCSID("$Id: get_host_realm.c,v 1.35 2005/08/23 08:14:02 lha Exp $"); /* To automagically find the correct realm of a host (without * [domain_realm] in krb5.conf) add a text record for your domain with @@ -94,30 +94,41 @@ dns_find_realm(krb5_context context, const char *domain, krb5_realm **realms) { - static char *default_labels[] = { "_kerberos", NULL }; + static const char *default_labels[] = { "_kerberos", NULL }; char dom[MAXHOSTNAMELEN]; struct dns_reply *r; - char **labels; + const char **labels; + char **config_labels; int i, ret; - labels = krb5_config_get_strings(context, NULL, "libdefaults", - "dns_lookup_realm_labels", NULL); - if(labels == NULL) + config_labels = krb5_config_get_strings(context, NULL, "libdefaults", + "dns_lookup_realm_labels", NULL); + if(config_labels != NULL) + labels = (const char **)config_labels; + else labels = default_labels; if(*domain == '.') domain++; for (i = 0; labels[i] != NULL; i++) { ret = snprintf(dom, sizeof(dom), "%s.%s.", labels[i], domain); - if(ret < 0 || ret >= sizeof(dom)) + if(ret < 0 || ret >= sizeof(dom)) { + if (config_labels) + krb5_config_free_strings(config_labels); return -1; + } r = dns_lookup(dom, "TXT"); if(r != NULL) { ret = copy_txt_to_realms (r->head, realms); dns_free_data(r); - if(ret == 0) + if(ret == 0) { + if (config_labels) + krb5_config_free_strings(config_labels); return 0; + } } } + if (config_labels) + krb5_config_free_strings(config_labels); return -1; } diff --git a/source4/heimdal/lib/krb5/krb5-private.h b/source4/heimdal/lib/krb5/krb5-private.h index e70527845b..8e2ebcf43e 100644 --- a/source4/heimdal/lib/krb5/krb5-private.h +++ b/source4/heimdal/lib/krb5/krb5-private.h @@ -309,6 +309,7 @@ _krb5_pk_rd_pa_reply ( void */*c*/, krb5_enctype /*etype*/, unsigned /*nonce*/, + const krb5_data */*req_buffer*/, PA_DATA */*pa*/, krb5_keyblock **/*key*/); diff --git a/source4/heimdal/lib/krb5/krb5-protos.h b/source4/heimdal/lib/krb5/krb5-protos.h index 2750c8b5d2..711c5ead6e 100644 --- a/source4/heimdal/lib/krb5/krb5-protos.h +++ b/source4/heimdal/lib/krb5/krb5-protos.h @@ -20,6 +20,15 @@ extern "C" { #endif #endif +void +initialize_heim_error_table_r (struct et_list **/*list*/); + +void +initialize_k524_error_table_r (struct et_list **/*list*/); + +void +initialize_krb5_error_table_r (struct et_list **/*list*/); + krb5_error_code KRB5_LIB_FUNCTION krb524_convert_creds_kdc ( krb5_context /*context*/, @@ -2392,7 +2401,7 @@ krb5_prepend_config_files_default ( const char */*filelist*/, char ***/*pfilenames*/); -krb5_realm* +krb5_realm* KRB5_LIB_FUNCTION krb5_princ_realm ( krb5_context /*context*/, krb5_principal /*principal*/); @@ -2418,18 +2427,18 @@ krb5_principal_compare_any_realm ( const char* KRB5_LIB_FUNCTION krb5_principal_get_comp_string ( krb5_context /*context*/, - krb5_principal /*principal*/, + krb5_const_principal /*principal*/, unsigned int /*component*/); const char* KRB5_LIB_FUNCTION krb5_principal_get_realm ( krb5_context /*context*/, - krb5_principal /*principal*/); + krb5_const_principal /*principal*/); int KRB5_LIB_FUNCTION krb5_principal_get_type ( krb5_context /*context*/, - krb5_principal /*principal*/); + krb5_const_principal /*principal*/); krb5_boolean KRB5_LIB_FUNCTION krb5_principal_match ( @@ -3154,6 +3163,12 @@ krb5_unparse_name ( krb5_const_principal /*principal*/, char **/*name*/); +krb5_error_code KRB5_LIB_FUNCTION +krb5_unparse_name_always_short ( + krb5_context /*context*/, + krb5_const_principal /*principal*/, + char **/*name*/); + krb5_error_code KRB5_LIB_FUNCTION krb5_unparse_name_fixed ( krb5_context /*context*/, diff --git a/source4/heimdal/lib/krb5/principal.c b/source4/heimdal/lib/krb5/principal.c index b510478f65..74db080ab7 100644 --- a/source4/heimdal/lib/krb5/principal.c +++ b/source4/heimdal/lib/krb5/principal.c @@ -41,7 +41,7 @@ #include #include "resolve.h" -RCSID("$Id: principal.c,v 1.90 2005/06/30 01:38:15 lha Exp $"); +RCSID("$Id: principal.c,v 1.91 2005/08/23 08:34:40 lha Exp $"); #define princ_num_comp(P) ((P)->name.name_string.len) #define princ_type(P) ((P)->name.name_type) @@ -69,21 +69,21 @@ krb5_principal_set_type(krb5_context context, int KRB5_LIB_FUNCTION krb5_principal_get_type(krb5_context context, - krb5_principal principal) + krb5_const_principal principal) { return princ_type(principal); } const char* KRB5_LIB_FUNCTION krb5_principal_get_realm(krb5_context context, - krb5_principal principal) + krb5_const_principal principal) { return princ_realm(principal); } const char* KRB5_LIB_FUNCTION krb5_principal_get_comp_string(krb5_context context, - krb5_principal principal, + krb5_const_principal principal, unsigned int component) { if(component >= princ_num_comp(principal)) @@ -268,16 +268,6 @@ unparse_name_fixed(krb5_context context, return ERANGE; } /* add realm if different from default realm */ - if(short_form) { - krb5_realm r; - krb5_error_code ret; - ret = krb5_get_default_realm(context, &r); - if(ret) - return ret; - if(strcmp(princ_realm(principal), r) != 0) - short_form = 0; - free(r); - } if(!short_form) { add_char(name, idx, len, '@'); idx = quote_string(princ_realm(principal), name, idx, len); @@ -296,13 +286,31 @@ krb5_unparse_name_fixed(krb5_context context, return unparse_name_fixed(context, principal, name, len, FALSE); } +krb5_error_code KRB5_LIB_FUNCTION +krb5_unparse_name_norealm_fixed(krb5_context context, + krb5_const_principal principal, + char *name, + size_t len) +{ + return unparse_name_fixed(context, principal, name, len, TRUE); +} + krb5_error_code KRB5_LIB_FUNCTION krb5_unparse_name_fixed_short(krb5_context context, krb5_const_principal principal, char *name, size_t len) { - return unparse_name_fixed(context, principal, name, len, TRUE); + krb5_realm r; + krb5_error_code ret; + krb5_boolean short_form = TRUE; + ret = krb5_get_default_realm(context, &r); + if(ret) + return ret; + if(strcmp(princ_realm(principal), r) != 0) + short_form = 0; + free(r); + return unparse_name_fixed(context, principal, name, len, short_form); } static krb5_error_code @@ -355,6 +363,23 @@ krb5_error_code KRB5_LIB_FUNCTION krb5_unparse_name_short(krb5_context context, krb5_const_principal principal, char **name) +{ + krb5_realm r; + krb5_error_code ret; + krb5_boolean short_form = TRUE; + ret = krb5_get_default_realm(context, &r); + if(ret) + return ret; + if(strcmp(princ_realm(principal), r) != 0) + short_form = 0; + free(r); + return unparse_name(context, principal, name, short_form); +} + +krb5_error_code KRB5_LIB_FUNCTION +krb5_unparse_name_norealm(krb5_context context, + krb5_const_principal principal, + char **name) { return unparse_name(context, principal, name, TRUE); } @@ -372,7 +397,7 @@ krb5_unparse_name_ext(krb5_context context, #endif -krb5_realm* +krb5_realm* KRB5_LIB_FUNCTION krb5_princ_realm(krb5_context context, krb5_principal principal) { @@ -380,6 +405,7 @@ krb5_princ_realm(krb5_context context, } + void KRB5_LIB_FUNCTION krb5_princ_set_realm(krb5_context context, krb5_principal principal, @@ -764,7 +790,6 @@ krb5_425_conv_principal_ext2(krb5_context context, } #else struct addrinfo hints, *ai; - int ret; memset (&hints, 0, sizeof(hints)); hints.ai_flags = AI_CANONNAME; -- cgit