Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
void unbecome_root(void);
void smbd_become_root(void);
void smbd_unbecome_root(void);
+bool become_guest(void);
+void unbecome_guest(void);
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,
pop_conn_ctx();
}
+bool become_guest(void)
+{
+ bool ok;
+
+ ok = push_sec_ctx();
+ if (!ok) {
+ return false;
+ }
+
+ push_conn_ctx();
+
+ ok = change_to_guest();
+ if (!ok) {
+ pop_sec_ctx();
+ pop_conn_ctx();
+ return false;
+ }
+
+ return true;
+}
+
+void unbecome_guest(void)
+{
+ pop_sec_ctx();
+ pop_conn_ctx();
+ return;
+}
+
/****************************************************************************
Push the current security context then force a change via change_to_user().
Saves and restores the connection context.