From: Ralph Boehme Date: Tue, 7 Apr 2020 07:56:51 +0000 (+0200) Subject: smbd: RIP conn->origpath X-Git-Tag: ldb-2.2.0~244 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=792c82d6dbba0dd58106cc0ff38c4d86a49cee25;p=thirdparty%2Fsamba.git smbd: RIP conn->origpath 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 3126f228626..ab4098636dc 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -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; diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index 0f30ab1fb88..547f55db7d8 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -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"); diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 41b73afc056..2c31e2b960a 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -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); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index ea99f0d2129..ed38121f292 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -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.