[Fedora-directory-commits] ldapserver/ldap/servers/slapd daemon.c, 1.15, 1.16 start_tls_extop.c, 1.9, 1.10

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Wed Oct 10 01:55:38 UTC 2007


Author: rmeggins

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22654/ldapserver/ldap/servers/slapd

Modified Files:
	daemon.c start_tls_extop.c 
Log Message:
Resolves: bug 244475
Bug Description: crash at startup with new ldap sdk on 64-bit platform
Reviewed by: nkinder (Thanks!)
Fix Description: I went ahead and cleaned up or removed the incorrect ber code.  We do not need to use LBER_SOCKBUF_OPT_DESC or LBER_SOCKBUF_OPT_READ_FN or LBER_SOCKBUF_OPT_WRITE_FN.  I removed an unnecessary malloc/free and just used the stack as we do everywhere else in the code.  It looks as though the start_tls cleanup code is almost never used - the code assumes that when you do a start_tls, that stays in force throughout the lifetime of the connection.  Removing this code now should insulate us from future ldap c sdk changes.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no



Index: daemon.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/daemon.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- daemon.c	20 Sep 2007 16:54:38 -0000	1.15
+++ daemon.c	10 Oct 2007 01:55:36 -0000	1.16
@@ -2242,13 +2242,9 @@
 	}
 	PR_Lock( conn->c_mutex );
 
-#if !defined( XP_WIN32 )
-	ber_sockbuf_set_option(conn->c_sb,LBER_SOCKBUF_OPT_DESC,&pr_clonefd);
-#else
+#if defined( XP_WIN32 )
 	if( !secure )
 		ber_sockbuf_set_option(conn->c_sb,LBER_SOCKBUF_OPT_DESC,&ns);
-	else
-		ber_sockbuf_set_option(conn->c_sb,LBER_SOCKBUF_OPT_DESC,&pr_clonefd);
 #endif
 
 	conn->c_sd = ns;
@@ -2288,13 +2284,6 @@
 		func_pointers.lbextiofn_socket_arg = (struct lextiof_socket_private *) pr_clonefd;
 		ber_sockbuf_set_option( conn->c_sb,
 			LBER_SOCKBUF_OPT_EXT_IO_FNS, &func_pointers);
- 
-		/* changed here by Cheston
-		ber_sockbuf_set_option( conn->c_sb,
-			LBER_SOCKBUF_OPT_READ_FN, (void *)secure_read_function );
-		ber_sockbuf_set_option( conn->c_sb,
-			LBER_SOCKBUF_OPT_WRITE_FN, (void *)secure_write_function );
-		*/
 	} else {
 		struct lber_x_ext_io_fns func_pointers;
 		memset(&func_pointers, 0, sizeof(func_pointers));
@@ -2309,12 +2298,6 @@
 #endif
 		ber_sockbuf_set_option( conn->c_sb,
 			LBER_SOCKBUF_OPT_EXT_IO_FNS, &func_pointers);	
-		/*
-		ber_sockbuf_set_option( conn->c_sb,
-			LBER_SOCKBUF_OPT_READ_FN, (void *)read_function );
-		ber_sockbuf_set_option( conn->c_sb,
-			LBER_SOCKBUF_OPT_WRITE_FN, (void *)write_function );
-		*/
 	}
 
 	if( secure && config_get_SSLclientAuth() != SLAPD_SSLCLIENTAUTH_OFF ) { 


Index: start_tls_extop.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/start_tls_extop.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- start_tls_extop.c	27 Feb 2007 02:57:30 -0000	1.9
+++ start_tls_extop.c	10 Oct 2007 01:55:36 -0000	1.10
@@ -277,24 +277,17 @@
 	secure = 1;
 	ns = configure_pr_socket( &newsocket, secure, 0 /*never local*/ );
 
-
-	/*
-	ber_sockbuf_set_option( conn->c_sb, LBER_SOCKBUF_OPT_DESC, &newsocket );
-	ber_sockbuf_set_option( conn->c_sb, LBER_SOCKBUF_OPT_READ_FN, (void *)secure_read_function );
-	ber_sockbuf_set_option( conn->c_sb, LBER_SOCKBUF_OPT_WRITE_FN, (void *)secure_write_function );
-	*/
-
 	/*changed to */
 	{
-	struct lber_x_ext_io_fns *func_pointers = malloc(LBER_X_EXTIO_FNS_SIZE);
-		func_pointers->lbextiofn_size = LBER_X_EXTIO_FNS_SIZE;
-		func_pointers->lbextiofn_read = secure_read_function;
-		func_pointers->lbextiofn_write = secure_write_function;
-		func_pointers->lbextiofn_writev = NULL;
-		func_pointers->lbextiofn_socket_arg = (struct lextiof_socket_private *) newsocket;
+		struct lber_x_ext_io_fns func_pointers;
+		memset(&func_pointers, 0, sizeof(func_pointers));
+		func_pointers.lbextiofn_size = LBER_X_EXTIO_FNS_SIZE; 
+		func_pointers.lbextiofn_read = secure_read_function;
+		func_pointers.lbextiofn_write = secure_write_function;
+		func_pointers.lbextiofn_writev = NULL;
+		func_pointers.lbextiofn_socket_arg = (struct lextiof_socket_private *) newsocket;
 		ber_sockbuf_set_option( conn->c_sb,
-			LBER_SOCKBUF_OPT_EXT_IO_FNS, func_pointers);
-		free(func_pointers);
+			LBER_SOCKBUF_OPT_EXT_IO_FNS, &func_pointers);
 	}	
 	conn->c_flags |= CONN_FLAG_SSL;
 	conn->c_flags |= CONN_FLAG_START_TLS;
@@ -420,26 +413,17 @@
 	secure = 0;
 	ns = configure_pr_socket( &(c->c_prfd), secure, 0 /*never local*/ );
 
-	ber_sockbuf_set_option( c->c_sb, LBER_SOCKBUF_OPT_DESC, &(c->c_prfd) );
-
 #else
 	ns = PR_FileDesc2NativeHandle( c->c_prfd );
 	c->c_prfd = NULL;
 
 	configure_ns_socket( &ns );
-
-	ber_sockbuf_set_option( c->c_sb, LBER_SOCKBUF_OPT_DESC, &ns );	
-
 #endif
 
 	c->c_sd = ns;
         c->c_flags &= ~CONN_FLAG_SSL;
         c->c_flags &= ~CONN_FLAG_START_TLS;
 
-	ber_sockbuf_set_option( c->c_sb, LBER_SOCKBUF_OPT_READ_FN, (void *)read_function );
-	ber_sockbuf_set_option( c->c_sb, LBER_SOCKBUF_OPT_WRITE_FN, (void *)write_function );
-
-
 	/*  authentication & authorization credentials must be set to "anonymous". */
 
 	bind_credentials_clear( c, PR_FALSE, PR_TRUE );




More information about the Fedora-directory-commits mailing list