diff options
author | Jeremy Allison <jra@samba.org> | 2009-06-18 13:13:38 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-06-18 13:13:38 -0700 |
commit | 34267482d53cb559cc40c4ec2bee929c21b7886b (patch) | |
tree | dae973a4b11a0a7f3dd51e07a30f7a1065d7c6a6 /source3/smbd/filename.c | |
parent | e7e98ba4807f3c4e0538b24ae0092f69383ae2d7 (diff) | |
download | samba-34267482d53cb559cc40c4ec2bee929c21b7886b.tar.gz samba-34267482d53cb559cc40c4ec2bee929c21b7886b.tar.bz2 samba-34267482d53cb559cc40c4ec2bee929c21b7886b.zip |
Replace the boilerplate calls to :
resolve_dfspath() -> unix_convert() -> get_full_smb_filename() -> check_name()
with a new function filename_convert().
This restores the check_name() calls that had gone missing
since the default create_file was changed. All "standard"
pathname processing now goes through filename_convert().
I'll take a look at the non-standard pathname processing
next. As a benefit, fixed a missing resolve_dfspath()
in the trans2 mkdir call.
Jeremy.
Diffstat (limited to 'source3/smbd/filename.c')
-rw-r--r-- | source3/smbd/filename.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 456caf590b..e1e54549f7 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -1150,3 +1150,55 @@ static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx, TALLOC_FREE(streams); return status; } + +/**************************************************************************** + Go through all the steps to validate a filename. +****************************************************************************/ + +NTSTATUS filename_convert(TALLOC_CTX *ctx, + connection_struct *conn, + bool dfs_path, + const char *name_in, + struct smb_filename **pp_smb_fname, + char **pp_name) +{ + NTSTATUS status; + + *pp_smb_fname = NULL; + *pp_name = NULL; + + status = resolve_dfspath(ctx, conn, + dfs_path, + name_in, + pp_name); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10,("filename_convert: resolve_dfspath failed " + "for name %s with %s\n", + name_in, + nt_errstr(status) )); + return status; + } + status = unix_convert(ctx, conn, *pp_name, pp_smb_fname, 0); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10,("filename_convert: unix_convert failed " + "for name %s with %s\n", + *pp_name, + nt_errstr(status) )); + return status; + } + + status = get_full_smb_filename(ctx, *pp_smb_fname, pp_name); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + status = check_name(conn, *pp_name); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(3,("filename_convert: check_name failed " + "for name %s with %s\n", + *pp_name, + nt_errstr(status) )); + return status; + } + return status; +} |