mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
mdssvc: maintain a connection struct in the mds_ctx
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14740 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
9a2d6bcfd5
commit
8b681cfb5d
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "smbd/proto.h"
|
||||
#include "librpc/gen_ndr/auth.h"
|
||||
#include "dbwrap/dbwrap.h"
|
||||
#include "lib/util/dlinklist.h"
|
||||
@ -1531,10 +1532,15 @@ struct mds_ctx *mds_init_ctx(TALLOC_CTX *mem_ctx,
|
||||
const char *sharename,
|
||||
const char *path)
|
||||
{
|
||||
const struct loadparm_substitution *lp_sub =
|
||||
loadparm_s3_global_substitution();
|
||||
struct smb_filename conn_basedir;
|
||||
struct mds_ctx *mds_ctx;
|
||||
int backend;
|
||||
int ret;
|
||||
bool ok;
|
||||
smb_iconv_t iconv_hnd = (smb_iconv_t)-1;
|
||||
NTSTATUS status;
|
||||
|
||||
mds_ctx = talloc_zero(mem_ctx, struct mds_ctx);
|
||||
if (mds_ctx == NULL) {
|
||||
@ -1616,6 +1622,30 @@ struct mds_ctx *mds_init_ctx(TALLOC_CTX *mem_ctx,
|
||||
goto error;
|
||||
}
|
||||
|
||||
status = create_conn_struct_cwd(mds_ctx,
|
||||
ev,
|
||||
msg_ctx,
|
||||
session_info,
|
||||
snum,
|
||||
lp_path(talloc_tos(), lp_sub, snum),
|
||||
&mds_ctx->conn);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG_ERR("failed to create conn for vfs: %s\n",
|
||||
nt_errstr(status));
|
||||
goto error;
|
||||
}
|
||||
|
||||
conn_basedir = (struct smb_filename) {
|
||||
.base_name = mds_ctx->conn->connectpath,
|
||||
};
|
||||
|
||||
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));
|
||||
goto error;
|
||||
}
|
||||
|
||||
ok = mds_ctx->backend->connect(mds_ctx);
|
||||
if (!ok) {
|
||||
DBG_ERR("backend connect failed\n");
|
||||
|
@ -126,6 +126,7 @@ struct mds_ctx {
|
||||
int snum;
|
||||
const char *sharename;
|
||||
const char *spath;
|
||||
struct connection_struct *conn;
|
||||
struct sl_query *query_list; /* list of active queries */
|
||||
struct db_context *ino_path_map; /* dbwrap rbt for storing inode->path mappings */
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user