I don't think it's legal, nor do I think people should buy a domain from a hosting provider. I did sell domains back then to my hosting clients, but I didn't lock or keep anyone's domain. It depends on the company too. Sometimes you choose a company with "jerks" running it. Usually a GOOD and REPUTABLE hosting company, will be nice enough to help you move, if needed.
As for your domain, depending on who they resell from, you can contact that reseller company. I remember someone did this not too long ago and the owner contact ENOM. Since the hosting company has a reseller account with them and within a week, the company unlocked the domain name. I believe it is "illegal" to hold your domain name. Best thing you can do is let us know the hosting company name and url.
Bottom line is these days, never register domains through hosting companies, UNLESS you know them very well. These days, you can get a FREE reseller account from enom $8.95 and manage your own domains
