Blame SOURCES/openldap-network-timeout.patch

5b6c6a
459132: RFE: CRM 1845142 'OpenLDAP libraries on RHEL 4 and failover'
5b6c6a
5b6c6a
Source: upstream, cvs diff -r 1.105 -r 1.106 init.c
5b6c6a
        (+ delete other than NETWORK_TIMEOUT options)
5b6c6a
5b6c6a
diff -up openldap-2.3.42/doc/man/man5/ldap.conf.5.network-timeout openldap-2.3.42/doc/man/man5/ldap.conf.5
5b6c6a
--- openldap-2.3.42/doc/man/man5/ldap.conf.5.network-timeout	2008-08-18 10:52:11.000000000 +0200
5b6c6a
+++ openldap-2.3.42/doc/man/man5/ldap.conf.5	2008-02-12 00:24:09.000000000 +0100
5b6c6a
@@ -86,6 +86,10 @@ list of hosts may be provided.
5b6c6a
 is deprecated in favor of
5b6c6a
 .BR URI .
5b6c6a
 .TP
5b6c6a
+.B NETWORK_TIMEOUT <integer>
5b6c6a
+Specifies the timeout (in seconds) after which the poll(2)/select(2)
5b6c6a
+following a connect(2) returns in case of no activity.
5b6c6a
+.TP
5b6c6a
 .B PORT <port>
5b6c6a
 Specifies the default port used when connecting to LDAP servers(s).
5b6c6a
 The port may be specified as a number.
5b6c6a
diff -up openldap-2.3.42/libraries/libldap/init.c.network-timeout openldap-2.3.42/libraries/libldap/init.c
5b6c6a
--- openldap-2.3.42/libraries/libldap/init.c.network-timeout	2008-08-18 10:20:20.000000000 +0200
5b6c6a
+++ openldap-2.3.42/libraries/libldap/init.c	2008-08-18 10:48:37.000000000 +0200
5b6c6a
@@ -43,6 +43,8 @@ struct ldapoptions ldap_int_global_optio
5b6c6a
 #define ATTR_SASL	6
5b6c6a
 #define ATTR_TLS	7
5b6c6a
 
5b6c6a
+#define ATTR_OPT_TV	8
5b6c6a
+
5b6c6a
 struct ol_keyvalue {
5b6c6a
 	const char *		key;
5b6c6a
 	int			value;
5b6c6a
@@ -63,6 +65,7 @@ static const struct ol_attribute {
5b6c6a
 	const void *	data;
5b6c6a
 	size_t		offset;
5b6c6a
 } attrs[] = {
5b6c6a
+	{0, ATTR_OPT_TV,	"NETWORK_TIMEOUT",	NULL,	LDAP_OPT_NETWORK_TIMEOUT},
5b6c6a
 	{0, ATTR_KV,		"DEREF",	deref_kv, /* or &deref_kv[0] */
5b6c6a
 		offsetof(struct ldapoptions, ldo_deref)},
5b6c6a
 	{0, ATTR_INT,		"SIZELIMIT",	NULL,
5b6c6a
@@ -241,6 +244,14 @@ static void openldap_ldap_init_w_conf(
5b6c6a
 			   	ldap_int_tls_config( NULL, attrs[i].offset, opt );
5b6c6a
 #endif
5b6c6a
 				break;
5b6c6a
+			case ATTR_OPT_TV: {
5b6c6a
+				struct timeval tv;
5b6c6a
+				tv.tv_sec = atol( opt );
5b6c6a
+				tv.tv_usec = 0;
5b6c6a
+				if ( tv.tv_sec > 0 ) {
5b6c6a
+					(void)ldap_set_option( NULL, attrs[i].offset, (const void *)&tv;;
5b6c6a
+				}
5b6c6a
+				} break;
5b6c6a
 			}
5b6c6a
 
5b6c6a
 			break;