Re: [libvirt] libvirt-php login issue to ESXi

2011-06-29 Thread Koen Calliauw
Hi Michal,

Here's what appears in the logfile when using libvirt_logfile_set:

[Wed Jun 29 15:18:00 2011] [error] [client 10.9.1.10] PHP Warning:
libvirt_connect(): internal error HTTP response code 500 for call to
'Login'. Fault: ServerFaultCode - Cannot complete login due to an incorrect
user name or password. in /var/www/virt.php on line 9, referer:
http://10.9.0.3/
[2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect: Cannot establish
connection to esx://10.9.0.2?transport=http

Best regards,
Koen Calliauw

On Wed, Jun 29, 2011 at 3:10 PM, Michal Novotny minov...@redhat.com wrote:

 Hi Koen,
 thanks for you e-mail. I don't know what exactly is going on here but
 could you please try to enable debug logging using

 libvirt_logfile_set($filename, $maxsize)

 API function? The maxsize parameter is optional and it defaults to 1024
 KiB (1M). The file have to have write permissions so you can touch the
 file, e.g. debug.log and change it's permissions to 777 to allow
 logging. Once you try to login using the script you mentioned with debug
 set you will get the debug output into the debug.log file which could be
 send to us for further analysis.

 Thanks,
 Michal


 On 06/29/2011 03:03 PM, Koen Calliauw wrote:
  Hi all,
 
  I've started playing with libvirt-php yesterday and with the help of
  Michal Novotny got it running quite painlessly. However, the login
  from PHP to my testing ESXi server seems to be failing. I've
  wiresharked the HTTP traffic with a virsh -c (which works) and
  compared that to the traffic I see when using the libvirt-php
  extension, here's the difference I see (mind the username)
 
  Not working (libvirt-php)
 
  Login xmlns=urn:vim25_this xmlns=urn:vim25
  xsi:type=ManagedObjectReference
  type=SessionManagerha-sessionmgr/_thisuserName xmlns=urn:vim25
  xsi:type=xsd:stringroot8./userNamepassword xmlns=urn:vim25
  xsi:type=xsd:stringfakepass/password/Login
 
  Working (virsh -c)
 
  Login xmlns=urn:vim25_this xmlns=urn:vim25
  xsi:type=ManagedObjectReference
  type=SessionManagerha-sessionmgr/_thisuserName xmlns=urn:vim25
  xsi:type=xsd:stringroot/userNamepassword xmlns=urn:vim25
  xsi:type=xsd:stringfakepass/password/Login
 
  So for some reason something gets appended (8.) or encoded wrong or
  something when I use the PHP extension. This is the testing code I run:
 
  ?php
  $credentials =
  array(VIR_CRED_AUTHNAME='root',VIR_CRED_PASSPHRASE='fakepass');
  $conn = libvirt_connect(esx://10.9.0.2?transport=http
  http://10.9.0.2?transport=http, FALSE, $credentials);
  if($conn) {
  print_r(libvirt_connect_get_hypervisor($conn));
 
  } else {
  echo Connection failed: .libvirt_get_last_error();
  }
 
  Any help with this issue would be greatly appreciated. Thanks!
 
  Best regards,
  Koen Calliauw


 --
 Michal Novotny minov...@redhat.com, RHCE, Red Hat
 Virtualization | libvirt-php bindings | php-virt-control.org


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] libvirt-php login issue to ESXi

2011-06-29 Thread Michal Novotny
Hi Koen,
that's bad. I don't have logging of username and password length here.
I'll try to work on this. You can try attached patch to extend logging
by username and password in the mean time and provide me the full
resulting log file? Please review whether there is no password and if
there is then please change it to fakepass.

Thanks,
Michal

On 06/29/2011 03:19 PM, Koen Calliauw wrote:
 Hi Michal,

 Here's what appears in the logfile when using libvirt_logfile_set:

 [Wed Jun 29 15:18:00 2011] [error] [client 10.9.1.10] PHP Warning: 
 libvirt_connect(): internal error HTTP response code 500 for call to
 'Login'. Fault: ServerFaultCode - Cannot complete login due to an
 incorrect user name or password. in /var/www/virt.php on line 9,
 referer: http://10.9.0.3/
 [2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect: Cannot
 establish connection to esx://10.9.0.2?transport=http
 http://10.9.0.2?transport=http

 Best regards,
 Koen Calliauw

 On Wed, Jun 29, 2011 at 3:10 PM, Michal Novotny minov...@redhat.com
 mailto:minov...@redhat.com wrote:

 Hi Koen,
 thanks for you e-mail. I don't know what exactly is going on here but
 could you please try to enable debug logging using

 libvirt_logfile_set($filename, $maxsize)

 API function? The maxsize parameter is optional and it defaults to
 1024
 KiB (1M). The file have to have write permissions so you can touch the
 file, e.g. debug.log and change it's permissions to 777 to allow
 logging. Once you try to login using the script you mentioned with
 debug
 set you will get the debug output into the debug.log file which
 could be
 send to us for further analysis.

 Thanks,
 Michal


 On 06/29/2011 03:03 PM, Koen Calliauw wrote:
  Hi all,
 
  I've started playing with libvirt-php yesterday and with the help of
  Michal Novotny got it running quite painlessly. However, the login
  from PHP to my testing ESXi server seems to be failing. I've
  wiresharked the HTTP traffic with a virsh -c (which works) and
  compared that to the traffic I see when using the libvirt-php
  extension, here's the difference I see (mind the username)
 
  Not working (libvirt-php)
 
  Login xmlns=urn:vim25_this xmlns=urn:vim25
  xsi:type=ManagedObjectReference
  type=SessionManagerha-sessionmgr/_thisuserName
 xmlns=urn:vim25
  xsi:type=xsd:stringroot8./userNamepassword xmlns=urn:vim25
  xsi:type=xsd:stringfakepass/password/Login
 
  Working (virsh -c)
 
  Login xmlns=urn:vim25_this xmlns=urn:vim25
  xsi:type=ManagedObjectReference
  type=SessionManagerha-sessionmgr/_thisuserName
 xmlns=urn:vim25
  xsi:type=xsd:stringroot/userNamepassword xmlns=urn:vim25
  xsi:type=xsd:stringfakepass/password/Login
 
  So for some reason something gets appended (8.) or encoded wrong or
  something when I use the PHP extension. This is the testing code
 I run:
 
  ?php
  $credentials =
  array(VIR_CRED_AUTHNAME='root',VIR_CRED_PASSPHRASE='fakepass');
  $conn = libvirt_connect(esx://10.9.0.2?transport=http
 http://10.9.0.2?transport=http
  http://10.9.0.2?transport=http, FALSE, $credentials);
  if($conn) {
  print_r(libvirt_connect_get_hypervisor($conn));
 
  } else {
  echo Connection failed: .libvirt_get_last_error();
  }
 
  Any help with this issue would be greatly appreciated. Thanks!
 
  Best regards,
  Koen Calliauw


 --
 Michal Novotny minov...@redhat.com mailto:minov...@redhat.com,
 RHCE, Red Hat
 Virtualization | libvirt-php bindings | php-virt-control.org
 http://php-virt-control.org




-- 
Michal Novotny minov...@redhat.com, RHCE, Red Hat
Virtualization | libvirt-php bindings | php-virt-control.org

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index c3253c0..0be65e3 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -1196,7 +1196,7 @@ static int libvirt_virConnectAuthCallback(virConnectCredentialPtr cred,  unsigne
 	php_libvirt_cred_value *creds=(php_libvirt_cred_value*) cbdata;
 	for(i=0;incred;i++)
 	{
-		//printf (Cred %i: type %i, prompt %s challenge %s\n,i,cred[i].type,cred[i].prompt,cred[i].challenge);
+		DPRINTF(%s: cred %d, type %d, prompt %s challenge %s\n , __FUNCTION__, i, cred[i].type, cred[i].prompt, cred[i].challenge);
 		if (creds != NULL)
 			for (j=0;jcreds[0].count;j++)
 			{
@@ -1207,7 +1207,7 @@ static int libvirt_virConnectAuthCallback(virConnectCredentialPtr cred,  unsigne
 	strncpy(cred[i].result,creds[j].result,creds[j].resultlen);
 }
 			}
-			//printf (Result: %s (%i)\n,cred[i].result,cred[i].resultlen);
+			DPRINTF(%s: result %s (%d)\n, __FUNCTION__, cred[i].result, cred[i].resultlen);
 	}
 
 	return 0;
@@ -1316,16 +1316,20 @@ PHP_FUNCTION(libvirt_connect)
 			zend_hash_move_forward_ex(arr_hash, pointer)) {
 				if (Z_TYPE_PP(data) == IS_STRING) {
 	if 

Re: [libvirt] libvirt-php login issue to ESXi

2011-06-29 Thread Koen Calliauw
Hi Michal,

Here's the output. Please note that special characters were visible when
opening the file with vi, though not with a cat on the console, so this is a
copy/paste out of vi.

[2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials index 2
[2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials index 5
[2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: Found 2 elements
for credentials
[2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: cred
0, type 2, prompt Enter username for 10.9.0.2 [root] challenge 10.9.0.2
 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback:
result rootV^? (4)
[2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: cred
0, type 5, prompt Enter rootV^?'s password for 10.9.0.2 challenge 10.9.0.2
 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback:
result fakepass (12)
[Wed Jun 29 15:44:00 2011] [error] [client 10.9.1.10] PHP Warning:
libvirt_connect(): internal error HTTP response code 500 for call to
'Login'. Fault: ServerFaultCode - Cannot complete login due to an incorrect
user name or password. in /var/www/virt.php on line 9, referer:
http://10.9.0.3/
[2011-06-29 15:44:00 libvirt-php/core]: libvirt_connect: Cannot establish
connection to esx://10.9.0.2?transport=http

Best regards,
Koen Calliauw



On Wed, Jun 29, 2011 at 3:35 PM, Michal Novotny minov...@redhat.com wrote:

 Hi Koen,
 that's bad. I don't have logging of username and password length here.
 I'll try to work on this. You can try attached patch to extend logging
 by username and password in the mean time and provide me the full
 resulting log file? Please review whether there is no password and if
 there is then please change it to fakepass.

 Thanks,
 Michal

 On 06/29/2011 03:19 PM, Koen Calliauw wrote:
  Hi Michal,
 
  Here's what appears in the logfile when using libvirt_logfile_set:
 
  [Wed Jun 29 15:18:00 2011] [error] [client 10.9.1.10] PHP Warning:
  libvirt_connect(): internal error HTTP response code 500 for call to
  'Login'. Fault: ServerFaultCode - Cannot complete login due to an
  incorrect user name or password. in /var/www/virt.php on line 9,
  referer: http://10.9.0.3/
  [2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect: Cannot
  establish connection to esx://10.9.0.2?transport=http
  http://10.9.0.2?transport=http
 
  Best regards,
  Koen Calliauw
 
  On Wed, Jun 29, 2011 at 3:10 PM, Michal Novotny minov...@redhat.com
  mailto:minov...@redhat.com wrote:
 
  Hi Koen,
  thanks for you e-mail. I don't know what exactly is going on here but
  could you please try to enable debug logging using
 
  libvirt_logfile_set($filename, $maxsize)
 
  API function? The maxsize parameter is optional and it defaults to
  1024
  KiB (1M). The file have to have write permissions so you can touch
 the
  file, e.g. debug.log and change it's permissions to 777 to allow
  logging. Once you try to login using the script you mentioned with
  debug
  set you will get the debug output into the debug.log file which
  could be
  send to us for further analysis.
 
  Thanks,
  Michal
 
 
  On 06/29/2011 03:03 PM, Koen Calliauw wrote:
   Hi all,
  
   I've started playing with libvirt-php yesterday and with the help
 of
   Michal Novotny got it running quite painlessly. However, the login
   from PHP to my testing ESXi server seems to be failing. I've
   wiresharked the HTTP traffic with a virsh -c (which works) and
   compared that to the traffic I see when using the libvirt-php
   extension, here's the difference I see (mind the username)
  
   Not working (libvirt-php)
  
   Login xmlns=urn:vim25_this xmlns=urn:vim25
   xsi:type=ManagedObjectReference
   type=SessionManagerha-sessionmgr/_thisuserName
  xmlns=urn:vim25
   xsi:type=xsd:stringroot8./userNamepassword xmlns=urn:vim25
   xsi:type=xsd:stringfakepass/password/Login
  
   Working (virsh -c)
  
   Login xmlns=urn:vim25_this xmlns=urn:vim25
   xsi:type=ManagedObjectReference
   type=SessionManagerha-sessionmgr/_thisuserName
  xmlns=urn:vim25
   xsi:type=xsd:stringroot/userNamepassword xmlns=urn:vim25
   xsi:type=xsd:stringfakepass/password/Login
  
   So for some reason something gets appended (8.) or encoded wrong or
   something when I use the PHP extension. This is the testing code
  I run:
  
   ?php
   $credentials =
   array(VIR_CRED_AUTHNAME='root',VIR_CRED_PASSPHRASE='fakepass');
   $conn = libvirt_connect(esx://10.9.0.2?transport=http
  http://10.9.0.2?transport=http
   http://10.9.0.2?transport=http, FALSE, $credentials);
   if($conn) {
   print_r(libvirt_connect_get_hypervisor($conn));
  
   } else {
   echo Connection failed: .libvirt_get_last_error();
   }
  
   Any help with this issue would 

Re: [libvirt] libvirt-php login issue to ESXi

2011-06-29 Thread Michal Novotny
Hi Koen,
please try this patch. I can't test it myself since it's logging
automatically in my setup but I *think* I may have found the problem.
Could you please apply attached patch (revert the patch I sent to you
before) and provide me the test results?

Thanks,
Michal

 On 06/29/2011 03:47 PM, Koen Calliauw wrote:
 Hi Michal,

 Here's the output. Please note that special characters were visible
 when opening the file with vi, though not with a cat on the console,
 so this is a copy/paste out of vi.

 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials
 index 2
 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials
 index 5
 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: Found 2
 elements for credentials
 [2011-06-29 15:43:58 libvirt-php/core]:
 libvirt_virConnectAuthCallback: cred 0, type 2, prompt Enter username
 for 10.9.0.2 [root] challenge 10.9.0.2
  [2011-06-29 15:43:58 libvirt-php/core]:
 libvirt_virConnectAuthCallback: result rootV^? (4)
 [2011-06-29 15:43:58 libvirt-php/core]:
 libvirt_virConnectAuthCallback: cred 0, type 5, prompt Enter rootV^?'s
 password for 10.9.0.2 challenge 10.9.0.2
  [2011-06-29 15:43:58 libvirt-php/core]:
 libvirt_virConnectAuthCallback: result fakepass (12)
 [Wed Jun 29 15:44:00 2011] [error] [client 10.9.1.10] PHP Warning: 
 libvirt_connect(): internal error HTTP response code 500 for call to
 'Login'. Fault: ServerFaultCode - Cannot complete login due to an
 incorrect user name or password. in /var/www/virt.php on line 9,
 referer: http://10.9.0.3/
 [2011-06-29 15:44:00 libvirt-php/core]: libvirt_connect: Cannot
 establish connection to esx://10.9.0.2?transport=http
 http://10.9.0.2?transport=http

 Best regards,
 Koen Calliauw



 On Wed, Jun 29, 2011 at 3:35 PM, Michal Novotny minov...@redhat.com
 mailto:minov...@redhat.com wrote:

 Hi Koen,
 that's bad. I don't have logging of username and password length here.
 I'll try to work on this. You can try attached patch to extend logging
 by username and password in the mean time and provide me the full
 resulting log file? Please review whether there is no password and if
 there is then please change it to fakepass.

 Thanks,
 Michal

 On 06/29/2011 03:19 PM, Koen Calliauw wrote:
  Hi Michal,
 
  Here's what appears in the logfile when using libvirt_logfile_set:
 
  [Wed Jun 29 15:18:00 2011] [error] [client 10.9.1.10] PHP Warning:
  libvirt_connect(): internal error HTTP response code 500 for call to
  'Login'. Fault: ServerFaultCode - Cannot complete login due to an
  incorrect user name or password. in /var/www/virt.php on line 9,
  referer: http://10.9.0.3/
  [2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect: Cannot
  establish connection to esx://10.9.0.2?transport=http
 http://10.9.0.2?transport=http
  http://10.9.0.2?transport=http
 
  Best regards,
  Koen Calliauw
 
  On Wed, Jun 29, 2011 at 3:10 PM, Michal Novotny
 minov...@redhat.com mailto:minov...@redhat.com
  mailto:minov...@redhat.com mailto:minov...@redhat.com wrote:
 
  Hi Koen,
  thanks for you e-mail. I don't know what exactly is going on
 here but
  could you please try to enable debug logging using
 
  libvirt_logfile_set($filename, $maxsize)
 
  API function? The maxsize parameter is optional and it
 defaults to
  1024
  KiB (1M). The file have to have write permissions so you can
 touch the
  file, e.g. debug.log and change it's permissions to 777 to allow
  logging. Once you try to login using the script you
 mentioned with
  debug
  set you will get the debug output into the debug.log file which
  could be
  send to us for further analysis.
 
  Thanks,
  Michal
 
 
  On 06/29/2011 03:03 PM, Koen Calliauw wrote:
   Hi all,
  
   I've started playing with libvirt-php yesterday and with
 the help of
   Michal Novotny got it running quite painlessly. However,
 the login
   from PHP to my testing ESXi server seems to be failing. I've
   wiresharked the HTTP traffic with a virsh -c (which works) and
   compared that to the traffic I see when using the libvirt-php
   extension, here's the difference I see (mind the username)
  
   Not working (libvirt-php)
  
   Login xmlns=urn:vim25_this xmlns=urn:vim25
   xsi:type=ManagedObjectReference
   type=SessionManagerha-sessionmgr/_thisuserName
  xmlns=urn:vim25
   xsi:type=xsd:stringroot8./userNamepassword
 xmlns=urn:vim25
   xsi:type=xsd:stringfakepass/password/Login
  
   Working (virsh -c)
  
   Login xmlns=urn:vim25_this xmlns=urn:vim25
   xsi:type=ManagedObjectReference
   

Re: [libvirt] libvirt-php login issue to ESXi

2011-06-29 Thread Michal Novotny
Hi Koen,
so is it working fine already ? I'm glad to hear that ;-)

Best regards,
Michal

On 06/29/2011 04:04 PM, Koen Calliauw wrote:
 Hi Michal,

 That resolved the issue! Thank you very much for the quick resolution,
 I appreciate it.

 Best regards,
 Koen

 On Wed, Jun 29, 2011 at 4:00 PM, Michal Novotny minov...@redhat.com
 mailto:minov...@redhat.com wrote:

 Hi Koen,
 please try this patch. I can't test it myself since it's logging
 automatically in my setup but I *think* I may have found the problem.
 Could you please apply attached patch (revert the patch I sent to you
 before) and provide me the test results?

 Thanks,
 Michal

  On 06/29/2011 03:47 PM, Koen Calliauw wrote:
  Hi Michal,
 
  Here's the output. Please note that special characters were visible
  when opening the file with vi, though not with a cat on the console,
  so this is a copy/paste out of vi.
 
  [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials
  index 2
  [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials
  index 5
  [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: Found 2
  elements for credentials
  [2011-06-29 15:43:58 libvirt-php/core]:
  libvirt_virConnectAuthCallback: cred 0, type 2, prompt Enter
 username
  for 10.9.0.2 [root] challenge 10.9.0.2
   [2011-06-29 15:43:58 libvirt-php/core]:
  libvirt_virConnectAuthCallback: result rootV^? (4)
  [2011-06-29 15:43:58 libvirt-php/core]:
  libvirt_virConnectAuthCallback: cred 0, type 5, prompt Enter
 rootV^?'s
  password for 10.9.0.2 challenge 10.9.0.2
   [2011-06-29 15:43:58 libvirt-php/core]:
  libvirt_virConnectAuthCallback: result fakepass (12)
  [Wed Jun 29 15:44:00 2011] [error] [client 10.9.1.10] PHP Warning:
  libvirt_connect(): internal error HTTP response code 500 for call to
  'Login'. Fault: ServerFaultCode - Cannot complete login due to an
  incorrect user name or password. in /var/www/virt.php on line 9,
  referer: http://10.9.0.3/
  [2011-06-29 15:44:00 libvirt-php/core]: libvirt_connect: Cannot
  establish connection to esx://10.9.0.2?transport=http
 http://10.9.0.2?transport=http
  http://10.9.0.2?transport=http
 
  Best regards,
  Koen Calliauw
 
 
 
  On Wed, Jun 29, 2011 at 3:35 PM, Michal Novotny
 minov...@redhat.com mailto:minov...@redhat.com
  mailto:minov...@redhat.com mailto:minov...@redhat.com wrote:
 
  Hi Koen,
  that's bad. I don't have logging of username and password
 length here.
  I'll try to work on this. You can try attached patch to
 extend logging
  by username and password in the mean time and provide me the
 full
  resulting log file? Please review whether there is no
 password and if
  there is then please change it to fakepass.
 
  Thanks,
  Michal
 
  On 06/29/2011 03:19 PM, Koen Calliauw wrote:
   Hi Michal,
  
   Here's what appears in the logfile when using
 libvirt_logfile_set:
  
   [Wed Jun 29 15:18:00 2011] [error] [client 10.9.1.10] PHP
 Warning:
   libvirt_connect(): internal error HTTP response code 500
 for call to
   'Login'. Fault: ServerFaultCode - Cannot complete login
 due to an
   incorrect user name or password. in /var/www/virt.php on
 line 9,
   referer: http://10.9.0.3/
   [2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect:
 Cannot
   establish connection to esx://10.9.0.2?transport=http
 http://10.9.0.2?transport=http
  http://10.9.0.2?transport=http
   http://10.9.0.2?transport=http
  
   Best regards,
   Koen Calliauw
  
   On Wed, Jun 29, 2011 at 3:10 PM, Michal Novotny
  minov...@redhat.com mailto:minov...@redhat.com
 mailto:minov...@redhat.com mailto:minov...@redhat.com
   mailto:minov...@redhat.com mailto:minov...@redhat.com
 mailto:minov...@redhat.com mailto:minov...@redhat.com wrote:
  
   Hi Koen,
   thanks for you e-mail. I don't know what exactly is
 going on
  here but
   could you please try to enable debug logging using
  
   libvirt_logfile_set($filename, $maxsize)
  
   API function? The maxsize parameter is optional and it
  defaults to
   1024
   KiB (1M). The file have to have write permissions so
 you can
  touch the
   file, e.g. debug.log and change it's permissions to
 777 to allow
   logging. Once you try to login using the script you
  mentioned with
   debug
   set you will get the debug output into the debug.log
 file which
   could be
  

Re: [libvirt] libvirt-php login issue to ESXi

2011-06-29 Thread Koen Calliauw
Hi Michal,

That resolved the issue! Thank you very much for the quick resolution, I
appreciate it.

Best regards,
Koen

On Wed, Jun 29, 2011 at 4:00 PM, Michal Novotny minov...@redhat.com wrote:

 Hi Koen,
 please try this patch. I can't test it myself since it's logging
 automatically in my setup but I *think* I may have found the problem.
 Could you please apply attached patch (revert the patch I sent to you
 before) and provide me the test results?

 Thanks,
 Michal

  On 06/29/2011 03:47 PM, Koen Calliauw wrote:
  Hi Michal,
 
  Here's the output. Please note that special characters were visible
  when opening the file with vi, though not with a cat on the console,
  so this is a copy/paste out of vi.
 
  [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials
  index 2
  [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials
  index 5
  [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: Found 2
  elements for credentials
  [2011-06-29 15:43:58 libvirt-php/core]:
  libvirt_virConnectAuthCallback: cred 0, type 2, prompt Enter username
  for 10.9.0.2 [root] challenge 10.9.0.2
   [2011-06-29 15:43:58 libvirt-php/core]:
  libvirt_virConnectAuthCallback: result rootV^? (4)
  [2011-06-29 15:43:58 libvirt-php/core]:
  libvirt_virConnectAuthCallback: cred 0, type 5, prompt Enter rootV^?'s
  password for 10.9.0.2 challenge 10.9.0.2
   [2011-06-29 15:43:58 libvirt-php/core]:
  libvirt_virConnectAuthCallback: result fakepass (12)
  [Wed Jun 29 15:44:00 2011] [error] [client 10.9.1.10] PHP Warning:
  libvirt_connect(): internal error HTTP response code 500 for call to
  'Login'. Fault: ServerFaultCode - Cannot complete login due to an
  incorrect user name or password. in /var/www/virt.php on line 9,
  referer: http://10.9.0.3/
  [2011-06-29 15:44:00 libvirt-php/core]: libvirt_connect: Cannot
  establish connection to esx://10.9.0.2?transport=http
  http://10.9.0.2?transport=http
 
  Best regards,
  Koen Calliauw
 
 
 
  On Wed, Jun 29, 2011 at 3:35 PM, Michal Novotny minov...@redhat.com
  mailto:minov...@redhat.com wrote:
 
  Hi Koen,
  that's bad. I don't have logging of username and password length
 here.
  I'll try to work on this. You can try attached patch to extend
 logging
  by username and password in the mean time and provide me the full
  resulting log file? Please review whether there is no password and if
  there is then please change it to fakepass.
 
  Thanks,
  Michal
 
  On 06/29/2011 03:19 PM, Koen Calliauw wrote:
   Hi Michal,
  
   Here's what appears in the logfile when using libvirt_logfile_set:
  
   [Wed Jun 29 15:18:00 2011] [error] [client 10.9.1.10] PHP Warning:
   libvirt_connect(): internal error HTTP response code 500 for call
 to
   'Login'. Fault: ServerFaultCode - Cannot complete login due to an
   incorrect user name or password. in /var/www/virt.php on line 9,
   referer: http://10.9.0.3/
   [2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect: Cannot
   establish connection to esx://10.9.0.2?transport=http
  http://10.9.0.2?transport=http
   http://10.9.0.2?transport=http
  
   Best regards,
   Koen Calliauw
  
   On Wed, Jun 29, 2011 at 3:10 PM, Michal Novotny
  minov...@redhat.com mailto:minov...@redhat.com
   mailto:minov...@redhat.com mailto:minov...@redhat.com wrote:
  
   Hi Koen,
   thanks for you e-mail. I don't know what exactly is going on
  here but
   could you please try to enable debug logging using
  
   libvirt_logfile_set($filename, $maxsize)
  
   API function? The maxsize parameter is optional and it
  defaults to
   1024
   KiB (1M). The file have to have write permissions so you can
  touch the
   file, e.g. debug.log and change it's permissions to 777 to
 allow
   logging. Once you try to login using the script you
  mentioned with
   debug
   set you will get the debug output into the debug.log file which
   could be
   send to us for further analysis.
  
   Thanks,
   Michal
  
  
   On 06/29/2011 03:03 PM, Koen Calliauw wrote:
Hi all,
   
I've started playing with libvirt-php yesterday and with
  the help of
Michal Novotny got it running quite painlessly. However,
  the login
from PHP to my testing ESXi server seems to be failing. I've
wiresharked the HTTP traffic with a virsh -c (which works)
 and
compared that to the traffic I see when using the libvirt-php
extension, here's the difference I see (mind the username)
   
Not working (libvirt-php)
   
Login xmlns=urn:vim25_this xmlns=urn:vim25
xsi:type=ManagedObjectReference
type=SessionManagerha-sessionmgr/_thisuserName

Re: [libvirt] libvirt-php login issue to ESXi

2011-06-29 Thread Koen Calliauw
Hi,

Yes, it's connecting perfectly now and I get the expected result from
print_r(libvirt_connect_get_hypervisor($conn));

Array
(
[hypervisor] = ESX
[major] = 4
[minor] = 1
[release] = 0
[hypervisor_string] = ESX 4.1.0
)

Thanks again,

Best regards,
Koen




On Wed, Jun 29, 2011 at 4:06 PM, Michal Novotny minov...@redhat.com wrote:

 Hi Koen,
 so is it working fine already ? I'm glad to hear that ;-)

 Best regards,
 Michal

 On 06/29/2011 04:04 PM, Koen Calliauw wrote:
  Hi Michal,
 
  That resolved the issue! Thank you very much for the quick resolution,
  I appreciate it.
 
  Best regards,
  Koen
 
  On Wed, Jun 29, 2011 at 4:00 PM, Michal Novotny minov...@redhat.com
  mailto:minov...@redhat.com wrote:
 
  Hi Koen,
  please try this patch. I can't test it myself since it's logging
  automatically in my setup but I *think* I may have found the problem.
  Could you please apply attached patch (revert the patch I sent to you
  before) and provide me the test results?
 
  Thanks,
  Michal
 
   On 06/29/2011 03:47 PM, Koen Calliauw wrote:
   Hi Michal,
  
   Here's the output. Please note that special characters were visible
   when opening the file with vi, though not with a cat on the
 console,
   so this is a copy/paste out of vi.
  
   [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect:
 credentials
   index 2
   [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect:
 credentials
   index 5
   [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: Found 2
   elements for credentials
   [2011-06-29 15:43:58 libvirt-php/core]:
   libvirt_virConnectAuthCallback: cred 0, type 2, prompt Enter
  username
   for 10.9.0.2 [root] challenge 10.9.0.2
[2011-06-29 15:43:58 libvirt-php/core]:
   libvirt_virConnectAuthCallback: result rootV^? (4)
   [2011-06-29 15:43:58 libvirt-php/core]:
   libvirt_virConnectAuthCallback: cred 0, type 5, prompt Enter
  rootV^?'s
   password for 10.9.0.2 challenge 10.9.0.2
[2011-06-29 15:43:58 libvirt-php/core]:
   libvirt_virConnectAuthCallback: result fakepass (12)
   [Wed Jun 29 15:44:00 2011] [error] [client 10.9.1.10] PHP Warning:
   libvirt_connect(): internal error HTTP response code 500 for call
 to
   'Login'. Fault: ServerFaultCode - Cannot complete login due to an
   incorrect user name or password. in /var/www/virt.php on line 9,
   referer: http://10.9.0.3/
   [2011-06-29 15:44:00 libvirt-php/core]: libvirt_connect: Cannot
   establish connection to esx://10.9.0.2?transport=http
  http://10.9.0.2?transport=http
   http://10.9.0.2?transport=http
  
   Best regards,
   Koen Calliauw
  
  
  
   On Wed, Jun 29, 2011 at 3:35 PM, Michal Novotny
  minov...@redhat.com mailto:minov...@redhat.com
   mailto:minov...@redhat.com mailto:minov...@redhat.com wrote:
  
   Hi Koen,
   that's bad. I don't have logging of username and password
  length here.
   I'll try to work on this. You can try attached patch to
  extend logging
   by username and password in the mean time and provide me the
  full
   resulting log file? Please review whether there is no
  password and if
   there is then please change it to fakepass.
  
   Thanks,
   Michal
  
   On 06/29/2011 03:19 PM, Koen Calliauw wrote:
Hi Michal,
   
Here's what appears in the logfile when using
  libvirt_logfile_set:
   
[Wed Jun 29 15:18:00 2011] [error] [client 10.9.1.10] PHP
  Warning:
libvirt_connect(): internal error HTTP response code 500
  for call to
'Login'. Fault: ServerFaultCode - Cannot complete login
  due to an
incorrect user name or password. in /var/www/virt.php on
  line 9,
referer: http://10.9.0.3/
[2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect:
  Cannot
establish connection to esx://10.9.0.2?transport=http
  http://10.9.0.2?transport=http
   http://10.9.0.2?transport=http
http://10.9.0.2?transport=http
   
Best regards,
Koen Calliauw
   
On Wed, Jun 29, 2011 at 3:10 PM, Michal Novotny
   minov...@redhat.com mailto:minov...@redhat.com
  mailto:minov...@redhat.com mailto:minov...@redhat.com
mailto:minov...@redhat.com mailto:minov...@redhat.com
  mailto:minov...@redhat.com mailto:minov...@redhat.com wrote:
   
Hi Koen,
thanks for you e-mail. I don't know what exactly is
  going on
   here but
could you please try to enable debug logging using
   
libvirt_logfile_set($filename, $maxsize)
   
API function? The 

Re: [libvirt] libvirt-php login issue to ESXi

2011-06-29 Thread Michal Novotny
Hi,
that's great. I'm really glad to hear that ;-)
If you have any further issues don't hesitate to write an e-mail again ;-)

Thanks,
Michal

On 06/29/2011 04:08 PM, Koen Calliauw wrote:
 Hi,

 Yes, it's connecting perfectly now and I get the expected result from
 print_r(libvirt_connect_get_hypervisor($conn));

 Array
 (
 [hypervisor] = ESX
 [major] = 4
 [minor] = 1
 [release] = 0
 [hypervisor_string] = ESX 4.1.0
 )

 Thanks again,

 Best regards,
 Koen



 On Wed, Jun 29, 2011 at 4:06 PM, Michal Novotny minov...@redhat.com
 mailto:minov...@redhat.com wrote:

 Hi Koen,
 so is it working fine already ? I'm glad to hear that ;-)

 Best regards,
 Michal

 On 06/29/2011 04:04 PM, Koen Calliauw wrote:
  Hi Michal,
 
  That resolved the issue! Thank you very much for the quick
 resolution,
  I appreciate it.
 
  Best regards,
  Koen
 
  On Wed, Jun 29, 2011 at 4:00 PM, Michal Novotny
 minov...@redhat.com mailto:minov...@redhat.com
  mailto:minov...@redhat.com mailto:minov...@redhat.com wrote:
 
  Hi Koen,
  please try this patch. I can't test it myself since it's logging
  automatically in my setup but I *think* I may have found the
 problem.
  Could you please apply attached patch (revert the patch I
 sent to you
  before) and provide me the test results?
 
  Thanks,
  Michal
 
   On 06/29/2011 03:47 PM, Koen Calliauw wrote:
   Hi Michal,
  
   Here's the output. Please note that special characters
 were visible
   when opening the file with vi, though not with a cat on
 the console,
   so this is a copy/paste out of vi.
  
   [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect:
 credentials
   index 2
   [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect:
 credentials
   index 5
   [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect:
 Found 2
   elements for credentials
   [2011-06-29 15:43:58 libvirt-php/core]:
   libvirt_virConnectAuthCallback: cred 0, type 2, prompt Enter
  username
   for 10.9.0.2 [root] challenge 10.9.0.2
[2011-06-29 15:43:58 libvirt-php/core]:
   libvirt_virConnectAuthCallback: result rootV^? (4)
   [2011-06-29 15:43:58 libvirt-php/core]:
   libvirt_virConnectAuthCallback: cred 0, type 5, prompt Enter
  rootV^?'s
   password for 10.9.0.2 challenge 10.9.0.2
[2011-06-29 15:43:58 libvirt-php/core]:
   libvirt_virConnectAuthCallback: result fakepass (12)
   [Wed Jun 29 15:44:00 2011] [error] [client 10.9.1.10] PHP
 Warning:
   libvirt_connect(): internal error HTTP response code 500
 for call to
   'Login'. Fault: ServerFaultCode - Cannot complete login
 due to an
   incorrect user name or password. in /var/www/virt.php on
 line 9,
   referer: http://10.9.0.3/
   [2011-06-29 15:44:00 libvirt-php/core]: libvirt_connect:
 Cannot
   establish connection to esx://10.9.0.2?transport=http
 http://10.9.0.2?transport=http
  http://10.9.0.2?transport=http
   http://10.9.0.2?transport=http
  
   Best regards,
   Koen Calliauw
  
  
  
   On Wed, Jun 29, 2011 at 3:35 PM, Michal Novotny
  minov...@redhat.com mailto:minov...@redhat.com
 mailto:minov...@redhat.com mailto:minov...@redhat.com
   mailto:minov...@redhat.com mailto:minov...@redhat.com
 mailto:minov...@redhat.com mailto:minov...@redhat.com wrote:
  
   Hi Koen,
   that's bad. I don't have logging of username and password
  length here.
   I'll try to work on this. You can try attached patch to
  extend logging
   by username and password in the mean time and provide
 me the
  full
   resulting log file? Please review whether there is no
  password and if
   there is then please change it to fakepass.
  
   Thanks,
   Michal
  
   On 06/29/2011 03:19 PM, Koen Calliauw wrote:
Hi Michal,
   
Here's what appears in the logfile when using
  libvirt_logfile_set:
   
[Wed Jun 29 15:18:00 2011] [error] [client
 10.9.1.10] PHP
  Warning:
libvirt_connect(): internal error HTTP response code 500
  for call to
'Login'. Fault: ServerFaultCode - Cannot complete login
  due to an
incorrect user name or password. in /var/www/virt.php on
  line 9,
referer: http://10.9.0.3/
[2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect: