Fix bug #7781 (Samba transforms "ShareName" to lowercase when adding new share via...
[samba.git] / source3 / smbd / msdfs.c
index dcef75e094fdc09966555554a1edf46b80de117f..718d0def7214514c4660ef825f409745deb9bb0f 100644 (file)
@@ -525,15 +525,10 @@ static NTSTATUS dfs_path_lookup(TALLOC_CTX *ctx,
                conn->connectpath, pdp->reqpath));
 
        /*
-        * Note the unix path conversion here we're doing we can
+        * Note the unix path conversion here we're doing we
         * throw away. We're looking for a symlink for a dfs
         * resolution, if we don't find it we'll do another
         * unix_convert later in the codepath.
-        * If we needed to remember what we'd resolved in
-        * dp->reqpath (as the original code did) we'd
-        * copy (localhost, dp->reqpath) on any code
-        * path below that returns True - but I don't
-        * think this is needed. JRA.
         */
 
        status = unix_convert(ctx, conn, pdp->reqpath, &smb_fname,
@@ -544,11 +539,7 @@ static NTSTATUS dfs_path_lookup(TALLOC_CTX *ctx,
                                     NT_STATUS_OBJECT_PATH_NOT_FOUND)) {
                        return status;
                }
-
-               /* Create an smb_fname to use below. */
-               status = create_synthetic_smb_fname(ctx, pdp->reqpath, NULL,
-                                                   NULL, &smb_fname);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (smb_fname == NULL || smb_fname->base_name == NULL) {
                        return status;
                }
        }
@@ -795,6 +786,7 @@ static NTSTATUS self_ref(TALLOC_CTX *ctx,
 **********************************************************************/
 
 NTSTATUS get_referred_path(TALLOC_CTX *ctx,
+                       struct auth_serversupplied_info *server_info,
                        const char *dfs_path,
                        struct junction_map *jucn,
                        int *consumedcntp,
@@ -830,8 +822,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
        snum = lp_servicenumber(jucn->service_name);
        if(snum < 0) {
                fstring service_name;
-               fstrcpy(service_name, jucn->service_name);
-               if ((snum = find_service(service_name)) < 0) {
+               if ((snum = find_service(jucn->service_name, service_name)) < 0) {
                        return NT_STATUS_NOT_FOUND;
                }
                TALLOC_FREE(jucn->service_name);
@@ -916,7 +907,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
        }
 
        status = create_conn_struct(ctx, &conn, snum, lp_pathname(snum),
-                                   NULL, &oldpath);
+                                   server_info, &oldpath);
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(pdp);
                return status;
@@ -1221,8 +1212,9 @@ int setup_dfs_referral(connection_struct *orig_conn,
        }
 
        /* The following call can change cwd. */
-       *pstatus = get_referred_path(ctx, pathnamep, junction,
-                       &consumedcnt, &self_referral);
+       *pstatus = get_referred_path(ctx, orig_conn->server_info,
+                                    pathnamep, junction,
+                                    &consumedcnt, &self_referral);
        if (!NT_STATUS_IS_OK(*pstatus)) {
                vfs_ChDir(orig_conn,orig_conn->connectpath);
                talloc_destroy(ctx);
@@ -1738,6 +1730,7 @@ NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
                                connection_struct *conn,
                                bool dfs_pathnames,
                                const char *name_in,
+                               bool allow_wcards,
                                char **pp_name_out,
                                bool *ppath_contains_wcard)
 {
@@ -1748,7 +1741,7 @@ NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
                status = dfs_redirect(ctx,
                                        conn,
                                        name_in,
-                                       True,
+                                       allow_wcards,
                                        pp_name_out,
                                        &path_contains_wcard);