From: Ralph Boehme Date: Tue, 15 Jun 2021 12:14:52 +0000 (+0200) Subject: mdssvc: chdir() to the conn of the RPC request X-Git-Tag: tevent-0.11.0~341 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6de3a88494b5932d0fd10f5c8c8ec57916aeefc5;p=thirdparty%2Fsamba.git mdssvc: chdir() to the conn of the RPC request In preperation of calling VFS functions. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14740 Reviewed-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/rpc_server/mdssvc/mdssvc.c b/source3/rpc_server/mdssvc/mdssvc.c index 5b864eeb8f1..84c60c17961 100644 --- a/source3/rpc_server/mdssvc/mdssvc.c +++ b/source3/rpc_server/mdssvc/mdssvc.c @@ -1674,11 +1674,15 @@ bool mds_dispatch(struct mds_ctx *mds_ctx, struct mdssvc_blob *response_blob) { bool ok; + int ret; ssize_t len; DALLOC_CTX *query = NULL; DALLOC_CTX *reply = NULL; char *rpccmd; const struct slrpc_cmd *slcmd; + const struct smb_filename conn_basedir = { + .base_name = mds_ctx->conn->connectpath, + }; if (CHECK_DEBUGLVL(10)) { const struct sl_query *slq; @@ -1730,6 +1734,14 @@ bool mds_dispatch(struct mds_ctx *mds_ctx, goto cleanup; } + ret = vfs_ChDir(mds_ctx->conn, &conn_basedir); + if (ret != 0) { + DBG_ERR("vfs_ChDir [%s] failed: %s\n", + conn_basedir.base_name, strerror(errno)); + ok = false; + goto cleanup; + } + ok = slcmd->function(mds_ctx, query, reply); if (ok) { DBG_DEBUG("%s", dalloc_dump(reply, 0));