summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-07-10 15:43:21 -0700
committerTim Prouty <tprouty@samba.org>2009-07-20 17:26:57 -0700
commitf4530f6d2a0688e350c3c7be23f256ebceffa636 (patch)
tree785069a2aa45cf71426dfbd2ef4e2d652a8be02c /source3
parent841efce8b5e931a7ec910afb7d0d8b6a123c6900 (diff)
downloadsamba-f4530f6d2a0688e350c3c7be23f256ebceffa636.tar.gz
samba-f4530f6d2a0688e350c3c7be23f256ebceffa636.tar.bz2
samba-f4530f6d2a0688e350c3c7be23f256ebceffa636.zip
s3: Plumb smb_filename through open_fake_file
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/smbd/fake_file.c29
-rw-r--r--source3/smbd/open.c13
3 files changed, 26 insertions, 20 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index c26f2a7c3a..c48cebce11 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6266,11 +6266,11 @@ void reply_openerror(struct smb_request *req, NTSTATUS status);
/* The following definitions come from smbd/fake_file.c */
-enum FAKE_FILE_TYPE is_fake_file(const char *fname);
+enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname);
NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
uint16_t current_vuid,
enum FAKE_FILE_TYPE fake_file_type,
- const char *fname,
+ const struct smb_filename *smb_fname,
uint32 access_mask,
files_struct **result);
NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp);
diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c
index ef54398bc4..743d88f360 100644
--- a/source3/smbd/fake_file.c
+++ b/source3/smbd/fake_file.c
@@ -71,23 +71,32 @@ static struct fake_file_handle *init_fake_file_handle(enum FAKE_FILE_TYPE type)
Does this name match a fake filename ?
****************************************************************************/
-enum FAKE_FILE_TYPE is_fake_file(const char *fname)
+enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname)
{
#ifdef HAVE_SYS_QUOTAS
int i;
+ char *fname = NULL;
+ NTSTATUS status;
#endif
- if (!fname) {
+ if (!smb_fname) {
return FAKE_FILE_TYPE_NONE;
}
#ifdef HAVE_SYS_QUOTAS
+ status = get_full_smb_filename(talloc_tos(), smb_fname, &fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ return FAKE_FILE_TYPE_NONE;
+ }
+
for (i=0;fake_files[i].name!=NULL;i++) {
if (strncmp(fname,fake_files[i].name,strlen(fake_files[i].name))==0) {
DEBUG(5,("is_fake_file: [%s] is a fake file\n",fname));
+ TALLOC_FREE(fname);
return fake_files[i].type;
}
}
+ TALLOC_FREE(fname);
#endif
return FAKE_FILE_TYPE_NONE;
@@ -101,7 +110,7 @@ enum FAKE_FILE_TYPE is_fake_file(const char *fname)
NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
uint16_t current_vuid,
enum FAKE_FILE_TYPE fake_file_type,
- const char *fname,
+ const struct smb_filename *smb_fname,
uint32 access_mask,
files_struct **result)
{
@@ -112,7 +121,8 @@ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
if (conn->server_info->utok.uid != 0) {
DEBUG(3, ("open_fake_file_shared: access_denied to "
"service[%s] file[%s] user[%s]\n",
- lp_servicename(SNUM(conn)), fname,
+ lp_servicename(SNUM(conn)),
+ smb_fname_str_dbg(smb_fname),
conn->server_info->unix_name));
return NT_STATUS_ACCESS_DENIED;
@@ -124,7 +134,8 @@ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
}
DEBUG(5,("open_fake_file_shared: fname = %s, FID = %d, access_mask = 0x%x\n",
- fname, fsp->fnum, (unsigned int)access_mask));
+ smb_fname_str_dbg(smb_fname), fsp->fnum,
+ (unsigned int)access_mask));
fsp->conn = conn;
fsp->fh->fd = -1;
@@ -132,8 +143,12 @@ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
fsp->fh->pos = -1;
fsp->can_lock = False; /* Should this be true ? - No, JRA */
fsp->access_mask = access_mask;
- string_set(&fsp->fsp_name,fname);
-
+ status = fsp_set_smb_fname(fsp, smb_fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ file_free(req, fsp);
+ return NT_STATUS_NO_MEMORY;
+ }
+
fsp->fake_file_handle = init_fake_file_handle(fake_file_type);
if (fsp->fake_file_handle==NULL) {
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 33763d202d..7692c7c847 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -3462,16 +3462,9 @@ NTSTATUS create_file_default(connection_struct *conn,
*/
if (is_ntfs_stream_smb_fname(smb_fname)) {
- char *fname = NULL;
enum FAKE_FILE_TYPE fake_file_type;
- status = get_full_smb_filename(talloc_tos(), smb_fname,
- &fname);
- if (!NT_STATUS_IS_OK(status)) {
- goto fail;
- }
-
- fake_file_type = is_fake_file(fname);
+ fake_file_type = is_fake_file(smb_fname);
if (fake_file_type != FAKE_FILE_TYPE_NONE) {
@@ -3487,9 +3480,8 @@ NTSTATUS create_file_default(connection_struct *conn,
* close it
*/
status = open_fake_file(req, conn, req->vuid,
- fake_file_type, fname,
+ fake_file_type, smb_fname,
access_mask, &fsp);
- TALLOC_FREE(fname);
if (!NT_STATUS_IS_OK(status)) {
goto fail;
}
@@ -3497,7 +3489,6 @@ NTSTATUS create_file_default(connection_struct *conn,
ZERO_STRUCT(smb_fname->st);
goto done;
}
- TALLOC_FREE(fname);
if (!(conn->fs_capabilities & FILE_NAMED_STREAMS)) {
status = NT_STATUS_OBJECT_NAME_NOT_FOUND;