-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FTP mount doesn't work with encryption #5950
Comments
FTP is using fopen() directly on the "ftp://" address, which effectively streams the content. So to fix this we either need to:
The second one might be overkill if we anyway plan to fix 1) in the future and maybe try and use the streaming approach for ext storage in general, as per #5949 |
I tried uploading two files, a small one and a big one. When downloading them, they are both empty. If I create a file using the text editor, I can download it properly, maybe because it's using file_get_contents instead of the stream calls. @schiesbn please have a look. |
Seems to be an issue with the writeback code in ftp.php. Getting this: |
When opening the FTP stream with |
FYI @icewind1991 @schiesbn we need to be careful with this in the future |
@schiesbn I tried this again but it hangs on FTP upload. Since #7454 the encryption app now correctly remembers that the fopen mode is "w" which is a good thing. Still, what happens is that the "postFOpen" hook calls "isEncryptedPath()" (why need this for "w" mode if we completely overwrite?) which tries to do a second "fopen" of the same file on the FTP server, and blocks. I suspect that the FTP server is probably waiting for the "write" call to finish before returning the result (some kind of locking). After a timeout, I get this in the log:
Would it be possible to remove the "isEncryptedPath()" test when mode is "w" or do that check in "preFOpen" ? Remember that "isEncryptedPath()", if it wouldn't block, would find out that "fseek()" doesn't work, then close, and then call getLocalFile() which would yet again open a third connection to download the full file to check if it is encrypted. fseek(). But fseek() fails, so it tries to download the file to do the "is it encrypted" detection that open a second fopen() in "r" mode to download the file. I can't debug further, it always hangs at some point. |
The isEncryptedPath() call is needed to decide if files should be encrypted or not. We could indeed move it to a postFopen proxy. I will look into it. What FTP server do you use? The last time I tried it everything worked as expected but I remember that you use a different FTP server and they not always behave the same way. |
I used vsftpd. I guess the difference could be that mine was using file locking (if a write operation is pending, it blocks read operations) |
Is this fixed with #7912? |
@schiesbn we should retry with the new encryption |
works with new encryption: #23657 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Steps
Expected result
Downloaded file is not encrypted.
Actual result
Downloaded file is still encrypted
CC @schiesbn FYI
I suspect it could be another fseek() issue.
The text was updated successfully, but these errors were encountered: