[PATCH] Additional patch for bug #12687
Andreas Schneider
asn at samba.org
Tue May 30 14:59:24 UTC 2017
Hi,
the patch for bug #12687 is incomplete. The the attached patch to fix the
issue.
Review and push appreciated.
Thanks,
Andreas
--
Andreas Schneider GPG-ID: CC014E3D
Samba Team asn at samba.org
www.samba.org
-------------- next part --------------
>From b30c69090af39bc0e9d6670b30689ce9f0853b74 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 21 Mar 2017 15:32:37 +0100
Subject: [PATCH 1/2] s3:smbd: Pass down remote and local address to
get_referred_path()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12687
Pair-Programmed-With: Ralph Boehme <slow at samba.org>
Signed-off-by: Andreas Schneider <asn at samba.org>
Signed-off-by: Ralph Boehme <slow at samba.org>
---
source3/modules/vfs_default.c | 2 ++
source3/rpc_server/dfs/srv_dfs_nt.c | 6 ++++++
source3/smbd/msdfs.c | 12 +++++++-----
source3/smbd/proto.h | 12 +++++++-----
4 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index fa89f7f2551..e1b2712d793 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -217,6 +217,8 @@ static NTSTATUS vfswrap_get_dfs_referrals(struct vfs_handle_struct *handle,
/* The following call can change cwd. */
status = get_referred_path(r, pathnamep,
+ handle->conn->sconn->remote_address,
+ handle->conn->sconn->local_address,
!handle->conn->sconn->using_smb2,
junction, &consumedcnt, &self_referral);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c
index ab2af53c0ba..0a4d6d31b7c 100644
--- a/source3/rpc_server/dfs/srv_dfs_nt.c
+++ b/source3/rpc_server/dfs/srv_dfs_nt.c
@@ -76,6 +76,8 @@ WERROR _dfs_Add(struct pipes_struct *p, struct dfs_Add *r)
/* The following call can change the cwd. */
status = get_referred_path(ctx, r->in.path,
+ p->remote_address,
+ p->local_address,
true, /*allow_broken_path */
jn, &consumedcnt, &self_ref);
if(!NT_STATUS_IS_OK(status)) {
@@ -146,6 +148,8 @@ WERROR _dfs_Remove(struct pipes_struct *p, struct dfs_Remove *r)
}
status = get_referred_path(ctx, r->in.dfs_entry_path,
+ p->remote_address,
+ p->local_address,
true, /*allow_broken_path */
jn, &consumedcnt, &self_ref);
if(!NT_STATUS_IS_OK(status)) {
@@ -374,6 +378,8 @@ WERROR _dfs_GetInfo(struct pipes_struct *p, struct dfs_GetInfo *r)
/* The following call can change the cwd. */
status = get_referred_path(ctx, r->in.dfs_entry_path,
+ p->remote_address,
+ p->local_address,
true, /*allow_broken_path */
jn, &consumedcnt, &self_ref);
if(!NT_STATUS_IS_OK(status) ||
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index c22cd1e77b8..fb222127fd4 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -953,11 +953,13 @@ static NTSTATUS self_ref(TALLOC_CTX *ctx,
**********************************************************************/
NTSTATUS get_referred_path(TALLOC_CTX *ctx,
- const char *dfs_path,
- bool allow_broken_path,
- struct junction_map *jucn,
- int *consumedcntp,
- bool *self_referralp)
+ const char *dfs_path,
+ const struct tsocket_address *remote_address,
+ const struct tsocket_address *local_address,
+ bool allow_broken_path,
+ struct junction_map *jucn,
+ int *consumedcntp,
+ bool *self_referralp)
{
struct connection_struct *conn;
char *targetpath = NULL;
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 0be2a49b4f3..e2d5a6a9fbe 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -472,11 +472,13 @@ bool is_msdfs_link(connection_struct *conn,
SMB_STRUCT_STAT *sbufp);
struct junction_map;
NTSTATUS get_referred_path(TALLOC_CTX *ctx,
- const char *dfs_path,
- bool allow_broken_path,
- struct junction_map *jucn,
- int *consumedcntp,
- bool *self_referralp);
+ const char *dfs_path,
+ const struct tsocket_address *remote_address,
+ const struct tsocket_address *local_address,
+ bool allow_broken_path,
+ struct junction_map *jucn,
+ int *consumedcntp,
+ bool *self_referralp);
int setup_dfs_referral(connection_struct *orig_conn,
const char *dfs_path,
int max_referral_level,
--
2.13.0
>From d6b92de1dc03e510f1c614e2a1ec36da710a68fc Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 21 Mar 2017 15:45:34 +0100
Subject: [PATCH 2/2] s3:smbd: Set up local and remote address for fake
connection
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12687
Pair-Programmed-With: Ralph Boehme <slow at samba.org>
Signed-off-by: Andreas Schneider <asn at samba.org>
Signed-off-by: Ralph Boehme <slow at samba.org>
---
source3/smbd/msdfs.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index fb222127fd4..3ed0650d486 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -1071,6 +1071,29 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
return status;
}
+ /*
+ * TODO
+ *
+ * The remote and local address should be passed down to
+ * create_conn_struct_cwd.
+ */
+ if (conn->sconn->remote_address == NULL) {
+ conn->sconn->remote_address =
+ tsocket_address_copy(remote_address, conn->sconn);
+ if (conn->sconn->remote_address == NULL) {
+ TALLOC_FREE(pdp);
+ return NT_STATUS_NO_MEMORY;
+ }
+ }
+ if (conn->sconn->local_address == NULL) {
+ conn->sconn->local_address =
+ tsocket_address_copy(local_address, conn->sconn);
+ if (conn->sconn->local_address == NULL) {
+ TALLOC_FREE(pdp);
+ return NT_STATUS_NO_MEMORY;
+ }
+ }
+
/* If this is a DFS path dfs_lookup should return
* NT_STATUS_PATH_NOT_COVERED. */
--
2.13.0
More information about the samba-technical
mailing list