Good question, zombieman. I believe so. The DRS is enabled via a signal transmitted from race control to a sensor in the car controlling the DRS. Once the system is enabled the driver activates it and it is only disengaged on the next application of the brakes. There is nothing in the technical regulations to forbid the use of the DRS in the scenario that you describe. In theory the signal to enable the system could be countermanded from race control but I'm not sure it's set up to do that.
Consider the scenario in which a driver is about to be passed in a battle for position. When there are no other cars in play he cannot activate his DRS to defend the attack, yet if he is within a second of a back marker his DRS will be enabled. On reaching the activation line he can deploy the DRS to lap the backmarker and in the process use the DRS in a defensive way to hold off his attacker. However, this is an unintended consequence of implementing the DRS as an overtaking aid for drivers and, in theory, not in the spirit of the rules. Since the system is enabled by electronic sensors, not by Charlie Whiting or other human intervention, they can't actually stop drivers using it to lap people.
I suspect that the same difficulty would apply to the other situation as well although I stand to be corrected if anyone has a better take on it.
Edit: Slow typing again .. Sly and Josh get in there before me! I'll leave it in anyway.