1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-06 22:12:47 -05:00

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.
This commit is contained in:
Simon Tatham
2016-02-27 09:25:23 +00:00
parent 5ee166aab6
commit 9c6a600e5b
4 changed files with 4 additions and 9 deletions

View File

@ -182,6 +182,5 @@ int agent_query(void *in, int inlen, void **out, int *outlen,
sfree(mapname);
if (psd)
LocalFree(psd);
sfree(usersid);
return 1;
}