X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=windows%2Fwinsecur.c;h=8b3c7f161893d8b0cc5fb904cd12b4e7b71b3c28;hb=1de7240eb88fa24a8532ded116b4ec72dd213008;hp=8d0b223aa67b6a892f359ee4a3859071478814a4;hpb=a5634e0ccb7955bef810cfaadb5562d6da33f5b1;p=PuTTY.git diff --git a/windows/winsecur.c b/windows/winsecur.c index 8d0b223a..8b3c7f16 100644 --- a/windows/winsecur.c +++ b/windows/winsecur.c @@ -44,6 +44,9 @@ PSID get_user_sid(void) DWORD toklen, sidlen; PSID sid = NULL, ret = NULL; + if (usersid) + return usersid; + if (!got_advapi()) goto cleanup; @@ -73,7 +76,7 @@ PSID get_user_sid(void) /* Success. Move sid into the return value slot, and null it out * to stop the cleanup code freeing it. */ - ret = sid; + ret = usersid = sid; sid = NULL; cleanup: @@ -140,8 +143,6 @@ int make_private_security_descriptor(DWORD permissions, PACL *acl, char **error) { - SID_IDENTIFIER_AUTHORITY world_auth = SECURITY_WORLD_SID_AUTHORITY; - SID_IDENTIFIER_AUTHORITY nt_auth = SECURITY_NT_AUTHORITY; EXPLICIT_ACCESS ea[3]; int acl_err; int ret = FALSE; @@ -225,16 +226,14 @@ int make_private_security_descriptor(DWORD permissions, int setprocessacl(char *error) { - SID_IDENTIFIER_AUTHORITY world_auth = SECURITY_WORLD_SID_AUTHORITY; - SID_IDENTIFIER_AUTHORITY nt_auth = SECURITY_NT_AUTHORITY; EXPLICIT_ACCESS ea[2]; int acl_err; int ret=FALSE; PACL acl = NULL; - static const nastyace=WRITE_DAC | WRITE_OWNER | + static const DWORD nastyace=WRITE_DAC | WRITE_OWNER | PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | - PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION | + PROCESS_DUP_HANDLE | PROCESS_SET_QUOTA | PROCESS_SET_INFORMATION | PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_SUSPEND_RESUME;