I dimly remember hearing about an OSX application that let you, for example, enable password lock when leaving the current WiFi, but I can't find it anymore. Does anyone know how it's called? Thanks!
I'd be surprised if this exists.
Typically when you walk out of/into a wifi network's range your mac will be turned off, which means nothing can run while you're crossing the boundary. Unlike iOS, there is no API on OS X for running code when you enter/exit a specific location even while the device is turned off. This is a feature that needs hardware support, and Macs don't have it.
Scripts executed by utilities like ControlPlane will not run until after you actually wake your mac up again, and by then it's too late to change the wake-from-sleep behaviour.
It might be possible with some deep hacks into the system, but I'd be surprised.
I have a feeling you may be thinking of Sidekick.app
Months later, but I came across this post so thought I'd share my findings. ControlPlane is a free alternative to Sidekick, and does exactly what you're asking. By default, you can have your screensaver password enabled, and disable only when meeting certain criteria, such as joining a particular wifi network, identified by SSID or BSSID.