Clarify where we just change to the root of the export.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
handle->conn->sconn->remote_address,
handle->conn->sconn->local_address,
junction, &consumedcnt, &self_referral);
-
- {
- struct smb_filename connectpath_fname = {
- .base_name = handle->conn->connectpath
- };
- vfs_ChDir(handle->conn, &connectpath_fname);
- }
+ vfs_ChDir_shareroot(handle->conn);
if (!NT_STATUS_IS_OK(status)) {
return status;
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
- struct smb_filename conn_basedir;
struct mds_ctx *mds_ctx;
int backend;
int ret;
goto error;
}
- conn_basedir = (struct smb_filename) {
- .base_name = mds_ctx->conn->connectpath,
- };
-
- ret = vfs_ChDir(mds_ctx->conn, &conn_basedir);
+ ret = vfs_ChDir_shareroot(mds_ctx->conn);
if (ret != 0) {
- DBG_ERR("vfs_ChDir [%s] failed: %s\n",
- conn_basedir.base_name, strerror(errno));
+ DBG_ERR("vfs_ChDir_shareroot [%s] failed: %s\n",
+ mds_ctx->conn->connectpath,
+ strerror(errno));
status = map_nt_error_from_unix(errno);
goto error;
}
DALLOC_CTX *reply = NULL;
char *rpccmd;
const struct slrpc_cmd *slcmd;
- const struct smb_filename conn_basedir = {
- .base_name = mds_ctx->conn->connectpath,
- };
NTSTATUS status;
if (CHECK_DEBUGLVL(10)) {
goto cleanup;
}
- ret = vfs_ChDir(mds_ctx->conn, &conn_basedir);
+ ret = vfs_ChDir_shareroot(mds_ctx->conn);
if (ret != 0) {
- DBG_ERR("vfs_ChDir [%s] failed: %s\n",
- conn_basedir.base_name, strerror(errno));
+ DBG_ERR("vfs_ChDir_shareroot [%s] failed: %s\n",
+ mds_ctx->conn->connectpath,
+ strerror(errno));
ok = false;
goto cleanup;
}
struct conn_struct_tos **_c)
{
struct conn_struct_tos *c = NULL;
- struct smb_filename smb_fname_connectpath = {0};
NTSTATUS status;
+ int ret;
*_c = NULL;
return status;
}
- smb_fname_connectpath = (struct smb_filename) {
- .base_name = c->conn->connectpath
- };
-
- if (vfs_ChDir(c->conn, &smb_fname_connectpath) != 0) {
+ ret = vfs_ChDir_shareroot(c->conn);
+ if (ret != 0) {
status = map_nt_error_from_unix(errno);
DBG_NOTICE("Can't ChDir to new conn path %s. "
"Error was %s\n",
char **talloced);
int vfs_ChDir(connection_struct *conn,
const struct smb_filename *smb_fname);
+int vfs_ChDir_shareroot(connection_struct *conn);
struct smb_filename *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
int vfs_stat(struct connection_struct *conn,
struct smb_filename *smb_fname);
bool chdir_current_service(connection_struct *conn)
{
- const struct smb_filename connectpath_fname = {
- .base_name = conn->connectpath,
- };
int saved_errno = 0;
char *utok_str = NULL;
int ret;
conn->lastused_count++;
- ret = vfs_ChDir(conn, &connectpath_fname);
+ ret = vfs_ChDir_shareroot(conn);
if (ret == 0) {
return true;
}
return false;
}
- DBG_ERR("vfs_ChDir(%s) failed: %s. Current token: %s\n",
+ DBG_ERR("vfs_ChDir_shareroot(%s) failed: %s. Current token: %s\n",
conn->connectpath,
strerror(saved_errno),
utok_str);
return ret;
}
+int vfs_ChDir_shareroot(connection_struct *conn)
+{
+ const struct smb_filename connectpath_fname = {
+ .base_name = conn->connectpath,
+ };
+ int ret = vfs_ChDir(conn, &connectpath_fname);
+ return ret;
+}
+
/*******************************************************************
Return the absolute current directory path - given a UNIX pathname.
Note that this path is returned in DOS format, not UNIX