1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

smbd: Pass name and stat_ex to dos_mode_msdfs()

We'll use it in a place without a smb_fname soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2023-06-20 16:28:19 +02:00
parent 614debf4d9
commit f56ceab909
3 changed files with 11 additions and 7 deletions

View File

@ -563,18 +563,19 @@ dos_mode_from_name(connection_struct *conn, const char *name, uint32_t dosmode)
****************************************************************************/
uint32_t dos_mode_msdfs(connection_struct *conn,
const struct smb_filename *smb_fname)
const char *name,
const struct stat_ex *st)
{
uint32_t result = 0;
DEBUG(8,("dos_mode_msdfs: %s\n", smb_fname_str_dbg(smb_fname)));
DEBUG(8, ("dos_mode_msdfs: %s\n", name));
if (!VALID_STAT(smb_fname->st)) {
if (!VALID_STAT(*st)) {
return 0;
}
result = dos_mode_from_name(conn, smb_fname->base_name, result);
result |= dos_mode_from_sbuf(conn, &smb_fname->st, NULL);
result = dos_mode_from_name(conn, name, result);
result |= dos_mode_from_sbuf(conn, st, NULL);
if (result == 0) {
result = FILE_ATTRIBUTE_NORMAL;

View File

@ -243,7 +243,8 @@ mode_t unix_mode(connection_struct *conn, int dosmode,
const struct smb_filename *smb_fname,
struct files_struct *parent_dirfsp);
uint32_t dos_mode_msdfs(connection_struct *conn,
const struct smb_filename *smb_fname);
const char *name,
const struct stat_ex *st);
uint32_t fdos_mode(struct files_struct *fsp);
struct tevent_req *dos_mode_at_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,

View File

@ -1075,7 +1075,9 @@ static bool smbd_dirptr_lanman2_mode_fn(TALLOC_CTX *ctx,
return false;
}
*_mode = dos_mode_msdfs(state->conn, smb_fname);
*_mode = dos_mode_msdfs(state->conn,
smb_fname->base_name,
&smb_fname->st);
return true;
}