php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21642 fsockopen() tls doenst work with tlsftp's
Submitted: 2003-01-14 16:28 UTC Modified: 2003-01-15 14:08 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: toppi at kacke dot de Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 4.3.0 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: toppi at kacke dot de
New email:
PHP Version: OS:

 

 [2003-01-14 16:28 UTC] toppi at kacke dot de
Trying to tls://ftp_ip:port ... 

Warning: fsockopen() [function.fsockopen]: php_stream_sock_ssl_activate_with_method: SSL handshake/connection failed in ftpclass.php on line 204

Warning: fsockopen() [function.fsockopen]: failed to activate SSL mode 2 in ftpclass.php on line 204

The TLS SERVER replies tru fread() at least :

UK (glftpd 1.28_Linux+TLS) ready.
500 '': Command not understood.

I would expect when using a tls-prefix its working similare to ftp_ssl_connect (what is working fine but not needed cause no filepointer back).

No chance in php to connect ftp+tls tru fsock which is needed if you need a filepointer back to use fread/write etc.

Greetings

Toppi 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-14 16:41 UTC] wez@php.net
this is expected behaviour; fsockopen("tls://") opens the socket with TLS turned on.
By default, TLS-enabled ftp servers start "in the clear" - with crypto turned off.

If you want to use TLS over ftp, consider using fopen("ftps://") instead (which will attempt TLS negotiation according to the relevant rfcs), or if that is not sufficient, try using the curl functions.

 [2003-01-15 05:12 UTC] toppi at kacke dot de
TLS becomes more a standard instead of FTP.

I cant recognize the reason why fsockopen() doesnt handle tls/ssl similare to fopen().

Why not starting (like fopen() it does) in clear mode, then switch to tls/ssl if this all is FLASE return fail ?

Atm i have to run a TLSwrapper in background to connect FTP+TLS cause fsock yes but ssl...

The use of Curl or fopen instead ? Sounds a bit crazy for me tho :)

A Create a socket function should handle all streams.

Im looking forward to fsockopen supports ftp+tls :)

Greetings
Toppi
 [2003-01-15 05:41 UTC] toppi at kacke dot de
Just info when using fopen();

it retruns

Warning: fopen(ftps://...@ip:port) [function.fopen]: failed to create stream: Operation not permitted in .....
 [2003-01-15 05:51 UTC] toppi at kacke dot de
Please add rfc2228 handle to fsockopen(); 

:-)
 [2003-01-15 07:23 UTC] wez@php.net
fsockopen is intended to open *only* a raw socket and not implement some protocol level stuff -> that is what the URL wrappers are for in fopen().
Please try one of the alternative methods for working with secure ftp.
If you find a problem with those, then open a new bug report.
 [2003-01-15 13:39 UTC] toppi at kacke dot de
Hi Wez,

i know this prolly no faq here but im sticky since days on it and i didnt get help anywhere yet, so excuse my last question in this thread please.

example:

<?PHP

$sock = fsockopen($server, $port, $errno, $errstr, timeout);
fgets($sock....);
if TLS then {
    frwite (ftp, "AUTH", "TLS"))

    //to use php_stream_api or streams and options
    //and swtich into ssl mode ? like php.ftp it does ?
    
    // ctx = SSL_CTX_new(SSLv23_client_method()); ?????
    
    //or a simple stream wrapper from php

    frwite(ftp, "PBSZ")
    .
    ...and so on.....
}
?>


a simple "yes" or "no" from your side would be enough, so
ill try to figure it out by myself.

Maybe theres something easie php-trick i dont know,
to solve this problem.

Also theres no help available on the web to it.

Im sorry to waste your time in here , but its realy importand to realize it in php.


Toppi
 [2003-01-15 14:08 UTC] wez@php.net
Responding by private mail.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 17:01:29 2024 UTC