[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#7271) Don't clobber SASL_NOCANON in clients/tools/common.c



--DKU6Jbt7q3WqK7+M
Content-Type: multipart/mixed; boundary="Nq2Wo0NMKNjxTN9z"
Content-Disposition: inline


--Nq2Wo0NMKNjxTN9z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

I forgot to add the notice to the patch I just submitted.  Here's the
notice:


The attached patch file is derived from OpenLDAP Software. All of the
modifications to OpenLDAP Software represented in the following
patch(es) were developed by W. Trevor King wking@tremily.us. I have
not assigned rights and/or interest in this work to any party.

I, W. Trevor King, hereby place the following modifications to
OpenLDAP Software (and only these modifications) into the public
domain. Hence, these modifications may be freely used and/or
redistributed for any purpose with or without attribution and/or other
notice.


I've attached the patch again, since that matches the language in the
notice.

Cheers,
Trevor

--=20
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

--Nq2Wo0NMKNjxTN9z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tool-nocanon.patch"
Content-Transfer-Encoding: quoted-printable

ITS#7271 fix SASL_NOCANON clobbering in tools/common.c.

diff --git a/clients/tools/common.c b/clients/tools/common.c
index 9c98b62..9868658 100644
--- a/clients/tools/common.c
+++ b/clients/tools/common.c
@@ -1214,6 +1214,7 @@ LDAP *
 tool_conn_setup( int dont, void (*private_setup)( LDAP * ) )
 {
 	LDAP *ld =3D NULL;
+	int i;
=20
 	if ( debug ) {
 		if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug )
@@ -1410,13 +1411,22 @@ dnssrv_free:;
=20
 #ifdef HAVE_CYRUS_SASL
 		/* canon */
-		if( ldap_set_option( ld, LDAP_OPT_X_SASL_NOCANON,
-			nocanon ? LDAP_OPT_ON : LDAP_OPT_OFF ) !=3D LDAP_OPT_SUCCESS )
+		if( ldap_get_option( ld, LDAP_OPT_X_SASL_NOCANON, &i )
+			!=3D LDAP_OPT_SUCCESS )
 		{
-			fprintf( stderr, "Could not set LDAP_OPT_X_SASL_NOCANON %s\n",
-				nocanon ? "on" : "off" );
+			fprintf( stderr, "Could not get LDAP_OPT_X_SASL_NOCANON\n" );
 			tool_exit( ld, EXIT_FAILURE );
 		}
+		if (!i) {
+			fprintf( stderr, "Set NOCANON to %s\n", nocanon ? "on" : "off" );
+			if( ldap_set_option( ld, LDAP_OPT_X_SASL_NOCANON,
+				nocanon ? LDAP_OPT_ON : LDAP_OPT_OFF ) !=3D LDAP_OPT_SUCCESS )
+			{
+				fprintf( stderr, "Could not set LDAP_OPT_X_SASL_NOCANON %s\n",
+					nocanon ? "on" : "off" );
+				tool_exit( ld, EXIT_FAILURE );
+			}
+		}  /* otherwise SASL_NOCANON already set to true (e.g. via ~/.ldaprc) */
 #endif
 		if( ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &protocol )
 			!=3D LDAP_OPT_SUCCESS )

--Nq2Wo0NMKNjxTN9z--

--DKU6Jbt7q3WqK7+M
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)

iQEcBAEBAgAGBQJPrw4RAAoJEPe7CdOcrcTZAiUH/RJN9EcOW0HdIr60/vrHQ01r
et05+CMhoSM9OQST7KxVz0IOA0tzgIu6y7KHFSirUFOmb8KNyS+u0uI2b4OMINoF
0qVHo3Ed4gYYQtc9TsTPOTNw0/HfRwiLxYHh6Xrmeq0Z9o+rL1wsFoEwVBQTXc4W
3xsYtjoyRFK5KbmMw+iA1zsIWOTD9cs+PqQ0EWDXl2ptMHjhrBOs8/Demi495UA7
iCmrPbD8uv8T5NMCiqIB3yOkyrX2+0wLsLVO/B21qTb8swFOrSFjlACZ4SjvVYmy
ZJ6njl7vu0h7vPF12Z+NQW5xMFCYz6wbesrhCNbj0k7eJ5gbD+Zd2tP8VQOS3C4=
=9g7U
-----END PGP SIGNATURE-----

--DKU6Jbt7q3WqK7+M--