summaryrefslogtreecommitdiff
path: root/source3/smbd
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
commitea279249c9e20081bdb34080c2fa3b8b46c13896 (patch)
treef85954bf778fee7ca185431e4bc787f0ba7e1c93 /source3/smbd
parent47f230b761f33210beab7f632e8ed1f111959aba (diff)
downloadsamba-ea279249c9e20081bdb34080c2fa3b8b46c13896.tar.gz
samba-ea279249c9e20081bdb34080c2fa3b8b46c13896.tar.bz2
samba-ea279249c9e20081bdb34080c2fa3b8b46c13896.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 (This used to be commit c76ecbae6295022d031d2e286f2d67e5d08946a2)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/conn.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index 38fa2e0237..2a77e23e73 100644
--- a/source3/smbd/conn.c
+++ b/source3/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);