s3:vfs: untangle logic for loading and probing modules in vfs_init_custom()
authorMichael Adam <obnox@samba.org>
Wed, 29 Apr 2009 14:33:45 +0000 (16:33 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 29 Apr 2009 14:48:22 +0000 (16:48 +0200)
This is to be able to provide more specific error messages.

Michael

source3/smbd/vfs.c

index 426772889c7a30c5f38700a5a940b6a0132e8a8d..f219e5554c4602d560a03735799a7a8a1b33ecad 100644 (file)
@@ -161,18 +161,30 @@ bool vfs_init_custom(connection_struct *conn, const char *vfs_object)
        }
 
        /* First, try to load the module with the new module system */
-       if((entry = vfs_find_backend_entry(module_name)) || 
-          (NT_STATUS_IS_OK(smb_probe_module("vfs", module_path)) &&
-               (entry = vfs_find_backend_entry(module_name)))) {
-
-               DEBUGADD(5,("Successfully loaded vfs module [%s] with the new modules system\n", vfs_object));
-               
-               if ((ops = entry->vfs_op_tuples) == NULL) {
-                       DEBUG(0, ("entry->vfs_op_tuples==NULL for [%s] failed\n", vfs_object));
+       entry = vfs_find_backend_entry(module_name);
+       if (!entry) {
+               NTSTATUS status;
+
+               DEBUG(5, ("vfs module [%s] not loaded - trying to load...\n",
+                         vfs_object));
+
+               status = smb_probe_module("vfs", module_path);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(0, ("error probing vfs module '%s': %s\n",
+                                 module_path, nt_errstr(status)));
+                       goto fail;
+               }
+
+               entry = vfs_find_backend_entry(module_name);
+               if (!entry) {
+                       DEBUG(0,("Can't find a vfs module [%s]\n",vfs_object));
                        goto fail;
-               }
-       } else {
-               DEBUG(0,("Can't find a vfs module [%s]\n",vfs_object));
+               }
+       }
+
+       DEBUGADD(5,("Successfully loaded vfs module [%s] with the new modules system\n", vfs_object));
+       if ((ops = entry->vfs_op_tuples) == NULL) {
+               DEBUG(0, ("entry->vfs_op_tuples==NULL for [%s] failed\n", vfs_object));
                goto fail;
        }