Re: [Synalist] RE : RE : SFTP - error 10091

2012-02-22 Thread Krzysztof
2012/2/22 Ludo Brands ludo.bra...@free.fr:
 With Cryptlib I get this same error 10091 (but instead of
 Network subsystem is unusable I see some squares (some
 charset problem). I debug into and problem is in function:

 TSSLCryptLib.Connect

 In line:
 if not SSLCheck(cryptSetAttribute(FCryptSession,
 CRYPT_SESSINFO_ACTIVE, 1)) then
       Exit;

 SSLCheck return False, because cryptSetAttribute return -22
 (and in SSLCheck is error check if Value0 then error). I
 can't debug further because cryptSetAttribute is external function


 Are you getting more information in SSL.LastErrorDesc? You can trace into
 SSLCheck and verify the value at the end.

Ok, so I'm back to stable synapse 39 and cryptlib 3.2.2.

So in summary, problem is in function:

TSSLCryptLib.Connect

In line:
if not SSLCheck(cryptSetAttribute(FCryptSession, CRYPT_SESSINFO_ACTIVE, 1)) then
  Exit;

Function cryptSetAttribute return value -22 and send it to SSLCheck.
This occur error:

FLastErrorDesc := GetString(FCryptSession, CRYPT_ATTRIBUTE_INT_ERRORMESSAGE);

Above string is '敓癲牥爠灥牯整㩤䤠癮污摩瀠獡睳牯d'#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0.
Instead of these
 chinese chars I see squares. GetString is calling:
cryptGetAttributeString(cryptHandle, attributeType, pointer(Result), l);
... where attributeType=13
I think something wrong is with function cryptSetAttribute (which
return -22) because it is suspending for 5-10 seconds.

Regards

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public


[Synalist] RE : RE : RE : SFTP - error 10091

2012-02-22 Thread Ludo Brands
 Ok, so I'm back to stable synapse 39 and cryptlib 3.2.2.
 
 So in summary, problem is in function:
 
 TSSLCryptLib.Connect
 
 In line:
 if not SSLCheck(cryptSetAttribute(FCryptSession, 
 CRYPT_SESSINFO_ACTIVE, 1)) then
   Exit;
 
 Function cryptSetAttribute return value -22 and send it to 
 SSLCheck. This occur error:
 
 FLastErrorDesc := GetString(FCryptSession, 
 CRYPT_ATTRIBUTE_INT_ERRORMESSAGE);
 
 Above string is '敓癲牥爠灥牯整㩤䤠癮污摩瀠獡睳牯d'#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0.
 Instead of these
  chinese chars I see squares. GetString is calling: 
 cryptGetAttributeString(cryptHandle, attributeType, 
 pointer(Result), l); ... where attributeType=13 I think 
 something wrong is with function cryptSetAttribute (which 
 return -22) because it is suspending for 5-10 seconds.
 

5-10 seconds isn't that long to do the SSH authorization (even when it fails). 

The chinese characters could mean 2 things. Delphi 10 interpreting the ascii 
string as unicode or a mismatch with the cryptlib binding and the cryptlib dll 
loaded. A while ago I was chasing weird bugs in cryptlib which finally turned 
out to be a wrong cryptlib ddl being picked up. I contributed then a patch to 
synapse that checks for the correct dll version at run time. I would suggest 
you try with synapse snapshot or svn and cryptlib 3.2.2.

Ludo 
 


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public


Re: [Synalist] RE : RE : RE : SFTP - error 10091

2012-02-22 Thread Krzysztof
I have tried this combination too, but this same error

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public


[Synalist] RE : RE : RE : RE : SFTP - error 10091

2012-02-22 Thread Ludo Brands
 
 I have tried this combination too, but this same error
 

Just tried sftp demo with D2006, cl332 and synapse svn. It connects
correctly but then raises an out of memory exception in Receive packet in
TSimpleSFTP.Init which is well after the SSH authentication.

I get also the 10091 error when I mistype the username or password but it
gives a nice Server reported: Invalid password after 5-10 seconds.

I don't have D2010 so perhaps somebody else can help.

Ludo


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public


Re: [Synalist] RE : RE : RE : RE : RE : SFTP - error 10091

2012-02-22 Thread lists
Thank you - this was the only program in the synapse demos that i had trouble 
with and brought it out of retirement when i saw this thread

FYI the fpc cross compiler on the commandline in linux making win32 executables 
works great with synapse

from using the ppcross386 with -gl -vh i get this when it times out and the 
exception is raised
there were a number of units in places that weren't used but commenting them 
out had not effect

I hope this gives you additional info you might not have had about where the 
code was having problems

TApplication.HandleException Synapse TCP/IP Socket error 10060: Connection 
timed out
  Stack trace:
  $005CB88E  TBLOCKSOCKET__EXCEPTCHECK,  line 2598 of 
/usr/local/fpc/units-win32/synapse/blcksock.pas
  $005CA968  TBLOCKSOCKET__RECVPACKET,  line 2351 of 
/usr/local/fpc/units-win32/synapse/blcksock.pas
  $005CA4B9  TBLOCKSOCKET__RECVBUFFEREX,  line 2212 of 
/usr/local/fpc/units-win32/synapse/blcksock.pas
  $0042E59E  TSIMPLESFTP__RECEIVEBUFFER,  line 722 of SimpleSFTP.pas
  $0042E61C  TSIMPLESFTP__RECEIVEPACKET,  line 733 of SimpleSFTP.pas
  $0042E8DD  TSIMPLESFTP__INIT,  line 767 of SimpleSFTP.pas
  $0042D9C3  TSIMPLESFTP__CONNECT,  line 593 of SimpleSFTP.pas
  $0042BFCF  TTESTSFTPFORM__CONNECTBUTTONCLICK,  line 88 of Main.pas
  $004B7119  TCONTROL__CLICK,  line 2662 of 
/usr/local/lazarus/lcl-win32/include/control.inc
  $005698A3  TBUTTONCONTROL__CLICK,  line 62 of 
/usr/local/lazarus/lcl-win32/include/buttoncontrol.inc
  $00569FD6  TCUSTOMBUTTON__CLICK,  line 174 of 
/usr/local/lazarus/lcl-win32/include/buttons.inc
  $0056A791  TBUTTON__CLICK,  line 349 of 
/usr/local/lazarus/lcl-win32/include/buttons.inc
  $0056975E  TBUTTONCONTROL__WMDEFAULTCLICKED,  line 26 of 
/usr/local/lazarus/lcl-win32/include/buttoncontrol.inc
  $0040CF06
  $004A710D  TWINCONTROL__WNDPROC,  line 5276 of 
/usr/local/lazarus/lcl-win32/include/wincontrol.inc
  $005A996B  DELIVERMESSAGE,  line 113 of 
/usr/local/lazarus/lcl-win32/lclmessageglue.pas
  $005B3C00  GTK2WSBUTTON_CLICKED,  line 2307 of 
/usr/local/lazarus/lcl-win32/interfaces/gtk2/gtk2wsstdctrls.pp





The sftp code was clearly not ported to fpc. Furthermore, it uses windows
only calls like CopyMemory. FPC has this also in the windows unit.

Using lazarus I used the Delphi project converter tool and I had only to
change one line and set the project options to Delphi mode to get sftp
running. And it also breaks with an out of memory error after succesfully
logging in.

I attach the converted files for your perusal,

Ludo



--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public


[Synalist] RE : RE : RE : RE : RE : RE : SFTP - error 10091

2012-02-22 Thread Ludo Brands
 after commenting out all the unused units i now get
 
 TApplication.HandleException Out of memory
   Stack trace:
   $0040FE3A
   $00410189
   $005C300D  TSIMPLESFTP__INIT,  line 769 of SimpleSFTP.pas
   $005C20F3  TSIMPLESFTP__CONNECT,  line 595 of SimpleSFTP.pas
   $0042BFCF  TTESTSFTPFORM__CONNECTBUTTONCLICK,  line 89 of Main.pas
   $004B1679  TCONTROL__CLICK,  line 2662 of 
 /usr/local/lazarus/lcl-win32/include/control.inc
   $00563E03  TBUTTONCONTROL__CLICK,  line 62 of 
 /usr/local/lazarus/lcl-win32/include/buttoncontrol.inc
   $00564536  TCUSTOMBUTTON__CLICK,  line 174 of 
 /usr/local/lazarus/lcl-win32/include/buttons.inc
   $00564CF1  TBUTTON__CLICK,  line 349 of 
 /usr/local/lazarus/lcl-win32/include/buttons.inc
   $00563CBE  TBUTTONCONTROL__WMDEFAULTCLICKED,  line 26 of 
 /usr/local/lazarus/lcl-win32/include/buttoncontrol.inc
   $0040CF06
   $004A166D  TWINCONTROL__WNDPROC,  line 5276 of 
 /usr/local/lazarus/lcl-win32/include/wincontrol.inc
   $005A3ECB  DELIVERMESSAGE,  line 113 of 
 /usr/local/lazarus/lcl-win32/lclmessageglue.pas
   $005AE160  GTK2WSBUTTON_CLICKED,  line 2307 of 
 /usr/local/lazarus/lcl-win32/interfaces/gtk2/gtk2wsstdctrls.pp
   $63A44124
   $63A57879
   $63A58A93
 WARNING: TLCLComponent.Destroy with LCLRefCount0. Hint: 
 Maybe the component is processing an event?
 
 
 interesting how the user is able to login 
 
 /var/log/auth.log
 
 Feb 22 12:50:07 localhost sshd[20367]: Accepted password for 
 sftp1 from 127.0.0.1 port 51791 ssh2 Feb 22 12:50:07 
 localhost sshd[20367]: pam_unix(sshd:session): session opened 
 for user sftp1 by (uid=0) Feb 22 12:50:08 localhost 
 sshd[20367]: pam_unix(sshd:session): session closed for user sftp1
 
 

As said before, this problem is after the SSH authentication. You are logged
in but the FTP protocol negociation fails. 

Ludo


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public


[Synalist] RE : RE : RE : RE : RE : RE : SFTP - error 10091

2012-02-22 Thread Ludo Brands
 interesting how the user is able to login 
 
 /var/log/auth.log
 
 Feb 22 12:50:07 localhost sshd[20367]: Accepted password for 
 sftp1 from 127.0.0.1 port 51791 ssh2 Feb 22 12:50:07 
 localhost sshd[20367]: pam_unix(sshd:session): session opened 
 for user sftp1 by (uid=0) Feb 22 12:50:08 localhost 
 sshd[20367]: pam_unix(sshd:session): session closed for user sftp1
 

The difference between your situation and mine is that we both get logged in
but you don't receive an answer for the ftp negotiation and I receive data
that can't be interpreted correctly. Probably a difference in server. 
At the beginning of TSimpleSFTP.Init it says //negotiate protocol version
(we support version 3 only!)  . Although, when I connect with the sftp
command line (mingw), and type 'version' at the sftp prompt after logging
in, it says SFTP protocol version 3. So there is apparently something wrong
in the TSimpleSFTP implementation.

Ludo


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public


Re: [Synalist] Memory leak in ssl_openssl_lib.TSSLOpenSSL.LoadPFX method

2012-02-22 Thread Bronislav Klučka

  
  
Hi
how exactly was this function imported? what kind of changes was
done?


Brona

On 20.12.2011 18:37, Petr Fejfar wrote:

  Hi Lukas,


it seems there is another memory leak
in the method LoadPFX:

   ...
   ...
   cert := nil;
   pkey := nil;
   ca := nil;
   try {pf}
 if PKCS12parse(p12, FKeyPassword, pkey, cert, ca)  0 then
   if SSLCTXusecertificate(Fctx, cert)  0 then
 if SSLCTXusePrivateKey(Fctx, pkey)  0 then
   Result := True;
   {pf}
   finally
 EvpPkeyFree(pkey);
 X509free(cert);
 SkX509PopFree(ca,_X509Free); // for ca=nil a new STACK is
allocated
   end;
   {/pf}
   ...
   ...


To fix it, I had imported SK_X509_POP_FREE function
and had exported the variable _X509Free to pass it
as a procedural argument.


pf

--
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public



-- 
  
  
s pozdravem
 Bronislav Klučka




http://www.bauglir.com
bronislav.klu...@bauglir.com

  * webové aplikace
  * software na zakázku


  

  

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public