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

smbd: add {become,change_to}_user_by_fsp() helper functions

This can be used if a request operates on two fsp's,
e.g. the offload_write_send/recv code.
This is important if (at least) one of
the shares uses "force user".

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Stefan Metzmacher 2018-05-23 11:54:58 +02:00
parent 4512b91897
commit e4fb4c1d0e
2 changed files with 12 additions and 0 deletions

View File

@ -1196,6 +1196,7 @@ NTSTATUS check_user_share_access(connection_struct *conn,
uint32_t *p_share_access, uint32_t *p_share_access,
bool *p_readonly_share); bool *p_readonly_share);
bool change_to_user(connection_struct *conn, uint64_t vuid); bool change_to_user(connection_struct *conn, uint64_t vuid);
bool change_to_user_by_fsp(struct files_struct *fsp);
bool smbd_change_to_root_user(void); bool smbd_change_to_root_user(void);
bool smbd_become_authenticated_pipe_user(struct auth_session_info *session_info); bool smbd_become_authenticated_pipe_user(struct auth_session_info *session_info);
bool smbd_unbecome_authenticated_pipe_user(void); bool smbd_unbecome_authenticated_pipe_user(void);
@ -1204,6 +1205,7 @@ void unbecome_root(void);
void smbd_become_root(void); void smbd_become_root(void);
void smbd_unbecome_root(void); void smbd_unbecome_root(void);
bool become_user(connection_struct *conn, uint64_t vuid); bool become_user(connection_struct *conn, uint64_t vuid);
bool become_user_by_fsp(struct files_struct *fsp);
bool become_user_by_session(connection_struct *conn, bool become_user_by_session(connection_struct *conn,
const struct auth_session_info *session_info); const struct auth_session_info *session_info);
bool unbecome_user(void); bool unbecome_user(void);

View File

@ -418,6 +418,11 @@ bool change_to_user(connection_struct *conn, uint64_t vuid)
return change_to_user_internal(conn, vuser->session_info, vuid); return change_to_user_internal(conn, vuser->session_info, vuid);
} }
bool change_to_user_by_fsp(struct files_struct *fsp)
{
return change_to_user(fsp->conn, fsp->vuid);
}
static bool change_to_user_by_session(connection_struct *conn, static bool change_to_user_by_session(connection_struct *conn,
const struct auth_session_info *session_info) const struct auth_session_info *session_info)
{ {
@ -604,6 +609,11 @@ bool become_user(connection_struct *conn, uint64_t vuid)
return True; return True;
} }
bool become_user_by_fsp(struct files_struct *fsp)
{
return become_user(fsp->conn, fsp->vuid);
}
bool become_user_by_session(connection_struct *conn, bool become_user_by_session(connection_struct *conn,
const struct auth_session_info *session_info) const struct auth_session_info *session_info)
{ {