There is a ton of case law concerning vehicle stops. You are right, leos can detain, order out, drivers and passengers of vehicles during a lawful stop (ras only needed for traffic) check pa v mimms and md v wilson. Rarely is a search warrant used to search cars.... Check out carrol doctrine, inventory search, pc based on scope (usually drug offenses), police k9 hits, and remember that Terry applies to traffic stops as well.
It's usually pretty easy to figure out a legal way to search a car if you are a Leo. However, you don't automatically get to search the car just because you arrested the driver (recent case Arizona v gant).
Check out:
Pa v mimms
Md v Wilson
Us v stanfield
Preston v us
White v commonwealth of Va
King v commonwealth of Va
Many more, interesting readings