This uses the provided session_info instead of searching the user via
the vuid. This is useful to work with fake connnection you need to
create if someone connects directly to a rpc service.
Signed-off-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit
b137156acbf7c39c86f306100cccc65b441a3209)
void become_root(void);
void unbecome_root(void);
bool become_user(connection_struct *conn, uint16 vuid);
+bool become_user_by_session(connection_struct *conn,
+ const struct auth_serversupplied_info *session_info);
bool unbecome_user(void);
uid_t get_current_uid(connection_struct *conn);
gid_t get_current_gid(connection_struct *conn);
return True;
}
+bool become_user_by_session(connection_struct *conn,
+ const struct auth_serversupplied_info *session_info)
+{
+ if (!push_sec_ctx())
+ return false;
+
+ push_conn_ctx();
+
+ if (!change_to_user_by_session(conn, session_info)) {
+ pop_sec_ctx();
+ pop_conn_ctx();
+ return false;
+ }
+
+ return true;
+}
+
bool unbecome_user(void)
{
pop_sec_ctx();