Normally, diplomatic protection (as specifically immunity) is covered by the Vienna Convention on Diplomatic Relations. The way that treaty is phrased it's about bilateral relations, for example by referring explicitly to 'sending States' and 'receiving States'.
Suppose the President of the United States goes on a surprise visit to a warzone in the Middle East; are the president and his staff ever covered by some diplomatic protection? To make it an interesting question, let's consider the trip as follows:
The US president visits Iraq. The US and Iraq have diplomatic relations but the president's visit is not announced and it's a surprise to the Iraqi government when Air Force One lands at Al Asad air base and the president disembarks.
On the way back, the president decides he wants to surprise the president of France. Air Force One requests to land at Paris CDG airport without mentioning the president is on board (e.g. using some fake callsign). When they land it becomes clear the US president tries to enter France, but it's not clear if any form of diplomatic protection applies by default or if it's up to France to grant it.
Is the president and his entourage covered by the Vienna Convention during any part of this trip? Is there another international agreement that offers the president and his staff any diplomatic protection during this trip?
I chose the US, France, and Iraq as examples. I'm mostly interested in whether any treaties apply to unannounced travel by heads of state.