core: Expect (and verify) a uid on "owner" option.
* pinentry/pinentry.h (struct pinentry): Add field 'owner_uid'. * pinentry/pinentry.c (pinentry_reset): Handle this new field. (get_pid_name_for_uid): New. Atomic check for the base process name contingent on process ownership. (pinentry_get_title): Only scan for full commandline if the process actually belongs to the claimed uid. (option_handler): Option "owner" now expects "pid/uid hostname".
This requires an update to gpg's use of the "owner" option to emit the
uid (which will follow shortly). It is not as atomic as it should be.
In particular, there's a race condition between reading from
/proc/PID/status and reading from /proc/PID/cmdline, but it's a much
smaller race than there was previously.
Werner suggested using a / between pid/uid instead of whitespace.
- Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>