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

A bunch of bugs the ITS seems to be ignoring



Hi,

In late June I tried to submit 6 bug reports using your issue tracker
online. They seemed to submit OK, but didn't show up straight away,
however since you note on the site that they may not show up
immediately, I was content to wait. They still haven't shown up, though.

So now I have 7 bug reports! The original six are below. The seventh is
that the issue tracker doesn't work, or requires login or something else
that isn't documented.

If someone knows what I was doing wrong with the tracker and can explain
what I should be doing, I'm happy to enter these into it again more
effectively.

(My email program is likely to wrap this and thereby botch up the
patches, too. They're probably still easy enough to understand/fix.)

Ben.



------------------------------------------------------------------------



My precise situation is, I am sure, a very uncommon scenario. However, it may affect other building methods as well, and an appropriate fix I am sure could help a few users.

Here's what I have been doing (please try not to laugh!): I have been cross-compiling OpenLDAP on Mac OS X for MinGW32, including the SQL backend. I have found two issues related to the configuration/build process.

I am afraid I really have no knowledge of GNU autoconf, so I will describe the problem and my fixes, but with no pretense that they are appropriate for applying to the code. I will suggest an appropriate way to fix it, but will have to leave that work to another developer.

This is the first.

On Windows/MinGW, the ODBC library is not libodbc.a, but libodbc32.a. Furthermore, it seems the way function names are mangled on that platform includes their stack frame size: the symbol for SQLDriverConnect which configure tests for is _SQLDriverConnect@32.

I got around this by manually changing -lodbc to -lodbc32 in configure and then further patching it as follows:

diff -ru --exclude=Makefile openldap-2.4.10/configure openldap/configure
--- openldap-2.4.10/configure	2008-02-12 10:36:45.000000000 +1100
+++ openldap/configure	2008-06-28 19:36:36.000000000 +1000
@@ -32018,11 +32018,14 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char SQLDriverConnect ();
+/*char SQLDriverConnect ();*/
+#include <windows.h>
+#include <sqlext.h>
 int
 main ()
 {
-SQLDriverConnect ();
+/*SQLDriverConnect ();*/
+SQLDriverConnect (0,0,0,0,0,0,0,0);
   ;
   return 0;
 }

This pulls in the appropriate headers for configure to find and use _SQLDriverConect@32 in libodbc32. I got part of the idea from another user's post I found on the Net, but a quick search of your issue tracker didn't show it up, so I am reporting it now.

A more appropriate fix would be to change configure.in so that there are three checks for ODBC: one in libiodbc, one in libodbc and one in libodbc32, which is Windows specific, pulling in windows.h and sqlext.h before looking for the symbol with 8 arguments. I guess this would probably involve a more customised macro in configure.in. If that is too much trouble, perhaps the value for the ODBC library could just be assumed if configure can detect a Windows build.



------------------------------------------------------------------------



My precise situation is, I am sure, a very uncommon scenario. However, it may affect other building methods as well, and an appropriate fix I am sure could help a few users.

Here's what I have been doing (please try not to laugh!): I have been cross-compiling OpenLDAP on Mac OS X for MinGW32, including the SQL backend. I have found two issues related to the configuration/build process.

I am afraid I really have no knowledge of GNU autoconf, so I will describe the problem and my fixes, but with no pretense that they are appropriate for applying to the code. I will suggest an appropriate way to fix it, but will have to leave that work to another developer.

This is the second.

When linking OpenSSL on Windows, it is also necessary to link against libgdi32 and libws2_32 needs to be linked after libcrypto.

I worked around the problem with a simple substitution in configure:

s/-lcrypto/-lcrypto -lgdi32 -lws2_32

A more appropriate fix would be to make configure test first without these extra libraries, and then with them, so that they are included if needed.

Note that configure will not fail if -lws2_32 is omitted, but building libldap and libldap_r will fail later. I think it is probably safe to assume that if -lgdi32 is needed, -lws2_32 will be (or at least available and not harmful to include).

A quick search and I couldn't find this issue already in your tracker.



------------------------------------------------------------------------



I have recently cross-compiled OpenLDAP for MinGW32 on Mac OS X. In so doing, I discovered the following platform-specific issue.

The executables on Win32 have a .exe extension, so slapd does not detect the tool names and act accordingly. Consequently, slapadd, slaptest, etc. all act the same as slapd!

I solved the problem by patching main.c as follows:

diff -ru --exclude=Makefile openldap-2.4.10/servers/slapd/main.c openldap/servers/slapd/main.c
--- openldap-2.4.10/servers/slapd/main.c 2008-05-20 10:10:40.000000000 +1000
+++ openldap/servers/slapd/main.c 2008-06-28 21:56:09.000000000 +1000
@@ -71,14 +71,14 @@
char *name;
MainFunc *func;
} tools[] = {
- {"slapadd", slapadd},
- {"slapcat", slapcat},
- {"slapdn", slapdn},
- {"slapindex", slapindex},
- {"slappasswd", slappasswd},
- {"slaptest", slaptest},
- {"slapauth", slapauth},
- {"slapacl", slapacl},
+ {"slapadd.exe", slapadd},
+ {"slapcat.exe", slapcat},
+ {"slapdn.exe", slapdn},
+ {"slapindex.exe", slapindex},
+ {"slappasswd.exe", slappasswd},
+ {"slaptest.exe", slaptest},
+ {"slapauth.exe", slapauth},
+ {"slapacl.exe", slapacl},
/* NOTE: new tools must be added in chronological order,
* not in alphabetical order, because for backwards
* compatibility name[4] is used to identify the


Obviously this exact fix is not appropriate, because it will break every other platform, but I am not sure of the appropriate preprocessor directive to use to address this, as I guess it would also break a cygwin build, and should only be done for a MinGW32 build. However, it would be helpful to fix with an appropriate conditional!

I couldn't find a mention of this in your tracker so reporting it now.



------------------------------------------------------------------------



I have recently cross-compiled OpenLDAP for MinGW32 on Mac OS X. While debugging to find and fix two crashes which I will detail in other posts, I discovered that an assertion is always failing because it seems it is inappropriately included when it shouldn't be. I suggest this patch.

diff -ru --exclude=Makefile openldap-2.4.10/servers/slapd/daemon.c openldap/servers/slapd/daemon.c
--- openldap-2.4.10/servers/slapd/daemon.c 2008-05-28 06:12:44.000000000 +1000
+++ openldap/servers/slapd/daemon.c 2008-06-28 21:54:38.000000000 +1000
@@ -829,7 +829,9 @@
{
ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );


+#if defined(HAVE_EPOLL)
 	assert( SLAP_SOCK_NOT_ACTIVE(s) );
+#endif

 	if ( isactive ) slap_daemon.sd_nactives++;


If you search for where the relevant parts of the macros involved in SLAP_SOCK_NOT_ACTIVE, and particularly the marking of active and inactive, I believe you will find they apply only in the HAVE_EPOLL case, and thus the assertion should only hold in that case.


I did find a closed issue in your tracker related to the same assertion failing, but it didn't detail the fix, and was very old, so I assume was not relevant to this particular problem.



------------------------------------------------------------------------



I have recently cross-compiled OpenLDAP for MinGW32 on Mac OS X. I found two bugs in the source code relating to shutdown/freeing structures.

This is the first.

Because slapd_daemon_destroy can be called without slapd_deamon_init being called (e.g. if testing configuration, or giving -VV as the documentation suggests does something, though I'm not sure what), an attempt can be made to close sockets not opened. I suggest the following fix:

diff -ru --exclude=Makefile openldap-2.4.10/servers/slapd/daemon.c openldap/servers/slapd/daemon.c
--- openldap-2.4.10/servers/slapd/daemon.c 2008-05-28 06:12:44.000000000 +1000
+++ openldap/servers/slapd/daemon.c 2008-06-28 21:54:38.000000000 +1000
@@ -79,7 +79,7 @@
#define SLAPD_LISTEN_BACKLOG 1024
#endif /* ! SLAPD_LISTEN_BACKLOG */


-static ber_socket_t wake_sds[2];
+static ber_socket_t wake_sds[2] = {INVALID_SOCKET, INVALID_SOCKET};
 static int emfile;

 static volatile int waking;
@@ -1641,8 +1643,10 @@
 slapd_daemon_destroy( void )
 {
 	connections_destroy();
-	tcp_close( SLAP_FD2SOCK(wake_sds[1]) );
-	tcp_close( SLAP_FD2SOCK(wake_sds[0]) );
+	if ( wake_sds[1] != INVALID_SOCKET )
+		tcp_close( SLAP_FD2SOCK(wake_sds[1]) );
+	if ( wake_sds[0] != INVALID_SOCKET )
+		tcp_close( SLAP_FD2SOCK(wake_sds[0]) );
 	sockdestroy();

 #ifdef HAVE_SLP

I couldn't find this mentioned in your tracker already.



------------------------------------------------------------------------



I have recently cross-compiled OpenLDAP for MinGW32 on Mac OS X. I found two bugs in the source code relating to shutdown/freeing structures.

This is the second. It relates to back-sql, which I realise is unsupported on this platform, but seems to work very nicely once this and another bugfix or two (my other posts) are made. Mind you, I have only done a small amount of testing, and don't really understand what I am doing, as I am a complete newbie to LDAP. After sending these patches I intend to embark on a reading of your Administrator's Guide to learn.

From the source code, though, I don't see why the problem would only apply to this platform anyway. It is this:

When an SQL handle is opened, it is registered to be freed. When it is freed, however, it is not deregistered, so can easily be freed twice, particularly as to load the schemas the database connection is opened and closed. I suggest this patch to fix it (the patch looks larger than it really is as some code needed to be moved to ensure correct definition order):

diff -ru --exclude=Makefile openldap-2.4.10/servers/slapd/back-sql/sql-wrap.c openldap/servers/slapd/back-sql/sql-wrap.c
--- openldap-2.4.10/servers/slapd/back-sql/sql-wrap.c 2008-02-12 10:26:48.000000000 +1100
+++ openldap/servers/slapd/back-sql/sql-wrap.c 2008-06-28 22:29:25.000000000 +1000
@@ -462,28 +462,31 @@
return LDAP_SUCCESS;
}


+static void	*backsql_db_conn_dummy;
+
+static void
+backsql_db_conn_keyfree(
+	void		*key,
+	void		*data )
+{
+	backsql_close_db_handle( (SQLHDBC)data );
+}
+
 int
 backsql_free_db_conn( Operation *op, SQLHDBC dbh )
 {
 	Debug( LDAP_DEBUG_TRACE, "==>backsql_free_db_conn()\n", 0, 0, 0 );

 	(void)backsql_close_db_handle( dbh );
+	ldap_pvt_thread_pool_setkey( op->o_threadctx,
+			&backsql_db_conn_dummy, (void *)SQL_NULL_HDBC,
+			backsql_db_conn_keyfree, NULL, NULL );

 	Debug( LDAP_DEBUG_TRACE, "<==backsql_free_db_conn()\n", 0, 0, 0 );

 	return LDAP_SUCCESS;
 }

-static void	*backsql_db_conn_dummy;
-
-static void
-backsql_db_conn_keyfree(
-	void		*key,
-	void		*data )
-{
-	backsql_close_db_handle( (SQLHDBC)data );
-}
-
 int
 backsql_get_db_conn( Operation *op, SQLHDBC *dbhp )
 {

I could not find this issue already in your tracker.



------------------------------------------------------------------------