1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-30 06:50:24 +03:00

Finally we compile with Heimdal as well as MIT ! Wonder if it works... :-).

Jeremy.
(This used to be commit 1b71786c161cd8ec4c3c0c6b178370ed50feeef4)
This commit is contained in:
Jeremy Allison 2003-01-28 03:31:33 +00:00
parent db56e6f8f0
commit b1bce45141
6 changed files with 247 additions and 147 deletions

335
source3/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -2058,6 +2058,7 @@ fi
AC_CHECK_LIB(krb5, krb5_string_to_key_salt, [AC_DEFINE(HAVE_KRB5_STRING_TO_KEY_SALT,1,[Whether krb5_string_to_key_salt is available])])
AC_CHECK_LIB(krb5, krb5_auth_con_setkey, [AC_DEFINE(HAVE_KRB5_AUTH_CON_SETKEY,1,[Whether krb5_auth_con_setkey is available])])
AC_CHECK_LIB(krb5, krb5_auth_con_setuseruserkey, [AC_DEFINE(HAVE_KRB5_AUTH_CON_SETUSERUSERKEY,1,[Whether krb5_auth_con_setuseruserkey is available])])
AC_CHECK_LIB(krb5, krb5_locate_kdc, [AC_DEFINE(HAVE_KRB5_LOCATE_KDC,1,[Whether krb5_locate_kdc is available])])
AC_CACHE_CHECK([for addrtype in krb5_address],samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS,[
AC_TRY_COMPILE([#include <krb5.h>],

View File

@ -1637,6 +1637,9 @@
/* Whether krb5_auth_con_setuseruserkey is available */
#undef HAVE_KRB5_AUTH_CON_SETUSERUSERKEY
/* Whether krb5_locate_kdc is available */
#undef HAVE_KRB5_LOCATE_KDC
/* Whether the krb5_address struct has a addrtype property */
#undef HAVE_ADDRTYPE_IN_KRB5_ADDRESS

View File

@ -1229,6 +1229,7 @@ int create_kerberos_key_from_string(krb5_context context,
void get_auth_data_from_tkt(DATA_BLOB *auth_data, krb5_ticket *tkt);
krb5_const_principal get_principal_from_tkt(krb5_ticket *tkt);
krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters);
#endif /* HAVE_KRB5 */

View File

@ -140,6 +140,58 @@
#endif
}
#if !defined(HAVE_KRB5_LOCATE_KDC)
krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters)
{
krb5_krbhst_handle hnd;
krb5_krbhst_info *hinfo;
krb5_error_code rc;
int num_kdcs, i;
struct sockaddr *sa;
*addr_pp = NULL;
*naddrs = 0;
rc = krb5_krbhst_init(ctx, realm->data, KRB5_KRBHST_KDC, &hnd);
if (rc) {
DEBUG(0, ("krb5_locate_kdc: krb5_krbhst_init failed (%s)\n", error_message(rc)));
return rc;
}
for ( num_kdcs = 0; (rc = krb5_krbhst_next(ctx, hnd, &hinfo) == 0); num_kdcs++)
;
krb5_krbhst_reset(ctx, hnd);
if (!num_kdcs) {
DEBUG(0, ("krb5_locate_kdc: zero kdcs found !\n"));
krb5_krbhst_free(ctx, hnd);
return -1;
}
sa = malloc( sizeof(struct sockaddr) * num_kdcs );
if (!sa) {
DEBUG(0, ("krb5_locate_kdc: malloc failed\n"));
krb5_krbhst_free(ctx, hnd);
naddrs = 0;
return -1;
}
memset(*addr_pp, '\0', sizeof(struct sockaddr) * num_kdcs );
for (i = 0; i < num_kdcs && (rc = krb5_krbhst_next(ctx, hnd, &hinfo) == 0); i++) {
if (hinfo->ai->ai_family == AF_INET)
memcpy(&sa[i], hinfo->ai->ai_addr, sizeof(struct sockaddr));
}
krb5_krbhst_free(ctx, hnd);
*naddrs = num_kdcs;
*addr_pp = sa;
return 0;
}
#endif
/*
we can't use krb5_mk_req because w2k wants the service to be in a particular format
*/

View File

@ -201,7 +201,7 @@ static int net_lookup_kdc(int argc, const char **argv)
realm.length = strlen(realm.data);
}
rc = krb5_locate_kdc(ctx, &realm, &addrs, &num_kdcs, 0);
rc = krb5_locate_kdc(ctx, &realm, (struct sockaddr **)&addrs, &num_kdcs, 0);
if (rc) {
DEBUG(1, ("krb5_locate_kdc failed (%s)\n", error_message(rc)));
return -1;