Blame SOURCES/openldap-network-timeout.patch

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