Clean up struct connection_struct, make struct vuid_cache a pointer not inline.
authorJeremy Allison <jra@samba.org>
Thu, 20 Dec 2012 22:42:55 +0000 (14:42 -0800)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 9 Jan 2013 04:28:45 +0000 (15:28 +1100)
Change VFS ABI to 31 for 4.1.0.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/include/vfs.h
source3/modules/vfs_readonly.c
source3/smbd/conn.c
source3/smbd/uid.c

index 2992c1db32167f0db182960b1968d67a51b06eb2..7da022ef374d006aaca6e6d06755fee62cd563d6 100644 (file)
 /* Bump to version 30 - Samba 4.0.0 will ship with interface version 30 */
 /* Leave at 30 - not yet released. Added conn->cwd to save vfs_GetWd() calls. */
 /* Leave at 30 - not yet released. Changed sys_acl_blob_get_file interface to remove type */
-#define SMB_VFS_INTERFACE_VERSION 30
+/* Bump to version 31 - Samba 4.1.0 will ship with interface version 31 */
+/* Leave at 31 - not yet released. Make struct vuid_cache_entry in
+               connection_struct a pointer. */
+
+#define SMB_VFS_INTERFACE_VERSION 31
 
 /*
     All intercepted VFS operations must be declared as static functions inside module source
@@ -306,7 +310,7 @@ typedef struct connection_struct {
        uint32_t cnum; /* an index passed over the wire */
        struct share_params *params;
        bool force_user;
-       struct vuid_cache vuid_cache;
+       struct vuid_cache *vuid_cache;
        bool printer;
        bool ipc;
        bool read_only; /* Attributes for the current user of the share. */
index 7919dbc78bf7b0a2dda48a0ad5c62461c4beb320..f75db093cc2d8aa40ac27949653fbc9fd56e381c 100644 (file)
@@ -82,12 +82,12 @@ 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 = &conn->vuid_cache.array[i];
+        struct vuid_cache_entry *ent = &conn->vuid_cache->array[i];
         ent->vuid = UID_FIELD_INVALID;
         TALLOC_FREE(ent->session_info);
         ent->read_only = false;
       }
-      conn->vuid_cache.next_entry = 0;
+      conn->vuid_cache->next_entry = 0;
     }
 
     return 0;
index bc5a03b4eb09034d59d538d1ee9f783fef42a106..1d4444f368fe83ca5c1a9b2eb374680ea7792a2f 100644 (file)
@@ -63,6 +63,7 @@ connection_struct *conn_new(struct smbd_server_connection *sconn)
 
        if (!(conn=talloc_zero(NULL, connection_struct)) ||
            !(conn->params = talloc(conn, struct share_params)) ||
+           !(conn->vuid_cache = talloc_zero(conn, struct vuid_cache)) ||
            !(conn->connectpath = talloc_strdup(conn, "")) ||
            !(conn->origpath = talloc_strdup(conn, ""))) {
                DEBUG(0,("TALLOC_ZERO() failed!\n"));
@@ -89,7 +90,7 @@ static void conn_clear_vuid_cache(connection_struct *conn, uint64_t vuid)
        for (i=0; i<VUID_CACHE_SIZE; i++) {
                struct vuid_cache_entry *ent;
 
-               ent = &conn->vuid_cache.array[i];
+               ent = &conn->vuid_cache->array[i];
 
                if (ent->vuid == vuid) {
                        ent->vuid = UID_FIELD_INVALID;
index 9244f2997d0cd2b265260ba049ce2b8d18c9b995..f9b5716f3d6d9c591f1e461c11ba733b4882d515 100644 (file)
@@ -68,7 +68,7 @@ static void free_conn_session_info_if_unused(connection_struct *conn)
 
        for (i = 0; i < VUID_CACHE_SIZE; i++) {
                struct vuid_cache_entry *ent;
-               ent = &conn->vuid_cache.array[i];
+               ent = &conn->vuid_cache->array[i];
                if (ent->vuid != UID_FIELD_INVALID &&
                                conn->session_info == ent->session_info) {
                        return;
@@ -96,7 +96,7 @@ static bool check_user_ok(connection_struct *conn,
        struct vuid_cache_entry *ent = NULL;
 
        for (i=0; i<VUID_CACHE_SIZE; i++) {
-               ent = &conn->vuid_cache.array[i];
+               ent = &conn->vuid_cache->array[i];
                if (ent->vuid == vuid) {
                        free_conn_session_info_if_unused(conn);
                        conn->session_info = ent->session_info;
@@ -141,10 +141,10 @@ static bool check_user_ok(connection_struct *conn,
                session_info->info->domain_name,
                NULL, session_info->security_token, lp_admin_users(snum));
 
-       ent = &conn->vuid_cache.array[conn->vuid_cache.next_entry];
+       ent = &conn->vuid_cache->array[conn->vuid_cache->next_entry];
 
-       conn->vuid_cache.next_entry =
-               (conn->vuid_cache.next_entry + 1) % VUID_CACHE_SIZE;
+       conn->vuid_cache->next_entry =
+               (conn->vuid_cache->next_entry + 1) % VUID_CACHE_SIZE;
 
        TALLOC_FREE(ent->session_info);