This function is policy-dependent. For the modern sudo front-end it will simply check tcpgid and/or ttypath.