summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-03-31 01:08:59 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-03-31 01:08:59 +0000
commitc76ecbae6295022d031d2e286f2d67e5d08946a2 (patch)
tree8c5b1d0f0aa1b7437e2440a0404e825a94de6bbe
parent453813ec6e2c25a3f6a664212aedcad15cfd6000 (diff)
downloadsamba-c76ecbae6295022d031d2e286f2d67e5d08946a2.tar.gz
samba-c76ecbae6295022d031d2e286f2d67e5d08946a2.tar.xz
samba-c76ecbae6295022d031d2e286f2d67e5d08946a2.zip
Don't try and dlsym or dlclose a NULL pointer.
The new modules system does not always dlopen() it's modules, and when it does, it keeps them open for the life of the server, not the life of the connection. This caused a segfault on every tree disconnect! Andrew Bartlett
-rw-r--r--source/smbd/conn.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/source/smbd/conn.c b/source/smbd/conn.c
index 38fa2e02376..2a77e23e73d 100644
--- a/source/smbd/conn.c
+++ b/source/smbd/conn.c
@@ -201,15 +201,18 @@ void conn_free(connection_struct *conn)
/* Free vfs_connection_struct */
handle = conn->vfs_private;
while(handle) {
- /* Close dlopen() handle */
- done_fptr = (void (*)(connection_struct *))sys_dlsym(handle->handle, "vfs_done");
-
- if (done_fptr == NULL) {
- DEBUG(3, ("No vfs_done() symbol found in module with handle %p, ignoring\n", handle->handle));
- } else {
- done_fptr(conn);
- }
- sys_dlclose(handle->handle);
+ if (handle->handle) {
+ /* Close dlopen() handle */
+ done_fptr = (void (*)(connection_struct *))sys_dlsym(handle->handle, "vfs_done");
+
+ if (done_fptr == NULL) {
+ DEBUG(3, ("No vfs_done() symbol found in module with handle %p, ignoring\n", handle->handle));
+ } else {
+ done_fptr(conn);
+ }
+ sys_dlclose(handle->handle);
+ }
+
DLIST_REMOVE(conn->vfs_private, handle);
thandle = handle->next;
SAFE_FREE(handle);