summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2004-08-25 07:52:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:29 -0500
commit77cc4121cf0a31a6594bccd1f86351aee785eb96 (patch)
tree20e8daad66f4233daf58e822cdbdaa35334582f5 /source3
parentf98af01f43d37d9d633ec8861232fc1c7f66d3f9 (diff)
downloadsamba-77cc4121cf0a31a6594bccd1f86351aee785eb96.tar.gz
samba-77cc4121cf0a31a6594bccd1f86351aee785eb96.tar.bz2
samba-77cc4121cf0a31a6594bccd1f86351aee785eb96.zip
r2057: Although rarely used, prevent "net lookup kdc" from segfaulting when
using our own implementation of krb5_lookup_kdc with heimdal. Also, heimdals krb5_krbhst_next() obviously does not retrieve the struct addrinfo in the krb5_krbhst_info-struct, using krb5_krbhst_get_addrinfo() instead. Guenther (This used to be commit cca660e109cc94b49ac6bf1f2802235d1d4d4383)
Diffstat (limited to 'source3')
-rw-r--r--source3/configure.in1
-rw-r--r--source3/libsmb/clikrb5.c12
2 files changed, 12 insertions, 1 deletions
diff --git a/source3/configure.in b/source3/configure.in
index 0dc4838809..d35e89c81f 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -2758,6 +2758,7 @@ if test x"$with_ads_support" != x"no"; then
AC_CHECK_FUNC_EXT(krb5_free_unparsed_name, $KRB5_LIBS)
AC_CHECK_FUNC_EXT(krb5_free_keytab_entry_contents, $KRB5_LIBS)
AC_CHECK_FUNC_EXT(krb5_kt_free_entry, $KRB5_LIBS)
+ AC_CHECK_FUNC_EXT(krb5_krbhst_get_addrinfo, $KRB5_LIBS)
LIBS="$LIBS $KRB5_LIBS"
diff --git a/source3/libsmb/clikrb5.c b/source3/libsmb/clikrb5.c
index 5fcde4654a..de2f0cec18 100644
--- a/source3/libsmb/clikrb5.c
+++ b/source3/libsmb/clikrb5.c
@@ -190,6 +190,7 @@
krb5_error_code rc;
int num_kdcs, i;
struct sockaddr *sa;
+ struct addrinfo **ai;
*addr_pp = NULL;
*naddrs = 0;
@@ -219,10 +220,19 @@
return -1;
}
+ *addr_pp = malloc(sizeof(struct sockaddr) * num_kdcs);
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)
+
+#if defined(HAVE_KRB5_KRBHST_GET_ADDRINFO)
+ rc = krb5_krbhst_get_addrinfo(ctx, hinfo, ai);
+ if (rc) {
+ DEBUG(0,("krb5_krbhst_get_addrinfo failed: %s\n", error_message(rc)));
+ return rc;
+ }
+#endif
+ if (hinfo->ai && hinfo->ai->ai_family == AF_INET)
memcpy(&sa[i], hinfo->ai->ai_addr, sizeof(struct sockaddr));
}