hooks: add set_uid function
hooks: use set_uid to change user id during hook call