Edit report at https://bugs.php.net/bug.php?id=63527&edit=1

 ID:                 63527
 Comment by:         friedrich dot grosse at gmail dot com
 Reported by:        friedrich dot grosse at gmail dot com
 Summary:            DCOM does not work with Username, Password parameter
 Status:             Open
 Type:               Bug
 Package:            COM related
 Operating System:   Windows Server 2008 R2
 PHP Version:        5.4.8
 Block user comment: N
 Private report:     N

 New Comment:

Here are some information copied from the security event log of the target 
machine. Note that the username is just 'A' and not the wanted 'Admin':

Subject:
        Security ID:            NULL SID
        Account Name:           -
        Account Domain:         -
        Logon ID:               0x0

Logon Type:                     3

Account For Which Logon Failed:
        Security ID:            NULL SID
        Account Name:           A
        Account Domain:         Testdomain.com


Previous Comments:
------------------------------------------------------------------------
[2012-11-15 13:06:53] friedrich dot grosse at gmail dot com

Description:
------------
I try to instantiate a DCOM object on a remote machine (Windows Server 2008 R2) 
in another 
domain using the Username and Password parameters of the COM class constructor 
[1]
I did also figure out that there is a Domain parameter which is not mentioned 
in 
the manual at 
[1].

However I can not authenticate at the remote machine.
The event log there indicates that only the first character of the Logon 
Accounts Username has 
been transmitted to the DCOM Server.
The Domain parameter has been received completely.

I am not familiar with PHP internals but I did a quick look in the source code 
and would guess 
that the issue can be traced back to [2].

The user_name and user_name_len are already parsed some lines above.
Why is php_com_string_to_olestring called with a -1 as second parameter which 
leads to 
determining the length of the username again?

Maybe giving user_name_len instead of -1 could fix this issue?


[1] http://de1.php.net/manual/de/class.com.php
[2] https://github.com/php/php-src/blob/master/ext/com_dotnet/com_com.c#L131

Test script:
---------------
try {
  $DCOMserverInfo = array(
      'Server' => "Server.com",
      'Username' => "Admin",
      'Domain' => "Testdomain.com",
      'Password' => "password"
  );
  /** You may change the COM module name to word.application or whatever COM 
enabled app is installed on the target machine. **/
  $comObj = new COM("word.application", $DCOMserverInfo);
  echo "Everything works fine";
}
catch (Exception $exception) {
  echo exception->getMessage();
}

Expected result:
----------------
Everything works fine

Actual result:
--------------
Failed to create COM object `word.application': Access is denied.


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63527&edit=1

Reply via email to