One must be very careful with variables that may contain spaces or other special characters. Whitespace can really wrench up the works.
The best solution in bash is to use [[ instead of [. It handles whitespace with grace and style. I recommend just switching to [[ in all cases and never using [. [[ is better in all respects.
if [[ $? -eq 0 ]]; then
if [[ $name = "$ufname" ]]; then
echo "Names are still the same"
fi
fi
The only reason to use [ is if portability is a concern--like if you're writing for plain sh rather than bash. In that case, you'll have to stick with [, and so you should quote your variables.
if [ $? -eq 0 ]; then
if [ "$name" = "$ufname" ]; then
echo "Names are still the same"
fi
fi