According to the Bible, does sin give Satan 'Legal Access' to your life in any sense? I was talking to a Christian friend recently, and she brought up this teaching that when you sin you give the devil 'legal access' (her words) to your life. The conversation was in the context of a Lutheran pastor with cancer we both knew, who refused to believe that his cancer was in any way a spiritual attack, as he was a child of God and 'defended from the darts of the enemy.'

I'm curious about any scriptural teaching on whether your sin opens up some sort of 'legal right' for satan to work in your life. Personally I'm quite uncomfortable with this idea for a number of reasons (for one, it doesn't seem to sit well with the story of Job), but I'd be interested if anyone can provide any scriputural justification/refutation.
I believe that Christians have developed this conviction from the passage in Ephesians 4:27 which in the NIV translation says, "and do not give the devil a foothold." 

Therefore taking this passage some believe that if you allow any sin in your life you are giving the devil a foothold or, as someone else might put it, "legal access" to your life.

Matthew Henry states in his commentary on Ephesians a similar belief, "We give place to the devil, when the first motions of sin are not grievous to our souls; when we consent to them; and when we repeat an evil deed. This teaches that as sin, if yielded unto, lets in the devil upon us, we are to resist it, keeping from all appearance of evil."