Phase: Architecture and Design
Using names for security purposes is not advised. Names are easy to forge and can have overlapping user IDs, potentially causing confusion or impersonation.
Phase: Implementation
Use getlogin_r() instead, which is reentrant, meaning that other processes are locked out from changing the username.