s3: smbd: Remove dfs_redirect().
authorJeremy Allison <jra@samba.org>
Wed, 10 Aug 2022 18:34:24 +0000 (11:34 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 12 Aug 2022 18:19:31 +0000 (18:19 +0000)
A moment of silence please.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15144

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/msdfs.c
source3/smbd/proto.h

index 5a2413ed8b97469d1e9b6496f17e31aeae83756e..d48c5d6c906afd91920a4ce21b77d9126004b0f5 100644 (file)
@@ -964,121 +964,6 @@ NTSTATUS dfs_filename_convert(TALLOC_CTX *ctx,
        return NT_STATUS_OK;
 }
 
-/*****************************************************************
- Decides if a dfs pathname should be redirected or not.
- If not, the pathname is converted to a tcon-relative local unix path
-
- search_wcard_flag: this flag performs 2 functions both related
- to searches.  See resolve_dfs_path() and parse_dfs_path_XX()
- for details.
-
- This function can return NT_STATUS_OK, meaning use the returned path as-is
- (mapped into a local path).
- or NT_STATUS_NOT_COVERED meaning return a DFS redirect, or
- any other NT_STATUS error which is a genuine error to be
- returned to the client.
-*****************************************************************/
-
-NTSTATUS dfs_redirect(TALLOC_CTX *ctx,
-                       connection_struct *conn,
-                       const char *path_in,
-                       uint32_t ucf_flags,
-                       bool allow_broken_path,
-                       NTTIME *_twrp,
-                       char **pp_path_out)
-{
-       char *hostname = NULL;
-       char *servicename = NULL;
-       char *reqpath = NULL;
-       bool servicename_matches = false;
-       NTSTATUS status;
-
-       status = parse_dfs_path(ctx,
-                               conn,
-                               path_in,
-                               allow_broken_path,
-                               &hostname,
-                               &servicename,
-                               &reqpath);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
-       if (reqpath[0] == '\0') {
-               *pp_path_out = talloc_strdup(ctx, "");
-               if (!*pp_path_out) {
-                       return NT_STATUS_NO_MEMORY;
-               }
-               DEBUG(5,("dfs_redirect: self-referral.\n"));
-               return NT_STATUS_OK;
-       }
-
-       /* If dfs pathname for a non-dfs share, convert to tcon-relative
-          path and return OK */
-
-       if (!lp_msdfs_root(SNUM(conn))) {
-               *pp_path_out = talloc_strdup(ctx, reqpath);
-               if (!*pp_path_out) {
-                       return NT_STATUS_NO_MEMORY;
-               }
-               return NT_STATUS_OK;
-       }
-
-       /* If it looked like a local path (zero hostname/servicename)
-        * just treat as a tcon-relative path. */
-
-       if (hostname[0] == '\0' && servicename[0] == '\0') {
-               *pp_path_out = talloc_strdup(ctx, reqpath);
-               if (!*pp_path_out) {
-                       return NT_STATUS_NO_MEMORY;
-               }
-               return NT_STATUS_OK;
-       }
-
-       servicename_matches = msdfs_servicename_matches_connection(
-                       conn,
-                       servicename,
-                       conn->session_info->unix_info->sanitized_username);
-       if (!servicename_matches) {
-               /* The given sharename doesn't match this connection. */
-               return NT_STATUS_OBJECT_PATH_NOT_FOUND;
-       }
-
-       status = dfs_path_lookup(ctx,
-                               conn,
-                               path_in,
-                               reqpath,
-                               ucf_flags,
-                               _twrp, /* twrp. */
-                               NULL, /* size_t *consumedcntp */
-                               NULL, /* struct referral **ppreflist */
-                               NULL); /* size_t *preferral_count */
-       if (!NT_STATUS_IS_OK(status)) {
-               if (NT_STATUS_EQUAL(status, NT_STATUS_PATH_NOT_COVERED)) {
-                       DEBUG(3,("dfs_redirect: Redirecting %s\n", path_in));
-               } else {
-                       DEBUG(10,("dfs_redirect: dfs_path_lookup "
-                               "failed for %s with %s\n",
-                               path_in, nt_errstr(status) ));
-               }
-               return status;
-       }
-
-       DEBUG(3,("dfs_redirect: Not redirecting %s.\n", path_in));
-
-       /* Form non-dfs tcon-relative path */
-       *pp_path_out = talloc_strdup(ctx, reqpath);
-       if (!*pp_path_out) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       DEBUG(3,("dfs_redirect: Path %s converted to non-dfs path %s\n",
-                               path_in,
-                               *pp_path_out));
-
-       return NT_STATUS_OK;
-}
-
 /**********************************************************************
  Return a self referral.
 **********************************************************************/
index 1c10849346eb66c083b931891023354c4373ae5f..bc305bce2966326a3d41f01d533f24247b24014b 100644 (file)
@@ -565,13 +565,6 @@ NTSTATUS dfs_filename_convert(TALLOC_CTX *ctx,
                              uint32_t ucf_flags,
                              const char *dfs_path_in,
                              char **pp_path_out);
-NTSTATUS dfs_redirect(TALLOC_CTX *ctx,
-                       connection_struct *conn,
-                       const char *name_in,
-                       uint32_t ucf_flags,
-                       bool allow_broken_path,
-                       NTTIME *twrp,
-                       char **pp_name_out);
 struct connection_struct;
 struct smb_filename;