South Korean court upholds ban on gay sex within armed forces