summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2018-12-28 12:12:20 +0100
committerStefan Metzmacher <metze@samba.org>2019-01-11 23:11:11 +0100
commit56dee840e48c327b0d2136f1d7dd36c63f439f7e (patch)
treebb85c69c9fec09abb779daad6dd9eea40fce2785
parent7f7ce0ec2f3e3cfb46314e5ad3ea6b5c49085f1d (diff)
downloadsamba-56dee840e48c327b0d2136f1d7dd36c63f439f7e.tar.gz
s3:smbd: pass (raw) ev to SMB_VFS_GET_DOS_ATTRIBUTES_SEND() instead of smb_vfs_ev_glue
This also removes smb_vfs_ev_glue_[push|pop]_use() as the only caller got removed. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--examples/VFS/skel_opaque.c3
-rw-r--r--examples/VFS/skel_transparent.c5
-rw-r--r--source3/include/vfs.h6
-rw-r--r--source3/modules/vfs_default.c3
-rw-r--r--source3/modules/vfs_full_audit.c5
-rw-r--r--source3/modules/vfs_not_implemented.c3
-rw-r--r--source3/modules/vfs_time_audit.c5
-rw-r--r--source3/smbd/dosmode.c5
-rw-r--r--source3/smbd/vfs.c57
9 files changed, 20 insertions, 72 deletions
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index b3cd83a3e42..6510ef30d6f 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -714,12 +714,11 @@ struct skel_get_dos_attributes_state {
static struct tevent_req *skel_get_dos_attributes_send(
TALLOC_CTX *mem_ctx,
- const struct smb_vfs_ev_glue *evg,
+ struct tevent_context *ev,
struct vfs_handle_struct *handle,
files_struct *dir_fsp,
struct smb_filename *smb_fname)
{
- struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
struct tevent_req *req = NULL;
struct skel_get_dos_attributes_state *state = NULL;
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 4e978577837..fc892a23208 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -895,12 +895,11 @@ static void skel_get_dos_attributes_done(struct tevent_req *subreq);
static struct tevent_req *skel_get_dos_attributes_send(
TALLOC_CTX *mem_ctx,
- const struct smb_vfs_ev_glue *evg,
+ struct tevent_context *ev,
struct vfs_handle_struct *handle,
files_struct *dir_fsp,
struct smb_filename *smb_fname)
{
- struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
struct tevent_req *req = NULL;
struct skel_get_dos_attributes_state *state = NULL;
struct tevent_req *subreq = NULL;
@@ -912,7 +911,7 @@ static struct tevent_req *skel_get_dos_attributes_send(
}
subreq = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_SEND(mem_ctx,
- evg,
+ ev,
handle,
dir_fsp,
smb_fname);
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 83ae6399a4a..619c1a8eb94 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -903,7 +903,7 @@ struct vfs_fn_pointers {
struct tevent_req *(*get_dos_attributes_send_fn)(
TALLOC_CTX *mem_ctx,
- const struct smb_vfs_ev_glue *evg,
+ struct tevent_context *ev,
struct vfs_handle_struct *handle,
files_struct *dir_fsp,
struct smb_filename *smb_fname);
@@ -1370,7 +1370,7 @@ NTSTATUS smb_vfs_call_fset_dos_attributes(struct vfs_handle_struct *handle,
uint32_t dosmode);
struct tevent_req *smb_vfs_call_get_dos_attributes_send(
TALLOC_CTX *mem_ctx,
- const struct smb_vfs_ev_glue *evg,
+ struct tevent_context *ev,
struct vfs_handle_struct *handle,
files_struct *dir_fsp,
struct smb_filename *smb_fname);
@@ -1852,7 +1852,7 @@ NTSTATUS vfs_not_implemented_get_dos_attributes(struct vfs_handle_struct *handle
uint32_t *dosmode);
struct tevent_req *vfs_not_implemented_get_dos_attributes_send(
TALLOC_CTX *mem_ctx,
- const struct smb_vfs_ev_glue *evg,
+ struct tevent_context *ev,
struct vfs_handle_struct *handle,
files_struct *dir_fsp,
struct smb_filename *smb_fname);
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index f54f87dc5c9..0a07d4069d7 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1504,12 +1504,11 @@ static void vfswrap_get_dos_attributes_getxattr_done(struct tevent_req *subreq);
static struct tevent_req *vfswrap_get_dos_attributes_send(
TALLOC_CTX *mem_ctx,
- const struct smb_vfs_ev_glue *evg,
+ struct tevent_context *ev,
struct vfs_handle_struct *handle,
files_struct *dir_fsp,
struct smb_filename *smb_fname)
{
- struct tevent_context *ev = dir_fsp->conn->sconn->raw_ev_ctx;
struct tevent_req *req = NULL;
struct tevent_req *subreq = NULL;
struct vfswrap_get_dos_attributes_state *state = NULL;
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 7dbb6e1e628..fcfb024d493 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -2141,12 +2141,11 @@ static void smb_full_audit_get_dos_attributes_done(struct tevent_req *subreq);
static struct tevent_req *smb_full_audit_get_dos_attributes_send(
TALLOC_CTX *mem_ctx,
- const struct smb_vfs_ev_glue *evg,
+ struct tevent_context *ev,
struct vfs_handle_struct *handle,
files_struct *dir_fsp,
struct smb_filename *smb_fname)
{
- struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
struct tevent_req *req = NULL;
struct smb_full_audit_get_dos_attributes_state *state = NULL;
struct tevent_req *subreq = NULL;
@@ -2169,7 +2168,7 @@ static struct tevent_req *smb_full_audit_get_dos_attributes_send(
};
subreq = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_SEND(mem_ctx,
- evg,
+ ev,
handle,
dir_fsp,
smb_fname);
diff --git a/source3/modules/vfs_not_implemented.c b/source3/modules/vfs_not_implemented.c
index d642a133c18..214390204a5 100644
--- a/source3/modules/vfs_not_implemented.c
+++ b/source3/modules/vfs_not_implemented.c
@@ -717,12 +717,11 @@ struct vfs_not_implemented_get_dos_attributes_state {
struct tevent_req *vfs_not_implemented_get_dos_attributes_send(
TALLOC_CTX *mem_ctx,
- const struct smb_vfs_ev_glue *evg,
+ struct tevent_context *ev,
struct vfs_handle_struct *handle,
files_struct *dir_fsp,
struct smb_filename *smb_fname)
{
- struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
struct tevent_req *req = NULL;
struct vfs_not_implemented_get_dos_attributes_state *state = NULL;
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index 5dd6032b658..a89c6be9f71 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -1768,12 +1768,11 @@ static void smb_time_audit_get_dos_attributes_done(struct tevent_req *subreq);
static struct tevent_req *smb_time_audit_get_dos_attributes_send(
TALLOC_CTX *mem_ctx,
- const struct smb_vfs_ev_glue *evg,
+ struct tevent_context *ev,
struct vfs_handle_struct *handle,
files_struct *dir_fsp,
struct smb_filename *smb_fname)
{
- struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
struct tevent_req *req = NULL;
struct smb_time_audit_get_dos_attributes_state *state = NULL;
struct tevent_req *subreq = NULL;
@@ -1789,7 +1788,7 @@ static struct tevent_req *smb_time_audit_get_dos_attributes_send(
};
subreq = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_SEND(mem_ctx,
- evg,
+ ev,
handle,
dir_fsp,
smb_fname);
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 966679a2c9c..52781ca5ab3 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "globals.h"
#include "system/filesys.h"
#include "librpc/gen_ndr/ndr_xattr.h"
#include "librpc/gen_ndr/ioctl.h"
@@ -764,7 +765,7 @@ struct tevent_req *dos_mode_at_send(TALLOC_CTX *mem_ctx,
files_struct *dir_fsp,
struct smb_filename *smb_fname)
{
- struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
+ struct tevent_context *ev = dir_fsp->conn->sconn->raw_ev_ctx;
struct tevent_req *req = NULL;
struct dos_mode_at_state *state = NULL;
struct tevent_req *subreq = NULL;
@@ -788,7 +789,7 @@ struct tevent_req *dos_mode_at_send(TALLOC_CTX *mem_ctx,
}
subreq = SMB_VFS_GET_DOS_ATTRIBUTES_SEND(state,
- evg,
+ ev,
dir_fsp,
smb_fname);
if (tevent_req_nomem(subreq, req)) {
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 7d46ec9273b..0cf8f8caa1d 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -2284,46 +2284,6 @@ struct smb_vfs_ev_glue *smb_vfs_ev_glue_create_switch(
return evg_u;
}
-static bool smb_vfs_ev_glue_push_use(const struct smb_vfs_ev_glue *evg,
- struct tevent_req *req)
-{
- if (evg->run_ev == evg->return_ev) {
- /*
- * We're already in the correct
- * impersonation environment.
- */
- return true;
- }
-
- /*
- * Make sure that our callers callback function
- * will be called in the return_ev environment.
- */
- tevent_req_defer_callback(req, evg->return_ev);
-
- /*
- * let the event context wrapper do
- * the required impersonation.
- */
- return tevent_context_push_use(evg->run_ev);
-}
-
-static void smb_vfs_ev_glue_pop_use(const struct smb_vfs_ev_glue *evg)
-{
- if (evg->run_ev == evg->return_ev) {
- /*
- * smb_vfs_ev_glue_push_use() didn't
- * change the impersonation environment.
- */
- return;
- }
-
- /*
- * undo the impersonation
- */
- tevent_context_pop_use(evg->run_ev);
-}
-
int smb_vfs_call_connect(struct vfs_handle_struct *handle,
const char *service, const char *user)
{
@@ -3265,7 +3225,7 @@ static void smb_vfs_call_get_dos_attributes_done(struct tevent_req *subreq);
struct tevent_req *smb_vfs_call_get_dos_attributes_send(
TALLOC_CTX *mem_ctx,
- const struct smb_vfs_ev_glue *evg,
+ struct tevent_context *ev,
struct vfs_handle_struct *handle,
files_struct *dir_fsp,
struct smb_filename *smb_fname)
@@ -3273,7 +3233,6 @@ struct tevent_req *smb_vfs_call_get_dos_attributes_send(
struct tevent_req *req = NULL;
struct smb_vfs_call_get_dos_attributes_state *state = NULL;
struct tevent_req *subreq = NULL;
- bool ok;
req = tevent_req_create(mem_ctx, &state,
struct smb_vfs_call_get_dos_attributes_state);
@@ -3284,22 +3243,16 @@ struct tevent_req *smb_vfs_call_get_dos_attributes_send(
VFS_FIND(get_dos_attributes_send);
state->recv_fn = handle->fns->get_dos_attributes_recv_fn;
- ok = smb_vfs_ev_glue_push_use(evg, req);
- if (!ok) {
- tevent_req_error(req, EIO);
- return tevent_req_post(req, evg->return_ev);
- }
-
subreq = handle->fns->get_dos_attributes_send_fn(mem_ctx,
- evg->next_glue,
+ ev,
handle,
dir_fsp,
smb_fname);
- smb_vfs_ev_glue_pop_use(evg);
-
if (tevent_req_nomem(subreq, req)) {
- return tevent_req_post(req, evg->return_ev);
+ return tevent_req_post(req, ev);
}
+ tevent_req_defer_callback(req, ev);
+
tevent_req_set_callback(subreq,
smb_vfs_call_get_dos_attributes_done,
req);