svn commit: samba r22003 - in branches: SAMBA_3_0/source/include SAMBA_3_0/source/libsmb SAMBA_3_0/source/utils SAMBA_3_0_25/source/include SAMBA_3_0_25/source/libsmb SAMBA_3_0_25/source/utils

jra at samba.org jra at samba.org
Wed Mar 28 19:48:00 GMT 2007


Author: jra
Date: 2007-03-28 19:47:59 +0000 (Wed, 28 Mar 2007)
New Revision: 22003

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22003

Log:
Fix from Jiri.Sasek at Sun.COM to wrap our krb5_locate_kdc
call as smb_krb5_locate_kdc to prevent incorrect linking
and crashes on Solaris.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/include/includes.h
   branches/SAMBA_3_0/source/libsmb/clikrb5.c
   branches/SAMBA_3_0/source/utils/net_lookup.c
   branches/SAMBA_3_0_25/source/include/includes.h
   branches/SAMBA_3_0_25/source/libsmb/clikrb5.c
   branches/SAMBA_3_0_25/source/utils/net_lookup.c


Changeset:
Modified: branches/SAMBA_3_0/source/include/includes.h
===================================================================
--- branches/SAMBA_3_0/source/include/includes.h	2007-03-28 14:16:34 UTC (rev 22002)
+++ branches/SAMBA_3_0/source/include/includes.h	2007-03-28 19:47:59 UTC (rev 22003)
@@ -1120,7 +1120,10 @@
 int create_kerberos_key_from_string_direct(krb5_context context, krb5_principal host_princ, krb5_data *password, krb5_keyblock *key, krb5_enctype enctype);
 BOOL get_auth_data_from_tkt(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, krb5_ticket *tkt);
 krb5_const_principal get_principal_from_tkt(krb5_ticket *tkt);
+krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters);
+#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);
+#endif
 krb5_error_code get_kerberos_allowed_etypes(krb5_context context, krb5_enctype **enctypes);
 BOOL get_krb5_smb_session_key(krb5_context context, krb5_auth_context auth_context, DATA_BLOB *session_key, BOOL remote);
 krb5_error_code smb_krb5_kt_free_entry(krb5_context context, krb5_keytab_entry *kt_entry);

Modified: branches/SAMBA_3_0/source/libsmb/clikrb5.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/clikrb5.c	2007-03-28 14:16:34 UTC (rev 22002)
+++ branches/SAMBA_3_0/source/libsmb/clikrb5.c	2007-03-28 19:47:59 UTC (rev 22003)
@@ -393,7 +393,7 @@
 
 #if defined(KRB5_KRBHST_INIT)
 /* Heimdal */
- krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters)
+ krb5_error_code smb_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;
@@ -407,7 +407,7 @@
 
 	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)));
+		DEBUG(0, ("smb_krb5_locate_kdc: krb5_krbhst_init failed (%s)\n", error_message(rc)));
 		return rc;
 	}
 
@@ -417,14 +417,14 @@
 	krb5_krbhst_reset(ctx, hnd);
 
 	if (!num_kdcs) {
-		DEBUG(0, ("krb5_locate_kdc: zero kdcs found !\n"));
+		DEBUG(0, ("smb_krb5_locate_kdc: zero kdcs found !\n"));
 		krb5_krbhst_free(ctx, hnd);
 		return -1;
 	}
 
 	sa = SMB_MALLOC_ARRAY( struct sockaddr, num_kdcs );
 	if (!sa) {
-		DEBUG(0, ("krb5_locate_kdc: malloc failed\n"));
+		DEBUG(0, ("smb_krb5_locate_kdc: malloc failed\n"));
 		krb5_krbhst_free(ctx, hnd);
 		naddrs = 0;
 		return -1;
@@ -454,7 +454,7 @@
 
 #else /* ! defined(KRB5_KRBHST_INIT) */
 
- krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm,
+ krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm,
 		struct sockaddr **addr_pp, int *naddrs, int get_masters)
 {
 	DEBUG(0, ("unable to explicitly locate the KDC on this platform\n"));
@@ -463,6 +463,14 @@
 
 #endif /* KRB5_KRBHST_INIT */
 
+#else /* ! HAVE_KRB5_LOCATE_KDC */
+
+ krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm,
+		struct sockaddr **addr_pp, int *naddrs, int get_masters)
+{
+	return krb5_locate_kdc(ctx, realm, addr_pp, naddrs, get_masters);
+}
+
 #endif /* HAVE_KRB5_LOCATE_KDC */
 
 #if !defined(HAVE_KRB5_FREE_UNPARSED_NAME)

Modified: branches/SAMBA_3_0/source/utils/net_lookup.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_lookup.c	2007-03-28 14:16:34 UTC (rev 22002)
+++ branches/SAMBA_3_0/source/utils/net_lookup.c	2007-03-28 19:47:59 UTC (rev 22003)
@@ -238,9 +238,9 @@
 		realm.length = strlen((const char *)realm.data);
 	}
 
-	rc = krb5_locate_kdc(ctx, &realm, (struct sockaddr **)(void *)&addrs, &num_kdcs, 0);
+	rc = smb_krb5_locate_kdc(ctx, &realm, (struct sockaddr **)(void *)&addrs, &num_kdcs, 0);
 	if (rc) {
-		DEBUG(1, ("krb5_locate_kdc failed (%s)\n", error_message(rc)));
+		DEBUG(1, ("smb_krb5_locate_kdc failed (%s)\n", error_message(rc)));
 		return -1;
 	}
 	for (i=0;i<num_kdcs;i++)

Modified: branches/SAMBA_3_0_25/source/include/includes.h
===================================================================
--- branches/SAMBA_3_0_25/source/include/includes.h	2007-03-28 14:16:34 UTC (rev 22002)
+++ branches/SAMBA_3_0_25/source/include/includes.h	2007-03-28 19:47:59 UTC (rev 22003)
@@ -1123,7 +1123,10 @@
 int create_kerberos_key_from_string_direct(krb5_context context, krb5_principal host_princ, krb5_data *password, krb5_keyblock *key, krb5_enctype enctype);
 BOOL get_auth_data_from_tkt(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, krb5_ticket *tkt);
 krb5_const_principal get_principal_from_tkt(krb5_ticket *tkt);
+krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters);
+#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);
+#endif
 krb5_error_code get_kerberos_allowed_etypes(krb5_context context, krb5_enctype **enctypes);
 BOOL get_krb5_smb_session_key(krb5_context context, krb5_auth_context auth_context, DATA_BLOB *session_key, BOOL remote);
 krb5_error_code smb_krb5_kt_free_entry(krb5_context context, krb5_keytab_entry *kt_entry);

Modified: branches/SAMBA_3_0_25/source/libsmb/clikrb5.c
===================================================================
--- branches/SAMBA_3_0_25/source/libsmb/clikrb5.c	2007-03-28 14:16:34 UTC (rev 22002)
+++ branches/SAMBA_3_0_25/source/libsmb/clikrb5.c	2007-03-28 19:47:59 UTC (rev 22003)
@@ -393,7 +393,7 @@
 
 #if defined(KRB5_KRBHST_INIT)
 /* Heimdal */
- krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters)
+ krb5_error_code smb_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;
@@ -407,7 +407,7 @@
 
 	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)));
+		DEBUG(0, ("smb_krb5_locate_kdc: krb5_krbhst_init failed (%s)\n", error_message(rc)));
 		return rc;
 	}
 
@@ -417,14 +417,14 @@
 	krb5_krbhst_reset(ctx, hnd);
 
 	if (!num_kdcs) {
-		DEBUG(0, ("krb5_locate_kdc: zero kdcs found !\n"));
+		DEBUG(0, ("smb_krb5_locate_kdc: zero kdcs found !\n"));
 		krb5_krbhst_free(ctx, hnd);
 		return -1;
 	}
 
 	sa = SMB_MALLOC_ARRAY( struct sockaddr, num_kdcs );
 	if (!sa) {
-		DEBUG(0, ("krb5_locate_kdc: malloc failed\n"));
+		DEBUG(0, ("smb_krb5_locate_kdc: malloc failed\n"));
 		krb5_krbhst_free(ctx, hnd);
 		naddrs = 0;
 		return -1;
@@ -454,7 +454,7 @@
 
 #else /* ! defined(KRB5_KRBHST_INIT) */
 
- krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm,
+ krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm,
 		struct sockaddr **addr_pp, int *naddrs, int get_masters)
 {
 	DEBUG(0, ("unable to explicitly locate the KDC on this platform\n"));
@@ -463,6 +463,14 @@
 
 #endif /* KRB5_KRBHST_INIT */
 
+#else /* ! HAVE_KRB5_LOCATE_KDC */
+
+ krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm,
+		struct sockaddr **addr_pp, int *naddrs, int get_masters)
+{
+	return krb5_locate_kdc(ctx, realm, addr_pp, naddrs, get_masters);
+}
+
 #endif /* HAVE_KRB5_LOCATE_KDC */
 
 #if !defined(HAVE_KRB5_FREE_UNPARSED_NAME)

Modified: branches/SAMBA_3_0_25/source/utils/net_lookup.c
===================================================================
--- branches/SAMBA_3_0_25/source/utils/net_lookup.c	2007-03-28 14:16:34 UTC (rev 22002)
+++ branches/SAMBA_3_0_25/source/utils/net_lookup.c	2007-03-28 19:47:59 UTC (rev 22003)
@@ -238,9 +238,9 @@
 		realm.length = strlen((const char *)realm.data);
 	}
 
-	rc = krb5_locate_kdc(ctx, &realm, (struct sockaddr **)(void *)&addrs, &num_kdcs, 0);
+	rc = smb_krb5_locate_kdc(ctx, &realm, (struct sockaddr **)(void *)&addrs, &num_kdcs, 0);
 	if (rc) {
-		DEBUG(1, ("krb5_locate_kdc failed (%s)\n", error_message(rc)));
+		DEBUG(1, ("smb_krb5_locate_kdc failed (%s)\n", error_message(rc)));
 		return -1;
 	}
 	for (i=0;i<num_kdcs;i++)



More information about the samba-cvs mailing list