From: Jeremy Allison Date: Fri, 10 Dec 2021 00:16:52 +0000 (-0800) Subject: s3: smbd: Remove the old unlink_internals() implementation. X-Git-Tag: tdb-1.4.6~343 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6db08012e999b59cc92ae0ba9ac864d4bf59694d;p=thirdparty%2Fsamba.git s3: smbd: Remove the old unlink_internals() implementation. No longer used. filename_convert() already handles mangled names just fine, so we don't need this logic. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 71be06ecc8c..2623165966f 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3275,88 +3275,6 @@ NTSTATUS unlink_internals(connection_struct *conn, return close_file(req, fsp, NORMAL_CLOSE); } -#if 0 -/**************************************************************************** - The guts of the unlink command, split out so it may be called by the NT SMB - code. -****************************************************************************/ - -NTSTATUS unlink_internals(connection_struct *conn, - struct smb_request *req, - uint32_t dirtype, - struct smb_filename *smb_fname) -{ - char *fname_dir = NULL; - char *fname_mask = NULL; - NTSTATUS status = NT_STATUS_OK; - struct smb_filename *smb_fname_dir = NULL; - TALLOC_CTX *ctx = talloc_tos(); - bool posix_pathname = (smb_fname->flags & SMB_FILENAME_POSIX_PATH); - - /* Split up the directory from the filename/mask. */ - status = split_fname_dir_mask(ctx, smb_fname->base_name, - &fname_dir, &fname_mask); - if (!NT_STATUS_IS_OK(status)) { - goto out; - } - - /* - * We should only check the mangled cache - * here if unix_convert failed. This means - * that the path in 'mask' doesn't exist - * on the file system and so we need to look - * for a possible mangle. This patch from - * Tine Smukavec . - */ - - if (!VALID_STAT(smb_fname->st) && - !posix_pathname && - mangle_is_mangled(fname_mask, conn->params)) { - char *new_mask = NULL; - mangle_lookup_name_from_8_3(ctx, fname_mask, - &new_mask, conn->params); - if (new_mask) { - TALLOC_FREE(fname_mask); - fname_mask = new_mask; - } - } - - /* - * Only one file needs to be unlinked. Append the mask back - * onto the directory. - */ - TALLOC_FREE(smb_fname->base_name); - if (ISDOT(fname_dir)) { - /* Ensure we use canonical names on open. */ - smb_fname->base_name = talloc_asprintf(smb_fname, - "%s", - fname_mask); - } else { - smb_fname->base_name = talloc_asprintf(smb_fname, - "%s/%s", - fname_dir, - fname_mask); - } - if (!smb_fname->base_name) { - status = NT_STATUS_NO_MEMORY; - goto out; - } - - status = check_name(conn, smb_fname); - if (!NT_STATUS_IS_OK(status)) { - goto out; - } - - status = do_unlink(conn, req, smb_fname, dirtype); - - out: - TALLOC_FREE(smb_fname_dir); - TALLOC_FREE(fname_dir); - TALLOC_FREE(fname_mask); - return status; -} -#endif - /**************************************************************************** Reply to a unlink ****************************************************************************/