s3:mdssvc: pass down sharename and SNUM
authorRalph Boehme <slow@samba.org>
Fri, 12 Apr 2019 10:15:56 +0000 (12:15 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 8 Aug 2019 20:24:31 +0000 (20:24 +0000)
Not used for now, will be needed in the upcoming Elasticsearch backend.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/rpc_server/mdssvc/mdssvc.c
source3/rpc_server/mdssvc/mdssvc.h
source3/rpc_server/mdssvc/srv_mdssvc_nt.c

index 42eb960bb26872b90163286d5cf6b74b31b5f441..d8dff563c1bd8181b99adc16a70e35023810b437 100644 (file)
@@ -1607,6 +1607,8 @@ static int mds_ctx_destructor_cb(struct mds_ctx *mds_ctx)
 struct mds_ctx *mds_init_ctx(TALLOC_CTX *mem_ctx,
                             struct tevent_context *ev,
                             struct auth_session_info *session_info,
+                            int snum,
+                            const char *sharename,
                             const char *path)
 {
        struct mds_ctx *mds_ctx;
@@ -1623,11 +1625,17 @@ struct mds_ctx *mds_init_ctx(TALLOC_CTX *mem_ctx,
                goto error;
        }
 
+       mds_ctx->sharename = talloc_strdup(mds_ctx, sharename);
+       if (mds_ctx->sharename == NULL) {
+               goto error;
+       }
+
        mds_ctx->spath = talloc_strdup(mds_ctx, path);
        if (mds_ctx->spath == NULL) {
                goto error;
        }
 
+       mds_ctx->snum = snum;
        mds_ctx->pipe_session_info = session_info;
 
        if (session_info->security_token->num_sids < 1) {
index 1be07f4a40a56a949ca84f48e39fb374b41cbb46..e6ed08709ed047423a46da28a671ee3bd376b205 100644 (file)
@@ -122,6 +122,8 @@ struct mds_ctx {
        struct auth_session_info *pipe_session_info;
        struct dom_sid sid;
        uid_t uid;
+       int snum;
+       const char *sharename;
        const char *spath;
        struct sl_query *query_list;     /* list of active queries */
        struct db_context *ino_path_map; /* dbwrap rbt for storing inode->path mappings */
@@ -145,10 +147,12 @@ struct mdssvc_backend {
  */
 extern bool mds_init(struct messaging_context *msg_ctx);
 extern bool mds_shutdown(void);
-extern struct mds_ctx *mds_init_ctx(TALLOC_CTX *mem_ctx,
-                                   struct tevent_context *ev,
-                                   struct auth_session_info *session_info,
-                                   const char *path);
+struct mds_ctx *mds_init_ctx(TALLOC_CTX *mem_ctx,
+                            struct tevent_context *ev,
+                            struct auth_session_info *session_info,
+                            int snum,
+                            const char *sharename,
+                            const char *path);
 extern bool mds_dispatch(struct mds_ctx *query_ctx,
                         struct mdssvc_blob *request_blob,
                         struct mdssvc_blob *response_blob);
index efdcd0c7c511767110ae24313d81b912a1e105cf..293d0659909b06f9ad4890af5392897acea86276 100644 (file)
@@ -113,6 +113,8 @@ bool shutdown_service_mdssvc(void)
 
 static NTSTATUS create_mdssvc_policy_handle(TALLOC_CTX *mem_ctx,
                                            struct pipes_struct *p,
+                                           int snum,
+                                           const char *sharename,
                                            const char *path,
                                            struct policy_handle *handle)
 {
@@ -123,6 +125,8 @@ static NTSTATUS create_mdssvc_policy_handle(TALLOC_CTX *mem_ctx,
        mds_ctx = mds_init_ctx(mem_ctx,
                               messaging_tevent_context(p->msg_ctx),
                               p->session_info,
+                              snum,
+                              sharename,
                               path);
        if (mds_ctx == NULL) {
                DEBUG(1, ("error in mds_init_ctx for: %s\n", path));
@@ -163,7 +167,10 @@ void _mdssvc_open(struct pipes_struct *p, struct mdssvc_open *r)
                        return;
                }
 
-               status = create_mdssvc_policy_handle(p->mem_ctx, p, path,
+               status = create_mdssvc_policy_handle(p->mem_ctx, p,
+                                                    snum,
+                                                    r->in.share_name,
+                                                    path,
                                                     r->out.handle);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("Couldn't create policy handle for %s\n",