The branch, master has been updated
       via  e530e43 s3:smbd: Set up local and remote address for fake connection
       via  cbf6712 s3:smbd: Pass down remote and local address to 
get_referred_path()
      from  ccd4f81 lib: Remove use of MSG_NOSIGNAL

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e530e43d67436881fd039877f956f0ad9b562af9
Author: Andreas Schneider <[email protected]>
Date:   Tue Mar 21 15:45:34 2017 +0100

    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 <[email protected]>
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Wed May 31 06:33:00 CEST 2017 on sn-devel-144

commit cbf67123e037207662ec0d4e53c55990e21b157e
Author: Andreas Schneider <[email protected]>
Date:   Tue Mar 21 15:32:37 2017 +0100

    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 <[email protected]>
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/vfs_default.c       |  2 ++
 source3/rpc_server/dfs/srv_dfs_nt.c |  6 ++++++
 source3/smbd/msdfs.c                | 36 +++++++++++++++++++++++++++++++-----
 source3/smbd/proto.h                | 12 +++++++-----
 4 files changed, 46 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index fa89f7f..e1b2712 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 ab2af53..0a4d6d3 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 c22cd1e..acb45fd 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -31,6 +31,7 @@
 #include "lib/param/loadparm.h"
 #include "libcli/security/security.h"
 #include "librpc/gen_ndr/ndr_dfsblobs.h"
+#include "lib/tsocket/tsocket.h"
 
 /**********************************************************************
  Parse a DFS pathname of the form \hostname\service\reqpath
@@ -953,11 +954,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;
@@ -1069,6 +1072,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. */
 
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 0be2a49..e2d5a6a 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,


-- 
Samba Shared Repository

Reply via email to