mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s3: smbd: Remove many common uses of lp_posix_pathnames().
Check the smb_filename->flags field, or req->posix_pathnames instead, depending on what is available. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
This commit is contained in:
parent
be56fffe4b
commit
ce75fbf4e3
@ -233,7 +233,7 @@ bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname)
|
||||
SMB_ASSERT(smb_fname->stream_name[0] != '\0');
|
||||
}
|
||||
|
||||
if (lp_posix_pathnames()) {
|
||||
if (smb_fname->flags & SMB_FILENAME_POSIX_PATH) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1138,7 +1138,7 @@ static int chmod_acl_module_common(struct vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode)
|
||||
{
|
||||
if (lp_posix_pathnames()) {
|
||||
if (smb_fname->flags & SMB_FILENAME_POSIX_PATH) {
|
||||
/* Only allow this on POSIX pathnames. */
|
||||
return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
|
||||
}
|
||||
@ -1159,7 +1159,7 @@ static int chmod_acl_acl_module_common(struct vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode)
|
||||
{
|
||||
if (lp_posix_pathnames()) {
|
||||
if (smb_fname->flags & SMB_FILENAME_POSIX_PATH) {
|
||||
/* Only allow this on POSIX pathnames. */
|
||||
return SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ static int unlink_acl_tdb(vfs_handle_struct *handle,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (lp_posix_pathnames()) {
|
||||
if (smb_fname_tmp->flags & SMB_FILENAME_POSIX_PATH) {
|
||||
ret = SMB_VFS_LSTAT(handle->conn, smb_fname_tmp);
|
||||
} else {
|
||||
ret = SMB_VFS_STAT(handle->conn, smb_fname_tmp);
|
||||
|
@ -2220,7 +2220,7 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
|
||||
smb_fname->base_name);
|
||||
smb_fname_cp.flags = smb_fname->flags;
|
||||
|
||||
if (lp_posix_pathnames()) {
|
||||
if (smb_fname_cp.flags & SMB_FILENAME_POSIX_PATH) {
|
||||
ret = SMB_VFS_LSTAT(handle->conn, &smb_fname_cp);
|
||||
} else {
|
||||
ret = SMB_VFS_STAT(handle->conn, &smb_fname_cp);
|
||||
|
@ -296,7 +296,7 @@ static int posix_eadb_unlink(vfs_handle_struct *handle,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (lp_posix_pathnames()) {
|
||||
if (smb_fname->flags & SMB_FILENAME_POSIX_PATH) {
|
||||
ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_tmp);
|
||||
} else {
|
||||
ret = SMB_VFS_NEXT_STAT(handle, smb_fname_tmp);
|
||||
|
@ -714,7 +714,7 @@ static int streams_depot_unlink(vfs_handle_struct *handle,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (lp_posix_pathnames()) {
|
||||
if (smb_fname_base->flags & SMB_FILENAME_POSIX_PATH) {
|
||||
ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_base);
|
||||
} else {
|
||||
ret = SMB_VFS_NEXT_STAT(handle, smb_fname_base);
|
||||
@ -776,7 +776,7 @@ static int streams_depot_rmdir(vfs_handle_struct *handle,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (lp_posix_pathnames()) {
|
||||
if (smb_fname_base->flags & SMB_FILENAME_POSIX_PATH) {
|
||||
ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_base);
|
||||
} else {
|
||||
ret = SMB_VFS_NEXT_STAT(handle, smb_fname_base);
|
||||
@ -974,7 +974,7 @@ static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle,
|
||||
ret = SMB_VFS_NEXT_FSTAT(handle, fsp, &smb_fname_base->st);
|
||||
}
|
||||
else {
|
||||
if (lp_posix_pathnames()) {
|
||||
if (smb_fname_base->flags & SMB_FILENAME_POSIX_PATH) {
|
||||
ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_base);
|
||||
} else {
|
||||
ret = SMB_VFS_NEXT_STAT(handle, smb_fname_base);
|
||||
|
@ -252,7 +252,7 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (lp_posix_pathnames()) {
|
||||
if (smb_fname_base->flags & SMB_FILENAME_POSIX_PATH) {
|
||||
ret = SMB_VFS_LSTAT(handle->conn, smb_fname_base);
|
||||
} else {
|
||||
ret = SMB_VFS_STAT(handle->conn, smb_fname_base);
|
||||
|
@ -364,7 +364,7 @@ static int xattr_tdb_unlink(vfs_handle_struct *handle,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (lp_posix_pathnames()) {
|
||||
if (smb_fname_tmp->flags & SMB_FILENAME_POSIX_PATH) {
|
||||
ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_tmp);
|
||||
} else {
|
||||
ret = SMB_VFS_NEXT_STAT(handle, smb_fname_tmp);
|
||||
|
@ -1178,7 +1178,7 @@ static void call_nt_transact_create(connection_struct *conn,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!lp_posix_pathnames() &&
|
||||
if (!req->posix_pathnames &&
|
||||
ea_list_has_invalid_name(ea_list)) {
|
||||
/* Realloc the size of parameters and data we will return */
|
||||
if (flags & EXTENDED_RESPONSE_REQUIRED) {
|
||||
|
@ -371,11 +371,19 @@ static NTSTATUS get_ea_list_from_file_path(TALLOC_CTX *mem_ctx,
|
||||
size_t i, num_names;
|
||||
char **names;
|
||||
struct ea_list *ea_list_head = NULL;
|
||||
bool posix_pathnames = false;
|
||||
NTSTATUS status;
|
||||
|
||||
*pea_total_len = 0;
|
||||
*ea_list = NULL;
|
||||
|
||||
if (fsp) {
|
||||
posix_pathnames =
|
||||
(fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH);
|
||||
} else {
|
||||
posix_pathnames = (smb_fname->flags & SMB_FILENAME_POSIX_PATH);
|
||||
}
|
||||
|
||||
status = get_ea_names_from_file(talloc_tos(),
|
||||
conn,
|
||||
fsp,
|
||||
@ -404,7 +412,7 @@ static NTSTATUS get_ea_list_from_file_path(TALLOC_CTX *mem_ctx,
|
||||
* Filter out any underlying POSIX EA names
|
||||
* that a Windows client can't handle.
|
||||
*/
|
||||
if (!lp_posix_pathnames() &&
|
||||
if (!posix_pathnames &&
|
||||
is_invalid_windows_ea_name(names[i])) {
|
||||
continue;
|
||||
}
|
||||
@ -692,11 +700,19 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
|
||||
const struct smb_filename *smb_fname, struct ea_list *ea_list)
|
||||
{
|
||||
NTSTATUS status;
|
||||
bool posix_pathnames = false;
|
||||
|
||||
if (!lp_ea_support(SNUM(conn))) {
|
||||
return NT_STATUS_EAS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (fsp) {
|
||||
posix_pathnames =
|
||||
(fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH);
|
||||
} else {
|
||||
posix_pathnames = (smb_fname->flags & SMB_FILENAME_POSIX_PATH);
|
||||
}
|
||||
|
||||
status = refuse_symlink(conn, fsp, smb_fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -717,7 +733,7 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
|
||||
* we set *any* of them.
|
||||
*/
|
||||
|
||||
if (!lp_posix_pathnames() && ea_list_has_invalid_name(ea_list)) {
|
||||
if (!posix_pathnames && ea_list_has_invalid_name(ea_list)) {
|
||||
return STATUS_INVALID_EA_NAME;
|
||||
}
|
||||
|
||||
@ -1297,7 +1313,7 @@ static void call_trans2open(connection_struct *conn,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!lp_posix_pathnames() &&
|
||||
if (!req->posix_pathnames &&
|
||||
ea_list_has_invalid_name(ea_list)) {
|
||||
int param_len = 30;
|
||||
*pparams = (char *)SMB_REALLOC(*pparams, param_len);
|
||||
|
Loading…
Reference in New Issue
Block a user