There is a federal law that protects you in these cases where you are traveling through a state and not making any stops in that state. However, some states like to ignore this.
A cop can always search your car, the key question is whether or not the search is legal. Chances are, unless you consent to it it won't be unless the cop has probable cause.
This question is best left up to lawyers in the courts. The key thing you need to know is that you never need to consent to a search and you should never consent to a search -- even once he gets a warrant. Never physically resist the officer.
These two videos are simply a must for you to watch:
They will both be well worth your time!