File ldap-yp-tools-1.13.dif of Package ldap-yp-tools

---
 common/common.h    |    4 ++++
 ldapcat/ldapcat.in |    4 ++++
 2 files changed, 8 insertions(+)

--- common/common.h
+++ common/common.h	2022-01-25 09:39:42.244333821 +0000
@@ -61,6 +61,10 @@ typedef struct {
 int get_ldap_config(LDAPConfig * config);
 int rebindproc(LDAP * ld, LDAP_CONST char *url, ber_tag_t request,
 	       ber_int_t msgid, void *params);
+#ifdef HAVE_LDAP_H
+#undef ldap_connect
+#define ldap_connect mask_ldap_connect
+#endif
 LDAP *ldap_connect(LDAPConfig * config);
 void free_ldap_user_entry(USEREntry * user);
 USEREntry *get_ldap_user_entry(LDAP * ld, LDAPConfig * config, char *uid);
--- ldapcat/ldapcat.in
+++ ldapcat/ldapcat.in	2023-07-27 08:37:31.723526531 +0000
@@ -771,6 +771,7 @@ sub ldap_connect
 	my $port    = shift;
 
 	my $fqdn;
+	my $scheme = 'ldap';
 	my ($ldap, $result);
 	my ($binddn, $bindpw);
 
@@ -798,10 +799,13 @@ sub ldap_connect
 		return undef;
 	}
 
+	$scheme = 'ldaps' if ($port != 389);
+
 	# Simple authentication to LDAP
 	if (!($ldap = new Net::LDAP(
 				$server,
 				port	=> $port,
+				scheme	=> $scheme,
 				version	=> 3,
 				))) {
 		$@ = "Unable to init for $server: $@\n";
openSUSE Build Service is sponsored by