From: Jeremy Allison Date: Wed, 10 Aug 2022 18:34:24 +0000 (-0700) Subject: s3: smbd: Remove dfs_redirect(). X-Git-Tag: talloc-2.4.0~1449 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6b1224b22012b54b1ae20b682daf61c877362a7b;p=thirdparty%2Fsamba.git s3: smbd: Remove dfs_redirect(). A moment of silence please. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15144 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 5a2413ed8b9..d48c5d6c906 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -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. **********************************************************************/ diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 1c10849346e..bc305bce296 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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;