#include "lib/util/sys_rw_data.h"
#include "librpc/gen_ndr/open_files.h"
#include "smb1_utils.h"
+#include "libcli/smb/smb2_posix.h"
/****************************************************************************
Ensure we check the path in *exactly* the same way as W2K for a findfirst/findnext
NTSTATUS status;
int ret;
bool posix_paths = (req != NULL && req->posix_pathnames);
+ struct smb2_create_blobs *posx = NULL;
DEBUG(10,("do_unlink: %s, dirtype = %d\n",
smb_fname_str_dbg(smb_fname),
return NT_STATUS_OBJECT_NAME_INVALID;
#endif /* JRATEST */
+ if (posix_paths) {
+ status = make_smb2_posix_create_ctx(
+ talloc_tos(), &posx, 0777);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_WARNING("make_smb2_posix_create_ctx failed: %s\n",
+ nt_errstr(status));
+ return status;
+ }
+ }
+
/* On open checks the open itself will check the share mode, so
don't do it here as we'll get it wrong. */
NULL, /* ea_list */
&fsp, /* result */
NULL, /* pinfo */
- NULL, NULL); /* create context */
+ posx, /* in_context_blobs */
+ NULL); /* out_context_blobs */
+
+ TALLOC_FREE(posx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("SMB_VFS_CREATEFILE failed: %s\n",
long offset = 0;
int create_options = 0;
bool posix_pathnames = (req != NULL && req->posix_pathnames);
+ struct smb2_create_blobs *posx = NULL;
int rc;
/*
}
}
+ if (posix_pathnames) {
+ status = make_smb2_posix_create_ctx(talloc_tos(), &posx, 0777);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_WARNING("make_smb2_posix_create_ctx failed: %s\n",
+ nt_errstr(status));
+ goto out;
+ }
+ }
+
if (!src_has_wild) {
files_struct *fsp;
NULL, /* ea_list */
&fsp, /* result */
NULL, /* pinfo */
- NULL, NULL); /* create context */
+ posx, /* in_context_blobs */
+ NULL); /* out_context_blobs */
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("Could not open rename source %s: %s\n",
NULL, /* ea_list */
&fsp, /* result */
NULL, /* pinfo */
- NULL, NULL); /* create context */
+ posx, /* in_context_blobs */
+ NULL); /* out_context_blobs */
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3,("rename_internals: SMB_VFS_CREATE_FILE "
}
out:
+ TALLOC_FREE(posx);
TALLOC_FREE(talloced);
TALLOC_FREE(smb_fname_src_dir);
TALLOC_FREE(fname_src_dir);
#include "lib/readdir_attr.h"
#include "messages.h"
#include "smb1_utils.h"
+#include "libcli/smb/smb2_posix.h"
#define DIR_ENTRY_SAFETY_MARGIN 4096
uint32_t share_access = FILE_SHARE_READ|
FILE_SHARE_WRITE|
FILE_SHARE_DELETE;
+ struct smb2_create_blobs *posx = NULL;
+
/*
* Only FILE_FLAG_POSIX_SEMANTICS matters on existing files,
* but set reasonable defaults.
goto done;
}
+ status = make_smb2_posix_create_ctx(
+ talloc_tos(),
+ &posx,
+ file_attributes & ~FILE_FLAG_POSIX_SEMANTICS);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_WARNING("make_smb2_posix_create_ctx failed: %s\n",
+ nt_errstr(status));
+ goto done;
+ }
+
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
NULL, /* ea_list */
ret_fsp, /* result */
NULL, /* pinfo */
- NULL, /* in_context */
+ posx, /* in_context */
NULL); /* out_context */
done:
+ TALLOC_FREE(posx);
TALLOC_FREE(smb_fname_tmp);
return status;
}
uint16_t info_level_return = 0;
int info;
char *pdata = *ppdata;
+ struct smb2_create_blobs *posx = NULL;
if (total_data < 18) {
return NT_STATUS_INVALID_PARAMETER;
mod_unixmode = (uint32_t)unixmode | FILE_FLAG_POSIX_SEMANTICS;
+ status = make_smb2_posix_create_ctx(talloc_tos(), &posx, unixmode);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_WARNING("make_smb2_posix_create_ctx failed: %s\n",
+ nt_errstr(status));
+ return status;
+ }
+
DEBUG(10,("smb_posix_mkdir: file %s, mode 0%o\n",
smb_fname_str_dbg(smb_fname), (unsigned int)unixmode));
NULL, /* ea_list */
&fsp, /* result */
&info, /* pinfo */
- NULL, NULL); /* create context */
+ posx, /* in_context_blobs */
+ NULL); /* out_context_blobs */
+
+ TALLOC_FREE(posx);
if (NT_STATUS_IS_OK(status)) {
close_file(req, fsp, NORMAL_CLOSE);
int oplock_request = 0;
int info = 0;
uint16_t info_level_return = 0;
+ struct smb2_create_blobs *posx = NULL;
if (total_data < 18) {
return NT_STATUS_INVALID_PARAMETER;
return status;
}
+ status = make_smb2_posix_create_ctx(talloc_tos(), &posx, unixmode);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_WARNING("make_smb2_posix_create_ctx failed: %s\n",
+ nt_errstr(status));
+ return status;
+ }
+
mod_unixmode = (uint32_t)unixmode | FILE_FLAG_POSIX_SEMANTICS;
if (wire_open_mode & SMB_O_SYNC) {
NULL, /* ea_list */
&fsp, /* result */
&info, /* pinfo */
- NULL, NULL); /* create context */
+ posx, /* in_context_blobs */
+ NULL); /* out_context_blobs */
+
+ TALLOC_FREE(posx);
if (!NT_STATUS_IS_OK(status)) {
return status;
int create_options = 0;
struct share_mode_lock *lck = NULL;
bool other_nonposix_opens;
+ struct smb2_create_blobs *posx = NULL;
if (total_data < 2) {
return NT_STATUS_INVALID_PARAMETER;
create_options |= FILE_DIRECTORY_FILE;
}
+ status = make_smb2_posix_create_ctx(talloc_tos(), &posx, 0777);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_WARNING("make_smb2_posix_create_ctx failed: %s\n",
+ nt_errstr(status));
+ return status;
+ }
+
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
NULL, /* ea_list */
&fsp, /* result */
&info, /* pinfo */
- NULL, NULL); /* create context */
+ posx, /* in_context_blobs */
+ NULL); /* out_context_blobs */
+
+ TALLOC_FREE(posx);
if (!NT_STATUS_IS_OK(status)) {
return status;