remove duplicated code on validate_privs