s3:smbd: Set up local and remote address for fake connection
authorAndreas Schneider <asn@samba.org>
Tue, 21 Mar 2017 14:45:34 +0000 (15:45 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 31 May 2017 04:33:00 +0000 (06:33 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12687

Pair-Programmed-With: Ralph Boehme <slow@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed May 31 06:33:00 CEST 2017 on sn-devel-144

source3/smbd/msdfs.c

index fb222127fd4fbf8f49b8ce7430faae356fdf0f14..acb45fd01c2fd8b9925e168213348a1d89f39d42 100644 (file)
@@ -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
@@ -1071,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. */