]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbdotconf: mark "msdfs proxy" with substitution="1"
authorRalph Boehme <slow@samba.org>
Thu, 31 Oct 2019 17:56:10 +0000 (18:56 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 27 Nov 2019 10:25:33 +0000 (10:25 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
docs-xml/smbdotconf/vfs/msdfsproxy.xml
source3/smbd/msdfs.c
source3/smbd/service.c
source3/smbd/smb2_tcon.c

index 566dcd7d69158660fec7b90b8b471ca35901afc7..55a410fe49e7278d1dbf3030b2802c6333acb579 100644 (file)
@@ -1,6 +1,7 @@
 <samba:parameter name="msdfs proxy"
                  context="S"
-                                type="string"
+                 type="string"
+                 substitution="1"
                  xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
        <para>This parameter indicates that the share is a
index 7ef368240d5ce8d8c413e45f6756016a3a3630bd..45015cae140a05e9eed3b6eca8967e0d61ee68fd 100644 (file)
@@ -1009,6 +1009,8 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
                           bool *self_referralp)
 {
        TALLOC_CTX *frame = talloc_stackframe();
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        struct conn_struct_tos *c = NULL;
        struct connection_struct *conn = NULL;
        char *targetpath = NULL;
@@ -1058,7 +1060,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
                }
        }
 
-       if (!lp_msdfs_root(snum) && (*lp_msdfs_proxy(talloc_tos(), snum) == '\0')) {
+       if (!lp_msdfs_root(snum) && (*lp_msdfs_proxy(talloc_tos(), lp_sub, snum) == '\0')) {
                DEBUG(3,("get_referred_path: |%s| in dfs path %s is not "
                        "a dfs root.\n",
                        pdp->servicename, dfs_path));
@@ -1079,7 +1081,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
                struct referral *ref;
                int refcount;
 
-               if (*lp_msdfs_proxy(talloc_tos(), snum) == '\0') {
+               if (*lp_msdfs_proxy(talloc_tos(), lp_sub, snum) == '\0') {
                        TALLOC_FREE(frame);
                        return self_ref(ctx,
                                        dfs_path,
@@ -1094,7 +1096,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
                 */
 
                tmp = talloc_asprintf(frame, "msdfs:%s",
-                                     lp_msdfs_proxy(frame, snum));
+                                     lp_msdfs_proxy(frame, lp_sub, snum));
                if (tmp == NULL) {
                        TALLOC_FREE(frame);
                        return NT_STATUS_NO_MEMORY;
@@ -1495,12 +1497,14 @@ bool remove_msdfs_link(const struct junction_map *jucn)
 static int count_dfs_links(TALLOC_CTX *ctx, int snum)
 {
        TALLOC_CTX *frame = talloc_stackframe();
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        size_t cnt = 0;
        DIR *dirp = NULL;
        const char *dname = NULL;
        char *talloced = NULL;
        const char *connect_path = lp_path(frame, snum);
-       const char *msdfs_proxy = lp_msdfs_proxy(frame, snum);
+       const char *msdfs_proxy = lp_msdfs_proxy(frame, lp_sub, snum);
        struct conn_struct_tos *c = NULL;
        connection_struct *conn = NULL;
        NTSTATUS status;
@@ -1585,13 +1589,15 @@ static int form_junctions(TALLOC_CTX *ctx,
                                size_t jn_remain)
 {
        TALLOC_CTX *frame = talloc_stackframe();
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        size_t cnt = 0;
        DIR *dirp = NULL;
        const char *dname = NULL;
        char *talloced = NULL;
        const char *connect_path = lp_path(frame, snum);
        char *service_name = lp_servicename(frame, snum);
-       const char *msdfs_proxy = lp_msdfs_proxy(frame, snum);
+       const char *msdfs_proxy = lp_msdfs_proxy(frame, lp_sub, snum);
        struct conn_struct_tos *c = NULL;
        connection_struct *conn = NULL;
        struct referral *ref = NULL;
index 4b574661256ff8fb7acd1c8368e37c3d3be98494..e1a718b6d91813e908ec3bfbb83b829ee26b48c3 100644 (file)
@@ -1027,6 +1027,8 @@ connection_struct *make_connection(struct smb_request *req,
                                   NTSTATUS *status)
 {
        struct smbd_server_connection *sconn = req->sconn;
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        uid_t euid;
        struct user_struct *vuser = NULL;
        char *service = NULL;
@@ -1127,10 +1129,10 @@ connection_struct *make_connection(struct smb_request *req,
        }
 
        /* Handle non-Dfs clients attempting connections to msdfs proxy */
-       if (lp_host_msdfs() && (*lp_msdfs_proxy(talloc_tos(), snum) != '\0'))  {
+       if (lp_host_msdfs() && (*lp_msdfs_proxy(talloc_tos(), lp_sub, snum) != '\0'))  {
                DEBUG(3, ("refusing connection to dfs proxy share '%s' "
                          "(pointing to %s)\n", 
-                       service, lp_msdfs_proxy(talloc_tos(), snum)));
+                       service, lp_msdfs_proxy(talloc_tos(), lp_sub, snum)));
                *status = NT_STATUS_BAD_NETWORK_NAME;
                return NULL;
        }
index c2a5cbc39aa00af0a37f6b25898d827864d85d4f..4ae75d79dd606ed011705862ca7a6b1c59fd47d3 100644 (file)
@@ -191,6 +191,8 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
                                       uint32_t *out_tree_id,
                                       bool *disconnect)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        struct smbXsrv_connection *conn = req->xconn;
        const char *share = in_path;
        char *service = NULL;
@@ -276,7 +278,7 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
 
        /* Handle non-DFS clients attempting connections to msdfs proxy */
        if (lp_host_msdfs()) {
-               char *proxy = lp_msdfs_proxy(talloc_tos(), snum);
+               char *proxy = lp_msdfs_proxy(talloc_tos(), lp_sub, snum);
 
                if ((proxy != NULL) && (*proxy != '\0')) {
                        DBG_NOTICE("refusing connection to dfs proxy share "