]> asedeno.scripts.mit.edu Git - PuTTY.git/commit
Make get_user_sid() return the cached copy if one already exists.
authorSimon Tatham <anakin@pobox.com>
Sat, 27 Feb 2016 09:25:23 +0000 (09:25 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 29 Feb 2016 19:59:37 +0000 (19:59 +0000)
commit9c6a600e5bf02d86d2eec8fa47be1277cb22ed8f
treede48de12ef3596320fa08346c67d6e35e5b95f57
parent5ee166aab63c6960d9b153e7a307b80c2474825f
Make get_user_sid() return the cached copy if one already exists.

A user reported in January that locking down our process ACL causes
get_user_sid's call to OpenProcessToken to fail with a permissions
error. This _shouldn't_ be important, because we'll already have found
and cached the user SID before getting that far - but unfortunately
the call to get_user_sid in winnpc.c was bypassing the cache and
trying the whole process again.

This fix changes the memory ownership semantics of get_user_sid():
it's now an error to free the value it gives you, or else the *next*
call to get_user_sid() will return a stale pointer. Hence, also
removed those frees everywhere they appear.
windows/winnpc.c
windows/winpgnt.c
windows/winpgntc.c
windows/winsecur.c