smbd: Fix a typo in a few places
[samba.git] / source3 / modules / vfs_readonly.c
index 58c83e5e1be224ba268d00a5f4944b4a2c4f775f..cde8ef973ca158075b227dd5ae07984fc8b52e69 100644 (file)
@@ -21,6 +21,7 @@
 */
 
 #include "includes.h"
+#include "smbd/smbd.h"
 #include "getdate.h"
 
 /*
@@ -62,6 +63,11 @@ static int readonly_connect(vfs_handle_struct *handle,
   const char **period = lp_parm_string_list(SNUM(handle->conn),
                                             (handle->param ? handle->param : MODULE_NAME),
                                             "period", period_def); 
+  int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+  if (ret < 0) {
+    return ret;
+  }
 
   if (period && period[0] && period[1]) {
     int i;
@@ -76,35 +82,32 @@ static int readonly_connect(vfs_handle_struct *handle,
 
       /* Wipe out the VUID cache. */
       for (i=0; i< VUID_CACHE_SIZE; i++) {
-        struct vuid_cache_entry *ent = ent = &conn->vuid_cache.array[i];
+        struct vuid_cache_entry *ent = &conn->vuid_cache->array[i];
         ent->vuid = UID_FIELD_INVALID;
-        TALLOC_FREE(ent->server_info);
+        TALLOC_FREE(ent->session_info);
         ent->read_only = false;
-        ent->admin_user = false;
+        ent->share_access = 0;
       }
-      conn->vuid_cache.next_entry = 0;
+      conn->vuid_cache->next_entry = 0;
     }
 
-    return SMB_VFS_NEXT_CONNECT(handle, service, user);
+    return 0;
 
   } else {
     
-    return 1;
+    return 0;
     
   }
 }
 
 
-/* VFS operations structure */
-
-static vfs_op_tuple readonly_op_tuples[] = {
-       /* Disk operations */
-  {SMB_VFS_OP(readonly_connect),       SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT},
-  {SMB_VFS_OP(NULL),                   SMB_VFS_OP_NOOP,    SMB_VFS_LAYER_NOOP}
+static struct vfs_fn_pointers vfs_readonly_fns = {
+       .connect_fn = readonly_connect
 };
 
-NTSTATUS vfs_readonly_init(void);
-NTSTATUS vfs_readonly_init(void)
+NTSTATUS vfs_readonly_init(TALLOC_CTX *);
+NTSTATUS vfs_readonly_init(TALLOC_CTX *ctx)
 {
-  return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, MODULE_NAME, readonly_op_tuples);
+  return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, MODULE_NAME,
+                         &vfs_readonly_fns);
 }