]> granicus.if.org Git - php/commitdiff
- #27051, create process as impersonated user
authorPierre Joye <pajoye@php.net>
Tue, 1 Sep 2009 22:51:31 +0000 (22:51 +0000)
committerPierre Joye <pajoye@php.net>
Tue, 1 Sep 2009 22:51:31 +0000 (22:51 +0000)
NEWS
TSRM/tsrm_win32.c

diff --git a/NEWS b/NEWS
index bd172d6621db08383a1908ae5fb9fe25cbe9f741..5499d5f7055893926d1b34ed154087c09b0e2e34 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -176,7 +176,9 @@ PHP                                                                        NEWS
   com, Kalle)
 - Fixed bug #38091 (Mail() does not use FQDN when sending SMTP helo). 
   (Kalle, Rick Yorgason)
-- Fixed bug #28038  (Sent incorrect RCPT TO commands to SMTP server) (Garrett)
+- Fixed bug #28038 (Sent incorrect RCPT TO commands to SMTP server) (Garrett)
+- Fixed bug #27051 (Impersonation with FastCGI does not exec process as 
+  impersonated user). (Pierre)
 
 30 Jun 2009, PHP 5.3.0
 - Upgraded bundled PCRE to version 7.9. (Nuno)
index 19139dd7aeb875caaebc9517268e2b6e8c685179..9cf1fa44aeb0e02d508d4cfd00546ce6e3e95f5a 100644 (file)
@@ -311,6 +311,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
        SECURITY_ATTRIBUTES security;
        HANDLE in, out;
        DWORD dwCreateFlags = 0;
+       BOOL res;
        process_pair *proc;
        char *cmd;
        int i;
@@ -370,12 +371,17 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
        cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c ")+2);
        sprintf(cmd, "%s /c \"%s\"", TWG(comspec), command);
 
-       if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, dwCreateFlags, env, cwd, &startup, &process)) {
-               free(cmd);
-               return NULL;
+       if(TWG(impersonation_token) == NULL) {
+               res = CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, dwCreateFlags, env, cwd, &startup, &process);
+       } else {
+               res = CreateProcessAsUser(TWG(impersonation_token), NULL, cmd, &security, &security, security.bInheritHandle, dwCreateFlags, env, cwd, &startup, &process);
        }
        free(cmd);
 
+       if (!res) {
+               return NULL;
+       }
+
        CloseHandle(process.hThread);
        proc = process_get(NULL TSRMLS_CC);