If CDPATH was set to PROFILE_HOME, as was the case when becoming a user
with no default CDPATH, we would end up in the unexpected situation of
typing, say, "cd .ssh" from the target user's home directory but
actually changing to the profile user's .ssh directory.
The new logic for CDPATH is as follows:
Do nothing if CDPATH already contains PROFILE_HOME.
Otherwise set it to . if empty then unconditionally append PROFILE_HOME.
-[ -n "$PROFILE_HOME" ] && CDPATH="${CDPATH:+$CDPATH:}$PROFILE_HOME"
+[ -n "$PROFILE_HOME" -a "${CDPATH/:$PROFILE_HOME}" = "$CDPATH" ] && CDPATH="${CDPATH:-.}:$PROFILE_HOME"