Prison smoking ban 'unlawful'