1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

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 <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2020-04-07 09:56:51 +02:00 committed by Jeremy Allison
parent 3d09993725
commit 792c82d6db
4 changed files with 0 additions and 32 deletions

View 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;

View 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");

View 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);

View 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.