NTSTATUS unlink_internals(connection_struct *conn,
struct smb_request *req,
uint32_t dirtype,
- struct smb_filename *smb_fname);
+ struct smb_filename *smb_fname,
+ bool has_wcard);
void reply_unlink(struct smb_request *req);
ssize_t fake_sendfile(struct smbXsrv_connection *xconn, files_struct *fsp,
off_t startpos, size_t nread);
NTSTATUS unlink_internals(connection_struct *conn,
struct smb_request *req,
uint32_t dirtype,
- struct smb_filename *smb_fname)
+ struct smb_filename *smb_fname,
+ bool has_wild)
{
char *fname_dir = NULL;
char *fname_mask = NULL;
int count=0;
NTSTATUS status = NT_STATUS_OK;
struct smb_filename *smb_fname_dir = NULL;
- bool has_wild = false;
TALLOC_CTX *ctx = talloc_tos();
/* Split up the directory from the filename/mask. */
goto out;
}
- if (req != NULL && !req->posix_pathnames) {
- /*
- * Check the wildcard mask *before*
- * unmangling. As mangling is done
- * for names that can't be returned
- * to Windows the unmangled name may
- * contain Windows wildcard characters.
- */
- has_wild = ms_has_wild(fname_mask);
- }
-
/*
* We should only check the mangled cache
* here if unix_convert failed. This means
uint32_t ucf_flags = UCF_ALWAYS_ALLOW_WCARD_LCOMP |
ucf_flags_from_smb_request(req);
TALLOC_CTX *ctx = talloc_tos();
+ bool has_wild = false;
START_PROFILE(SMBunlink);
goto out;
}
+ if (req != NULL && !req->posix_pathnames) {
+ char *lcomp = get_original_lcomp(ctx,
+ conn,
+ name,
+ ucf_flags);
+ if (lcomp == NULL) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ goto out;
+ }
+ has_wild = ms_has_wild(lcomp);
+ TALLOC_FREE(lcomp);
+ }
+
DEBUG(3,("reply_unlink : %s\n", smb_fname_str_dbg(smb_fname)));
- status = unlink_internals(conn, req, dirtype, smb_fname);
+ status = unlink_internals(conn, req, dirtype, smb_fname, has_wild);
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->xconn, req->mid)) {
/* We have re-scheduled this call. */