summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-04-07 13:39:57 -0700
committerTim Prouty <tprouty@samba.org>2009-05-20 17:40:15 -0700
commitc1a21d085d758284fe6997a05396f225da683352 (patch)
tree5cb74bc432c5e3c76f8eaac6652a3125ea108515 /source3/include
parent5d3d51e9ad1e4db8d9580ce7f2ba4e86e658bb13 (diff)
downloadsamba-c1a21d085d758284fe6997a05396f225da683352.tar.gz
samba-c1a21d085d758284fe6997a05396f225da683352.tar.bz2
samba-c1a21d085d758284fe6997a05396f225da683352.zip
s3: Change unix_convert (and its callers) to use struct smb_filename
This is the first of a series of patches that change path based operations to operate on a struct smb_filename instead of a char *. This same concept already exists in source4. My goals for this series of patches are to eventually: 1) Solve the stream vs. posix filename that contains a colon ambiguity that currently exists. 2) Make unix_convert the only function that parses the stream name. 3) Clean up the unix_convert API. 4) Change all path based vfs operation to take a struct smb_filename. 5) Make is_ntfs_stream_name() a constant operation that can simply check the state of struct smb_filename rather than re-parse the filename. 6) Eliminate the need for split_ntfs_stream_name() to exist. My strategy is to start from the inside at unix_convert() and work my way out through the vfs layer, call by call. This first patch does just that, by changing unix_convert and all of its callers to operate on struct smb_filename. Since this is such a large change, I plan on pushing the patches in phases, where each phase keeps full compatibility and passes make test. The API of unix_convert has been simplified from: NTSTATUS unix_convert(TALLOC_CTX *ctx, connection_struct *conn, const char *orig_path, bool allow_wcard_last_component, char **pp_conv_path, char **pp_saved_last_component, SMB_STRUCT_STAT *pst) to: NTSTATUS unix_convert(TALLOC_CTX *ctx, connection_struct *conn, const char *orig_path, struct smb_filename *smb_fname, uint32_t ucf_flags) Currently the smb_filename struct looks like: struct smb_filename { char *base_name; char *stream_name; char *original_lcomp; SMB_STRUCT_STAT st; }; One key point here is the decision to break up the base_name and stream_name. I have introduced a helper function called get_full_smb_filename() that takes an smb_filename struct and allocates the full_name. I changed the callers of unix_convert() to subsequently call get_full_smb_filename() for the time being, but I plan to eventually eliminate get_full_smb_filename().
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/proto.h12
-rw-r--r--source3/include/smb.h16
2 files changed, 22 insertions, 6 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 6f298ad9a0..a45fa42e3d 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6264,13 +6264,13 @@ int fsp_stat(files_struct *fsp, SMB_STRUCT_STAT *pst);
/* The following definitions come from smbd/filename.c */
+NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_fname,
+ char **full_name);
NTSTATUS unix_convert(TALLOC_CTX *ctx,
- connection_struct *conn,
- const char *orig_path,
- bool allow_wcard_last_component,
- char **pp_conv_path,
- char **pp_saved_last_component,
- SMB_STRUCT_STAT *pst);
+ connection_struct *conn,
+ const char *orig_path,
+ struct smb_filename **smb_fname,
+ uint32_t ucf_flags);
NTSTATUS check_name(connection_struct *conn, const char *name);
int get_real_filename(connection_struct *conn, const char *path,
const char *name, TALLOC_CTX *mem_ctx,
diff --git a/source3/include/smb.h b/source3/include/smb.h
index abcd49451c..9332df3cd2 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -1925,4 +1925,20 @@ struct smb_file_time {
struct timespec create_time;
};
+/*
+ * unix_convert_flags
+ */
+#define UCF_SAVE_LCOMP 0x00000001
+#define UCF_ALLOW_WCARD_LCOMP 0x00000002
+
+/*
+ * smb_filename
+ */
+struct smb_filename {
+ char *base_name;
+ char *stream_name;
+ char *original_lcomp;
+ SMB_STRUCT_STAT st;
+};
+
#endif /* _SMB_H */