Blame SOURCES/openldap-network-timeout.patch

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