The documentation reads:
Helper function for authentication modules. Either login in or registers the current user, based on username. Either way, the global $user object is populated based on $name.
It seems to me that this function does not actually perform a login (it does not trigger the user_hook with op=login. It does not call user_external_login or even user_authenticate_finalize.
Am I interpreting it wrong?