1 |
jpp |
1.1 |
From be3f182c7bda75d531fa60c6d08a734f0098f2cc Mon Sep 17 00:00:00 2001 |
2 |
|
|
From: Andreas Schneider <asn@samba.org> |
3 |
|
|
Date: Tue, 14 Mar 2017 16:12:20 +0100 |
4 |
|
|
Subject: [PATCH] s3:vfs_expand_msdfs: Do not open the remote address as a file |
5 |
|
|
|
6 |
|
|
The arguments get passed in the wrong order to read_target_host(). |
7 |
|
|
|
8 |
|
|
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12687 |
9 |
|
|
|
10 |
|
|
Signed-off-by: Andreas Schneider <asn@samba.org> |
11 |
|
|
(cherry picked from commit 1115f152de9ec25bc9e5e499874b4a7c92c888c0) |
12 |
|
|
--- |
13 |
|
|
source3/modules/vfs_expand_msdfs.c | 3 +-- |
14 |
|
|
1 file changed, 1 insertion(+), 2 deletions(-) |
15 |
|
|
|
16 |
|
|
diff --git a/source3/modules/vfs_expand_msdfs.c b/source3/modules/vfs_expand_msdfs.c |
17 |
|
|
index ffbfa333bad..e42d0098b32 100644 |
18 |
|
|
--- a/source3/modules/vfs_expand_msdfs.c |
19 |
|
|
+++ b/source3/modules/vfs_expand_msdfs.c |
20 |
|
|
@@ -147,8 +147,7 @@ static char *expand_msdfs_target(TALLOC_CTX *ctx, |
21 |
|
|
return NULL; |
22 |
|
|
} |
23 |
|
|
|
24 |
|
|
- targethost = read_target_host( |
25 |
|
|
- ctx, raddr, mapfilename); |
26 |
|
|
+ targethost = read_target_host(ctx, mapfilename, raddr); |
27 |
|
|
if (targethost == NULL) { |
28 |
|
|
DEBUG(1, ("Could not expand target host from file %s\n", |
29 |
|
|
mapfilename)); |
30 |
|
|
-- |
31 |
|
|
2.12.0 |
32 |
|
|
|
33 |
|
|
From cf65cc80e8598beef855678118c7c603d4b5729e Mon Sep 17 00:00:00 2001 |
34 |
|
|
From: Andreas Schneider <asn@samba.org> |
35 |
|
|
Date: Tue, 21 Mar 2017 15:32:37 +0100 |
36 |
|
|
Subject: [PATCH 1/2] s3:smbd: Pass down remote and local address to |
37 |
|
|
get_referred_path() |
38 |
|
|
|
39 |
|
|
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12687 |
40 |
|
|
|
41 |
|
|
Pair-Programmed-With: Ralph Boehme <slow@samba.org> |
42 |
|
|
|
43 |
|
|
Signed-off-by: Andreas Schneider <asn@samba.org> |
44 |
|
|
Signed-off-by: Ralph Boehme <slow@samba.org> |
45 |
|
|
Reviewed-by: Jeremy Allison <jra@samba.org> |
46 |
|
|
(cherry picked from commit cbf67123e037207662ec0d4e53c55990e21b157e) |
47 |
|
|
--- |
48 |
|
|
source3/modules/vfs_default.c | 2 ++ |
49 |
|
|
source3/rpc_server/dfs/srv_dfs_nt.c | 6 ++++++ |
50 |
|
|
source3/smbd/msdfs.c | 12 +++++++----- |
51 |
|
|
source3/smbd/proto.h | 12 +++++++----- |
52 |
|
|
4 files changed, 22 insertions(+), 10 deletions(-) |
53 |
|
|
|
54 |
|
|
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c |
55 |
|
|
index e0b6125f7d8..dcae861103d 100644 |
56 |
|
|
--- a/source3/modules/vfs_default.c |
57 |
|
|
+++ b/source3/modules/vfs_default.c |
58 |
|
|
@@ -216,6 +216,8 @@ static NTSTATUS vfswrap_get_dfs_referrals(struct vfs_handle_struct *handle, |
59 |
|
|
|
60 |
|
|
/* The following call can change cwd. */ |
61 |
|
|
status = get_referred_path(r, pathnamep, |
62 |
|
|
+ handle->conn->sconn->remote_address, |
63 |
|
|
+ handle->conn->sconn->local_address, |
64 |
|
|
!handle->conn->sconn->using_smb2, |
65 |
|
|
junction, &consumedcnt, &self_referral); |
66 |
|
|
if (!NT_STATUS_IS_OK(status)) { |
67 |
|
|
diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c |
68 |
|
|
index ab2af53c0ba..0a4d6d31b7c 100644 |
69 |
|
|
--- a/source3/rpc_server/dfs/srv_dfs_nt.c |
70 |
|
|
+++ b/source3/rpc_server/dfs/srv_dfs_nt.c |
71 |
|
|
@@ -76,6 +76,8 @@ WERROR _dfs_Add(struct pipes_struct *p, struct dfs_Add *r) |
72 |
|
|
|
73 |
|
|
/* The following call can change the cwd. */ |
74 |
|
|
status = get_referred_path(ctx, r->in.path, |
75 |
|
|
+ p->remote_address, |
76 |
|
|
+ p->local_address, |
77 |
|
|
true, /*allow_broken_path */ |
78 |
|
|
jn, &consumedcnt, &self_ref); |
79 |
|
|
if(!NT_STATUS_IS_OK(status)) { |
80 |
|
|
@@ -146,6 +148,8 @@ WERROR _dfs_Remove(struct pipes_struct *p, struct dfs_Remove *r) |
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
status = get_referred_path(ctx, r->in.dfs_entry_path, |
84 |
|
|
+ p->remote_address, |
85 |
|
|
+ p->local_address, |
86 |
|
|
true, /*allow_broken_path */ |
87 |
|
|
jn, &consumedcnt, &self_ref); |
88 |
|
|
if(!NT_STATUS_IS_OK(status)) { |
89 |
|
|
@@ -374,6 +378,8 @@ WERROR _dfs_GetInfo(struct pipes_struct *p, struct dfs_GetInfo *r) |
90 |
|
|
|
91 |
|
|
/* The following call can change the cwd. */ |
92 |
|
|
status = get_referred_path(ctx, r->in.dfs_entry_path, |
93 |
|
|
+ p->remote_address, |
94 |
|
|
+ p->local_address, |
95 |
|
|
true, /*allow_broken_path */ |
96 |
|
|
jn, &consumedcnt, &self_ref); |
97 |
|
|
if(!NT_STATUS_IS_OK(status) || |
98 |
|
|
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c |
99 |
|
|
index 61538cec832..3cf82d3b430 100644 |
100 |
|
|
--- a/source3/smbd/msdfs.c |
101 |
|
|
+++ b/source3/smbd/msdfs.c |
102 |
|
|
@@ -953,11 +953,13 @@ static NTSTATUS self_ref(TALLOC_CTX *ctx, |
103 |
|
|
**********************************************************************/ |
104 |
|
|
|
105 |
|
|
NTSTATUS get_referred_path(TALLOC_CTX *ctx, |
106 |
|
|
- const char *dfs_path, |
107 |
|
|
- bool allow_broken_path, |
108 |
|
|
- struct junction_map *jucn, |
109 |
|
|
- int *consumedcntp, |
110 |
|
|
- bool *self_referralp) |
111 |
|
|
+ const char *dfs_path, |
112 |
|
|
+ const struct tsocket_address *remote_address, |
113 |
|
|
+ const struct tsocket_address *local_address, |
114 |
|
|
+ bool allow_broken_path, |
115 |
|
|
+ struct junction_map *jucn, |
116 |
|
|
+ int *consumedcntp, |
117 |
|
|
+ bool *self_referralp) |
118 |
|
|
{ |
119 |
|
|
struct connection_struct *conn; |
120 |
|
|
char *targetpath = NULL; |
121 |
|
|
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h |
122 |
|
|
index c1b8201b472..e64457cf9e0 100644 |
123 |
|
|
--- a/source3/smbd/proto.h |
124 |
|
|
+++ b/source3/smbd/proto.h |
125 |
|
|
@@ -473,11 +473,13 @@ bool is_msdfs_link(connection_struct *conn, |
126 |
|
|
SMB_STRUCT_STAT *sbufp); |
127 |
|
|
struct junction_map; |
128 |
|
|
NTSTATUS get_referred_path(TALLOC_CTX *ctx, |
129 |
|
|
- const char *dfs_path, |
130 |
|
|
- bool allow_broken_path, |
131 |
|
|
- struct junction_map *jucn, |
132 |
|
|
- int *consumedcntp, |
133 |
|
|
- bool *self_referralp); |
134 |
|
|
+ const char *dfs_path, |
135 |
|
|
+ const struct tsocket_address *remote_address, |
136 |
|
|
+ const struct tsocket_address *local_address, |
137 |
|
|
+ bool allow_broken_path, |
138 |
|
|
+ struct junction_map *jucn, |
139 |
|
|
+ int *consumedcntp, |
140 |
|
|
+ bool *self_referralp); |
141 |
|
|
int setup_dfs_referral(connection_struct *orig_conn, |
142 |
|
|
const char *dfs_path, |
143 |
|
|
int max_referral_level, |
144 |
|
|
-- |
145 |
|
|
2.13.0 |
146 |
|
|
|
147 |
|
|
|
148 |
|
|
From 8f748924275fa8cb3951c296ad4ba5ca5989ac41 Mon Sep 17 00:00:00 2001 |
149 |
|
|
From: Andreas Schneider <asn@samba.org> |
150 |
|
|
Date: Tue, 21 Mar 2017 15:45:34 +0100 |
151 |
|
|
Subject: [PATCH 2/2] s3:smbd: Set up local and remote address for fake |
152 |
|
|
connection |
153 |
|
|
|
154 |
|
|
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12687 |
155 |
|
|
|
156 |
|
|
Pair-Programmed-With: Ralph Boehme <slow@samba.org> |
157 |
|
|
|
158 |
|
|
Signed-off-by: Andreas Schneider <asn@samba.org> |
159 |
|
|
Signed-off-by: Ralph Boehme <slow@samba.org> |
160 |
|
|
Reviewed-by: Jeremy Allison <jra@samba.org> |
161 |
|
|
|
162 |
|
|
(cherry picked from commit e530e43d67436881fd039877f956f0ad9b562af9) |
163 |
|
|
--- |
164 |
|
|
source3/smbd/msdfs.c | 24 ++++++++++++++++++++++++ |
165 |
|
|
1 file changed, 24 insertions(+) |
166 |
|
|
|
167 |
|
|
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c |
168 |
|
|
index 3cf82d3b430..c25fb17cee8 100644 |
169 |
|
|
--- a/source3/smbd/msdfs.c |
170 |
|
|
+++ b/source3/smbd/msdfs.c |
171 |
|
|
@@ -31,6 +31,7 @@ |
172 |
|
|
#include "lib/param/loadparm.h" |
173 |
|
|
#include "libcli/security/security.h" |
174 |
|
|
#include "librpc/gen_ndr/ndr_dfsblobs.h" |
175 |
|
|
+#include "lib/tsocket/tsocket.h" |
176 |
|
|
|
177 |
|
|
/********************************************************************** |
178 |
|
|
Parse a DFS pathname of the form \hostname\service\reqpath |
179 |
|
|
@@ -1071,6 +1072,29 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx, |
180 |
|
|
return status; |
181 |
|
|
} |
182 |
|
|
|
183 |
|
|
+ /* |
184 |
|
|
+ * TODO |
185 |
|
|
+ * |
186 |
|
|
+ * The remote and local address should be passed down to |
187 |
|
|
+ * create_conn_struct_cwd. |
188 |
|
|
+ */ |
189 |
|
|
+ if (conn->sconn->remote_address == NULL) { |
190 |
|
|
+ conn->sconn->remote_address = |
191 |
|
|
+ tsocket_address_copy(remote_address, conn->sconn); |
192 |
|
|
+ if (conn->sconn->remote_address == NULL) { |
193 |
|
|
+ TALLOC_FREE(pdp); |
194 |
|
|
+ return NT_STATUS_NO_MEMORY; |
195 |
|
|
+ } |
196 |
|
|
+ } |
197 |
|
|
+ if (conn->sconn->local_address == NULL) { |
198 |
|
|
+ conn->sconn->local_address = |
199 |
|
|
+ tsocket_address_copy(local_address, conn->sconn); |
200 |
|
|
+ if (conn->sconn->local_address == NULL) { |
201 |
|
|
+ TALLOC_FREE(pdp); |
202 |
|
|
+ return NT_STATUS_NO_MEMORY; |
203 |
|
|
+ } |
204 |
|
|
+ } |
205 |
|
|
+ |
206 |
|
|
/* If this is a DFS path dfs_lookup should return |
207 |
|
|
* NT_STATUS_PATH_NOT_COVERED. */ |
208 |
|
|
|
209 |
|
|
-- |
210 |
|
|
2.13.0 |
211 |
|
|
|