]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: RIP conn->origpath
authorRalph Boehme <slow@samba.org>
Tue, 7 Apr 2020 07:56:51 +0000 (09:56 +0200)
committerJeremy Allison <jra@samba.org>
Sat, 30 May 2020 01:17:36 +0000 (01:17 +0000)
conn->origpath is always a duplicate of conn->connectpath.

The only function that sets conn->connectpath is set_conn_connectpath() and
everywhere it's called, there's a subsequent talloc_strdup() into
conn->origpath.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/vfs.h
source3/smbd/conn.c
source3/smbd/msdfs.c
source3/smbd/service.c

index 3126f2286269d20d05517baa9d6e579f760e6507..ab4098636dc7c006152c54ff173eef1b98c0ba67 100644 (file)
@@ -528,7 +528,6 @@ typedef struct connection_struct {
           and directories when setting time ? */
        enum timestamp_set_resolution ts_res;
        char *connectpath;
-       char *origpath;
        struct files_struct *cwd_fsp; /* Working directory. */
        bool tcon_done;
 
index 0f30ab1fb88eb8317c491709bcf9285d3e5cc2ed..547f55db7d8aedc12f5616ccced277e994f7e04c 100644 (file)
@@ -84,12 +84,6 @@ connection_struct *conn_new(struct smbd_server_connection *sconn)
                TALLOC_FREE(conn);
                return NULL;
        }
-       conn->origpath = talloc_strdup(conn, "");
-       if (conn->origpath == NULL) {
-               DBG_ERR("talloc_zero failed\n");
-               TALLOC_FREE(conn);
-               return NULL;
-       }
        conn->cwd_fsp = talloc_zero(conn, struct files_struct);
        if (conn->cwd_fsp == NULL) {
                DBG_ERR("talloc_zero failed\n");
index 41b73afc05654c95394fdd1081b65629f7ecdfd2..2c31e2b960ad47dd6571b5bf8f5712fd84e0a7e3 100644 (file)
@@ -365,13 +365,6 @@ static NTSTATUS create_conn_struct_as_root(TALLOC_CTX *ctx,
                return NT_STATUS_ACCESS_DENIED;
        }
 
-       talloc_free(conn->origpath);
-       conn->origpath = talloc_strdup(conn, conn->connectpath);
-       if (conn->origpath == NULL) {
-               conn_free(conn);
-               return NT_STATUS_NO_MEMORY;
-       }
-
        conn->fs_capabilities = SMB_VFS_FS_CAPABILITIES(conn, &conn->ts_res);
        conn->tcon_done = true;
        *pconn = talloc_move(ctx, &conn);
index ea99f0d2129d83fc3eb52baa43e7930e92a295ea..ed38121f29275c7a98db287371ddfaa25ade0d7b 100644 (file)
@@ -144,9 +144,6 @@ bool chdir_current_service(connection_struct *conn)
        const struct smb_filename connectpath_fname = {
                .base_name = conn->connectpath,
        };
-       const struct smb_filename origpath_fname = {
-               .base_name = conn->origpath,
-       };
        int saved_errno = 0;
        char *utok_str = NULL;
        int ret;
@@ -171,18 +168,6 @@ bool chdir_current_service(connection_struct *conn)
                strerror(saved_errno),
                utok_str);
 
-       ret = vfs_ChDir(conn, &origpath_fname);
-       if (ret == 0) {
-               TALLOC_FREE(utok_str);
-               return true;
-       }
-       saved_errno = errno;
-
-       DBG_ERR("vfs_ChDir(%s) failed: %s. Current token: %s\n",
-               conn->origpath,
-               strerror(saved_errno),
-               utok_str);
-
        if (saved_errno != 0) {
                errno = saved_errno;
        }
@@ -860,9 +845,6 @@ static NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn,
        }
        conn->base_share_dev = smb_fname_cpath->st.st_ex_dev;
 
-       talloc_free(conn->origpath);
-       conn->origpath = talloc_strdup(conn, conn->connectpath);
-
        /* Figure out the characteristics of the underlying filesystem. This
         * assumes that all the filesystem mounted within a share path have
         * the same characteristics, which is likely but not guaranteed.